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

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp

Issue 1410343003: [Merge to XFA] Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebase to origin/xfa Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index 2d6e9f3436561e59d98aad8c0a708ef0339952c2..55c62e287801d209010e96757263bfeaf7b5e1b3 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -283,7 +283,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
int predictor = 0;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
- predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor"));
+ predictor = pParams->GetInteger(FX_BSTRC("Predictor"));
Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1);
BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8);
Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1);
@@ -306,9 +306,8 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
FX_BOOL bEarlyChange = TRUE;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
- predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor"));
- bEarlyChange =
- ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("EarlyChange"), 1);
+ predictor = pParams->GetInteger(FX_BSTRC("Predictor"));
+ bEarlyChange = pParams->GetInteger(FX_BSTRC("EarlyChange"), 1);
Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1);
BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8);
Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1);
@@ -365,7 +364,9 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
int estimated_size =
i == DecoderList.GetSize() - 1 ? last_estimated_size : 0;
CFX_ByteString decoder = DecoderList[i];
- CPDF_Dictionary* pParam = (CPDF_Dictionary*)ParamList[i];
+ // Use ToDictionary here because we can push NULL into the ParamList.
+ CPDF_Dictionary* pParam =
+ ToDictionary(static_cast<CPDF_Object*>(ParamList[i]));
uint8_t* new_buf = NULL;
FX_DWORD new_size = (FX_DWORD)-1;
int offset = -1;
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser.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