From f86ca3884886506c999a3b521078151e7cda0bf9 Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 13 Sep 2016 12:23:30 -0700 Subject: Remove more strcmp/memcmp usage. Review-Url: https://codereview.chromium.org/2340513002 --- core/fpdfapi/fpdf_font/font_int.h | 2 +- core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'core/fpdfapi/fpdf_font') 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; -- cgit v1.2.3