Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2056)

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp

Issue 1701883004: Banish CFX_ByteStringArray and CFX_WideStringArray to the XFA side. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/include/fxge/fx_ge.h ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index d3ef4d738a606a3bf443ed35c2a5e8b27686cf25..7c1c6b1f531ce73d3c193a600d6f7d72f6de559e 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -10,6 +10,7 @@
#include "core/include/fpdfapi/fpdf_parser.h"
#include "core/include/fxcodec/fx_codec.h"
#include "core/include/fxcrt/fx_ext.h"
+#include "third_party/base/stl_util.h"
#define _STREAM_MAX_SIZE_ 20 * 1024 * 1024
@@ -339,7 +340,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
CPDF_Object* pParams =
pDict ? pDict->GetElementValue("DecodeParms") : nullptr;
- CFX_ByteStringArray DecoderList;
+ std::vector<CFX_ByteString> DecoderList;
CFX_ArrayTemplate<CPDF_Object*> ParamList;
if (CPDF_Array* pDecoders = pDecoder->AsArray()) {
CPDF_Array* pParamsArray = ToArray(pParams);
@@ -347,19 +348,18 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
pParams = nullptr;
for (FX_DWORD i = 0; i < pDecoders->GetCount(); i++) {
- CFX_ByteStringC str = pDecoders->GetConstStringAt(i);
- DecoderList.Add(str);
+ DecoderList.push_back(pDecoders->GetConstStringAt(i));
ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr);
}
} else {
- DecoderList.Add(pDecoder->GetConstString());
+ DecoderList.push_back(pDecoder->GetConstString());
ParamList.Add(pParams ? pParams->GetDict() : nullptr);
}
uint8_t* last_buf = (uint8_t*)src_buf;
FX_DWORD last_size = src_size;
- for (int i = 0; i < DecoderList.GetSize(); i++) {
- int estimated_size =
- i == DecoderList.GetSize() - 1 ? last_estimated_size : 0;
+ int nSize = pdfium::CollectionSize<int>(DecoderList);
+ for (int i = 0; i < nSize; i++) {
+ int estimated_size = i == nSize - 1 ? last_estimated_size : 0;
CFX_ByteString decoder = DecoderList[i];
// Use ToDictionary here because we can push nullptr into the ParamList.
CPDF_Dictionary* pParam = ToDictionary(ParamList[i]);
@@ -367,7 +367,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
FX_DWORD new_size = (FX_DWORD)-1;
int offset = -1;
if (decoder == "FlateDecode" || decoder == "Fl") {
- if (bImageAcc && i == DecoderList.GetSize() - 1) {
+ if (bImageAcc && i == nSize - 1) {
ImageEncoding = "FlateDecode";
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
@@ -384,7 +384,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
} else if (decoder == "ASCIIHexDecode" || decoder == "AHx") {
offset = HexDecode(last_buf, last_size, new_buf, new_size);
} else if (decoder == "RunLengthDecode" || decoder == "RL") {
- if (bImageAcc && i == DecoderList.GetSize() - 1) {
+ if (bImageAcc && i == nSize - 1) {
ImageEncoding = "RunLengthDecode";
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
« no previous file with comments | « core/include/fxge/fx_ge.h ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698