summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-14 17:06:23 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-14 17:06:23 -0700
commit759247991b5f1df71335294e6bfe3e3fe7aec7b4 (patch)
tree3de1b72b34c3eae83f4b9fa58e978a643ff0bf6a /core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp
parentdacc22cdfea727a04bce086d9bfec9a4d1a29bd4 (diff)
downloadpdfium-759247991b5f1df71335294e6bfe3e3fe7aec7b4.tar.xz
Move extern cmap declarations from .cpp files into new .h files.
That way, the compiler can check them against the definitions rather than just relying on the linker to line things up. Make the types of the declarations and definitions match exactly, instead of being synonym typedefs of each other. Fix some IWYU and use FX_ArraySize where possible. BUG=https://code.google.com/p/pdfium/issues/detail?id=178 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1221503005 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp b/core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp
index f7549642ae..15d3a83fbf 100644
--- a/core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp
+++ b/core/src/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp
@@ -6,25 +6,12 @@
#include "../../../../include/fpdfapi/fpdf_resource.h"
#include "../../../../include/fpdfapi/fpdf_module.h"
+#include "../../../../include/fxcrt/fx_basic.h" // For FX_ArraySize().
#include "../../fpdf_font/font_int.h"
#include "../cmap_int.h"
-extern const FX_WORD g_FXCMAP_B5pc_H_0[];
-extern const FX_WORD g_FXCMAP_B5pc_V_0[];
-extern const FX_WORD g_FXCMAP_HKscs_B5_H_5[];
-extern const FX_WORD g_FXCMAP_HKscs_B5_V_5[];
-extern const FX_WORD g_FXCMAP_ETen_B5_H_0[];
-extern const FX_WORD g_FXCMAP_ETen_B5_V_0[];
-extern const FX_WORD g_FXCMAP_ETenms_B5_H_0[];
-extern const FX_WORD g_FXCMAP_ETenms_B5_V_0[];
-extern const FX_WORD g_FXCMAP_CNS_EUC_H_0[];
-extern const FX_WORD g_FXCMAP_CNS_EUC_H_0_DWord[];
-extern const FX_WORD g_FXCMAP_CNS_EUC_V_0[];
-extern const FX_WORD g_FXCMAP_CNS_EUC_V_0_DWord[];
-extern const FX_WORD g_FXCMAP_UniCNS_UCS2_H_3[];
-extern const FX_WORD g_FXCMAP_UniCNS_UCS2_V_3[];
-extern const FX_WORD g_FXCMAP_UniCNS_UTF16_H_0[];
-extern const FX_WORD g_FXCMAP_CNS1CID2Unicode_5[];
-const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = {
+#include "cmaps_cns1.h"
+
+static const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = {
{ "B5pc-H", FXCMAP_CMap::Range, g_FXCMAP_B5pc_H_0, 247, FXCMAP_CMap::None, NULL, 0, 0 },
{ "B5pc-V", FXCMAP_CMap::Range, g_FXCMAP_B5pc_V_0, 12, FXCMAP_CMap::None, NULL, 0, -1 },
{ "HKscs-B5-H", FXCMAP_CMap::Range, g_FXCMAP_HKscs_B5_H_5, 1210, FXCMAP_CMap::None, NULL, 0, 0 },
@@ -40,11 +27,12 @@ const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = {
{ "UniCNS-UTF16-H", FXCMAP_CMap::Single, g_FXCMAP_UniCNS_UTF16_H_0, 14557, FXCMAP_CMap::None, NULL, 0, 0 },
{ "UniCNS-UTF16-V", FXCMAP_CMap::Range, g_FXCMAP_UniCNS_UCS2_V_3, 13, FXCMAP_CMap::None, NULL, 0, -1 },
};
+
void CPDF_ModuleMgr::LoadEmbeddedCNS1CMaps()
{
CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
pFontGlobals->m_EmbeddedCharsets[CIDSET_CNS1].m_pMapList = g_FXCMAP_CNS1_cmaps;
- pFontGlobals->m_EmbeddedCharsets[CIDSET_CNS1].m_Count = sizeof g_FXCMAP_CNS1_cmaps / sizeof (FXCMAP_CMap);
+ pFontGlobals->m_EmbeddedCharsets[CIDSET_CNS1].m_Count = FX_ArraySize(g_FXCMAP_CNS1_cmaps);
pFontGlobals->m_EmbeddedToUnicodes[CIDSET_CNS1].m_pMap = g_FXCMAP_CNS1CID2Unicode_5;
pFontGlobals->m_EmbeddedToUnicodes[CIDSET_CNS1].m_Count = 19088;
}