summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font/cpdf_cidfont.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-26 17:20:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-26 17:20:28 +0000
commit785da23f6cce8004b8e7759345abd877dab953ea (patch)
treea1f15eb6e7c9b32c08803f775c01dd5e3225c206 /core/fpdfapi/font/cpdf_cidfont.cpp
parente529390fd5b521e4c223343a4b367b0ced357ed5 (diff)
downloadpdfium-785da23f6cce8004b8e7759345abd877dab953ea.tar.xz
Use pdfium::span in CPDF_CID2UnicodeMap.
Change-Id: Ie63f622674d9085fa45642c15e7ee8b22ca98555 Reviewed-on: https://pdfium-review.googlesource.com/36130 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/font/cpdf_cidfont.cpp')
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp20
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)