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 --- core/fpdfapi/edit/cpdf_creator.cpp | 12 ++++++------ core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'core/fpdfapi') diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp index 590229bf4f..db5bd681d4 100644 --- a/core/fpdfapi/edit/cpdf_creator.cpp +++ b/core/fpdfapi/edit/cpdf_creator.cpp @@ -556,15 +556,15 @@ int32_t CPDF_Creator::WriteDoc_Stage3() { j++; if (i == 1) - str.Format("0 %d\r\n0000000000 65535 f\r\n", j); + str = ByteString::Format("0 %d\r\n0000000000 65535 f\r\n", j); else - str.Format("%d %d\r\n", i, j - i); + str = ByteString::Format("%d %d\r\n", i, j - i); if (!m_Archive->WriteBlock(str.c_str(), str.GetLength())) return -1; while (i < j) { - str.Format("%010d 00000 n\r\n", m_ObjectOffsets[i++]); + str = ByteString::Format("%010d 00000 n\r\n", m_ObjectOffsets[i++]); if (!m_Archive->WriteBlock(str.c_str(), str.GetLength())) return -1; } @@ -590,16 +590,16 @@ int32_t CPDF_Creator::WriteDoc_Stage3() { } objnum = m_NewObjNumArray[i]; if (objnum == 1) - str.Format("0 %d\r\n0000000000 65535 f\r\n", j - i + 1); + str = ByteString::Format("0 %d\r\n0000000000 65535 f\r\n", j - i + 1); else - str.Format("%d %d\r\n", objnum, j - i); + str = ByteString::Format("%d %d\r\n", objnum, j - i); if (!m_Archive->WriteBlock(str.c_str(), str.GetLength())) return -1; while (i < j) { objnum = m_NewObjNumArray[i++]; - str.Format("%010d 00000 n\r\n", m_ObjectOffsets[objnum]); + str = ByteString::Format("%010d 00000 n\r\n", m_ObjectOffsets[objnum]); if (!m_Archive->WriteBlock(str.c_str(), str.GetLength())) return -1; } diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index 593680e7ff..8a08a849cc 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -138,10 +138,10 @@ ByteString CPDF_PageContentGenerator::RealizeResource( ByteString name; int idnum = 1; while (1) { - name.Format("FX%c%d", bsType[0], idnum); - if (!pResList->KeyExist(name)) { + name = ByteString::Format("FX%c%d", bsType[0], idnum); + if (!pResList->KeyExist(name)) break; - } + idnum++; } pResList->SetNewFor(name, m_pDocument.Get(), -- cgit v1.2.3