OLD | NEW |
1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 21 matching lines...) Expand all Loading... |
32 const int FLAG_WE_HAVE_INSTRUCTIONS = 1 << 8; | 32 const int FLAG_WE_HAVE_INSTRUCTIONS = 1 << 8; |
33 | 33 |
34 void WriteBytes(std::vector<uint8_t>* out, const uint8_t* data, size_t len) { | 34 void WriteBytes(std::vector<uint8_t>* out, const uint8_t* data, size_t len) { |
35 if (len == 0) return; | 35 if (len == 0) return; |
36 size_t offset = out->size(); | 36 size_t offset = out->size(); |
37 out->resize(offset + len); | 37 out->resize(offset + len); |
38 memcpy(&(*out)[offset], data, len); | 38 memcpy(&(*out)[offset], data, len); |
39 } | 39 } |
40 | 40 |
41 void WriteBytes(std::vector<uint8_t>* out, const std::vector<uint8_t>& in) { | 41 void WriteBytes(std::vector<uint8_t>* out, const std::vector<uint8_t>& in) { |
42 for (int i = 0; i < in.size(); ++i) { | 42 for (size_t i = 0; i < in.size(); ++i) { |
43 out->push_back(in[i]); | 43 out->push_back(in[i]); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 void WriteUShort(std::vector<uint8_t>* out, int value) { | 47 void WriteUShort(std::vector<uint8_t>* out, int value) { |
48 out->push_back(value >> 8); | 48 out->push_back(value >> 8); |
49 out->push_back(value & 255); | 49 out->push_back(value & 255); |
50 } | 50 } |
51 | 51 |
52 void WriteLong(std::vector<uint8_t>* out, int value) { | 52 void WriteLong(std::vector<uint8_t>* out, int value) { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 transformed_hmtx->tag = kHmtxTableTag ^ 0x80808080; | 411 transformed_hmtx->tag = kHmtxTableTag ^ 0x80808080; |
412 transformed_hmtx->flag_byte = 1 << 6; | 412 transformed_hmtx->flag_byte = 1 << 6; |
413 transformed_hmtx->length = transformed_hmtx->buffer.size(); | 413 transformed_hmtx->length = transformed_hmtx->buffer.size(); |
414 transformed_hmtx->data = transformed_hmtx->buffer.data(); | 414 transformed_hmtx->data = transformed_hmtx->buffer.data(); |
415 | 415 |
416 | 416 |
417 return true; | 417 return true; |
418 } | 418 } |
419 | 419 |
420 } // namespace woff2 | 420 } // namespace woff2 |
OLD | NEW |