diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-26 19:48:59 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-26 19:48:59 +0000 |
commit | c4dce690f433a41c4429e872c2306e09b14c5d9f (patch) | |
tree | 43990b61718628e7731fb8b6bf7c12e4df04b8ff /core/fpdfapi/cmaps | |
parent | ca386ad150be28116997b713056a4a2197c7b7e8 (diff) | |
download | pdfium-c4dce690f433a41c4429e872c2306e09b14c5d9f.tar.xz |
Use pdfium::span<> in cpdf_fontglobals.h
Required moving some sizes to .h file for default construction
of spans from c-style arrays.
Change-Id: I45c42103f3575bc83e57a085ad4e8f16698468d3
Reviewed-on: https://pdfium-review.googlesource.com/36190
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/cmaps')
-rw-r--r-- | core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/cmaps/CNS1/cmaps_cns1.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/cmaps/GB1/cmaps_gb1.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/cmaps/Japan1/cmaps_japan1.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/cmaps/Korea1/cmaps_korea1.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/cmaps/fpdf_cmaps.cpp | 9 |
9 files changed, 17 insertions, 22 deletions
diff --git a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp index 5076fcdd88..1291fa1c40 100644 --- a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp +++ b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp @@ -41,8 +41,6 @@ static const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = { void CPDF_ModuleMgr::LoadEmbeddedCNS1CMaps() { CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); - pFontGlobals->SetEmbeddedCharset(CIDSET_CNS1, g_FXCMAP_CNS1_cmaps, - FX_ArraySize(g_FXCMAP_CNS1_cmaps)); - pFontGlobals->SetEmbeddedToUnicode(CIDSET_CNS1, g_FXCMAP_CNS1CID2Unicode_5, - 19088); + pFontGlobals->SetEmbeddedCharset(CIDSET_CNS1, g_FXCMAP_CNS1_cmaps); + pFontGlobals->SetEmbeddedToUnicode(CIDSET_CNS1, g_FXCMAP_CNS1CID2Unicode_5); } diff --git a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.h b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.h index 627feb7bed..483fd66fc2 100644 --- a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.h +++ b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.h @@ -26,6 +26,6 @@ extern const FXCMAP_DWordCIDMap g_FXCMAP_CNS_EUC_V_0_DWord[]; extern const uint16_t g_FXCMAP_UniCNS_UCS2_H_3[]; extern const uint16_t g_FXCMAP_UniCNS_UCS2_V_3[]; extern const uint16_t g_FXCMAP_UniCNS_UTF16_H_0[]; -extern const uint16_t g_FXCMAP_CNS1CID2Unicode_5[]; +extern const uint16_t g_FXCMAP_CNS1CID2Unicode_5[19088]; #endif // CORE_FPDFAPI_CMAPS_CNS1_CMAPS_CNS1_H_ diff --git a/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp b/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp index f35161ab97..26022c623d 100644 --- a/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp +++ b/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp @@ -41,8 +41,6 @@ static const FXCMAP_CMap g_FXCMAP_GB1_cmaps[] = { void CPDF_ModuleMgr::LoadEmbeddedGB1CMaps() { CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); - pFontGlobals->SetEmbeddedCharset(CIDSET_GB1, g_FXCMAP_GB1_cmaps, - FX_ArraySize(g_FXCMAP_GB1_cmaps)); - pFontGlobals->SetEmbeddedToUnicode(CIDSET_GB1, g_FXCMAP_GB1CID2Unicode_5, - 30284); + pFontGlobals->SetEmbeddedCharset(CIDSET_GB1, g_FXCMAP_GB1_cmaps); + pFontGlobals->SetEmbeddedToUnicode(CIDSET_GB1, g_FXCMAP_GB1CID2Unicode_5); } diff --git a/core/fpdfapi/cmaps/GB1/cmaps_gb1.h b/core/fpdfapi/cmaps/GB1/cmaps_gb1.h index a475af1568..989d9ce163 100644 --- a/core/fpdfapi/cmaps/GB1/cmaps_gb1.h +++ b/core/fpdfapi/cmaps/GB1/cmaps_gb1.h @@ -24,6 +24,6 @@ extern const FXCMAP_DWordCIDMap g_FXCMAP_GBK2K_H_5_DWord[]; extern const uint16_t g_FXCMAP_GBK2K_V_5[]; extern const uint16_t g_FXCMAP_UniGB_UCS2_H_4[]; extern const uint16_t g_FXCMAP_UniGB_UCS2_V_4[]; -extern const uint16_t g_FXCMAP_GB1CID2Unicode_5[]; +extern const uint16_t g_FXCMAP_GB1CID2Unicode_5[30284]; #endif // CORE_FPDFAPI_CMAPS_GB1_CMAPS_GB1_H_ diff --git a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp index f640fdd597..ecc2b3fd3b 100644 --- a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp +++ b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp @@ -53,8 +53,7 @@ static const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[] = { void CPDF_ModuleMgr::LoadEmbeddedJapan1CMaps() { CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); - pFontGlobals->SetEmbeddedCharset(CIDSET_JAPAN1, g_FXCMAP_Japan1_cmaps, - FX_ArraySize(g_FXCMAP_Japan1_cmaps)); + pFontGlobals->SetEmbeddedCharset(CIDSET_JAPAN1, g_FXCMAP_Japan1_cmaps); pFontGlobals->SetEmbeddedToUnicode(CIDSET_JAPAN1, - g_FXCMAP_Japan1CID2Unicode_4, 15444); + g_FXCMAP_Japan1CID2Unicode_4); } diff --git a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.h b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.h index 27777f2dec..0979d2a40d 100644 --- a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.h +++ b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.h @@ -30,6 +30,6 @@ extern const uint16_t g_FXCMAP_UniJIS_UCS2_HW_V_4[]; extern const uint16_t g_FXCMAP_UniJIS_UTF16_H_0[]; extern const uint16_t g_FXCMAP_UniJIS_UTF16_H_0_DWord[]; extern const uint16_t g_FXCMAP_UniJIS_UTF16_V_0[]; -extern const uint16_t g_FXCMAP_Japan1CID2Unicode_4[]; +extern const uint16_t g_FXCMAP_Japan1CID2Unicode_4[15444]; #endif // CORE_FPDFAPI_CMAPS_JAPAN1_CMAPS_JAPAN1_H_ diff --git a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp index daec8259e9..4c9201269c 100644 --- a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp +++ b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp @@ -37,8 +37,7 @@ static const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[] = { void CPDF_ModuleMgr::LoadEmbeddedKorea1CMaps() { CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); - pFontGlobals->SetEmbeddedCharset(CIDSET_KOREA1, g_FXCMAP_Korea1_cmaps, - FX_ArraySize(g_FXCMAP_Korea1_cmaps)); + pFontGlobals->SetEmbeddedCharset(CIDSET_KOREA1, g_FXCMAP_Korea1_cmaps); pFontGlobals->SetEmbeddedToUnicode(CIDSET_KOREA1, - g_FXCMAP_Korea1CID2Unicode_2, 18352); + g_FXCMAP_Korea1CID2Unicode_2); } diff --git a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.h b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.h index 5005ff2dea..27b9b0b7c4 100644 --- a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.h +++ b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.h @@ -19,6 +19,6 @@ extern const uint16_t g_FXCMAP_KSCpc_EUC_H_0[]; extern const uint16_t g_FXCMAP_UniKS_UCS2_H_1[]; extern const uint16_t g_FXCMAP_UniKS_UCS2_V_1[]; extern const uint16_t g_FXCMAP_UniKS_UTF16_H_0[]; -extern const uint16_t g_FXCMAP_Korea1CID2Unicode_2[]; +extern const uint16_t g_FXCMAP_Korea1CID2Unicode_2[18352]; #endif // CORE_FPDFAPI_CMAPS_KOREA1_CMAPS_KOREA1_H_ diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp index bba8d2173d..bb4a397aa4 100644 --- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp +++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp @@ -11,6 +11,7 @@ #include "core/fpdfapi/cpdf_modulemgr.h" #include "core/fpdfapi/font/cpdf_fontglobals.h" #include "core/fpdfapi/page/cpdf_pagemodule.h" +#include "third_party/base/span.h" namespace { @@ -26,10 +27,10 @@ const FXCMAP_CMap* FPDFAPI_FindEmbeddedCMap(const ByteString& bsName, CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); - const FXCMAP_CMap* pCMaps; - uint32_t count; - std::tie(count, pCMaps) = pFontGlobals->GetEmbeddedCharset(charset); - for (uint32_t i = 0; i < count; i++) { + pdfium::span<const FXCMAP_CMap> pCMaps = + pFontGlobals->GetEmbeddedCharset(charset); + + for (size_t i = 0; i < pCMaps.size(); i++) { if (bsName == pCMaps[i].m_Name) return &pCMaps[i]; } |