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

Unified Diff: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp

Issue 1419643005: Merge to XFA: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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_render/fpdf_render_loadimage.cpp
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 79b4bba16200b6f7b7dd7f065da10df236539ce0..fecd6da9b24616629894e38bcd5f472a3a08e057 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -482,8 +482,7 @@ FX_BOOL CPDF_DIBSource::LoadColorInfo(CPDF_Dictionary* pFormResources,
m_bDoBpcCheck = FALSE;
return TRUE;
}
- } else if (pFilter->GetType() == PDFOBJ_ARRAY) {
- CPDF_Array* pArray = (CPDF_Array*)pFilter;
+ } else if (CPDF_Array* pArray = pFilter->AsArray()) {
if (pArray->GetString(pArray->GetCount() - 1) ==
FX_BSTRC("JPXDecode")) {
m_bDoBpcCheck = FALSE;
@@ -570,8 +569,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
if (pMask == NULL) {
return pCompData;
}
- if (pMask->GetType() == PDFOBJ_ARRAY) {
- CPDF_Array* pArray = (CPDF_Array*)pMask;
+ if (CPDF_Array* pArray = pMask->AsArray()) {
if (pArray->GetCount() >= m_nComponents * 2) {
for (FX_DWORD i = 0; i < m_nComponents; i++) {
int min_num = pArray->GetInteger(i * 2);
@@ -953,8 +951,7 @@ void CPDF_DIBSource::ValidateDictParam() {
} else if (filter == FX_BSTRC("DCTDecode")) {
m_bpc = 8;
}
- } else if (pFilter->GetType() == PDFOBJ_ARRAY) {
- CPDF_Array* pArray = (CPDF_Array*)pFilter;
+ } else if (CPDF_Array* pArray = pFilter->AsArray()) {
if (pArray->GetString(pArray->GetCount() - 1) ==
FX_BSTRC("CCITTFaxDecode") ||
pArray->GetString(pArray->GetCount() - 1) ==

Powered by Google App Engine
This is Rietveld 408576698