Index: core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
index 210d5433be7957a221e9d856a07213690a7bc928..9a1d48a41610b9f04f3f8ff5f68102cbb4aea555 100644 |
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
@@ -308,27 +308,27 @@ void CPDF_DocPageData::ReleaseFont(CPDF_Dictionary* pFontDict) { |
CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace(CPDF_Object* pCSObj, |
CPDF_Dictionary* pResources) { |
- if (!pCSObj) { |
- return NULL; |
- } |
- if (pCSObj->GetType() == PDFOBJ_NAME) { |
+ if (!pCSObj) |
+ return nullptr; |
+ |
+ if (pCSObj->IsName()) { |
CFX_ByteString name = pCSObj->GetConstString(); |
CPDF_ColorSpace* pCS = _CSFromName(name); |
if (!pCS && pResources) { |
CPDF_Dictionary* pList = pResources->GetDict(FX_BSTRC("ColorSpace")); |
if (pList) { |
pCSObj = pList->GetElementValue(name); |
- return GetColorSpace(pCSObj, NULL); |
+ return GetColorSpace(pCSObj, nullptr); |
} |
} |
- if (pCS == NULL || pResources == NULL) { |
+ if (!pCS || !pResources) |
return pCS; |
- } |
+ |
CPDF_Dictionary* pColorSpaces = pResources->GetDict(FX_BSTRC("ColorSpace")); |
- if (pColorSpaces == NULL) { |
+ if (!pColorSpaces) |
return pCS; |
- } |
- CPDF_Object* pDefaultCS = NULL; |
+ |
+ CPDF_Object* pDefaultCS = nullptr; |
switch (pCS->GetFamily()) { |
case PDFCS_DEVICERGB: |
pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultRGB")); |
@@ -340,10 +340,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace(CPDF_Object* pCSObj, |
pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultCMYK")); |
break; |
} |
- if (pDefaultCS == NULL) { |
- return pCS; |
- } |
- return GetColorSpace(pDefaultCS, NULL); |
+ return pDefaultCS ? GetColorSpace(pDefaultCS, nullptr) : pCS; |
} |
if (pCSObj->GetType() != PDFOBJ_ARRAY) |