| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fpdfapi/fpdf_font/font_int.h" | 7 #include "core/fpdfapi/fpdf_font/font_int.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" | 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" |
| 10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" | 10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 CIDSet CIDSetFromSizeT(size_t index) { | 185 CIDSet CIDSetFromSizeT(size_t index) { |
| 186 if (index >= CIDSET_NUM_SETS) { | 186 if (index >= CIDSET_NUM_SETS) { |
| 187 NOTREACHED(); | 187 NOTREACHED(); |
| 188 return CIDSET_UNKNOWN; | 188 return CIDSET_UNKNOWN; |
| 189 } | 189 } |
| 190 return static_cast<CIDSet>(index); | 190 return static_cast<CIDSet>(index); |
| 191 } | 191 } |
| 192 | 192 |
| 193 CFX_ByteStringC CMap_GetString(const CFX_ByteStringC& word) { | 193 CFX_ByteStringC CMap_GetString(const CFX_ByteStringC& word) { |
| 194 return word.Mid(1, word.GetLength() - 2); | 194 if (word.GetLength() <= 2) |
| 195 return CFX_ByteStringC(); |
| 196 return CFX_ByteStringC(&word[1], word.GetLength() - 2); |
| 195 } | 197 } |
| 196 | 198 |
| 197 int CompareDWORD(const void* data1, const void* data2) { | 199 int CompareDWORD(const void* data1, const void* data2) { |
| 198 return (*(uint32_t*)data1) - (*(uint32_t*)data2); | 200 return (*(uint32_t*)data1) - (*(uint32_t*)data2); |
| 199 } | 201 } |
| 200 | 202 |
| 201 int CompareCID(const void* key, const void* element) { | 203 int CompareCID(const void* key, const void* element) { |
| 202 if ((*(uint32_t*)key) < (*(uint32_t*)element)) { | 204 if ((*(uint32_t*)key) < (*(uint32_t*)element)) { |
| 203 return -1; | 205 return -1; |
| 204 } | 206 } |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount); | 788 FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount); |
| 787 } | 789 } |
| 788 | 790 |
| 789 CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering) { | 791 CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering) { |
| 790 for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) { | 792 for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) { |
| 791 if (ordering == g_CharsetNames[charset]) | 793 if (ordering == g_CharsetNames[charset]) |
| 792 return CIDSetFromSizeT(charset); | 794 return CIDSetFromSizeT(charset); |
| 793 } | 795 } |
| 794 return CIDSET_UNKNOWN; | 796 return CIDSET_UNKNOWN; |
| 795 } | 797 } |
| OLD | NEW |