| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |