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

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

Issue 1417823005: Add type cast definitions for CPDF_Name. (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_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)
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698