| 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } | 677 } |
| 678 | 678 |
| 679 // check if the table is sorted first by platform ID, then by encoding ID. | 679 // check if the table is sorted first by platform ID, then by encoding ID. |
| 680 uint32_t last_id = 0; | 680 uint32_t last_id = 0; |
| 681 for (unsigned i = 0; i < num_tables; ++i) { | 681 for (unsigned i = 0; i < num_tables; ++i) { |
| 682 uint32_t current_id | 682 uint32_t current_id |
| 683 = (subtable_headers[i].platform << 24) | 683 = (subtable_headers[i].platform << 24) |
| 684 + (subtable_headers[i].encoding << 16) | 684 + (subtable_headers[i].encoding << 16) |
| 685 + subtable_headers[i].language; | 685 + subtable_headers[i].language; |
| 686 if ((i != 0) && (last_id >= current_id)) { | 686 if ((i != 0) && (last_id >= current_id)) { |
| 687 return OTS_FAILURE_MSG("subtable %d with platform ID %d, encoding ID %d, l
anguage ID %d " | 687 OTS_WARNING("subtable %d with platform ID %d, encoding ID %d, language ID
%d " |
| 688 "following subtable with platform ID %d, encoding I
D %d, language ID %d", | 688 "following subtable with platform ID %d, encoding ID %d, langu
age ID %d", |
| 689 i, | 689 i, |
| 690 (uint8_t)(current_id >> 24), (uint8_t)(current_id >
> 16), (uint8_t)(current_id), | 690 (uint8_t)(current_id >> 24), (uint8_t)(current_id >> 16), (uin
t8_t)(current_id), |
| 691 (uint8_t)(last_id >> 24), (uint8_t)(last_id >> 16),
(uint8_t)(last_id)); | 691 (uint8_t)(last_id >> 24), (uint8_t)(last_id >> 16), (uint8_t)(
last_id)); |
| 692 } | 692 } |
| 693 last_id = current_id; | 693 last_id = current_id; |
| 694 } | 694 } |
| 695 | 695 |
| 696 // Now, verify that all the lengths are sane | 696 // Now, verify that all the lengths are sane |
| 697 for (unsigned i = 0; i < num_tables; ++i) { | 697 for (unsigned i = 0; i < num_tables; ++i) { |
| 698 if (!subtable_headers[i].length) continue; | 698 if (!subtable_headers[i].length) continue; |
| 699 if (subtable_headers[i].length > 1024 * 1024 * 1024) { | 699 if (subtable_headers[i].length > 1024 * 1024 * 1024) { |
| 700 return OTS_FAILURE_MSG("Bad cmap subtable %d length", i); | 700 return OTS_FAILURE_MSG("Bad cmap subtable %d length", i); |
| 701 } | 701 } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 return true; | 1097 return true; |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 void ots_cmap_free(OpenTypeFile *file) { | 1100 void ots_cmap_free(OpenTypeFile *file) { |
| 1101 delete file->cmap; | 1101 delete file->cmap; |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 } // namespace ots | 1104 } // namespace ots |
| 1105 | 1105 |
| 1106 #undef TABLE_NAME | 1106 #undef TABLE_NAME |
| OLD | NEW |