summaryrefslogtreecommitdiff
path: root/xfa/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-17 10:37:41 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-17 10:37:41 -0800
commit1871821653de9f4b1706d726f4d318cf739e55af (patch)
tree20e58a8f34ced5656e4a8d26d813737b2810e9f8 /xfa/src
parentfc75136232f1979217d7597b2c9c5966436eb1e1 (diff)
downloadpdfium-1871821653de9f4b1706d726f4d318cf739e55af.tar.xz
Remove FDE_Alloc in favor of FX_Alloc.
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1521163002 .
Diffstat (limited to 'xfa/src')
-rw-r--r--xfa/src/fdp/include/fde_mem.h16
-rw-r--r--xfa/src/fdp/src/css/fde_csssyntax.cpp19
-rw-r--r--xfa/src/fdp/src/fde/fde_gdidevice.cpp8
-rw-r--r--xfa/src/fdp/src/fde/fde_gedevice.cpp7
-rw-r--r--xfa/src/fdp/src/fde/fde_render.cpp21
-rw-r--r--xfa/src/fdp/src/tto/fde_textout.cpp41
-rw-r--r--xfa/src/fdp/src/xml/fde_xml.cpp63
-rw-r--r--xfa/src/fee/src/fee/fde_txtedtengine.cpp5
-rw-r--r--xfa/src/fee/src/fee/fde_txtedtpage.cpp9
-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
-rw-r--r--xfa/src/fgas/src/font/fx_gdifont.cpp23
-rw-r--r--xfa/src/fgas/src/font/fx_stdfontmgr.cpp13
-rw-r--r--xfa/src/fgas/src/xml/fx_sax_imp.cpp7
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp3
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp3
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp3
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp3
-rw-r--r--xfa/src/fxfa/src/app/xfa_checksum.cpp1
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffdoc.cpp5
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidget.cpp14
-rw-r--r--xfa/src/fxfa/src/app/xfa_textlayout.cpp16
-rw-r--r--xfa/src/fxfa/src/app/xfa_textlayout.h6
-rw-r--r--xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp10
-rw-r--r--xfa/src/fxjse/src/value.cpp3
26 files changed, 107 insertions, 211 deletions
diff --git a/xfa/src/fdp/include/fde_mem.h b/xfa/src/fdp/include/fde_mem.h
index d16bb53d26..c05ab8e85b 100644
--- a/xfa/src/fdp/include/fde_mem.h
+++ b/xfa/src/fdp/include/fde_mem.h
@@ -4,20 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _FDE_MEM
-#define _FDE_MEM
+#ifndef FDE_MEM_H_
+#define FDE_MEM_H_
#include "../../../../core/include/fxcrt/fx_memory.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define FDE_Alloc(size) FX_Alloc(uint8_t, size)
-#define FDE_Realloc(ptr, newSize) FX_Realloc(uint8_t, ptr, newSize)
-#define FDE_Free(ptr) FX_Free(ptr)
-#ifdef __cplusplus
-}
#define FDE_NewWith FXTARGET_NewWith
#define FDE_DeleteWith FXTARGET_DeleteWith
-#endif
-#endif
+
+#endif // FDE_MEM_H_
diff --git a/xfa/src/fdp/src/css/fde_csssyntax.cpp b/xfa/src/fdp/src/css/fde_csssyntax.cpp
index dea453ff03..7d540bb623 100644
--- a/xfa/src/fdp/src/css/fde_csssyntax.cpp
+++ b/xfa/src/fdp/src/css/fde_csssyntax.cpp
@@ -415,8 +415,8 @@ CFDE_CSSTextBuf::~CFDE_CSSTextBuf() {
Reset();
}
void CFDE_CSSTextBuf::Reset() {
- if (!m_bExtBuf && m_pBuffer != NULL) {
- FDE_Free(m_pBuffer);
+ if (!m_bExtBuf) {
+ FX_Free(m_pBuffer);
m_pBuffer = NULL;
}
m_iDatPos = m_iDatLen = m_iBufLen;
@@ -455,21 +455,20 @@ int32_t CFDE_CSSTextBuf::LoadFromStream(IFX_Stream* pTxtStream,
FX_BOOL CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) {
if (m_bExtBuf) {
return FALSE;
- } else if (m_pBuffer == NULL) {
- m_pBuffer = (FX_WCHAR*)FDE_Alloc(iDesiredSize * sizeof(FX_WCHAR));
+ }
+ if (!m_pBuffer) {
+ m_pBuffer = FX_Alloc(FX_WCHAR, iDesiredSize);
} else if (m_iBufLen != iDesiredSize) {
- m_pBuffer =
- (FX_WCHAR*)FDE_Realloc(m_pBuffer, iDesiredSize * sizeof(FX_WCHAR));
+ m_pBuffer = FX_Realloc(FX_WCHAR, m_pBuffer, iDesiredSize);
} else {
return TRUE;
}
- if (m_pBuffer == NULL) {
+ if (!m_pBuffer) {
m_iBufLen = 0;
return FALSE;
- } else {
- m_iBufLen = iDesiredSize;
- return TRUE;
}
+ m_iBufLen = iDesiredSize;
+ return TRUE;
}
void CFDE_CSSTextBuf::Subtract(int32_t iStart, int32_t iLength) {
FXSYS_assert(iStart >= 0 && iLength > 0);
diff --git a/xfa/src/fdp/src/fde/fde_gdidevice.cpp b/xfa/src/fdp/src/fde/fde_gdidevice.cpp
index 10a50868e3..0035f6b866 100644
--- a/xfa/src/fdp/src/fde/fde_gdidevice.cpp
+++ b/xfa/src/fdp/src/fde/fde_gdidevice.cpp
@@ -42,9 +42,7 @@ CFDE_GdiDevice::CFDE_GdiDevice(CFX_DIBitmap* pBitmap)
CFDE_GdiDevice::~CFDE_GdiDevice() {
delete m_pGraphics;
delete m_pBitmap;
- if (m_pGlyphBuf) {
- FDE_Free(m_pGlyphBuf);
- }
+ FX_Free(m_pGlyphBuf);
}
int32_t CFDE_GdiDevice::GetWidth() const {
return m_pBitmap->GetWidth();
@@ -193,10 +191,10 @@ FX_BOOL CFDE_GdiDevice::DrawString(IFDE_Brush* pBrush,
&mat2, gm, NULL, 0);
if (dwSize > 0) {
if (m_pGlyphBuf == NULL) {
- m_pGlyphBuf = FDE_Alloc(dwSize);
+ m_pGlyphBuf = FX_Alloc(uint8_t, dwSize);
m_dwGlyphLen = dwSize;
} else if (m_dwGlyphLen < dwSize) {
- m_pGlyphBuf = FDE_Realloc(m_pGlyphBuf, dwSize);
+ m_pGlyphBuf = FX_Realloc(uint8_t, m_pGlyphBuf, dwSize);
m_dwGlyphLen = dwSize;
}
pGdiFont->GetGlyphDIBits(pCharPos->m_GlyphIndex, argb, &mat2, gm,
diff --git a/xfa/src/fdp/src/fde/fde_gedevice.cpp b/xfa/src/fdp/src/fde/fde_gedevice.cpp
index 23da752e3b..8eb325ee02 100644
--- a/xfa/src/fdp/src/fde/fde_gedevice.cpp
+++ b/xfa/src/fdp/src/fde/fde_gedevice.cpp
@@ -49,12 +49,9 @@ CFDE_FxgeDevice::CFDE_FxgeDevice(CFX_RenderDevice* pDevice,
(FX_FLOAT)rt.Height());
}
CFDE_FxgeDevice::~CFDE_FxgeDevice() {
- if (m_pCharPos != NULL) {
- FDE_Free(m_pCharPos);
- }
- if (m_bOwnerDevice && m_pDevice) {
+ FX_Free(m_pCharPos);
+ if (m_bOwnerDevice)
delete m_pDevice;
- }
}
int32_t CFDE_FxgeDevice::GetWidth() const {
return m_pDevice->GetWidth();
diff --git a/xfa/src/fdp/src/fde/fde_render.cpp b/xfa/src/fdp/src/fde/fde_render.cpp
index af5b0e848d..f47c9fef76 100644
--- a/xfa/src/fdp/src/fde/fde_render.cpp
+++ b/xfa/src/fdp/src/fde/fde_render.cpp
@@ -158,20 +158,18 @@ FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) {
void CFDE_RenderContext::StopRender() {
Lock();
m_eStatus = FDE_RENDERSTATUS_Reset;
- m_pRenderDevice = NULL;
+ m_pRenderDevice = nullptr;
m_Transform.SetIdentity();
- if (m_pIterator != NULL) {
+ if (m_pIterator) {
m_pIterator->Release();
- m_pIterator = NULL;
+ m_pIterator = nullptr;
}
- if (m_pSolidBrush != NULL) {
+ if (m_pSolidBrush) {
m_pSolidBrush->Release();
- m_pSolidBrush = NULL;
- }
- if (m_pCharPos != NULL) {
- FDE_Free(m_pCharPos);
- m_pCharPos = NULL;
+ m_pSolidBrush = nullptr;
}
+ FX_Free(m_pCharPos);
+ m_pCharPos = nullptr;
m_iCharPosCount = 0;
Unlock();
}
@@ -194,10 +192,9 @@ void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet,
}
}
if (m_pCharPos == NULL) {
- m_pCharPos = (FXTEXT_CHARPOS*)FDE_Alloc(sizeof(FXTEXT_CHARPOS) * iCount);
+ m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, iCount);
} else if (m_iCharPosCount < iCount) {
- m_pCharPos = (FXTEXT_CHARPOS*)FDE_Realloc(m_pCharPos,
- sizeof(FXTEXT_CHARPOS) * iCount);
+ m_pCharPos = FX_Realloc(FXTEXT_CHARPOS, m_pCharPos, iCount);
}
if (m_iCharPosCount < iCount) {
m_iCharPosCount = iCount;
diff --git a/xfa/src/fdp/src/tto/fde_textout.cpp b/xfa/src/fdp/src/tto/fde_textout.cpp
index a1ef69ac42..9781c7f943 100644
--- a/xfa/src/fdp/src/tto/fde_textout.cpp
+++ b/xfa/src/fdp/src/tto/fde_textout.cpp
@@ -41,25 +41,19 @@ CFDE_TextOut::CFDE_TextOut()
m_rtLogicClip.Reset();
}
CFDE_TextOut::~CFDE_TextOut() {
- if (m_pTxtBreak != NULL) {
+ if (m_pTxtBreak) {
m_pTxtBreak->Release();
}
- if (m_pCharWidths != NULL) {
- FDE_Free(m_pCharWidths);
- }
- if (m_pEllCharWidths != NULL) {
- FDE_Free(m_pEllCharWidths);
- }
- if (m_pRenderDevice != NULL) {
+ FX_Free(m_pCharWidths);
+ FX_Free(m_pEllCharWidths);
+ if (m_pRenderDevice) {
m_pRenderDevice->Release();
}
- if (m_pCharPos != NULL) {
- FDE_Free(m_pCharPos);
- }
+ FX_Free(m_pCharPos);
m_ttoLines.RemoveAll();
}
void CFDE_TextOut::SetFont(IFX_Font* pFont) {
- FXSYS_assert(pFont != NULL);
+ FXSYS_assert(pFont);
m_pFont = pFont;
m_pTxtBreak->SetFont(pFont);
}
@@ -415,34 +409,31 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
void CFDE_TextOut::ExpandBuffer(int32_t iSize, int32_t iType) {
switch (iType) {
case 0:
- if (m_pCharWidths == NULL) {
- m_pCharWidths = (int32_t*)FDE_Alloc(iSize * sizeof(int32_t));
+ if (!m_pCharWidths) {
+ m_pCharWidths = FX_Alloc(int32_t, iSize);
m_iChars = iSize;
} else if (m_iChars < iSize) {
- m_pCharWidths =
- (int32_t*)FDE_Realloc(m_pCharWidths, iSize * sizeof(int32_t));
+ m_pCharWidths = FX_Realloc(int32_t, m_pCharWidths, iSize);
m_iChars = iSize;
}
- FXSYS_memset(m_pCharWidths, 0, iSize);
+ FXSYS_memset(m_pCharWidths, 0, iSize * sizeof(int32_t));
break;
case 1:
- if (m_pEllCharWidths == NULL) {
- m_pEllCharWidths = (int32_t*)FDE_Alloc(iSize * sizeof(int32_t));
+ if (!m_pEllCharWidths) {
+ m_pEllCharWidths = FX_Alloc(int32_t, iSize);
m_iEllChars = iSize;
} else if (m_iEllChars < iSize) {
- m_pEllCharWidths =
- (int32_t*)FDE_Realloc(m_pEllCharWidths, iSize * sizeof(int32_t));
+ m_pEllCharWidths = FX_Realloc(int32_t, m_pEllCharWidths, iSize);
m_iEllChars = iSize;
}
- FXSYS_memset(m_pEllCharWidths, 0, iSize);
+ FXSYS_memset(m_pEllCharWidths, 0, iSize * sizeof(int32_t));
break;
case 2:
if (m_pCharPos == NULL) {
- m_pCharPos = (FXTEXT_CHARPOS*)FDE_Alloc(iSize * sizeof(FXTEXT_CHARPOS));
+ m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, iSize);
m_iCharPosSize = iSize;
} else if (m_iCharPosSize < iSize) {
- m_pCharPos = (FXTEXT_CHARPOS*)FDE_Realloc(
- m_pCharPos, iSize * sizeof(FXTEXT_CHARPOS));
+ m_pCharPos = FX_Realloc(FXTEXT_CHARPOS, m_pCharPos, iSize);
m_iCharPosSize = iSize;
}
break;
diff --git a/xfa/src/fdp/src/xml/fde_xml.cpp b/xfa/src/fdp/src/xml/fde_xml.cpp
index 66a4eeb2b8..00a3bf24eb 100644
--- a/xfa/src/fdp/src/xml/fde_xml.cpp
+++ b/xfa/src/fdp/src/xml/fde_xml.cpp
@@ -1325,39 +1325,24 @@ CFDE_BlockBuffer::~CFDE_BlockBuffer() {
}
FX_WCHAR* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) {
iIndexInBlock = 0;
- int32_t iBlockNum = m_BlockArray.GetSize();
- if (iBlockNum == 0) {
- return NULL;
+ if (!m_BlockArray.GetSize()) {
+ return nullptr;
}
int32_t iRealIndex = m_iStartPosition + m_iDataLength;
- FX_WCHAR* pDataBlock = NULL;
if (iRealIndex == m_iBufferSize) {
- FX_WCHAR* pBlock = (FX_WCHAR*)FDE_Alloc(m_iAllocStep * sizeof(FX_WCHAR));
- if (pBlock) {
- m_BlockArray.Add(pBlock);
- m_iBufferSize += m_iAllocStep;
- }
- iIndexInBlock = 0;
- pDataBlock = pBlock;
- } else {
- int32_t iBlockIndex = iRealIndex / m_iAllocStep;
- int32_t iInnerIndex = iRealIndex % m_iAllocStep;
- iIndexInBlock = iInnerIndex;
- pDataBlock = (FX_WCHAR*)m_BlockArray[iBlockIndex];
+ FX_WCHAR* pBlock = FX_Alloc(FX_WCHAR, m_iAllocStep);
+ m_BlockArray.Add(pBlock);
+ m_iBufferSize += m_iAllocStep;
+ return pBlock;
}
- return pDataBlock;
+ iIndexInBlock = iRealIndex % m_iAllocStep;
+ return (FX_WCHAR*)m_BlockArray[iRealIndex / m_iAllocStep];
}
FX_BOOL CFDE_BlockBuffer::InitBuffer(int32_t iBufferSize) {
ClearBuffer();
int32_t iNumOfBlock = (iBufferSize - 1) / m_iAllocStep + 1;
for (int32_t i = 0; i < iNumOfBlock; i++) {
- FX_WCHAR* pBlockBuffer =
- (FX_WCHAR*)FDE_Alloc(m_iAllocStep * sizeof(FX_WCHAR));
- if (pBlockBuffer == NULL) {
- ClearBuffer();
- return FALSE;
- }
- m_BlockArray.Add(pBlockBuffer);
+ m_BlockArray.Add(FX_Alloc(FX_WCHAR, m_iAllocStep));
}
m_iBufferSize = iNumOfBlock * m_iAllocStep;
return TRUE;
@@ -1373,10 +1358,7 @@ void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) {
if (iBlockIndex >= iBlockSize) {
int32_t iNewBlocks = iBlockIndex - iBlockSize + 1;
do {
- FX_WCHAR* pBlock = (FX_WCHAR*)FDE_Alloc(m_iAllocStep * sizeof(FX_WCHAR));
- if (!pBlock) {
- return;
- }
+ FX_WCHAR* pBlock = FX_Alloc(FX_WCHAR, m_iAllocStep);
m_BlockArray.Add(pBlock);
m_iBufferSize += m_iAllocStep;
} while (--iNewBlocks);
@@ -1457,7 +1439,7 @@ void CFDE_BlockBuffer::ClearBuffer() {
m_iBufferSize = 0;
int32_t iSize = m_BlockArray.GetSize();
for (int32_t i = 0; i < iSize; i++) {
- FDE_Free(m_BlockArray[i]);
+ FX_Free(m_BlockArray[i]);
m_BlockArray[i] = NULL;
}
m_BlockArray.RemoveAll();
@@ -1506,7 +1488,7 @@ void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream,
uint8_t bom[4];
m_iCurrentPos = m_pStream->GetBOM(bom);
FXSYS_assert(m_pBuffer == NULL);
- m_pBuffer = (FX_WCHAR*)FDE_Alloc(m_iXMLPlaneSize * sizeof(FX_WCHAR));
+ m_pBuffer = FX_Alloc(FX_WCHAR, m_iXMLPlaneSize);
m_pStart = m_pEnd = m_pBuffer;
FXSYS_assert(!m_BlockBuffer.IsInitialized());
m_BlockBuffer.InitBuffer();
@@ -1519,8 +1501,7 @@ FX_DWORD CFDE_XMLSyntaxParser::DoSyntaxParse() {
m_dwStatus == FDE_XMLSYNTAXSTATUS_EOS) {
return m_dwStatus;
}
- FXSYS_assert(m_pStream != NULL && m_pBuffer != NULL &&
- m_BlockBuffer.IsInitialized());
+ FXSYS_assert(m_pStream && m_pBuffer && m_BlockBuffer.IsInitialized());
int32_t iStreamLength = m_pStream->GetLength();
int32_t iPos;
FX_WCHAR ch;
@@ -2026,11 +2007,12 @@ void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream,
uint8_t bom[4];
m_iCurrentPos = m_pStream->GetBOM(bom);
FXSYS_assert(m_pBuffer == NULL);
- m_pBuffer = (FX_WCHAR*)FDE_Alloc(m_iXMLPlaneSize * sizeof(FX_WCHAR));
+ m_pBuffer = FX_Alloc(FX_WCHAR, m_iXMLPlaneSize);
m_pStart = m_pEnd = m_pBuffer;
FXSYS_assert(m_pwsTextData == NULL);
- m_pwsTextData = (FX_WCHAR*)FDE_Alloc(m_iTextDataSize * sizeof(FX_WCHAR));
- m_iParsedBytes = m_iParsedChars = 0;
+ m_pwsTextData = FX_Alloc(FX_WCHAR, m_iTextDataSize);
+ m_iParsedBytes = 0;
+ m_iParsedChars = 0;
m_iBufferChars = 0;
}
FX_DWORD CFDE_XMLSyntaxParser::DoSyntaxParse() {
@@ -2449,13 +2431,9 @@ CFDE_XMLSyntaxParser::~CFDE_XMLSyntaxParser() {
m_pCurrentBlock = NULL;
}
#else
- if (m_pwsTextData != NULL) {
- FDE_Free(m_pwsTextData);
- }
+ FX_Free(m_pwsTextData);
#endif
- if (m_pBuffer != NULL) {
- FDE_Free(m_pBuffer);
- }
+ FX_Free(m_pBuffer);
}
int32_t CFDE_XMLSyntaxParser::GetStatus() const {
if (m_pStream == NULL) {
@@ -2648,8 +2626,7 @@ void CFDE_XMLSyntaxParser::ReallocTextDataBuffer() {
} else {
m_iTextDataSize += 1024 * 1024;
}
- m_pwsTextData =
- (FX_WCHAR*)FDE_Realloc(m_pwsTextData, m_iTextDataSize * sizeof(FX_WCHAR));
+ m_pwsTextData = FX_Realloc(FX_WCHAR, m_pwsTextData, m_iTextDataSize);
}
void CFDE_XMLSyntaxParser::GetData(CFX_WideString& wsData) const {
FX_WCHAR* pBuf = wsData.GetBuffer(m_iTextDataLength);
diff --git a/xfa/src/fee/src/fee/fde_txtedtengine.cpp b/xfa/src/fee/src/fee/fde_txtedtengine.cpp
index 2eb3f1ae4f..6cf8f0e872 100644
--- a/xfa/src/fee/src/fee/fde_txtedtengine.cpp
+++ b/xfa/src/fee/src/fee/fde_txtedtengine.cpp
@@ -124,8 +124,7 @@ void CFDE_TxtEdtEngine::SetTextByStream(IFX_Stream* pStream) {
int32_t nPos = pStream->GetBOM(bom);
pStream->Seek(FX_STREAMSEEK_Begin, nPos);
int32_t nPlateSize = FX_MIN(nStreamLength, m_pTxtBuf->GetChunkSize());
- FX_WCHAR* lpwstr = (FX_WCHAR*)FDE_Alloc(nPlateSize * sizeof(FX_WCHAR));
- FXSYS_assert(lpwstr);
+ FX_WCHAR* lpwstr = FX_Alloc(FX_WCHAR, nPlateSize);
FX_BOOL bEos = false;
while (!bEos) {
int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, bEos);
@@ -133,7 +132,7 @@ void CFDE_TxtEdtEngine::SetTextByStream(IFX_Stream* pStream) {
m_pTxtBuf->Insert(nIndex, lpwstr, nRead);
nIndex += nRead;
}
- FDE_Free(lpwstr);
+ FX_Free(lpwstr);
}
}
m_pTxtBuf->Insert(nIndex, &m_wLineEnd, 1);
diff --git a/xfa/src/fee/src/fee/fde_txtedtpage.cpp b/xfa/src/fee/src/fee/fde_txtedtpage.cpp
index 8c9b7439f1..ec715b9070 100644
--- a/xfa/src/fee/src/fee/fde_txtedtpage.cpp
+++ b/xfa/src/fee/src/fee/fde_txtedtpage.cpp
@@ -287,7 +287,7 @@ int32_t CFDE_TxtEdtPage::GetCharCount() const {
int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip,
FXTEXT_CHARPOS*& pCharPos,
FX_LPRECTF pBBox) const {
- pCharPos = (FXTEXT_CHARPOS*)FDE_Alloc(sizeof(FXTEXT_CHARPOS) * m_nCharCount);
+ pCharPos = FX_Alloc(FXTEXT_CHARPOS, m_nCharCount);
int32_t nCharPosCount = 0;
FDE_HVISUALOBJ hVisualObj = NULL;
int32_t nVisualObjCount = m_PieceMassArr.GetSize();
@@ -304,10 +304,9 @@ int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip,
pos += nCount;
}
if ((nCharPosCount * 5) < (m_nCharCount << 2)) {
- int32_t nLength = sizeof(FXTEXT_CHARPOS) * nCharPosCount;
- FXTEXT_CHARPOS* pTemp = (FXTEXT_CHARPOS*)FDE_Alloc(nLength);
- FXSYS_memcpy(pTemp, pCharPos, nLength);
- FDE_Free(pCharPos);
+ FXTEXT_CHARPOS* pTemp = FX_Alloc(FXTEXT_CHARPOS, nCharPosCount);
+ FXSYS_memcpy(pTemp, pCharPos, sizeof(FXTEXT_CHARPOS) * nCharPosCount);
+ FX_Free(pCharPos);
pCharPos = pTemp;
}
return nCharPosCount;
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;
diff --git a/xfa/src/fgas/src/font/fx_gdifont.cpp b/xfa/src/fgas/src/font/fx_gdifont.cpp
index fe02a049ad..6840c5bddf 100644
--- a/xfa/src/fgas/src/font/fx_gdifont.cpp
+++ b/xfa/src/fgas/src/font/fx_gdifont.cpp
@@ -19,8 +19,8 @@ CFX_GdiFontCache::~CFX_GdiFontCache() {
pGlyph = NULL;
m_GlyphMap.GetNextAssoc(pos, (void*&)iGlyph, (void*&)pGlyph);
if (pGlyph != NULL) {
- FDE_Free(pGlyph->pOutline);
- FDE_Free(pGlyph);
+ FX_Free(pGlyph->pOutline);
+ FX_Free(pGlyph);
}
}
m_GlyphMap.RemoveAll();
@@ -29,7 +29,7 @@ void CFX_GdiFontCache::SetCachedGlyphOutline(FX_DWORD dwGlyph,
const GLYPHMETRICS& gm,
uint8_t* pOutline) {
FXSYS_assert(pOutline != NULL);
- FX_LPGDIGOCACHE pGlyph = (FX_LPGDIGOCACHE)FDE_Alloc(sizeof(FX_GDIGOCACHE));
+ FX_LPGDIGOCACHE pGlyph = FX_Alloc(FX_GDIGOCACHE, 1);
pGlyph->gm = gm;
pGlyph->pOutline = pOutline;
m_GlyphMap.SetAt((void*)dwGlyph, (void*)pGlyph);
@@ -250,13 +250,10 @@ FX_BOOL CFX_GdiFont::LoadFont(IFX_Stream* pFontStream) {
if (iLength < 1) {
return FALSE;
}
- uint8_t* pBuf = (uint8_t*)FDE_Alloc(iLength);
- if (pBuf == NULL) {
- return FALSE;
- }
+ uint8_t* pBuf = FX_Alloc(uint8_t, iLength);
iLength = pFontStream->ReadData(pBuf, iLength);
FX_BOOL bRet = LoadFont(pBuf, iLength);
- FDE_Free(pBuf);
+ FX_Free(pBuf);
return bRet;
}
FX_BOOL CFX_GdiFont::LoadFont(const LOGFONTW& lf) {
@@ -275,11 +272,7 @@ int32_t CFX_GdiFont::GetFontFamilies(Gdiplus::FontCollection& fc) {
if (iCount < 1) {
return iCount;
}
- Gdiplus::FontFamily* pFontFamilies =
- (Gdiplus::FontFamily*)FDE_Alloc(iCount * sizeof(Gdiplus::FontFamily));
- if (pFontFamilies == NULL) {
- return -1;
- }
+ Gdiplus::FontFamily* pFontFamilies = FX_Alloc(Gdiplus::FontFamily, iCount);
int32_t iFind = 0;
fc.GetFamilies(iCount, pFontFamilies, &iFind);
for (int32_t i = 0; i < iCount; i++) {
@@ -289,7 +282,7 @@ int32_t CFX_GdiFont::GetFontFamilies(Gdiplus::FontCollection& fc) {
wsFamilyName.ReleaseBuffer();
m_FontFamilies.Add(wsFamilyName);
}
- FDE_Free(pFontFamilies);
+ FX_Free(pFontFamilies);
return iCount;
}
void CFX_GdiFont::RetrieveFontStyles() {
@@ -487,7 +480,7 @@ FX_DWORD CFX_GdiFont::GetGlyphDIBits(int32_t iGlyphIndex,
if (dwGlyphSize == 0 || dwGlyphSize == GDI_ERROR) {
return 0;
}
- pGlyphOutline = (uint8_t*)FX_Alloc(dwGlyphSize);
+ pGlyphOutline = FX_Alloc(uint8_t, dwGlyphSize);
::GetGlyphOutlineW(m_hDC, iGlyphIndex, uFormat, &gm, dwGlyphSize,
pGlyphOutline, pMatrix);
if (pCache == NULL) {
diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
index 885e7557c1..807213394b 100644
--- a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
+++ b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
@@ -465,9 +465,6 @@ static int32_t CALLBACK FX_GdiFontEnumProc(ENUMLOGFONTEX* lpelfe,
return 1;
}
FX_LPFONTDESCRIPTOR pFont = FX_Alloc(FX_FONTDESCRIPTOR, 1);
- if (NULL == pFont) {
- return 0;
- }
FXSYS_memset(pFont, 0, sizeof(FX_FONTDESCRIPTOR));
pFont->uCharSet = lf.lfCharSet;
pFont->dwFontStyles = FX_GetGdiFontStyles(lf);
@@ -1265,12 +1262,10 @@ void CFX_FontMgrImp::ReportFace(FXFT_Face pFace,
unsigned int error = FXFT_Load_Sfnt_Table(pFace, dwTag, 0, NULL, &nLength);
if (0 == error && 0 != nLength) {
pTable = FX_Alloc(uint8_t, nLength);
- if (NULL != pTable) {
- error = FXFT_Load_Sfnt_Table(pFace, dwTag, 0, pTable, NULL);
- if (0 != error) {
- FX_Free(pTable);
- pTable = NULL;
- }
+ error = FXFT_Load_Sfnt_Table(pFace, dwTag, 0, pTable, NULL);
+ if (0 != error) {
+ FX_Free(pTable);
+ pTable = NULL;
}
}
GetNames(pTable, pFont->m_wsFamilyNames);
diff --git a/xfa/src/fgas/src/xml/fx_sax_imp.cpp b/xfa/src/fgas/src/xml/fx_sax_imp.cpp
index 6a4ad34b8c..6ffa206f35 100644
--- a/xfa/src/fgas/src/xml/fx_sax_imp.cpp
+++ b/xfa/src/fgas/src/xml/fx_sax_imp.cpp
@@ -33,9 +33,6 @@ FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile,
}
m_dwBufSize = FX_MIN(dwLen, FX_SAXFILE_BUFSIZE);
m_pBuf = FX_Alloc(uint8_t, m_dwBufSize);
- if (!m_pBuf) {
- return FALSE;
- }
if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) {
return FALSE;
}
@@ -77,8 +74,8 @@ CFX_SAXReader::CFX_SAXReader()
m_iNameSize(256),
m_dwParseMode(0),
m_pCommentContext(nullptr) {
- m_pszData = (uint8_t*)FX_Alloc(uint8_t, m_iDataSize);
- m_pszName = (uint8_t*)FX_Alloc(uint8_t, m_iNameSize);
+ m_pszData = FX_Alloc(uint8_t, m_iDataSize);
+ m_pszName = FX_Alloc(uint8_t, m_iNameSize);
}
CFX_SAXReader::~CFX_SAXReader() {
Reset();
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
index e456d3e546..1a6afa7e1e 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -243,9 +243,6 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
CFX_ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
- if (!pCharPos) {
- return;
- }
FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
FX_FLOAT charsLen = 0;
FX_FLOAT geWidth = 0;
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index e66df05445..0e38ab283b 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -169,9 +169,6 @@ void CBC_OnedEAN13Writer::ShowChars(const CFX_WideStringC& contents,
CFX_ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
- if (!pCharPos) {
- return;
- }
FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
CFX_FxgeDevice geBitmap;
if (pOutBitmap != NULL) {
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 78503fae61..fcf781fd60 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -173,9 +173,6 @@ void CBC_OnedEAN8Writer::ShowChars(const CFX_WideStringC& contents,
CFX_ByteString str = FX_UTF8Encode(contents);
int32_t iLength = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLength);
- if (!pCharPos) {
- return;
- }
FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLength);
CFX_ByteString tempStr = str.Mid(0, 4);
int32_t iLen = tempStr.GetLength();
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index d1b98993e7..b3f9dc3f86 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -125,9 +125,6 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
CFX_ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
- if (!pCharPos) {
- return;
- }
FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
CFX_ByteString tempStr = str.Mid(1, 5);
FX_FLOAT strWidth = (FX_FLOAT)35 * multiple;
diff --git a/xfa/src/fxfa/src/app/xfa_checksum.cpp b/xfa/src/fxfa/src/app/xfa_checksum.cpp
index a70db6cba0..311c84111f 100644
--- a/xfa/src/fxfa/src/app/xfa_checksum.cpp
+++ b/xfa/src/fxfa/src/app/xfa_checksum.cpp
@@ -133,7 +133,6 @@ CXFA_ChecksumContext::~CXFA_ChecksumContext() {
FX_BOOL CXFA_ChecksumContext::StartChecksum() {
FinishChecksum();
m_pByteContext = FX_Alloc(uint8_t, 128);
- FXSYS_assert(m_pByteContext != NULL);
CRYPT_SHA1Start(m_pByteContext);
m_bsChecksum.Empty();
m_pSAXReader = FX_SAXReader_Create();
diff --git a/xfa/src/fxfa/src/app/xfa_ffdoc.cpp b/xfa/src/fxfa/src/app/xfa_ffdoc.cpp
index 0a4d592988..f53fe63f1a 100644
--- a/xfa/src/fxfa/src/app/xfa_ffdoc.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffdoc.cpp
@@ -76,10 +76,7 @@ FX_BOOL XFA_GetPDFContentsFromPDFXML(IFDE_XMLNode* pPDFElement,
pChunkElement->GetTextData(wsPDFContent);
iBufferSize = FX_Base64DecodeW(wsPDFContent, wsPDFContent.GetLength(), NULL);
pByteBuffer = FX_Alloc(uint8_t, iBufferSize + 1);
- if (!pByteBuffer) {
- return FALSE;
- }
- pByteBuffer[iBufferSize] = '0';
+ pByteBuffer[iBufferSize] = '0'; // FIXME: I bet this is wrong.
FX_Base64DecodeW(wsPDFContent, wsPDFContent.GetLength(), pByteBuffer);
return TRUE;
}
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
index a4015abe62..ed9bbb329b 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
@@ -841,7 +841,7 @@ static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) {
if (iLen == 0) {
iLen = FXSYS_strlen((FX_CHAR*)pStr);
}
- pCP = (uint8_t*)FDE_Alloc(iLen + 1);
+ pCP = FX_Alloc(uint8_t, iLen + 1);
for (; i < iLen; i++) {
if ((pStr[i] & 128) == 0) {
if (g_inv_base64[pStr[i]] != 0xFF || pStr[i] == '=') {
@@ -894,7 +894,7 @@ static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) {
j += 3;
}
}
- FDE_Free(pBuffer);
+ FX_Free(pBuffer);
return j;
}
static FX_CHAR g_base64_chars[] =
@@ -979,7 +979,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
if (iEncoding == XFA_ATTRIBUTEENUM_Base64) {
CFX_ByteString bsData = wsImage.UTF8Encode();
int32_t iLength = bsData.GetLength();
- pImageBuffer = FDE_Alloc(iLength);
+ pImageBuffer = FX_Alloc(uint8_t, iLength);
int32_t iRead = XFA_Base64Decode((const FX_CHAR*)bsData, pImageBuffer);
if (iRead > 0) {
pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead);
@@ -1003,17 +1003,13 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
pImageFileRead = pDoc->GetDocProvider()->OpenLinkedFile(pDoc, wsURL);
}
if (!pImageFileRead) {
- if (pImageBuffer) {
- FDE_Free(pImageBuffer);
- }
+ FX_Free(pImageBuffer);
return NULL;
}
bNameImage = FALSE;
CFX_DIBitmap* pBitmap =
XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi);
- if (pImageBuffer) {
- FDE_Free(pImageBuffer);
- }
+ FX_Free(pImageBuffer);
pImageFileRead->Release();
return pBitmap;
}
diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.cpp b/xfa/src/fxfa/src/app/xfa_textlayout.cpp
index 12e517de41..efdc116106 100644
--- a/xfa/src/fxfa/src/app/xfa_textlayout.cpp
+++ b/xfa/src/fxfa/src/app/xfa_textlayout.cpp
@@ -49,9 +49,9 @@ void CXFA_TextParseContext::SetDecls(const IFDE_CSSDeclaration** ppDeclArray,
return;
}
m_dwMatchedDecls = iDeclCount;
- int32_t iBytes = iDeclCount * sizeof(IFDE_CSSDeclaration*);
- m_ppMatchedDecls = (IFDE_CSSDeclaration**)FDE_Alloc(iBytes);
- FX_memcpy(m_ppMatchedDecls, ppDeclArray, iBytes);
+ m_ppMatchedDecls = FX_Alloc(IFDE_CSSDeclaration*, iDeclCount);
+ FX_memcpy(m_ppMatchedDecls, ppDeclArray,
+ iDeclCount * sizeof(IFDE_CSSDeclaration*));
}
CXFA_TextParser::~CXFA_TextParser() {
if (m_pUASheet != NULL) {
@@ -1270,10 +1270,8 @@ FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
XFA_LPCTEXTPIECE pPiece = pPieceLine->m_textPieces.GetAt(j);
int32_t iChars = pPiece->iChars;
if (iCharCount < iChars) {
- if (pCharPos != NULL) {
- FDE_Free(pCharPos);
- }
- pCharPos = (FXTEXT_CHARPOS*)FDE_Alloc(iChars * sizeof(FXTEXT_CHARPOS));
+ FX_Free(pCharPos);
+ pCharPos = FX_Alloc(FXTEXT_CHARPOS, iChars);
iCharCount = iChars;
}
FXSYS_memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS));
@@ -1284,9 +1282,7 @@ FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice,
}
}
pDevice->RestoreState(state);
- if (pCharPos != NULL) {
- FDE_Free(pCharPos);
- }
+ FX_Free(pCharPos);
pSolidBrush->Release();
pPen->Release();
pDevice->Release();
diff --git a/xfa/src/fxfa/src/app/xfa_textlayout.h b/xfa/src/fxfa/src/app/xfa_textlayout.h
index a42c27ede8..cbd315993c 100644
--- a/xfa/src/fxfa/src/app/xfa_textlayout.h
+++ b/xfa/src/fxfa/src/app/xfa_textlayout.h
@@ -49,11 +49,7 @@ class CXFA_TextParseContext : public CFX_Target {
m_ppMatchedDecls(nullptr),
m_dwMatchedDecls(0),
m_eDisplay(FDE_CSSDISPLAY_None) {}
- ~CXFA_TextParseContext() {
- if (m_ppMatchedDecls != NULL) {
- FDE_Free(m_ppMatchedDecls);
- }
- }
+ ~CXFA_TextParseContext() { FX_Free(m_ppMatchedDecls); }
void SetDisplay(FDE_CSSDISPLAY eDisplay) { m_eDisplay = eDisplay; }
FDE_CSSDISPLAY GetDisplay() const { return m_eDisplay; }
void SetDecls(const IFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount);
diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
index 3412aa258b..bf2aa0ccbe 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
@@ -5437,12 +5437,10 @@ void CXFA_FM2JSContext::Get(FXJSE_HOBJECT hThis,
if (pFile) {
int32_t size = pFile->GetSize();
uint8_t* pData = FX_Alloc(uint8_t, size);
- if (pData) {
- pFile->ReadBlock(pData, size);
- FXJSE_Value_SetUTF8String(args.GetReturnValue(),
- CFX_ByteStringC(pData, size));
- FX_Free(pData);
- }
+ pFile->ReadBlock(pData, size);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ CFX_ByteStringC(pData, size));
+ FX_Free(pData);
pFile->Release();
}
FXJSE_Value_Release(argOne);
diff --git a/xfa/src/fxjse/src/value.cpp b/xfa/src/fxjse/src/value.cpp
index 1ef7ceecb8..a6d01843e1 100644
--- a/xfa/src/fxjse/src/value.cpp
+++ b/xfa/src/fxjse/src/value.cpp
@@ -500,9 +500,6 @@ FX_BOOL CFXJSE_Value::Call(CFXJSE_Value* lpReceiver,
v8::Local<v8::Value>* lpLocalArgs = NULL;
if (nArgCount) {
lpLocalArgs = FX_Alloc(v8::Local<v8::Value>, nArgCount);
- if (!lpLocalArgs) {
- return FALSE;
- }
for (uint32_t i = 0; i < nArgCount; i++) {
new (lpLocalArgs + i) v8::Local<v8::Value>;
CFXJSE_Value* lpArg = (CFXJSE_Value*)lpArgs[i];