summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.cpp12
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.h3
2 files changed, 6 insertions, 9 deletions
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.cpp b/core/fpdfapi/font/cpdf_cmapmanager.cpp
index 53183af340..62a2013448 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.cpp
+++ b/core/fpdfapi/font/cpdf_cmapmanager.cpp
@@ -29,15 +29,13 @@ RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(const ByteString& name,
return pCMap;
}
-RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
- const ByteString& name,
- bool bPromptCJK) {
- const char* pname = name.c_str();
- if (*pname == '/')
- pname++;
+RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(ByteString name,
+ bool bPromptCJK) {
+ if (!name.IsEmpty() && name[0] == '/')
+ name = name.Right(name.GetLength() - 1);
auto pCMap = pdfium::MakeRetain<CPDF_CMap>();
- pCMap->LoadPredefined(this, pname, bPromptCJK);
+ pCMap->LoadPredefined(this, name, bPromptCJK);
return pCMap;
}
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.h b/core/fpdfapi/font/cpdf_cmapmanager.h
index 089eb3d705..47a0be063f 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.h
+++ b/core/fpdfapi/font/cpdf_cmapmanager.h
@@ -24,8 +24,7 @@ class CPDF_CMapManager {
CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
private:
- RetainPtr<CPDF_CMap> LoadPredefinedCMap(const ByteString& name,
- bool bPromptCJK);
+ RetainPtr<CPDF_CMap> LoadPredefinedCMap(ByteString name, bool bPromptCJK);
std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset,
bool bPromptCJK);