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_edit | |
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_edit')
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 16 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 14 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 4 |
4 files changed, 19 insertions, 19 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index eda51deb3b..5810da572b 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -56,13 +56,13 @@ void CPDF_PageContentGenerate::GenerateContent() { CFX_ByteString CPDF_PageContentGenerate::RealizeResource( CPDF_Object* pResourceObj, const FX_CHAR* szType) { - if (m_pPage->m_pResources == NULL) { + if (!m_pPage->m_pResources) { m_pPage->m_pResources = new CPDF_Dictionary; int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources); m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum); } CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDict(szType); - if (pResList == NULL) { + if (!pResList) { pResList = new CPDF_Dictionary; m_pPage->m_pResources->SetAt(szType, pResList); } diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index a797332727..b200b8d37d 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -17,7 +17,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive* pFile, FX_FILESIZE& offset) { int32_t len = 0; - if (pObj == NULL) { + if (!pObj) { if (pFile->AppendString(" null") < 0) { return -1; } @@ -416,7 +416,7 @@ FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler, if (src_size == 0) { return TRUE; } - if (pHandler == NULL) { + if (!pHandler) { m_pData = (uint8_t*)src_data; m_dwSize = src_size; m_bNewBuf = FALSE; @@ -1071,7 +1071,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt) { int32_t len = 0; - if (pObj == NULL) { + if (!pObj) { if (m_File.AppendString(" null") < 0) { return -1; } @@ -1098,7 +1098,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, case PDFOBJ_STRING: { CFX_ByteString str = pObj->GetString(); FX_BOOL bHex = pObj->AsString()->IsHex(); - if (m_pCryptoHandler == NULL || !bEncrypt) { + if (!m_pCryptoHandler || !bEncrypt) { CFX_ByteString content = PDF_EncodeString(str, bHex); if ((len = m_File.AppendString(content)) < 0) { return -1; @@ -1200,7 +1200,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, break; } case PDFOBJ_DICTIONARY: { - if (m_pCryptoHandler == NULL || pObj == m_pEncryptDict) { + if (!m_pCryptoHandler || pObj == m_pEncryptDict) { return PDF_CreatorAppendObject(pObj, &m_File, m_Offset); } if (m_File.AppendString("<<") < 0) { @@ -1263,7 +1263,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) { if (m_pParser->m_bVersionUpdated || m_bSecurityChanged || bExistInMap || bObjStm) { CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum); - if (pObj == NULL) { + if (!pObj) { m_ObjectOffset[objnum] = 0; m_ObjectSize[objnum] = 0; return 0; @@ -1278,7 +1278,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) { uint8_t* pBuffer; FX_DWORD size; m_pParser->GetIndirectBinary(objnum, pBuffer, size); - if (pBuffer == NULL) { + if (!pBuffer) { return 0; } if (m_pParser->m_V5Type[objnum] == 2) { @@ -1477,7 +1477,7 @@ void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) { int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { FXSYS_assert(m_iStage > -1 || m_iStage < 20); if (m_iStage == 0) { - if (m_pParser == NULL) { + if (!m_pParser) { m_dwFlags &= ~FPDFCREATE_INCREMENTAL; } if (m_bSecurityChanged && (m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0) { diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 7febc7932f..9c96a3027c 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -20,7 +20,7 @@ CPDF_Document::CPDF_Document() : CPDF_IndirectObjects(NULL) { m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); } void CPDF_Document::CreateNewDoc() { - ASSERT(m_pRootDict == NULL && m_pInfoDict == NULL); + ASSERT(!m_pRootDict && !m_pInfoDict); m_pRootDict = new CPDF_Dictionary; m_pRootDict->SetAtName("Type", "Catalog"); int objnum = AddIndirectObject(m_pRootDict); @@ -550,7 +550,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bTranslateName) { CTFontRef font = (CTFontRef)pFont; CTFontDescriptorRef descriptor = CTFontCopyFontDescriptor(font); - if (descriptor == NULL) { + if (!descriptor) { return NULL; } CFX_ByteString basefont; @@ -560,7 +560,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FXSYS_memset(bbox, 0, sizeof(int) * 4); CFArrayRef languages = (CFArrayRef)CTFontDescriptorCopyAttribute( descriptor, kCTFontLanguagesAttribute); - if (languages == NULL) { + if (!languages) { CFRelease(descriptor); return NULL; } @@ -574,7 +574,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, } CFRelease(descriptor); CFDictionaryRef traits = (CFDictionaryRef)CTFontCopyTraits(font); - if (traits == NULL) { + if (!traits) { CFRelease(languages); return NULL; } @@ -825,7 +825,7 @@ static void _InsertWidthArray1(CFX_Font* pFont, } CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { - if (pFont == NULL) { + if (!pFont) { return NULL; } FX_BOOL bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || @@ -1118,11 +1118,11 @@ CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, void CPDF_Document::DeletePage(int iPage) { CPDF_Dictionary* pRoot = GetRoot(); - if (pRoot == NULL) { + if (!pRoot) { return; } CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); - if (pPages == NULL) { + if (!pPages) { return; } int nPages = pPages->GetInteger("Count"); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index 640e8671f8..10b0272b52 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -51,7 +51,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) { m_bIsMask = FALSE; m_Width = width; m_Height = height; - if (m_pStream == NULL) { + if (!m_pStream) { m_pStream = new CPDF_Stream(NULL, 0, NULL); } return pDict; @@ -367,7 +367,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, dest_buf = NULL; } } - if (m_pStream == NULL) { + if (!m_pStream) { m_pStream = new CPDF_Stream(NULL, 0, NULL); } if (!bStream) { |