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

Unified Diff: xfa/fgas/crt/fgas_utils.cpp

Issue 2095653002: Remove NULL in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master 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/fgas/crt/fgas_utils.h ('k') | xfa/fgas/font/fgas_font.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fgas/crt/fgas_utils.cpp
diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp
index 6db7aa35ab85d8b67a42ff2eb623b88dfdbb6a0b..7207f055e579d45c384f333889de7f445e3cc48d 100644
--- a/xfa/fgas/crt/fgas_utils.cpp
+++ b/xfa/fgas/crt/fgas_utils.cpp
@@ -133,9 +133,9 @@ int32_t CFX_BaseArray::RemoveLast(int32_t iCount) {
void CFX_BaseArray::RemoveAll(FX_BOOL bLeaveMemory) {
if (!bLeaveMemory) {
uint8_t*& pBuffer = m_pData->pBuffer;
- if (pBuffer != NULL) {
+ if (pBuffer) {
FX_Free(pBuffer);
- pBuffer = NULL;
+ pBuffer = nullptr;
}
m_pData->iTotalCount = 0;
}
@@ -178,14 +178,14 @@ uint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) {
}
}
}
- ASSERT(pChunk != NULL);
+ ASSERT(pChunk);
m_iBlockCount = index + 1;
return pChunk + (index % m_iChunkSize) * m_iBlockSize;
}
uint8_t* CFX_BaseMassArrayImp::GetAt(int32_t index) const {
ASSERT(index > -1 && index < m_iBlockCount);
uint8_t* pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize);
- ASSERT(pChunk != NULL);
+ ASSERT(pChunk);
return pChunk + (index % m_iChunkSize) * m_iBlockSize;
}
int32_t CFX_BaseMassArrayImp::Append(const CFX_BaseMassArrayImp& src,
@@ -258,7 +258,7 @@ void CFX_BaseMassArrayImp::Append(int32_t iDstStart,
std::min(iSrcCount, std::min(iSrcChunkSize, iDstChunkSize));
int32_t iCopyBytes = iCopySize * m_iBlockSize;
while (iSrcCount > 0) {
- ASSERT(pDstChunk != NULL && pSrcChunk != NULL);
+ ASSERT(pDstChunk && pSrcChunk);
FXSYS_memcpy(pDstChunk, pSrcChunk, iCopyBytes);
iSrcCount -= iCopySize;
iSrcChunkSize -= iCopySize;
@@ -294,13 +294,9 @@ void CFX_BaseMassArrayImp::RemoveAll(FX_BOOL bLeaveMemory) {
m_iBlockCount = 0;
return;
}
- for (int32_t i = 0; i < m_iChunkCount; i++) {
- void* p = m_pData->GetAt(i);
- if (p == NULL) {
- continue;
- }
- FX_Free(p);
- }
+ for (int32_t i = 0; i < m_iChunkCount; i++)
+ FX_Free(m_pData->GetAt(i));
+
m_pData->RemoveAll();
m_iChunkCount = 0;
m_iBlockCount = 0;
@@ -363,7 +359,7 @@ uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) {
FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
int32_t& iChunkCount = pData->iChunkCount;
int32_t iChunkSize = pData->iChunkSize;
- uint8_t* pChunk = NULL;
+ uint8_t* pChunk = nullptr;
int32_t iChunk = index / iChunkSize;
if (iChunk < iChunkCount) {
pChunk = pData->ChunkBuffer.GetAt(iChunk);
@@ -421,7 +417,7 @@ void CFX_BaseStack::Pop() {
uint8_t* CFX_BaseStack::GetTopElement() const {
int32_t iSize = m_pData->m_iBlockCount;
if (iSize < 1) {
- return NULL;
+ return nullptr;
}
return m_pData->GetAt(iSize - 1);
}
« no previous file with comments | « xfa/fgas/crt/fgas_utils.h ('k') | xfa/fgas/font/fgas_font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698