Chromium Code Reviews| 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..08dd3ab626694e0fb934f9994e29469cbbc728c5 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; |
| @@ -296,7 +296,7 @@ void CFX_BaseMassArrayImp::RemoveAll(FX_BOOL bLeaveMemory) { |
| } |
| for (int32_t i = 0; i < m_iChunkCount; i++) { |
| void* p = m_pData->GetAt(i); |
| - if (p == NULL) { |
| + if (!p) { |
|
Lei Zhang
2016/06/23 17:56:00
I think we can call free() on nullptr.
dsinclair
2016/06/23 18:46:52
Done.
|
| continue; |
| } |
| FX_Free(p); |
| @@ -363,7 +363,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 +421,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); |
| } |