summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_flatten.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-14 11:04:57 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-14 11:04:57 -0700
commit7b1ccf9697692844e764d730079a0f0b98fd6d06 (patch)
tree8e1c0b669a8dd1e06de50454b4e5db5e7c6e1a2a /fpdfsdk/fpdf_flatten.cpp
parent774bdde253b8394aa2ac791e273508ff006d813a (diff)
downloadpdfium-7b1ccf9697692844e764d730079a0f0b98fd6d06.tar.xz
Make CPDF_Dictionary methods take CFX_ByteString arguments
This will help avoid duplicate allocation of CFX_ByteStrings when the caller already has one. It may seem counter-intuitive that requiring the caller to pass an allocated CFX_ByteString rather than a static CFX_ByteStringC would improve the situation, but due to the idiosyncrasies of std::map, the CPDF_Dictionary methods must always do an allocation under the covers which can't be avoided. The changed callers in this CL are places where we would previously demote to CFX_ByteStringC and then allocate a a duplicate CFX_ByteString in the dictionary method. Review URL: https://codereview.chromium.org/1889863002
Diffstat (limited to 'fpdfsdk/fpdf_flatten.cpp')
-rw-r--r--fpdfsdk/fpdf_flatten.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index 54e606397f..e445d9abfa 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -393,7 +393,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
char sExtend[5] = {};
FXSYS_itoa(iKey, sExtend, 10);
key = CFX_ByteString("FFT") + CFX_ByteString(sExtend);
- if (!pPageXObject->KeyExist(key.AsStringC()))
+ if (!pPageXObject->KeyExist(key))
break;
}
}
@@ -403,7 +403,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CPDF_Dictionary* pNewXORes = NULL;
if (!key.IsEmpty()) {
- pPageXObject->SetAtReference(key.AsStringC(), pDocument, dwObjNum);
+ pPageXObject->SetAtReference(key, pDocument, dwObjNum);
CPDF_Dictionary* pNewOXbjectDic = pNewXObject->GetDict();
pNewXORes = new CPDF_Dictionary;
pNewOXbjectDic->SetAt("Resources", pNewXORes);
@@ -435,7 +435,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
continue;
if (!sAnnotState.IsEmpty()) {
- pAPStream = pAPDic->GetStreamBy(sAnnotState.AsStringC());
+ pAPStream = pAPDic->GetStreamBy(sAnnotState);
} else {
auto it = pAPDic->begin();
if (it != pAPDic->end()) {
@@ -484,7 +484,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CFX_ByteString sFormName;
sFormName.Format("F%d", i);
uint32_t dwObjNum = pDocument->AddIndirectObject(pObj);
- pXObject->SetAtReference(sFormName.AsStringC(), pDocument, dwObjNum);
+ pXObject->SetAtReference(sFormName, pDocument, dwObjNum);
CPDF_StreamAcc acc;
acc.LoadAllData(pNewXObject);