OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ots.h" | 5 #include "ots.h" |
6 | 6 |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <zlib.h> | 8 #include <zlib.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 uint8_t* p = new uint8_t[length]; | 75 uint8_t* p = new uint8_t[length]; |
76 hunks_.push_back(p); | 76 hunks_.push_back(p); |
77 return p; | 77 return p; |
78 } | 78 } |
79 | 79 |
80 private: | 80 private: |
81 std::vector<uint8_t*> hunks_; | 81 std::vector<uint8_t*> hunks_; |
82 }; | 82 }; |
83 | 83 |
84 // Use a macro instead of a function because gcc 4.4.3 creates static | 84 // Use a macro instead of a function because gcc 4.4.3 creates static |
85 // initializers in that case. Note this macro assumes a little-endian system. | 85 // initializers in that case. |
86 #if defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN) | |
jfkthame
2012/04/28 09:10:46
Unfortunately, this doesn't work as intended on so
| |
87 #define TAG(d, c, b, a) (a | (b << 8) | (c << 16) | (d << 24)) | |
88 #else | |
86 #define TAG(a, b, c, d) (a | (b << 8) | (c << 16) | (d << 24)) | 89 #define TAG(a, b, c, d) (a | (b << 8) | (c << 16) | (d << 24)) |
90 #endif | |
87 | 91 |
88 const struct { | 92 const struct { |
89 uint32_t tag; | 93 uint32_t tag; |
90 bool (*parse)(ots::OpenTypeFile *otf, const uint8_t *data, size_t length); | 94 bool (*parse)(ots::OpenTypeFile *otf, const uint8_t *data, size_t length); |
91 bool (*serialise)(ots::OTSStream *out, ots::OpenTypeFile *file); | 95 bool (*serialise)(ots::OTSStream *out, ots::OpenTypeFile *file); |
92 bool (*should_serialise)(ots::OpenTypeFile *file); | 96 bool (*should_serialise)(ots::OpenTypeFile *file); |
93 void (*free)(ots::OpenTypeFile *file); | 97 void (*free)(ots::OpenTypeFile *file); |
94 bool required; | 98 bool required; |
95 } table_parsers[] = { | 99 } table_parsers[] = { |
96 { TAG('m', 'a', 'x', 'p'), ots::ots_maxp_parse, ots::ots_maxp_serialise, | 100 { TAG('m', 'a', 'x', 'p'), ots::ots_maxp_parse, ots::ots_maxp_serialise, |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 va_start(va, format); | 715 va_start(va, format); |
712 std::vfprintf(stderr, format, va); | 716 std::vfprintf(stderr, format, va); |
713 va_end(va); | 717 va_end(va); |
714 std::fprintf(stderr, "\n"); | 718 std::fprintf(stderr, "\n"); |
715 std::fflush(stderr); | 719 std::fflush(stderr); |
716 } | 720 } |
717 } | 721 } |
718 #endif | 722 #endif |
719 | 723 |
720 } // namespace ots | 724 } // namespace ots |
OLD | NEW |