summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfppo.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-13 17:51:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-13 17:51:27 -0700
commit71a452f8ce12e31cc4e0d8c7878567b0c7fc63c2 (patch)
treea0ee545eb67b14f9398df98196d88e5150893ce8 /fpdfsdk/fpdfppo.cpp
parentafe94306e3c542f0d499e7f7706ee5dec4028d8a (diff)
downloadpdfium-71a452f8ce12e31cc4e0d8c7878567b0c7fc63c2.tar.xz
Make CFX_ByteString(const CFX_ByteStringC&) explicit.
Add missing helper function to CFX_ByteTextBuf to avoid the anti-pattern CFX_ByteString(sBuf.AsStringC()), using the name "Make" to indicate there's an allocation going on in this case. Change some method arguments to take pre-existing ByteStrings where possible. Review-Url: https://codereview.chromium.org/1977093002
Diffstat (limited to 'fpdfsdk/fpdfppo.cpp')
-rw-r--r--fpdfsdk/fpdfppo.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index 1ec968ddf4..97fd390cb3 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -32,7 +32,7 @@ class CPDF_PageOrganizer {
CPDF_Document* pDestPDFDoc,
int nIndex);
CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict,
- CFX_ByteString nSrctag);
+ const CFX_ByteString& bsSrctag);
FX_BOOL UpdateReference(CPDF_Object* pObj,
CPDF_Document* pDoc,
ObjectNumberMap* pObjNumberMap);
@@ -175,8 +175,8 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
CPDF_Dictionary* pDict,
- CFX_ByteString nSrctag) {
- if (!pDict || nSrctag.IsEmpty())
+ const CFX_ByteString& bsSrcTag) {
+ if (!pDict || bsSrcTag.IsEmpty())
return nullptr;
if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type"))
return nullptr;
@@ -191,13 +191,12 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
if (!pp)
return nullptr;
- CFX_ByteStringC sSrcTag = nSrctag.AsStringC();
- if (pDict->KeyExist(sSrcTag))
- return pDict->GetObjectBy(sSrcTag);
+ if (pDict->KeyExist(bsSrcTag))
+ return pDict->GetObjectBy(bsSrcTag);
while (pp) {
- if (pp->KeyExist(sSrcTag))
- return pp->GetObjectBy(sSrcTag);
+ if (pp->KeyExist(bsSrcTag))
+ return pp->GetObjectBy(bsSrcTag);
if (!pp->KeyExist("Parent"))
break;
pp = ToDictionary(pp->GetObjectBy("Parent")->GetDirect());