summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.cpp12
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.h3
-rw-r--r--core/fpdftext/cpdf_textpagefind.cpp2
-rw-r--r--core/fxcrt/css/cfx_cssrulecollection.cpp2
-rw-r--r--core/fxcrt/css/cfx_cssstyleselector.cpp2
5 files changed, 9 insertions, 12 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);
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 62bc3cb87c..19ae58a8c3 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -161,7 +161,7 @@ bool CPDF_TextPageFind::FindNext() {
}
continue;
}
- nResultPos = m_strText.Find(csWord.c_str(), nStartPos);
+ nResultPos = m_strText.Find(csWord.AsStringView(), nStartPos);
if (!nResultPos.has_value()) {
m_IsFind = false;
return m_IsFind;
diff --git a/core/fxcrt/css/cfx_cssrulecollection.cpp b/core/fxcrt/css/cfx_cssrulecollection.cpp
index 2030518b69..f525821522 100644
--- a/core/fxcrt/css/cfx_cssrulecollection.cpp
+++ b/core/fxcrt/css/cfx_cssrulecollection.cpp
@@ -29,7 +29,7 @@ void CFX_CSSRuleCollection::Clear() {
const std::vector<std::unique_ptr<CFX_CSSRuleCollection::Data>>*
CFX_CSSRuleCollection::GetTagRuleData(const WideString& tagname) const {
- auto it = m_TagRules.find(FX_HashCode_GetW(tagname.c_str(), true));
+ auto it = m_TagRules.find(FX_HashCode_GetW(tagname.AsStringView(), true));
return it != m_TagRules.end() ? &it->second : nullptr;
}
diff --git a/core/fxcrt/css/cfx_cssstyleselector.cpp b/core/fxcrt/css/cfx_cssstyleselector.cpp
index 4a47798d31..9b1a2235bc 100644
--- a/core/fxcrt/css/cfx_cssstyleselector.cpp
+++ b/core/fxcrt/css/cfx_cssstyleselector.cpp
@@ -75,7 +75,7 @@ bool CFX_CSSStyleSelector::MatchSelector(const WideString& tagname,
pSel->GetType() == CFX_CSSSelectorType::Descendant) {
return false;
}
- return pSel->GetNameHash() == FX_HashCode_GetW(tagname.c_str(), true);
+ return pSel->GetNameHash() == FX_HashCode_GetW(tagname.AsStringView(), true);
}
void CFX_CSSStyleSelector::ComputeStyle(