summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/fpdf_cmaps/cmap_int.h3
-rw-r--r--core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp10
-rw-r--r--core/fpdfapi/fpdf_font/font_int.h2
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_cid.cpp26
4 files changed, 21 insertions, 20 deletions
diff --git a/core/fpdfapi/fpdf_cmaps/cmap_int.h b/core/fpdfapi/fpdf_cmaps/cmap_int.h
index 685d6fe4b1..5735432371 100644
--- a/core/fpdfapi/fpdf_cmaps/cmap_int.h
+++ b/core/fpdfapi/fpdf_cmaps/cmap_int.h
@@ -7,6 +7,7 @@
#ifndef CORE_FPDFAPI_FPDF_CMAPS_CMAP_INT_H_
#define CORE_FPDFAPI_FPDF_CMAPS_CMAP_INT_H_
+#include "core/fxcrt/include/fx_string.h"
#include "core/fxcrt/include/fx_system.h"
struct FXCMAP_CMap {
@@ -22,7 +23,7 @@ struct FXCMAP_CMap {
int m_UseOffset;
};
-void FPDFAPI_FindEmbeddedCMap(const char* name,
+void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& name,
int charset,
int coding,
const FXCMAP_CMap*& pMap);
diff --git a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
index 1e0250c1af..caf234badb 100644
--- a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
@@ -53,7 +53,7 @@ static int compareDWordSingle(const void* p1, const void* p2) {
}; // extern "C"
-void FPDFAPI_FindEmbeddedCMap(const char* name,
+void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& bsName,
int charset,
int coding,
const FXCMAP_CMap*& pMap) {
@@ -64,10 +64,10 @@ void FPDFAPI_FindEmbeddedCMap(const char* name,
pFontGlobals->m_EmbeddedCharsets[charset].m_pMapList;
for (uint32_t i = 0; i < pFontGlobals->m_EmbeddedCharsets[charset].m_Count;
i++) {
- if (FXSYS_strcmp(name, pCMaps[i].m_Name))
- continue;
- pMap = &pCMaps[i];
- break;
+ if (bsName == pCMaps[i].m_Name) {
+ pMap = &pCMaps[i];
+ break;
+ }
}
}
diff --git a/core/fpdfapi/fpdf_font/font_int.h b/core/fpdfapi/fpdf_font/font_int.h
index a09bb6bce6..e4689bfd74 100644
--- a/core/fpdfapi/fpdf_font/font_int.h
+++ b/core/fpdfapi/fpdf_font/font_int.h
@@ -139,7 +139,7 @@ class CPDF_CMap {
~CPDF_CMap();
FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr,
- const FX_CHAR* name,
+ const CFX_ByteString& name,
FX_BOOL bPromptCJK);
FX_BOOL LoadEmbedded(const uint8_t* pData, uint32_t dwSize);
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index d8cada7af3..457f8eec3e 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -315,10 +315,9 @@ CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name,
}
void CPDF_CMapManager::ReloadAll() {
- for (const auto& pair : m_CMaps) {
- CPDF_CMap* pCMap = pair.second;
- pCMap->LoadPredefined(this, pair.first.c_str(), FALSE);
- }
+ for (const auto& pair : m_CMaps)
+ pair.second->LoadPredefined(this, pair.first, FALSE);
+
for (size_t i = 0; i < FX_ArraySize(m_CID2UnicodeMaps); ++i) {
if (CPDF_CID2UnicodeMap* pMap = m_CID2UnicodeMaps[i]) {
pMap->Load(this, CIDSetFromSizeT(i), FALSE);
@@ -528,12 +527,12 @@ FX_BOOL CPDF_CMap::IsVertWriting() const {
}
FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
- const FX_CHAR* pName,
+ const CFX_ByteString& bsName,
FX_BOOL bPromptCJK) {
- m_PredefinedCMap = pName;
+ m_PredefinedCMap = bsName;
if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") {
m_Coding = CIDCODING_CID;
- m_bVertical = pName[9] == 'V';
+ m_bVertical = bsName[9] == 'V';
m_bLoaded = TRUE;
return TRUE;
}
@@ -564,13 +563,14 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
}
}
}
- FPDFAPI_FindEmbeddedCMap(pName, m_Charset, m_Coding, m_pEmbedMap);
- if (m_pEmbedMap) {
- m_bLoaded = TRUE;
- return TRUE;
- }
- return FALSE;
+ FPDFAPI_FindEmbeddedCMap(bsName, m_Charset, m_Coding, m_pEmbedMap);
+ if (!m_pEmbedMap)
+ return FALSE;
+
+ m_bLoaded = TRUE;
+ return TRUE;
}
+
FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) {
m_pMapping = FX_Alloc(uint16_t, 65536);
CPDF_CMapParser parser;