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

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

Issue 1417033004: Merge to XFA: Add type cast definitions for CPDF_Name. (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_page/fpdf_page_colors.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 584f9c24d337f08399d33efee78e49dfb6c1fb47..73b10918564824b9d002e6f8267f3cbcbaa69be9 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -1057,9 +1057,9 @@ FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
return FALSE;
}
CPDF_Object* pFuncObj = pArray->GetElementValue(3);
- if (pFuncObj && pFuncObj->GetType() != PDFOBJ_NAME) {
+ if (pFuncObj && !pFuncObj->IsName())
m_pFunc = CPDF_Function::Load(pFuncObj);
- }
+
if (m_pFunc && m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
delete m_pFunc;
m_pFunc = NULL;
@@ -1202,30 +1202,27 @@ CPDF_ColorSpace* _CSFromName(const CFX_ByteString& name) {
return NULL;
}
CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) {
- if (pObj == NULL) {
- return NULL;
- }
- if (pObj->GetType() == PDFOBJ_NAME) {
+ if (!pObj)
+ return nullptr;
+ if (pObj->IsName())
return _CSFromName(pObj->GetString());
- }
+
if (pObj->GetType() == PDFOBJ_STREAM) {
CPDF_Dictionary* pDict = ((CPDF_Stream*)pObj)->GetDict();
- if (!pDict) {
- return NULL;
- }
- CPDF_ColorSpace* pRet = NULL;
+ if (!pDict)
+ return nullptr;
+
+ CPDF_ColorSpace* pRet = nullptr;
FX_POSITION pos = pDict->GetStartPos();
while (pos) {
CFX_ByteString bsKey;
CPDF_Object* pValue = pDict->GetNextElement(pos, bsKey);
- if (pValue && pValue->GetType() == PDFOBJ_NAME) {
+ if (ToName(pValue))
pRet = _CSFromName(pValue->GetString());
- }
- if (pRet) {
+ if (pRet)
return pRet;
- }
}
- return NULL;
+ return nullptr;
}
if (pObj->GetType() != PDFOBJ_ARRAY) {
return NULL;

Powered by Google App Engine
This is Rietveld 408576698