| 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 "cmap.h" | 5 #include "cmap.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // this might seem odd, but it's true. The offset is relative to the | 226 // this might seem odd, but it's true. The offset is relative to the |
| 227 // location of the offset value itself. | 227 // location of the offset value itself. |
| 228 const uint32_t glyph_id_offset = ranges[i].id_range_offset_offset + | 228 const uint32_t glyph_id_offset = ranges[i].id_range_offset_offset + |
| 229 ranges[i].id_range_offset + | 229 ranges[i].id_range_offset + |
| 230 range_delta * 2; | 230 range_delta * 2; |
| 231 // We need to be able to access a 16-bit value from this offset | 231 // We need to be able to access a 16-bit value from this offset |
| 232 if (glyph_id_offset + 1 >= length) { | 232 if (glyph_id_offset + 1 >= length) { |
| 233 return OTS_FAILURE(); | 233 return OTS_FAILURE(); |
| 234 } | 234 } |
| 235 uint16_t glyph; | 235 uint16_t glyph; |
| 236 memcpy(&glyph, data + glyph_id_offset, 2); | 236 std::memcpy(&glyph, data + glyph_id_offset, 2); |
| 237 glyph = ntohs(glyph); | 237 glyph = ntohs(glyph); |
| 238 if (glyph >= num_glyphs) { | 238 if (glyph >= num_glyphs) { |
| 239 return OTS_FAILURE(); | 239 return OTS_FAILURE(); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 // We accept the table. | 245 // We accept the table. |
| 246 // TODO(yusukes): transcode the subtable. | 246 // TODO(yusukes): transcode the subtable. |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 out->RestoreChecksum(saved_checksum); | 1067 out->RestoreChecksum(saved_checksum); |
| 1068 | 1068 |
| 1069 return true; | 1069 return true; |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 void ots_cmap_free(OpenTypeFile *file) { | 1072 void ots_cmap_free(OpenTypeFile *file) { |
| 1073 delete file->cmap; | 1073 delete file->cmap; |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 } // namespace ots | 1076 } // namespace ots |
| OLD | NEW |