summaryrefslogtreecommitdiff
path: root/xfa/src/fgas/src/crt
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src/fgas/src/crt')
-rw-r--r--xfa/src/fgas/src/crt/fx_memory.cpp3
-rw-r--r--xfa/src/fgas/src/crt/fx_stream.cpp4
-rw-r--r--xfa/src/fgas/src/crt/fx_utils.cpp12
3 files changed, 7 insertions, 12 deletions
diff --git a/xfa/src/fgas/src/crt/fx_memory.cpp b/xfa/src/fgas/src/crt/fx_memory.cpp
index f3d0f10aa3..ae387b2ee0 100644
--- a/xfa/src/fgas/src/crt/fx_memory.cpp
+++ b/xfa/src/fgas/src/crt/fx_memory.cpp
@@ -45,9 +45,6 @@ FX_LPSTATICSTORECHUNK CFX_StaticStore::AllocChunk(size_t size) {
FXSYS_assert(size != 0);
FX_LPSTATICSTORECHUNK pChunk = (FX_LPSTATICSTORECHUNK)FX_Alloc(
uint8_t, sizeof(FX_STATICSTORECHUNK) + size);
- if (pChunk == NULL) {
- return NULL;
- }
pChunk->iChunkSize = size;
pChunk->iFreeSize = size;
pChunk->pNextChunk = NULL;
diff --git a/xfa/src/fgas/src/crt/fx_stream.cpp b/xfa/src/fgas/src/crt/fx_stream.cpp
index 11ce71f9a3..57bf13fa29 100644
--- a/xfa/src/fgas/src/crt/fx_stream.cpp
+++ b/xfa/src/fgas/src/crt/fx_stream.cpp
@@ -791,10 +791,10 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr,
iBytes = FX_MIN(iBytes, m_pStreamImp->GetLength() - pos);
if (iBytes > 0) {
if (m_pBuf == NULL) {
- m_pBuf = (uint8_t*)FX_Alloc(uint8_t, iBytes);
+ m_pBuf = FX_Alloc(uint8_t, iBytes);
m_iBufSize = iBytes;
} else if (iBytes > m_iBufSize) {
- m_pBuf = (uint8_t*)FX_Realloc(uint8_t, m_pBuf, iBytes);
+ m_pBuf = FX_Realloc(uint8_t, m_pBuf, iBytes);
m_iBufSize = iBytes;
}
m_pStreamImp->Lock();
diff --git a/xfa/src/fgas/src/crt/fx_utils.cpp b/xfa/src/fgas/src/crt/fx_utils.cpp
index 8389452c81..4d27e5bf19 100644
--- a/xfa/src/fgas/src/crt/fx_utils.cpp
+++ b/xfa/src/fgas/src/crt/fx_utils.cpp
@@ -49,13 +49,12 @@ uint8_t* CFX_BaseArray::AddSpaceTo(int32_t index) {
int32_t iGrowSize = m_pData->iGrowSize;
iTotalCount = (index / iGrowSize + 1) * iGrowSize;
int32_t iNewSize = iTotalCount * iBlockSize;
- if (pBuffer == NULL) {
+ if (!pBuffer) {
pBuffer = FX_Alloc(uint8_t, iNewSize);
} else {
pBuffer = FX_Realloc(uint8_t, pBuffer, iNewSize);
}
}
- FXSYS_assert(pBuffer != NULL);
int32_t& iBlockCount = m_pData->iBlockCount;
if (index >= iBlockCount) {
iBlockCount = index + 1;
@@ -161,7 +160,7 @@ uint8_t* CFX_BaseMassArrayImp::AddSpaceTo(int32_t index) {
pChunk = (uint8_t*)m_pData->GetAt(index / m_iChunkSize);
break;
} else {
- pChunk = (uint8_t*)FX_Alloc(uint8_t, iMemSize);
+ pChunk = FX_Alloc(uint8_t, iMemSize);
if (m_iChunkCount < m_pData->GetSize()) {
m_pData->SetAt(m_iChunkCount, pChunk);
} else {
@@ -354,10 +353,9 @@ uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) {
if (iChunk < iChunkCount) {
pChunk = (uint8_t*)pData->ChunkBuffer.GetAt(iChunk);
}
- if (pChunk == NULL) {
- int32_t iMemSize = iChunkSize * pData->iBlockSize;
- pChunk = (uint8_t*)FX_Alloc(uint8_t, iMemSize);
- FXSYS_memset(pChunk, 0, iMemSize);
+ if (!pChunk) {
+ pChunk = FX_Alloc2D(uint8_t, iChunkSize, pData->iBlockSize);
+ FXSYS_memset(pChunk, 0, iChunkSize * pData->iBlockSize);
pData->ChunkBuffer.SetAtGrow(iChunk, pChunk);
if (iChunkCount <= iChunk) {
iChunkCount = iChunk + 1;