summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_flatten.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-16 22:08:07 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-16 22:08:07 +0000
commit1c4735aed9442a8e442214a23a3df94bd8fc99b5 (patch)
tree37264efcc3a1d90e3a9f05384d283923c828242f /fpdfsdk/fpdf_flatten.cpp
parent3f1c832dda209cf6682bb75316c07d71332fe6c3 (diff)
downloadpdfium-1c4735aed9442a8e442214a23a3df94bd8fc99b5.tar.xz
Convert ByteString::{Format|FormatV} to static methods
This CL moves the Format and FormatV methods of ByteString to be static. Bug: pdfium:934 Change-Id: I9c30455a789aff9f619b9d5bf89c0712644f2d9a Reviewed-on: https://pdfium-review.googlesource.com/18650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_flatten.cpp')
-rw-r--r--fpdfsdk/fpdf_flatten.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index 35d3617627..07fbd7cd9e 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -173,8 +173,8 @@ uint32_t NewIndirectContentsStream(const ByteString& key,
CPDF_Stream* pNewContents = pDocument->NewIndirect<CPDF_Stream>(
nullptr, 0,
pdfium::MakeUnique<CPDF_Dictionary>(pDocument->GetByteStringPool()));
- ByteString sStream;
- sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
+ ByteString sStream =
+ ByteString::Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
pNewContents->SetData(sStream.raw_str(), sStream.GetLength());
return pNewContents->GetObjNum();
}
@@ -301,10 +301,9 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
ByteString key;
int nStreams = pdfium::CollectionSize<int>(ObjectArray);
if (nStreams > 0) {
- ByteString sKey;
int i = 0;
while (i < INT_MAX) {
- sKey.Format("FFT%d", i);
+ ByteString sKey = ByteString::Format("FFT%d", i);
if (!pPageXObject->KeyExist(sKey)) {
key = sKey;
break;
@@ -391,8 +390,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
if (!pXObject)
pXObject = pNewXORes->SetNewFor<CPDF_Dictionary>("XObject");
- ByteString sFormName;
- sFormName.Format("F%d", i);
+ ByteString sFormName = ByteString::Format("F%d", i);
pXObject->SetNewFor<CPDF_Reference>(sFormName, pDocument,
pObj->GetObjNum());
@@ -401,10 +399,8 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
ByteString sStream(pAcc->GetData(), pAcc->GetSize());
CFX_Matrix matrix = pAPDic->GetMatrixFor("Matrix");
CFX_Matrix m = GetMatrix(rcAnnot, rcStream, matrix);
- ByteString sTemp;
- sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f,
- sFormName.c_str());
- sStream += sTemp;
+ sStream += ByteString::Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d,
+ m.e, m.f, sFormName.c_str());
pNewXObject->SetDataAndRemoveFilter(sStream.raw_str(), sStream.GetLength());
}
pPageDict->RemoveFor("Annots");