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

Unified Diff: core/src/fpdfdoc/doc_basic.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years 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/fpdfdoc/doc_basic.cpp
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index 904ccf7c1fc391c5a1e48aac4c960aaf3a3d4351..f780c1a58d9b743bf677e6959697f12cc57c41fd 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -77,7 +77,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
return NULL;
}
CPDF_Array* pLimits = pNode->GetArray("Limits");
- if (pLimits != NULL) {
+ if (pLimits) {
CFX_ByteString csLeft = pLimits->GetString(0);
CFX_ByteString csRight = pLimits->GetString(1);
if (csLeft.Compare(csRight) > 0) {
@@ -96,7 +96,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
CFX_ByteString csValue = pNames->GetString(i * 2);
int32_t iCompare = csValue.Compare(csName);
if (iCompare <= 0) {
- if (ppFind != NULL) {
+ if (ppFind) {
*ppFind = pNames;
}
if (iCompare < 0) {
@@ -144,7 +144,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
nCurIndex += nCount;
return NULL;
}
- if (ppFind != NULL) {
+ if (ppFind) {
*ppFind = pNames;
}
csName = pNames->GetString((nIndex - nCurIndex) * 2);
@@ -389,7 +389,7 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const {
static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj,
const CFX_WideStringC& wsFileName,
FX_BOOL bURL) {
- ASSERT(pObj != NULL);
+ ASSERT(pObj);
Tom Sepez 2015/12/14 19:14:11 nit: will segv at line 399.
Lei Zhang 2015/12/15 01:38:32 Done.
CFX_WideString wsStr;
if (bURL) {
wsStr = wsFileName;
@@ -405,7 +405,7 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj,
}
void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName,
FX_BOOL bURL) {
- ASSERT(m_pObj != NULL);
+ ASSERT(m_pObj);
Tom Sepez 2015/12/14 19:14:09 nitto
Lei Zhang 2015/12/15 01:38:32 Done.
if (bURL) {
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
pDict->SetAtName("FS", "URL");
@@ -483,12 +483,12 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
int n = nPage;
while (n >= 0) {
pValue = numberTree.LookupValue(n);
- if (pValue != NULL) {
+ if (pValue) {
break;
}
n--;
}
- if (pValue != NULL) {
+ if (pValue) {
pValue = pValue->GetDirect();
if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) {
if (pLabel->KeyExist("P")) {

Powered by Google App Engine
This is Rietveld 408576698