diff options
Diffstat (limited to 'core/fpdfapi/font/cpdf_cidfont.cpp')
-rw-r--r-- | core/fpdfapi/font/cpdf_cidfont.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp index 4b4f04ba5f..ef471d02f1 100644 --- a/core/fpdfapi/font/cpdf_cidfont.cpp +++ b/core/fpdfapi/font/cpdf_cidfont.cpp @@ -23,6 +23,7 @@ #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "third_party/base/numerics/safe_math.h" #include "third_party/base/ptr_util.h" +#include "third_party/base/span.h" #include "third_party/base/stl_util.h" namespace { @@ -150,12 +151,9 @@ wchar_t EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, if (!cid) return 0; - const uint16_t* map; - uint32_t count; - std::tie(count, map) = GetFontGlobals()->GetEmbeddedToUnicode(charset); - if (map && cid < count) - return map[cid]; - return 0; + pdfium::span<const uint16_t> map = + GetFontGlobals()->GetEmbeddedToUnicode(charset); + return cid < map.size() ? map[cid] : 0; } uint32_t EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, @@ -164,13 +162,9 @@ uint32_t EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) return 0; - const uint16_t* map; - uint32_t count; - std::tie(count, map) = GetFontGlobals()->GetEmbeddedToUnicode(charset); - if (!map) - return 0; - - for (uint32_t i = 0; i < count; ++i) { + pdfium::span<const uint16_t> map = + GetFontGlobals()->GetEmbeddedToUnicode(charset); + for (uint32_t i = 0; i < map.size(); ++i) { if (map[i] == unicode) { uint32_t charCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); if (charCode) |