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

Unified Diff: xfa/fxfa/app/xfa_checksum.cpp

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: Created 4 years, 6 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
« no previous file with comments | « xfa/fxbarcode/qrcode/BC_QRGridSampler.cpp ('k') | xfa/fxfa/app/xfa_ffapp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_checksum.cpp
diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp
index b279dc95961e32594f5efa80a1cab7c0e80e2aa9..f1553d0f27a04c94b81b5270f39f2712a60c12b1 100644
--- a/xfa/fxfa/app/xfa_checksum.cpp
+++ b/xfa/fxfa/app/xfa_checksum.cpp
@@ -54,11 +54,11 @@ void Base64EncodePiece(const FX_BASE64DATA& src,
}
int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) {
- ASSERT(pSrc != NULL);
+ ASSERT(pSrc);
if (iSrcLen < 1) {
return 0;
}
- if (pDst == NULL) {
+ if (!pDst) {
int32_t iDstLen = iSrcLen / 3 * 4;
if ((iSrcLen % 3) != 0) {
iDstLen += 4;
@@ -102,7 +102,7 @@ void* CXFA_SAXReaderHandler::OnTagEnter(const CFX_ByteStringC& bsTagName,
UpdateChecksum(TRUE);
if (eType != CFX_SAXItem::Type::Tag &&
eType != CFX_SAXItem::Type::Instruction) {
- return NULL;
+ return nullptr;
}
m_SAXContext.m_eNode = eType;
CFX_ByteTextBuf& textBuf = m_SAXContext.m_TextBuf;
@@ -117,16 +117,16 @@ void* CXFA_SAXReaderHandler::OnTagEnter(const CFX_ByteStringC& bsTagName,
void CXFA_SAXReaderHandler::OnTagAttribute(void* pTag,
const CFX_ByteStringC& bsAttri,
const CFX_ByteStringC& bsValue) {
- if (pTag == NULL) {
+ if (!pTag)
return;
- }
+
CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf;
textBuf << " " << bsAttri << "=\"" << bsValue << "\"";
}
void CXFA_SAXReaderHandler::OnTagBreak(void* pTag) {
- if (pTag == NULL) {
+ if (!pTag)
return;
- }
+
CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf;
textBuf << ">";
UpdateChecksum(FALSE);
@@ -135,9 +135,9 @@ void CXFA_SAXReaderHandler::OnTagData(void* pTag,
CFX_SAXItem::Type eType,
const CFX_ByteStringC& bsData,
uint32_t dwStartPos) {
- if (pTag == NULL) {
+ if (!pTag)
return;
- }
+
CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf;
if (eType == CFX_SAXItem::Type::CharData) {
textBuf << "<![CDATA[";
@@ -148,9 +148,9 @@ void CXFA_SAXReaderHandler::OnTagData(void* pTag,
}
}
void CXFA_SAXReaderHandler::OnTagClose(void* pTag, uint32_t dwEndPos) {
- if (pTag == NULL) {
+ if (!pTag)
return;
- }
+
CXFA_SAXContext* pSAXContext = (CXFA_SAXContext*)pTag;
CFX_ByteTextBuf& textBuf = pSAXContext->m_TextBuf;
if (pSAXContext->m_eNode == CFX_SAXItem::Type::Instruction) {
@@ -163,9 +163,9 @@ void CXFA_SAXReaderHandler::OnTagClose(void* pTag, uint32_t dwEndPos) {
void CXFA_SAXReaderHandler::OnTagEnd(void* pTag,
const CFX_ByteStringC& bsTagName,
uint32_t dwEndPos) {
- if (pTag == NULL) {
+ if (!pTag)
return;
- }
+
CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf;
textBuf << "</" << bsTagName << ">";
UpdateChecksum(FALSE);
@@ -174,9 +174,9 @@ void CXFA_SAXReaderHandler::OnTargetData(void* pTag,
CFX_SAXItem::Type eType,
const CFX_ByteStringC& bsData,
uint32_t dwStartPos) {
- if (pTag == NULL && eType != CFX_SAXItem::Type::Comment) {
+ if (!pTag && eType != CFX_SAXItem::Type::Comment)
return;
- }
+
if (eType == CFX_SAXItem::Type::Comment) {
CFX_ByteTextBuf& textBuf = m_SAXContext.m_TextBuf;
textBuf << "<!--" << bsData << "-->";
@@ -240,7 +240,7 @@ FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_FileRead* pSrcFile,
CFX_SaxParseMode_NotConvert_sharp) < 0) {
return FALSE;
}
- return m_pSAXReader->ContinueParse(NULL) > 99;
+ return m_pSAXReader->ContinueParse(nullptr) > 99;
}
void CXFA_ChecksumContext::FinishChecksum() {
@@ -250,12 +250,12 @@ void CXFA_ChecksumContext::FinishChecksum() {
uint8_t digest[20];
FXSYS_memset(digest, 0, 20);
CRYPT_SHA1Finish(m_pByteContext, digest);
- int32_t nLen = Base64EncodeA(digest, 20, NULL);
+ int32_t nLen = Base64EncodeA(digest, 20, nullptr);
FX_CHAR* pBuffer = m_bsChecksum.GetBuffer(nLen);
Base64EncodeA(digest, 20, pBuffer);
m_bsChecksum.ReleaseBuffer(nLen);
FX_Free(m_pByteContext);
- m_pByteContext = NULL;
+ m_pByteContext = nullptr;
}
}
« no previous file with comments | « xfa/fxbarcode/qrcode/BC_QRGridSampler.cpp ('k') | xfa/fxfa/app/xfa_ffapp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698