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

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

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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 "../../../include/fpdfapi/fpdf_parser.h" 7 #include "../../../include/fpdfapi/fpdf_parser.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 #include <limits.h> 10 #include <limits.h>
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 uint8_t* new_buf = NULL; 304 uint8_t* new_buf = NULL;
305 FX_DWORD new_size = (FX_DWORD) - 1; 305 FX_DWORD new_size = (FX_DWORD) - 1;
306 int offset = -1; 306 int offset = -1;
307 if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) { 307 if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
308 if (bImageAcc && i == DecoderList.GetSize() - 1) { 308 if (bImageAcc && i == DecoderList.GetSize() - 1) {
309 ImageEncoding = FX_BSTRC("FlateDecode"); 309 ImageEncoding = FX_BSTRC("FlateDecode");
310 dest_buf = (uint8_t*)last_buf; 310 dest_buf = (uint8_t*)last_buf;
311 dest_size = last_size; 311 dest_size = last_size;
312 pImageParms = pParam; 312 pImageParms = pParam;
313 return TRUE; 313 return TRUE;
314 } else {
315 offset = FPDFAPI_FlateOrLZWDecode(FALSE, last_buf, last_size, pP aram, estimated_size, new_buf, new_size);
316 } 314 }
315 offset = FPDFAPI_FlateOrLZWDecode(FALSE, last_buf, last_size, pParam , estimated_size, new_buf, new_size);
317 } else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW" )) { 316 } else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW" )) {
318 offset = FPDFAPI_FlateOrLZWDecode(TRUE, last_buf, last_size, pParam, estimated_size, new_buf, new_size); 317 offset = FPDFAPI_FlateOrLZWDecode(TRUE, last_buf, last_size, pParam, estimated_size, new_buf, new_size);
319 } else if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC(" A85")) { 318 } else if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC(" A85")) {
320 offset = _A85Decode(last_buf, last_size, new_buf, new_size); 319 offset = _A85Decode(last_buf, last_size, new_buf, new_size);
321 } else if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC( "AHx")) { 320 } else if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC( "AHx")) {
322 offset = _HexDecode(last_buf, last_size, new_buf, new_size); 321 offset = _HexDecode(last_buf, last_size, new_buf, new_size);
323 } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC ("RL")) { 322 } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC ("RL")) {
324 if (bImageAcc && i == DecoderList.GetSize() - 1) { 323 if (bImageAcc && i == DecoderList.GetSize() - 1) {
325 ImageEncoding = FX_BSTRC("RunLengthDecode"); 324 ImageEncoding = FX_BSTRC("RunLengthDecode");
326 dest_buf = (uint8_t*)last_buf; 325 dest_buf = (uint8_t*)last_buf;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 518 }
520 } 519 }
521 FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_b uf, FX_DWORD& dest_size) 520 FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_b uf, FX_DWORD& dest_size)
522 { 521 {
523 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); 522 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
524 if (pEncoders) { 523 if (pEncoders) {
525 return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src _size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); 524 return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src _size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size);
526 } 525 }
527 return 0; 526 return 0;
528 } 527 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698