summaryrefslogtreecommitdiff
path: root/xfa/fgas/crt/fgas_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas/crt/fgas_utils.cpp')
-rw-r--r--xfa/fgas/crt/fgas_utils.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp
index 6db7aa35ab..7207f055e5 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);
}