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

Unified Diff: xfa/fde/cfde_txtedtparag.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/fde/cfde_txtedtpage.cpp ('k') | xfa/fde/cfde_txtedttextset.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fde/cfde_txtedtparag.cpp
diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp
index 63e9a939b54f4e22df773f42bf3ae4239205a328..11015f59fd032f46d5a7ecc40c88b935e7d47dd5 100644
--- a/xfa/fde/cfde_txtedtparag.cpp
+++ b/xfa/fde/cfde_txtedtparag.cpp
@@ -17,7 +17,7 @@ CFDE_TxtEdtParag::CFDE_TxtEdtParag(CFDE_TxtEdtEngine* pEngine)
: m_nCharStart(0),
m_nCharCount(0),
m_nLineCount(0),
- m_lpData(NULL),
+ m_lpData(nullptr),
m_pEngine(pEngine) {
ASSERT(m_pEngine);
}
@@ -28,7 +28,7 @@ CFDE_TxtEdtParag::~CFDE_TxtEdtParag() {
}
void CFDE_TxtEdtParag::LoadParag() {
- if (m_lpData != NULL) {
+ if (m_lpData) {
((int32_t*)m_lpData)[0]++;
return;
}
@@ -77,11 +77,11 @@ void CFDE_TxtEdtParag::LoadParag() {
pTxtBreak->ClearBreakPieces();
int32_t nLineCount = LineBaseArr.GetSize();
m_nLineCount = nLineCount;
- if (m_lpData == NULL) {
- m_lpData = FX_Alloc(int32_t, nLineCount + 1);
- } else {
+ if (m_lpData)
m_lpData = FX_Realloc(int32_t, m_lpData, (nLineCount + 1));
- }
+ else
+ m_lpData = FX_Alloc(int32_t, nLineCount + 1);
+
int32_t* pIntArr = (int32_t*)m_lpData;
pIntArr[0] = 1;
m_nLineCount = nLineCount;
@@ -93,12 +93,11 @@ void CFDE_TxtEdtParag::LoadParag() {
}
void CFDE_TxtEdtParag::UnloadParag() {
- ASSERT(m_lpData != NULL);
((int32_t*)m_lpData)[0]--;
ASSERT(((int32_t*)m_lpData)[0] >= 0);
if (((int32_t*)m_lpData)[0] == 0) {
FX_Free(m_lpData);
- m_lpData = NULL;
+ m_lpData = nullptr;
}
}
« no previous file with comments | « xfa/fde/cfde_txtedtpage.cpp ('k') | xfa/fde/cfde_txtedttextset.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698