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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp

Issue 1417893003: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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_page/fpdf_page_pattern.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 3f915a7b7989200d204037458d0029ef62a539a2..924a965e6463069b31367c4c8f7076bb10e0c4a4 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -118,14 +118,13 @@ FX_BOOL CPDF_ShadingPattern::Load() {
}
CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function"));
if (pFunc) {
- if (pFunc->GetType() == PDFOBJ_ARRAY) {
- m_nFuncs = ((CPDF_Array*)pFunc)->GetCount();
- if (m_nFuncs > 4) {
+ if (CPDF_Array* pArray = pFunc->AsArray()) {
+ m_nFuncs = pArray->GetCount();
Lei Zhang 2015/10/21 21:44:09 m_nFuncs = std::min(pArray->GetCount(), 4)
dsinclair 2015/10/22 13:31:12 Done.
+ if (m_nFuncs > 4)
m_nFuncs = 4;
- }
+
for (int i = 0; i < m_nFuncs; i++) {
- m_pFunctions[i] =
- CPDF_Function::Load(((CPDF_Array*)pFunc)->GetElementValue(i));
+ m_pFunctions[i] = CPDF_Function::Load(pArray->GetElementValue(i));
}
} else {
m_pFunctions[0] = CPDF_Function::Load(pFunc);

Powered by Google App Engine
This is Rietveld 408576698