Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Unified Diff: core/fpdfdoc/doc_basic.cpp

Issue 1890973006: Avoid narrowing to StringC in CPDF_Name and CPDF_NameTree (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Missing !, use initializer list. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_parser/include/cpdf_name.h ('k') | core/fpdfdoc/include/fpdf_doc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/doc_basic.cpp
diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp
index a3e94cb033a59235dcf6ec3fd1d67d5c51572b2c..a0c6b2babc4494562af14b35178778dbebb6c01b 100644
--- a/core/fpdfdoc/doc_basic.cpp
+++ b/core/fpdfdoc/doc_basic.cpp
@@ -71,12 +71,19 @@ FX_FLOAT CPDF_Dest::GetParam(int index) {
CFX_ByteString CPDF_Dest::GetRemoteName() {
return m_pObj ? m_pObj->GetString() : CFX_ByteString();
}
+
CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc,
- const CFX_ByteStringC& category) {
- if (pDoc->GetRoot() && pDoc->GetRoot()->GetDictBy("Names"))
- m_pRoot = pDoc->GetRoot()->GetDictBy("Names")->GetDictBy(category);
- else
- m_pRoot = NULL;
+ const CFX_ByteString& category)
+ : m_pRoot(nullptr) {
+ CPDF_Dictionary* pRoot = pDoc->GetRoot();
+ if (!pRoot)
+ return;
+
+ CPDF_Dictionary* pNames = pRoot->GetDictBy("Names");
+ if (!pNames)
+ return;
+
+ m_pRoot = pNames->GetDictBy(category);
}
static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
@@ -233,7 +240,7 @@ CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const {
return SearchNameNode(m_pRoot, csName, nIndex, NULL);
}
CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
- const CFX_ByteStringC& sName) {
+ const CFX_ByteString& sName) {
CPDF_Object* pValue = LookupValue(sName);
if (!pValue) {
CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictBy("Dests");
« no previous file with comments | « core/fpdfapi/fpdf_parser/include/cpdf_name.h ('k') | core/fpdfdoc/include/fpdf_doc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698