summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdf_flatten.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index 0477d6fea5..914008c1a3 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -305,15 +305,18 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
if (!pPageXObject)
pPageXObject = pRes->SetNewFor<CPDF_Dictionary>("XObject");
- CFX_ByteString key = "";
+ CFX_ByteString key;
int nStreams = pdfium::CollectionSize<int>(ObjectArray);
if (nStreams > 0) {
- for (int iKey = 0; /*iKey < 100*/; iKey++) {
- char sExtend[5] = {};
- FXSYS_itoa(iKey, sExtend, 10);
- key = CFX_ByteString("FFT") + CFX_ByteString(sExtend);
- if (!pPageXObject->KeyExist(key))
+ CFX_ByteString sKey;
+ int i = 0;
+ while (i < INT_MAX) {
+ sKey.Format("FFT%d", i);
+ if (!pPageXObject->KeyExist(sKey)) {
+ key = sKey;
break;
+ }
+ ++i;
}
}