summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-12-05 20:27:02 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-05 20:27:02 +0000
commitc45271e053c8c458cefa4ccf847c85b7d1df3f09 (patch)
tree281529b69ec20663958d20d6d0ac76f31177e841 /core
parent82f2afe603ccb1e879a7a292259b0882b3d27bb6 (diff)
downloadpdfium-c45271e053c8c458cefa4ccf847c85b7d1df3f09.tar.xz
Remove redundant field in struct FXCMAP_CMap.
Change-Id: Ibac6398b5849820562830bb8ed95c3428496f7ef Reviewed-on: https://pdfium-review.googlesource.com/20410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp32
-rw-r--r--core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp32
-rw-r--r--core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp42
-rw-r--r--core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp24
-rw-r--r--core/fpdfapi/cmaps/cmap_int.h3
-rw-r--r--core/fpdfapi/cmaps/fpdf_cmaps.cpp12
6 files changed, 64 insertions, 81 deletions
diff --git a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
index 7d39fd93ad..5076fcdd88 100644
--- a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
+++ b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
@@ -12,34 +12,30 @@
#include "core/fpdfapi/page/cpdf_pagemodule.h"
static const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = {
- {"B5pc-H", g_FXCMAP_B5pc_H_0, nullptr, 247, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
- {"B5pc-V", g_FXCMAP_B5pc_V_0, nullptr, 12, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ {"B5pc-H", g_FXCMAP_B5pc_H_0, nullptr, 247, 0, FXCMAP_CMap::Range, 0},
+ {"B5pc-V", g_FXCMAP_B5pc_V_0, nullptr, 12, 0, FXCMAP_CMap::Range, -1},
{"HKscs-B5-H", g_FXCMAP_HKscs_B5_H_5, nullptr, 1210, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
+ 0},
{"HKscs-B5-V", g_FXCMAP_HKscs_B5_V_5, nullptr, 13, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
- {"ETen-B5-H", g_FXCMAP_ETen_B5_H_0, nullptr, 254, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
- {"ETen-B5-V", g_FXCMAP_ETen_B5_V_0, nullptr, 13, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ -1},
+ {"ETen-B5-H", g_FXCMAP_ETen_B5_H_0, nullptr, 254, 0, FXCMAP_CMap::Range, 0},
+ {"ETen-B5-V", g_FXCMAP_ETen_B5_V_0, nullptr, 13, 0, FXCMAP_CMap::Range, -1},
{"ETenms-B5-H", g_FXCMAP_ETenms_B5_H_0, nullptr, 1, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -2},
+ -2},
{"ETenms-B5-V", g_FXCMAP_ETenms_B5_V_0, nullptr, 18, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ -1},
{"CNS-EUC-H", g_FXCMAP_CNS_EUC_H_0, g_FXCMAP_CNS_EUC_H_0_DWord, 157, 238,
- FXCMAP_CMap::Range, FXCMAP_CMap::Range, 0},
+ FXCMAP_CMap::Range, 0},
{"CNS-EUC-V", g_FXCMAP_CNS_EUC_V_0, g_FXCMAP_CNS_EUC_V_0_DWord, 180, 261,
- FXCMAP_CMap::Range, FXCMAP_CMap::Range, 0},
+ FXCMAP_CMap::Range, 0},
{"UniCNS-UCS2-H", g_FXCMAP_UniCNS_UCS2_H_3, nullptr, 16418, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, 0},
+ FXCMAP_CMap::Range, 0},
{"UniCNS-UCS2-V", g_FXCMAP_UniCNS_UCS2_V_3, nullptr, 13, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
{"UniCNS-UTF16-H", g_FXCMAP_UniCNS_UTF16_H_0, nullptr, 14557, 0,
- FXCMAP_CMap::Single, FXCMAP_CMap::None, 0},
+ FXCMAP_CMap::Single, 0},
{"UniCNS-UTF16-V", g_FXCMAP_UniCNS_UCS2_V_3, nullptr, 13, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
};
void CPDF_ModuleMgr::LoadEmbeddedCNS1CMaps() {
diff --git a/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp b/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
index 2c3974a3b0..f35161ab97 100644
--- a/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
+++ b/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
@@ -12,34 +12,30 @@
#include "core/fpdfapi/page/cpdf_pagemodule.h"
static const FXCMAP_CMap g_FXCMAP_GB1_cmaps[] = {
- {"GB-EUC-H", g_FXCMAP_GB_EUC_H_0, nullptr, 90, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
- {"GB-EUC-V", g_FXCMAP_GB_EUC_V_0, nullptr, 20, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ {"GB-EUC-H", g_FXCMAP_GB_EUC_H_0, nullptr, 90, 0, FXCMAP_CMap::Range, 0},
+ {"GB-EUC-V", g_FXCMAP_GB_EUC_V_0, nullptr, 20, 0, FXCMAP_CMap::Range, -1},
{"GBpc-EUC-H", g_FXCMAP_GBpc_EUC_H_0, nullptr, 91, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
+ 0},
{"GBpc-EUC-V", g_FXCMAP_GBpc_EUC_V_0, nullptr, 20, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ -1},
{"GBK-EUC-H", g_FXCMAP_GBK_EUC_H_2, nullptr, 4071, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
- {"GBK-EUC-V", g_FXCMAP_GBK_EUC_V_2, nullptr, 20, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ 0},
+ {"GBK-EUC-V", g_FXCMAP_GBK_EUC_V_2, nullptr, 20, 0, FXCMAP_CMap::Range, -1},
{"GBKp-EUC-H", g_FXCMAP_GBKp_EUC_H_2, nullptr, 4070, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -2},
+ -2},
{"GBKp-EUC-V", g_FXCMAP_GBKp_EUC_V_2, nullptr, 20, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ -1},
{"GBK2K-H", g_FXCMAP_GBK2K_H_5, g_FXCMAP_GBK2K_H_5_DWord, 4071, 1017,
- FXCMAP_CMap::Range, FXCMAP_CMap::Range, -4},
- {"GBK2K-V", g_FXCMAP_GBK2K_V_5, nullptr, 41, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -4},
+ {"GBK2K-V", g_FXCMAP_GBK2K_V_5, nullptr, 41, 0, FXCMAP_CMap::Range, -1},
{"UniGB-UCS2-H", g_FXCMAP_UniGB_UCS2_H_4, nullptr, 13825, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, 0},
+ FXCMAP_CMap::Range, 0},
{"UniGB-UCS2-V", g_FXCMAP_UniGB_UCS2_V_4, nullptr, 24, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
{"UniGB-UTF16-H", g_FXCMAP_UniGB_UCS2_H_4, nullptr, 13825, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, 0},
+ FXCMAP_CMap::Range, 0},
{"UniGB-UTF16-V", g_FXCMAP_UniGB_UCS2_V_4, nullptr, 24, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
};
void CPDF_ModuleMgr::LoadEmbeddedGB1CMaps() {
diff --git a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
index 603f238706..f640fdd597 100644
--- a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
+++ b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
@@ -13,45 +13,41 @@
static const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[] = {
{"83pv-RKSJ-H", g_FXCMAP_83pv_RKSJ_H_1, nullptr, 222, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
+ 0},
{"90ms-RKSJ-H", g_FXCMAP_90ms_RKSJ_H_2, nullptr, 171, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
+ 0},
{"90ms-RKSJ-V", g_FXCMAP_90ms_RKSJ_V_2, nullptr, 78, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ -1},
{"90msp-RKSJ-H", g_FXCMAP_90msp_RKSJ_H_2, nullptr, 170, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -2},
+ FXCMAP_CMap::Range, -2},
{"90msp-RKSJ-V", g_FXCMAP_90msp_RKSJ_V_2, nullptr, 78, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
{"90pv-RKSJ-H", g_FXCMAP_90pv_RKSJ_H_1, nullptr, 263, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
+ 0},
{"Add-RKSJ-H", g_FXCMAP_Add_RKSJ_H_1, nullptr, 635, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
+ 0},
{"Add-RKSJ-V", g_FXCMAP_Add_RKSJ_V_1, nullptr, 57, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
- {"EUC-H", g_FXCMAP_EUC_H_1, nullptr, 120, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
- {"EUC-V", g_FXCMAP_EUC_V_1, nullptr, 27, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ -1},
+ {"EUC-H", g_FXCMAP_EUC_H_1, nullptr, 120, 0, FXCMAP_CMap::Range, 0},
+ {"EUC-V", g_FXCMAP_EUC_V_1, nullptr, 27, 0, FXCMAP_CMap::Range, -1},
{"Ext-RKSJ-H", g_FXCMAP_Ext_RKSJ_H_2, nullptr, 665, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -4},
+ -4},
{"Ext-RKSJ-V", g_FXCMAP_Ext_RKSJ_V_2, nullptr, 39, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
- {"H", g_FXCMAP_H_1, nullptr, 118, 0, FXCMAP_CMap::Range, FXCMAP_CMap::None,
- 0},
- {"V", g_FXCMAP_V_1, nullptr, 27, 0, FXCMAP_CMap::Range, FXCMAP_CMap::None,
-1},
+ {"H", g_FXCMAP_H_1, nullptr, 118, 0, FXCMAP_CMap::Range, 0},
+ {"V", g_FXCMAP_V_1, nullptr, 27, 0, FXCMAP_CMap::Range, -1},
{"UniJIS-UCS2-H", g_FXCMAP_UniJIS_UCS2_H_4, nullptr, 9772, 0,
- FXCMAP_CMap::Single, FXCMAP_CMap::None, 0},
+ FXCMAP_CMap::Single, 0},
{"UniJIS-UCS2-V", g_FXCMAP_UniJIS_UCS2_V_4, nullptr, 251, 0,
- FXCMAP_CMap::Single, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Single, -1},
{"UniJIS-UCS2-HW-H", g_FXCMAP_UniJIS_UCS2_HW_H_4, nullptr, 4, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -2},
+ FXCMAP_CMap::Range, -2},
{"UniJIS-UCS2-HW-V", g_FXCMAP_UniJIS_UCS2_HW_V_4, nullptr, 199, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
{"UniJIS-UTF16-H", g_FXCMAP_UniJIS_UCS2_H_4, nullptr, 9772, 0,
- FXCMAP_CMap::Single, FXCMAP_CMap::None, 0},
+ FXCMAP_CMap::Single, 0},
{"UniJIS-UTF16-V", g_FXCMAP_UniJIS_UCS2_V_4, nullptr, 251, 0,
- FXCMAP_CMap::Single, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Single, -1},
};
void CPDF_ModuleMgr::LoadEmbeddedJapan1CMaps() {
diff --git a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
index 938344a316..daec8259e9 100644
--- a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
+++ b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
@@ -12,28 +12,26 @@
#include "core/fpdfapi/page/cpdf_pagemodule.h"
static const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[] = {
- {"KSC-EUC-H", g_FXCMAP_KSC_EUC_H_0, nullptr, 467, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, 0},
- {"KSC-EUC-V", g_FXCMAP_KSC_EUC_V_0, nullptr, 16, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ {"KSC-EUC-H", g_FXCMAP_KSC_EUC_H_0, nullptr, 467, 0, FXCMAP_CMap::Range, 0},
+ {"KSC-EUC-V", g_FXCMAP_KSC_EUC_V_0, nullptr, 16, 0, FXCMAP_CMap::Range, -1},
{"KSCms-UHC-H", g_FXCMAP_KSCms_UHC_H_1, nullptr, 675, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -2},
+ -2},
{"KSCms-UHC-V", g_FXCMAP_KSCms_UHC_V_1, nullptr, 16, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -1},
+ -1},
{"KSCms-UHC-HW-H", g_FXCMAP_KSCms_UHC_HW_H_1, nullptr, 675, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, 0},
+ FXCMAP_CMap::Range, 0},
{"KSCms-UHC-HW-V", g_FXCMAP_KSCms_UHC_HW_V_1, nullptr, 16, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
{"KSCpc-EUC-H", g_FXCMAP_KSCpc_EUC_H_0, nullptr, 509, 0, FXCMAP_CMap::Range,
- FXCMAP_CMap::None, -6},
+ -6},
{"UniKS-UCS2-H", g_FXCMAP_UniKS_UCS2_H_1, nullptr, 8394, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, 0},
+ FXCMAP_CMap::Range, 0},
{"UniKS-UCS2-V", g_FXCMAP_UniKS_UCS2_V_1, nullptr, 18, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
{"UniKS-UTF16-H", g_FXCMAP_UniKS_UTF16_H_0, nullptr, 158, 0,
- FXCMAP_CMap::Single, FXCMAP_CMap::None, -2},
+ FXCMAP_CMap::Single, -2},
{"UniKS-UTF16-V", g_FXCMAP_UniKS_UCS2_V_1, nullptr, 18, 0,
- FXCMAP_CMap::Range, FXCMAP_CMap::None, -1},
+ FXCMAP_CMap::Range, -1},
};
void CPDF_ModuleMgr::LoadEmbeddedKorea1CMaps() {
diff --git a/core/fpdfapi/cmaps/cmap_int.h b/core/fpdfapi/cmaps/cmap_int.h
index 58b4a2cc07..27f9617ed6 100644
--- a/core/fpdfapi/cmaps/cmap_int.h
+++ b/core/fpdfapi/cmaps/cmap_int.h
@@ -18,7 +18,7 @@ struct FXCMAP_DWordCIDMap {
};
struct FXCMAP_CMap {
- enum MapType : uint8_t { None, Single, Range };
+ enum MapType : uint8_t { Single, Range };
const char* m_Name;
const uint16_t* m_pWordMap;
@@ -26,7 +26,6 @@ struct FXCMAP_CMap {
uint16_t m_WordCount;
uint16_t m_DWordCount;
MapType m_WordMapType;
- MapType m_DWordMapType; // TODO(thestig): Remove.
int8_t m_UseOffset;
};
diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
index f0dcce5b39..96913726be 100644
--- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
@@ -71,8 +71,7 @@ uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) {
ASSERT(pMap);
if (charcode >> 16) {
while (pMap) {
- if (pMap->m_DWordMapType == FXCMAP_CMap::Range) {
- ASSERT(pMap->m_pDWordMap);
+ if (pMap->m_pDWordMap) {
auto* found = static_cast<FXCMAP_DWordCIDMap*>(
bsearch(&charcode, pMap->m_pDWordMap, pMap->m_DWordCount,
sizeof(FXCMAP_DWordCIDMap), compareDWordRange));
@@ -80,9 +79,6 @@ uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) {
return found->m_CID + static_cast<uint16_t>(charcode) -
found->m_LoWordLow;
}
- } else {
- ASSERT(pMap->m_DWordMapType == FXCMAP_CMap::None);
- ASSERT(!pMap->m_pDWordMap);
}
pMap = FindNextCMap(pMap);
}
@@ -99,7 +95,8 @@ uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) {
if (found)
return found[1];
- } else if (pMap->m_WordMapType == FXCMAP_CMap::Range) {
+ } else {
+ ASSERT(pMap->m_WordMapType == FXCMAP_CMap::Range);
uint16_t* found = static_cast<uint16_t*>(bsearch(
&code, pMap->m_pWordMap, pMap->m_WordCount, 6, compareWordRange));
if (found)
@@ -127,7 +124,8 @@ uint32_t FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) {
pCur += 2;
}
- } else if (pMap->m_WordMapType == FXCMAP_CMap::Range) {
+ } else {
+ ASSERT(pMap->m_WordMapType == FXCMAP_CMap::Range);
const uint16_t* pCur = pMap->m_pWordMap;
const uint16_t* pEnd = pMap->m_pWordMap + pMap->m_WordCount * 3;
while (pCur < pEnd) {