From 1c4735aed9442a8e442214a23a3df94bd8fc99b5 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 16 Nov 2017 22:08:07 +0000 Subject: 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 Reviewed-by: Tom Sepez --- fpdfsdk/fpdf_flatten.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'fpdfsdk/fpdf_flatten.cpp') 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( nullptr, 0, pdfium::MakeUnique(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(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("XObject"); - ByteString sFormName; - sFormName.Format("F%d", i); + ByteString sFormName = ByteString::Format("F%d", i); pXObject->SetNewFor(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"); -- cgit v1.2.3