diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
commit | 412e908082a361d0fd9591eab939e96a882212f1 (patch) | |
tree | 11726052ae08f13dc5a05a82cbce870758580aeb /core/src/fpdfapi/fpdf_page | |
parent | 96660d6f382204339d6b1aadc3913303d436e252 (diff) | |
download | pdfium-412e908082a361d0fd9591eab939e96a882212f1.tar.xz |
Merge to XFA: Get rid of most instance of 'foo == NULL'
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1520063002 .
(cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff)
Review URL: https://codereview.chromium.org/1528763003 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 17 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 42 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 8 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 8 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 36 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 14 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 6 |
7 files changed, 63 insertions, 68 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index f37dd770ca..1fef74b99b 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -689,7 +689,7 @@ CPDF_PageObjects::~CPDF_PageObjects() { } } void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause) { - if (m_pParser == NULL) { + if (!m_pParser) { return; } m_pParser->Continue(pPause); @@ -720,10 +720,7 @@ int CPDF_PageObjects::GetObjectIndex(CPDF_PageObject* pObj) const { } CPDF_PageObject* CPDF_PageObjects::GetObjectByIndex(int index) const { FX_POSITION pos = m_ObjectList.FindIndex(index); - if (pos == NULL) { - return NULL; - } - return (CPDF_PageObject*)m_ObjectList.GetAt(pos); + return pos ? static_cast<CPDF_PageObject*>(m_ObjectList.GetAt(pos)) : nullptr; } void CPDF_PageObjects::Transform(const CFX_Matrix& matrix) { FX_POSITION pos = m_ObjectList.GetHeadPosition(); @@ -758,11 +755,11 @@ CFX_FloatRect CPDF_PageObjects::CalcBoundingBox() const { return CFX_FloatRect(left, bottom, right, top); } void CPDF_PageObjects::LoadTransInfo() { - if (m_pFormDict == NULL) { + if (!m_pFormDict) { return; } CPDF_Dictionary* pGroup = m_pFormDict->GetDict("Group"); - if (pGroup == NULL) { + if (!pGroup) { return; } if (pGroup->GetString("S") != "Transparency") { @@ -800,7 +797,7 @@ void CPDF_Page::Load(CPDF_Document* pDocument, m_pPageRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreatePageCache(this); } - if (pPageDict == NULL) { + if (!pPageDict) { m_PageWidth = m_PageHeight = 100 * 1.0f; m_pPageResources = m_pResources = NULL; return; @@ -912,10 +909,10 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc, m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL; m_pResources = m_pFormDict->GetDict("Resources"); m_pPageResources = pPageResources; - if (m_pResources == NULL) { + if (!m_pResources) { m_pResources = pParentResources; } - if (m_pResources == NULL) { + if (!m_pResources) { m_pResources = pPageResources; } m_Transparency = 0; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 8deeb66deb..c9eee8e380 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -688,7 +688,7 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS() { FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { CPDF_Stream* pStream = pArray->GetStream(1); - if (pStream == NULL) { + if (!pStream) { return FALSE; } m_pProfile = pDoc->LoadIccProfile(pStream); @@ -699,7 +699,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { m_pProfile ->GetComponents(); // Try using the nComponents from ICC profile CPDF_Dictionary* pDict = pStream->GetDict(); - if (m_pProfile->m_pTransform == NULL) { // No valid ICC profile or using sRGB + if (!m_pProfile->m_pTransform) { // No valid ICC profile or using sRGB CPDF_Object* pAlterCSObj = pDict ? pDict->GetElementValue("Alternate") : NULL; if (pAlterCSObj) { @@ -764,7 +764,7 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf, return TRUE; } ICodec_IccModule* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule(); - if (m_pProfile->m_pTransform == NULL || pIccModule == NULL) { + if (!m_pProfile->m_pTransform || !pIccModule) { if (m_pAlterCS) { return m_pAlterCS->GetRGB(pBuf, R, G, B); } @@ -822,7 +822,7 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline( m_pProfile->m_pTransform, pDestBuf, pSrcBuf, pixels); } else { - if (m_pCache == NULL) { + if (!m_pCache) { ((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(uint8_t, nMaxColors, 3); uint8_t* temp_src = FX_Alloc2D(uint8_t, nMaxColors, m_nComponents); uint8_t* pSrc = temp_src; @@ -897,7 +897,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { } CPDF_DocPageData* pDocPageData = pDoc->GetPageData(); m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL); - if (m_pBaseCS == NULL) { + if (!m_pBaseCS) { return FALSE; } m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray()); @@ -1078,8 +1078,8 @@ FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, if (m_Type == None) { return FALSE; } - if (m_pFunc == NULL) { - if (m_pAltCS == NULL) { + if (!m_pFunc) { + if (!m_pAltCS) { return FALSE; } int nComps = m_pAltCS->CountComponents(); @@ -1154,7 +1154,7 @@ FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { } m_pAltCS = Load(pDoc, pAltCS); m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3)); - if (m_pAltCS == NULL || m_pFunc == NULL) { + if (!m_pAltCS || !m_pFunc) { return FALSE; } if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) { @@ -1166,7 +1166,7 @@ FX_BOOL CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const { - if (m_pFunc == NULL) { + if (!m_pFunc) { return FALSE; } CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs()); @@ -1331,7 +1331,7 @@ FX_BOOL CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf, return SetRGB(pBuf, R, G, B); } void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const { - if (buf == NULL || m_Family == PDFCS_PATTERN) { + if (!buf || m_Family == PDFCS_PATTERN) { return; } FX_FLOAT min, max; @@ -1418,7 +1418,7 @@ void CPDF_Color::ReleaseColorSpace() { } void CPDF_Color::SetColorSpace(CPDF_ColorSpace* pCS) { if (m_pCS == pCS) { - if (m_pBuffer == NULL) { + if (!m_pBuffer) { m_pBuffer = pCS->CreateBuf(); } ReleaseColorSpace(); @@ -1434,7 +1434,7 @@ void CPDF_Color::SetColorSpace(CPDF_ColorSpace* pCS) { } } void CPDF_Color::SetValue(FX_FLOAT* comps) { - if (m_pBuffer == NULL) { + if (!m_pBuffer) { return; } if (m_pCS->GetFamily() != PDFCS_PATTERN) { @@ -1445,7 +1445,7 @@ void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) { if (ncomps > MAX_PATTERN_COLORCOMPS) { return; } - if (m_pCS == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) { + if (!m_pCS || m_pCS->GetFamily() != PDFCS_PATTERN) { FX_Free(m_pBuffer); m_pCS = CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN); m_pBuffer = m_pCS->CreateBuf(); @@ -1482,7 +1482,7 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) { m_pCS = m_pCS->m_pDocument->GetPageData()->GetCopiedColorSpace(pArray); } } - if (m_pCS == NULL) { + if (!m_pCS) { return; } m_pBuffer = m_pCS->CreateBuf(); @@ -1498,7 +1498,7 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) { } } FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const { - if (m_pCS == NULL || m_pBuffer == NULL) { + if (!m_pCS || !m_pBuffer) { return FALSE; } FX_FLOAT r = 0.0f, g = 0.0f, b = 0.0f; @@ -1511,28 +1511,26 @@ FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const { return TRUE; } CPDF_Pattern* CPDF_Color::GetPattern() const { - if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) { + if (!m_pBuffer || m_pCS->GetFamily() != PDFCS_PATTERN) { return NULL; } PatternValue* pvalue = (PatternValue*)m_pBuffer; return pvalue->m_pPattern; } CPDF_ColorSpace* CPDF_Color::GetPatternCS() const { - if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) { + if (!m_pBuffer || m_pCS->GetFamily() != PDFCS_PATTERN) { return NULL; } return m_pCS->GetBaseCS(); } FX_FLOAT* CPDF_Color::GetPatternColor() const { - if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) { + if (!m_pBuffer || m_pCS->GetFamily() != PDFCS_PATTERN) { return NULL; } PatternValue* pvalue = (PatternValue*)m_pBuffer; return pvalue->m_nComps ? pvalue->m_Comps : NULL; } FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const { - if (m_pCS != other.m_pCS || m_pCS == NULL) { - return FALSE; - } - return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0; + return m_pCS && m_pCS == other.m_pCS && + FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index 5f9d038626..118f1cd5a3 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -207,7 +207,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) { } i++; } - if (_PDF_PSOpNames[i].name == NULL) { + if (!_PDF_PSOpNames[i].name) { FX_FLOAT* pd = FX_Alloc(FX_FLOAT, 1); *pd = FX_atof(word); m_Operators.Add((void*)PSOP_CONST); @@ -683,7 +683,7 @@ CPDF_ExpIntFunc::~CPDF_ExpIntFunc() { } FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { CPDF_Dictionary* pDict = pObj->GetDict(); - if (pDict == NULL) { + if (!pDict) { return FALSE; } CPDF_Array* pArray0 = pDict->GetArray("C0"); @@ -813,7 +813,7 @@ FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const { if (input < m_pBounds[i + 1]) { break; } - if (m_pSubFunctions[i] == NULL) { + if (!m_pSubFunctions[i]) { return FALSE; } input = PDF_Interpolate(input, m_pBounds[i], m_pBounds[i + 1], @@ -823,7 +823,7 @@ FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const { return TRUE; } CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) { - if (pFuncObj == NULL) { + if (!pFuncObj) { return NULL; } CPDF_Function* pFunc = NULL; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index 63f957a838..d8f21c692d 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -103,7 +103,7 @@ CPDF_Rect CPDF_ClipPath::GetClipBox() const { FX_BOOL bLayerStarted = FALSE; for (int i = 0; i < count; i++) { CPDF_TextObject* pTextObj = GetText(i); - if (pTextObj == NULL) { + if (!pTextObj) { if (!bStarted) { rect = layer_rect; bStarted = TRUE; @@ -637,7 +637,7 @@ void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name, FX_BOOL bDirect) { CPDF_ContentMarkItem& item = m_Marks.Add(); item.SetName(name); - if (pDict == NULL) { + if (!pDict) { return; } item.SetParam(bDirect ? CPDF_ContentMarkItem::DirectDict @@ -652,7 +652,7 @@ void CPDF_ContentMarkData::DeleteLastMark() { m_Marks.RemoveAt(size - 1); } FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const { - if (m_pObject == NULL) { + if (!m_pObject) { return FALSE; } for (int i = 0; i < m_pObject->CountItems(); i++) { @@ -665,7 +665,7 @@ FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const { } FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const { - if (m_pObject == NULL) { + if (!m_pObject) { return FALSE; } for (int i = 0; i < m_pObject->CountItems(); i++) { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 1df0c605e4..e90c53c956 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -117,7 +117,7 @@ void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) { CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(name, len))); } else { m_ParamBuf1[index].m_Type = PDFOBJ_NAME; - if (FXSYS_memchr(name, '#', len) == NULL) { + if (!FXSYS_memchr(name, '#', len)) { FXSYS_memcpy(m_ParamBuf1[index].m_Name.m_Buffer, name, len); m_ParamBuf1[index].m_Name.m_Len = len; } else { @@ -410,7 +410,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() { } CFX_ByteString tag = GetString(1); CPDF_Object* pProperty = GetObject(0); - if (pProperty == NULL) { + if (!pProperty) { return; } FX_BOOL bDirect = TRUE; @@ -631,7 +631,7 @@ void CPDF_StreamContentParser::Handle_SetColorSpace_Fill() { } CFX_ByteString csname = GetString(0); CPDF_ColorSpace* pCS = FindColorSpace(csname); - if (pCS == NULL) { + if (!pCS) { return; } m_pCurStates->m_ColorState.GetModify()->m_FillColor.SetColorSpace(pCS); @@ -642,7 +642,7 @@ void CPDF_StreamContentParser::Handle_SetColorSpace_Stroke() { } CFX_ByteString csname = GetString(0); CPDF_ColorSpace* pCS = FindColorSpace(csname); - if (pCS == NULL) { + if (!pCS) { return; } m_pCurStates->m_ColorState.GetModify()->m_StrokeColor.SetColorSpace(pCS); @@ -652,7 +652,7 @@ void CPDF_StreamContentParser::Handle_SetDash() { return; } CPDF_Array* pArray = GetObject(1) ? GetObject(1)->GetArray() : NULL; - if (pArray == NULL) { + if (!pArray) { return; } m_pCurStates->SetLineDash(pArray, GetNumber(0), 1.0f); @@ -771,7 +771,7 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline) { - if (pStream == NULL && pImage == NULL) { + if (!pStream && !pImage) { return NULL; } CFX_Matrix ImageMatrix; @@ -1032,7 +1032,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() { return; } CPDF_Object* pLastParam = GetObject(0); - if (pLastParam == NULL) { + if (!pLastParam) { return; } int nargs = m_ParamCount; @@ -1062,7 +1062,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { return; } CPDF_Object* pLastParam = GetObject(0); - if (pLastParam == NULL) { + if (!pLastParam) { return; } int nargs = m_ParamCount; @@ -1099,7 +1099,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() { return; } CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE); - if (pPattern == NULL) { + if (!pPattern) { return; } if (pPattern->m_PatternType != PATTERN_SHADING) { @@ -1162,24 +1162,24 @@ void CPDF_StreamContentParser::Handle_SetFont() { CPDF_Object* CPDF_StreamContentParser::FindResourceObj( const CFX_ByteStringC& type, const CFX_ByteString& name) { - if (m_pResources == NULL) { + if (!m_pResources) { return NULL; } if (m_pResources == m_pPageResources) { CPDF_Dictionary* pList = m_pResources->GetDict(type); - if (pList == NULL) { + if (!pList) { return NULL; } CPDF_Object* pRes = pList->GetElementValue(name); return pRes; } CPDF_Dictionary* pList = m_pResources->GetDict(type); - if (pList == NULL) { - if (m_pPageResources == NULL) { + if (!pList) { + if (!m_pPageResources) { return NULL; } CPDF_Dictionary* pList = m_pPageResources->GetDict(type); - if (pList == NULL) { + if (!pList) { return NULL; } CPDF_Object* pRes = pList->GetElementValue(name); @@ -1211,7 +1211,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace( CFX_ByteString defname = "Default"; defname += name.Mid(7); CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname); - if (pDefObj == NULL) { + if (!pDefObj) { if (name == "DeviceGray") { return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY); } @@ -1223,7 +1223,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace( return m_pDocument->LoadColorSpace(pDefObj); } CPDF_Object* pCSObj = FindResourceObj("ColorSpace", name); - if (pCSObj == NULL) { + if (!pCSObj) { m_bResourceMissing = TRUE; return NULL; } @@ -1253,7 +1253,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, FX_FLOAT* pKerning, int nsegs) { CPDF_Font* pFont = m_pCurStates->m_TextState.GetFont(); - if (pFont == NULL) { + if (!pFont) { return; } if (fInitKerning != 0) { @@ -1324,7 +1324,7 @@ void CPDF_StreamContentParser::Handle_ShowText() { } void CPDF_StreamContentParser::Handle_ShowText_Positioning() { CPDF_Array* pArray = GetObject(0) ? GetObject(0)->GetArray() : NULL; - if (pArray == NULL) { + if (!pArray) { return; } int n = pArray->GetCount(); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index fbe6faa471..2f68d78808 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -249,7 +249,7 @@ CPDF_StreamParser::~CPDF_StreamParser() { FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, uint8_t*& dest_buf, FX_DWORD& dest_size) { - if (pDecoder == NULL) { + if (!pDecoder) { return (FX_DWORD)-1; } int ncomps = pDecoder->CountComps(); @@ -353,7 +353,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, FX_DWORD bpc = pDict->GetInteger("BitsPerComponent"); FX_DWORD nComponents = 1; CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj); - if (pCS == NULL) { + if (!pCS) { nComponents = 3; } else { nComponents = pCS->CountComponents(); @@ -634,7 +634,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, CFX_ByteString key = PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)); CPDF_Object* pObj = ReadNextObject(TRUE); - if (pObj == NULL) { + if (!pObj) { if (pDict) { pDict->Release(); } @@ -655,7 +655,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, CPDF_Array* pArray = CPDF_Array::Create(); while (1) { CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, TRUE); - if (pObj == NULL) { + if (!pObj) { if (m_WordSize == 0 || m_WordBuffer[0] == ']') { return pArray; } @@ -924,8 +924,8 @@ void CPDF_ContentParser::Clear() { m_Status = Ready; } void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) { - if (m_Status != Ready || pPage == NULL || pPage->m_pDocument == NULL || - pPage->m_pFormDict == NULL) { + if (m_Status != Ready || !pPage || !pPage->m_pDocument || + !pPage->m_pFormDict) { m_Status = Done; return; } @@ -938,7 +938,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) { m_InternalStage = PAGEPARSE_STAGE_GETCONTENT; m_CurrentOffset = 0; CPDF_Object* pContent = pPage->m_pFormDict->GetElementValue("Contents"); - if (pContent == NULL) { + if (!pContent) { m_Status = Done; return; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index 5ead9a5bea..fc050b9369 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -129,7 +129,7 @@ FX_BOOL CPDF_ShadingPattern::Load() { CPDF_Dictionary* pShadingDict = m_pShadingObj ? m_pShadingObj->GetDict() : NULL; - if (pShadingDict == NULL) { + if (!pShadingDict) { return FALSE; } if (m_nFuncs) { @@ -151,7 +151,7 @@ FX_BOOL CPDF_ShadingPattern::Load() { } } CPDF_Object* pCSObj = pShadingDict->GetElementValue("ColorSpace"); - if (pCSObj == NULL) { + if (!pCSObj) { return FALSE; } CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData(); @@ -199,7 +199,7 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, m_CoordMax = m_nCoordBits == 32 ? -1 : (1 << m_nCoordBits) - 1; m_CompMax = (1 << m_nCompBits) - 1; CPDF_Array* pDecode = pDict->GetArray("Decode"); - if (pDecode == NULL || pDecode->GetCount() != 4 + m_nComps * 2) { + if (!pDecode || pDecode->GetCount() != 4 + m_nComps * 2) { return FALSE; } m_xmin = pDecode->GetNumber(0); |