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

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

Issue 1644633003: Member function name refactoring (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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 unified diff | Download patch
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 <limits.h> 7 #include <limits.h>
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_parser.h" 10 #include "core/include/fpdfapi/fpdf_parser.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 int width, 224 int width,
225 int height, 225 int height,
226 const CPDF_Dictionary* pParams) { 226 const CPDF_Dictionary* pParams) {
227 int K = 0; 227 int K = 0;
228 FX_BOOL EndOfLine = FALSE; 228 FX_BOOL EndOfLine = FALSE;
229 FX_BOOL ByteAlign = FALSE; 229 FX_BOOL ByteAlign = FALSE;
230 FX_BOOL BlackIs1 = FALSE; 230 FX_BOOL BlackIs1 = FALSE;
231 int Columns = 1728; 231 int Columns = 1728;
232 int Rows = 0; 232 int Rows = 0;
233 if (pParams) { 233 if (pParams) {
234 K = pParams->GetInteger("K"); 234 K = pParams->GetIntegerBy("K");
235 EndOfLine = pParams->GetInteger("EndOfLine"); 235 EndOfLine = pParams->GetIntegerBy("EndOfLine");
236 ByteAlign = pParams->GetInteger("EncodedByteAlign"); 236 ByteAlign = pParams->GetIntegerBy("EncodedByteAlign");
237 BlackIs1 = pParams->GetInteger("BlackIs1"); 237 BlackIs1 = pParams->GetIntegerBy("BlackIs1");
238 Columns = pParams->GetInteger("Columns", 1728); 238 Columns = pParams->GetIntegerBy("Columns", 1728);
239 Rows = pParams->GetInteger("Rows"); 239 Rows = pParams->GetIntegerBy("Rows");
240 if (Rows > USHRT_MAX) { 240 if (Rows > USHRT_MAX) {
241 Rows = 0; 241 Rows = 0;
242 } 242 }
243 if (Columns <= 0 || Rows < 0 || Columns > USHRT_MAX || Rows > USHRT_MAX) { 243 if (Columns <= 0 || Rows < 0 || Columns > USHRT_MAX || Rows > USHRT_MAX) {
244 return NULL; 244 return NULL;
245 } 245 }
246 } 246 }
247 return CPDF_ModuleMgr::Get()->GetFaxModule()->CreateDecoder( 247 return CPDF_ModuleMgr::Get()->GetFaxModule()->CreateDecoder(
248 src_buf, src_size, width, height, K, EndOfLine, ByteAlign, BlackIs1, 248 src_buf, src_size, width, height, K, EndOfLine, ByteAlign, BlackIs1,
249 Columns, Rows); 249 Columns, Rows);
(...skipping 23 matching lines...) Expand all
273 const uint8_t* src_buf, 273 const uint8_t* src_buf,
274 FX_DWORD src_size, 274 FX_DWORD src_size,
275 int width, 275 int width,
276 int height, 276 int height,
277 int nComps, 277 int nComps,
278 int bpc, 278 int bpc,
279 const CPDF_Dictionary* pParams) { 279 const CPDF_Dictionary* pParams) {
280 int predictor = 0; 280 int predictor = 0;
281 int Colors = 0, BitsPerComponent = 0, Columns = 0; 281 int Colors = 0, BitsPerComponent = 0, Columns = 0;
282 if (pParams) { 282 if (pParams) {
283 predictor = pParams->GetInteger("Predictor"); 283 predictor = pParams->GetIntegerBy("Predictor");
284 Colors = pParams->GetInteger("Colors", 1); 284 Colors = pParams->GetIntegerBy("Colors", 1);
285 BitsPerComponent = pParams->GetInteger("BitsPerComponent", 8); 285 BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8);
286 Columns = pParams->GetInteger("Columns", 1); 286 Columns = pParams->GetIntegerBy("Columns", 1);
287 if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) { 287 if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
288 return NULL; 288 return NULL;
289 } 289 }
290 } 290 }
291 return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder( 291 return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(
292 src_buf, src_size, width, height, nComps, bpc, predictor, Colors, 292 src_buf, src_size, width, height, nComps, bpc, predictor, Colors,
293 BitsPerComponent, Columns); 293 BitsPerComponent, Columns);
294 } 294 }
295 FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, 295 FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
296 const uint8_t* src_buf, 296 const uint8_t* src_buf,
297 FX_DWORD src_size, 297 FX_DWORD src_size,
298 CPDF_Dictionary* pParams, 298 CPDF_Dictionary* pParams,
299 FX_DWORD estimated_size, 299 FX_DWORD estimated_size,
300 uint8_t*& dest_buf, 300 uint8_t*& dest_buf,
301 FX_DWORD& dest_size) { 301 FX_DWORD& dest_size) {
302 int predictor = 0; 302 int predictor = 0;
303 FX_BOOL bEarlyChange = TRUE; 303 FX_BOOL bEarlyChange = TRUE;
304 int Colors = 0, BitsPerComponent = 0, Columns = 0; 304 int Colors = 0, BitsPerComponent = 0, Columns = 0;
305 if (pParams) { 305 if (pParams) {
306 predictor = pParams->GetInteger("Predictor"); 306 predictor = pParams->GetIntegerBy("Predictor");
307 bEarlyChange = pParams->GetInteger("EarlyChange", 1); 307 bEarlyChange = pParams->GetIntegerBy("EarlyChange", 1);
308 Colors = pParams->GetInteger("Colors", 1); 308 Colors = pParams->GetIntegerBy("Colors", 1);
309 BitsPerComponent = pParams->GetInteger("BitsPerComponent", 8); 309 BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8);
310 Columns = pParams->GetInteger("Columns", 1); 310 Columns = pParams->GetIntegerBy("Columns", 1);
311 if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) { 311 if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
312 return (FX_DWORD)-1; 312 return (FX_DWORD)-1;
313 } 313 }
314 } 314 }
315 return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode( 315 return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode(
316 bLZW, src_buf, src_size, bEarlyChange, predictor, Colors, 316 bLZW, src_buf, src_size, bEarlyChange, predictor, Colors,
317 BitsPerComponent, Columns, estimated_size, dest_buf, dest_size); 317 BitsPerComponent, Columns, estimated_size, dest_buf, dest_size);
318 } 318 }
319 FX_BOOL PDF_DataDecode(const uint8_t* src_buf, 319 FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
320 FX_DWORD src_size, 320 FX_DWORD src_size,
(...skipping 11 matching lines...) Expand all
332 CPDF_Object* pParams = 332 CPDF_Object* pParams =
333 pDict ? pDict->GetElementValue("DecodeParms") : nullptr; 333 pDict ? pDict->GetElementValue("DecodeParms") : nullptr;
334 CFX_ByteStringArray DecoderList; 334 CFX_ByteStringArray DecoderList;
335 CFX_ArrayTemplate<CPDF_Object*> ParamList; 335 CFX_ArrayTemplate<CPDF_Object*> ParamList;
336 if (CPDF_Array* pDecoders = pDecoder->AsArray()) { 336 if (CPDF_Array* pDecoders = pDecoder->AsArray()) {
337 CPDF_Array* pParamsArray = ToArray(pParams); 337 CPDF_Array* pParamsArray = ToArray(pParams);
338 if (!pParamsArray) 338 if (!pParamsArray)
339 pParams = nullptr; 339 pParams = nullptr;
340 340
341 for (FX_DWORD i = 0; i < pDecoders->GetCount(); i++) { 341 for (FX_DWORD i = 0; i < pDecoders->GetCount(); i++) {
342 CFX_ByteStringC str = pDecoders->GetConstString(i); 342 CFX_ByteStringC str = pDecoders->GetConstStringAt(i);
343 DecoderList.Add(str); 343 DecoderList.Add(str);
344 ParamList.Add(pParams ? pParamsArray->GetDict(i) : nullptr); 344 ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr);
345 } 345 }
346 } else { 346 } else {
347 DecoderList.Add(pDecoder->GetConstString()); 347 DecoderList.Add(pDecoder->GetConstString());
348 ParamList.Add(pParams ? pParams->GetDict() : nullptr); 348 ParamList.Add(pParams ? pParams->GetDict() : nullptr);
349 } 349 }
350 uint8_t* last_buf = (uint8_t*)src_buf; 350 uint8_t* last_buf = (uint8_t*)src_buf;
351 FX_DWORD last_size = src_size; 351 FX_DWORD last_size = src_size;
352 for (int i = 0; i < DecoderList.GetSize(); i++) { 352 for (int i = 0; i < DecoderList.GetSize(); i++) {
353 int estimated_size = 353 int estimated_size =
354 i == DecoderList.GetSize() - 1 ? last_estimated_size : 0; 354 i == DecoderList.GetSize() - 1 ? last_estimated_size : 0;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 FX_DWORD src_size, 566 FX_DWORD src_size,
567 uint8_t*& dest_buf, 567 uint8_t*& dest_buf,
568 FX_DWORD& dest_size) { 568 FX_DWORD& dest_size) {
569 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); 569 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
570 if (pEncoders) { 570 if (pEncoders) {
571 return pEncoders->GetFlateModule()->FlateOrLZWDecode( 571 return pEncoders->GetFlateModule()->FlateOrLZWDecode(
572 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); 572 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size);
573 } 573 }
574 return 0; 574 return 0;
575 } 575 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698