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

Side by Side Diff: core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp

Issue 1879683002: Remove CPDF_Object::GetConstString and overrides (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Move bLuminosity down. Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_string.cpp ('k') | core/fpdfapi/fpdf_parser/include/cpdf_array.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" 7 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
8 8
9 #include <limits.h> 9 #include <limits.h>
10 #include <vector> 10 #include <vector>
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 CPDF_Object* pParams = 343 CPDF_Object* pParams =
344 pDict ? pDict->GetDirectObjectBy("DecodeParms") : nullptr; 344 pDict ? pDict->GetDirectObjectBy("DecodeParms") : nullptr;
345 std::vector<CFX_ByteString> DecoderList; 345 std::vector<CFX_ByteString> DecoderList;
346 CFX_ArrayTemplate<CPDF_Object*> ParamList; 346 CFX_ArrayTemplate<CPDF_Object*> ParamList;
347 if (CPDF_Array* pDecoders = pDecoder->AsArray()) { 347 if (CPDF_Array* pDecoders = pDecoder->AsArray()) {
348 CPDF_Array* pParamsArray = ToArray(pParams); 348 CPDF_Array* pParamsArray = ToArray(pParams);
349 if (!pParamsArray) 349 if (!pParamsArray)
350 pParams = nullptr; 350 pParams = nullptr;
351 351
352 for (size_t i = 0; i < pDecoders->GetCount(); i++) { 352 for (size_t i = 0; i < pDecoders->GetCount(); i++) {
353 DecoderList.push_back(pDecoders->GetConstStringAt(i)); 353 DecoderList.push_back(pDecoders->GetStringAt(i));
354 ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr); 354 ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr);
355 } 355 }
356 } else { 356 } else {
357 DecoderList.push_back(pDecoder->GetConstString()); 357 DecoderList.push_back(pDecoder->GetString());
358 ParamList.Add(pParams ? pParams->GetDict() : nullptr); 358 ParamList.Add(pParams ? pParams->GetDict() : nullptr);
359 } 359 }
360 uint8_t* last_buf = (uint8_t*)src_buf; 360 uint8_t* last_buf = (uint8_t*)src_buf;
361 uint32_t last_size = src_size; 361 uint32_t last_size = src_size;
362 int nSize = pdfium::CollectionSize<int>(DecoderList); 362 int nSize = pdfium::CollectionSize<int>(DecoderList);
363 for (int i = 0; i < nSize; i++) { 363 for (int i = 0; i < nSize; i++) {
364 int estimated_size = i == nSize - 1 ? last_estimated_size : 0; 364 int estimated_size = i == nSize - 1 ? last_estimated_size : 0;
365 CFX_ByteString decoder = DecoderList[i]; 365 CFX_ByteString decoder = DecoderList[i];
366 // Use ToDictionary here because we can push nullptr into the ParamList. 366 // Use ToDictionary here because we can push nullptr into the ParamList.
367 CPDF_Dictionary* pParam = ToDictionary(ParamList[i]); 367 CPDF_Dictionary* pParam = ToDictionary(ParamList[i]);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 uint32_t src_size, 580 uint32_t src_size,
581 uint8_t*& dest_buf, 581 uint8_t*& dest_buf,
582 uint32_t& dest_size) { 582 uint32_t& dest_size) {
583 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); 583 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
584 if (pEncoders) { 584 if (pEncoders) {
585 return pEncoders->GetFlateModule()->FlateOrLZWDecode( 585 return pEncoders->GetFlateModule()->FlateOrLZWDecode(
586 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); 586 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size);
587 } 587 }
588 return 0; 588 return 0;
589 } 589 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_string.cpp ('k') | core/fpdfapi/fpdf_parser/include/cpdf_array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698