summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font/cpdf_cmapmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/font/cpdf_cmapmanager.cpp')
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.cpp12
1 files changed, 5 insertions, 7 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;
}