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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp

Issue 1243883003: Fix else-after-returns throughout pdfium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, Address comments. 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_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.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 "pageint.h" 10 #include "pageint.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_bu f, FX_DWORD& dest_size); 281 FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_bu f, FX_DWORD& dest_size);
282 FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams, 282 FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
283 FX_DWORD estimated_size, uint8_t*& dest_buf, F X_DWORD& dest_size); 283 FX_DWORD estimated_size, uint8_t*& dest_buf, F X_DWORD& dest_size);
284 FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit, 284 FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit,
285 int width, int height, CFX_ByteString& decoder, 285 int width, int height, CFX_ByteString& decoder,
286 CPDF_Dictionary* pParam, uint8_t*& dest_buf, FX_ DWORD& dest_size) 286 CPDF_Dictionary* pParam, uint8_t*& dest_buf, FX_ DWORD& dest_size)
287 { 287 {
288 if (decoder == FX_BSTRC("CCITTFaxDecode") || decoder == FX_BSTRC("CCF")) { 288 if (decoder == FX_BSTRC("CCITTFaxDecode") || decoder == FX_BSTRC("CCF")) {
289 ICodec_ScanlineDecoder* pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, lim it, width, height, pParam); 289 ICodec_ScanlineDecoder* pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, lim it, width, height, pParam);
290 return _DecodeAllScanlines(pDecoder, dest_buf, dest_size); 290 return _DecodeAllScanlines(pDecoder, dest_buf, dest_size);
291 } else if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85" )) { 291 }
292 if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85")) {
292 return _A85Decode(src_buf, limit, dest_buf, dest_size); 293 return _A85Decode(src_buf, limit, dest_buf, dest_size);
293 } else if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx ")) { 294 }
295 if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx")) {
294 return _HexDecode(src_buf, limit, dest_buf, dest_size); 296 return _HexDecode(src_buf, limit, dest_buf, dest_size);
295 } else if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) { 297 }
298 if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
296 return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size , dest_buf, dest_size); 299 return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size , dest_buf, dest_size);
297 } else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) { 300 }
301 if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
298 return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_bu f, dest_size); 302 return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_bu f, dest_size);
299 } else if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) { 303 }
304 if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) {
300 ICodec_ScanlineDecoder* pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule( )->CreateDecoder( 305 ICodec_ScanlineDecoder* pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule( )->CreateDecoder(
301 src_buf, limit, width, height, 0, pParam ? pParam->GetInteger(FX_BSTRC("ColorTransform"), 1) : 1); 306 src_buf, limit, width, height, 0, pParam ? pParam->GetInteger(FX_BST RC("ColorTransform"), 1) : 1);
302 return _DecodeAllScanlines(pDecoder, dest_buf, dest_size); 307 return _DecodeAllScanlines(pDecoder, dest_buf, dest_size);
303 } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL ")) { 308 }
309 if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) {
304 return RunLengthDecode(src_buf, limit, dest_buf, dest_size); 310 return RunLengthDecode(src_buf, limit, dest_buf, dest_size);
305 } 311 }
306 dest_size = 0; 312 dest_size = 0;
307 dest_buf = 0; 313 dest_buf = 0;
308 return (FX_DWORD) - 1; 314 return (FX_DWORD) - 1;
309 } 315 }
310 CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti onary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode) 316 CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti onary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode)
311 { 317 {
312 if (m_Pos == m_Size) { 318 if (m_Pos == m_Size) {
313 return NULL; 319 return NULL;
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 return 100; 1142 return 100;
1137 } 1143 }
1138 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) { 1144 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) {
1139 return 10; 1145 return 10;
1140 } 1146 }
1141 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { 1147 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) {
1142 return 90; 1148 return 90;
1143 } 1149 }
1144 return 10 + 80 * m_CurrentOffset / m_Size; 1150 return 10 + 80 * m_CurrentOffset / m_Size;
1145 } 1151 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698