summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/fpdfdoc/doc_form.cpp2
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp2
-rw-r--r--core/src/fxcodec/codec/fx_codec_bmp.cpp6
-rw-r--r--core/src/fxcodec/codec/fx_codec_gif.cpp6
-rw-r--r--core/src/fxcodec/codec/fx_codec_png.cpp10
-rw-r--r--core/src/fxcodec/codec/fx_codec_progress.cpp131
-rw-r--r--core/src/fxcodec/codec/fx_codec_progress.h18
-rw-r--r--core/src/fxcodec/lbmp/fx_bmp.cpp26
-rw-r--r--core/src/fxcodec/lbmp/fx_bmp.h5
-rw-r--r--core/src/fxcodec/lgif/fx_gif.cpp185
-rw-r--r--core/src/fxcodec/lgif/fx_gif.h5
-rw-r--r--core/src/fxcrt/fx_basic_maps.cpp4
-rw-r--r--fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp17
-rw-r--r--fpdfsdk/src/formfiller/FFL_CheckBox.cpp2
-rw-r--r--fpdfsdk/src/formfiller/FFL_IFormFiller.cpp16
-rw-r--r--fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp8
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp98
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp22
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp7
19 files changed, 135 insertions, 435 deletions
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 9252e073e0..f40f447a68 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -393,7 +393,7 @@ static FX_BOOL RetrieveStockFont(int iFontObject,
uint8_t charSet,
LOGFONTA& lf) {
HFONT hFont = (HFONT)::GetStockObject(iFontObject);
- if (hFont != NULL) {
+ if (hFont) {
memset(&lf, 0, sizeof(LOGFONTA));
int iRet = ::GetObject(hFont, sizeof(LOGFONTA), &lf);
if (iRet > 0 && (lf.lfCharSet == charSet || charSet == 255)) {
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index e16d852ccb..a7eea11b02 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -13,7 +13,7 @@ const int nMaxRecursion = 32;
static FX_BOOL IsTagged(const CPDF_Document* pDoc) {
CPDF_Dictionary* pCatalog = pDoc->GetRoot();
CPDF_Dictionary* pMarkInfo = pCatalog->GetDictBy("MarkInfo");
- return pMarkInfo != NULL && pMarkInfo->GetIntegerBy("Marked");
+ return pMarkInfo && pMarkInfo->GetIntegerBy("Marked");
}
CPDF_StructTree* CPDF_StructTree::LoadPage(const CPDF_Document* pDoc,
const CPDF_Dictionary* pPageDict) {
diff --git a/core/src/fxcodec/codec/fx_codec_bmp.cpp b/core/src/fxcodec/codec/fx_codec_bmp.cpp
index 4e5fef0d1d..042392c0d1 100644
--- a/core/src/fxcodec/codec/fx_codec_bmp.cpp
+++ b/core/src/fxcodec/codec/fx_codec_bmp.cpp
@@ -21,9 +21,7 @@ static void* _bmp_alloc_func(unsigned int size) {
return FX_Alloc(char, size);
}
static void _bmp_free_func(void* p) {
- if (p != NULL) {
- FX_Free(p);
- }
+ FX_Free(p);
}
};
static void _bmp_error_data(bmp_decompress_struct_p bmp_ptr,
@@ -72,7 +70,7 @@ void* CCodec_BmpModule::Start(void* pModule) {
}
void CCodec_BmpModule::Finish(void* pContext) {
FXBMP_Context* p = (FXBMP_Context*)pContext;
- if (p != NULL) {
+ if (p) {
_bmp_destroy_decompress(&p->bmp_ptr);
p->m_FreeFunc(p);
}
diff --git a/core/src/fxcodec/codec/fx_codec_gif.cpp b/core/src/fxcodec/codec/fx_codec_gif.cpp
index 4c60a0392c..af0c32ea9d 100644
--- a/core/src/fxcodec/codec/fx_codec_gif.cpp
+++ b/core/src/fxcodec/codec/fx_codec_gif.cpp
@@ -21,9 +21,7 @@ static void* _gif_alloc_func(unsigned int size) {
return FX_Alloc(char, size);
}
static void _gif_free_func(void* p) {
- if (p != NULL) {
- FX_Free(p);
- }
+ FX_Free(p);
}
};
static void _gif_error_data(gif_decompress_struct_p gif_ptr,
@@ -98,7 +96,7 @@ void* CCodec_GifModule::Start(void* pModule) {
}
void CCodec_GifModule::Finish(void* pContext) {
FXGIF_Context* p = (FXGIF_Context*)pContext;
- if (p != NULL) {
+ if (p) {
_gif_destroy_decompress(&p->gif_ptr);
p->m_FreeFunc(p);
}
diff --git a/core/src/fxcodec/codec/fx_codec_png.cpp b/core/src/fxcodec/codec/fx_codec_png.cpp
index 0df3455522..c8cb1b8a6a 100644
--- a/core/src/fxcodec/codec/fx_codec_png.cpp
+++ b/core/src/fxcodec/codec/fx_codec_png.cpp
@@ -105,9 +105,7 @@ static void* _png_alloc_func(unsigned int size) {
return FX_Alloc(char, size);
}
static void _png_free_func(void* p) {
- if (p != NULL) {
- FX_Free(p);
- }
+ FX_Free(p);
}
};
static void _png_get_header_func(png_structp png_ptr, png_infop info_ptr) {
@@ -192,7 +190,7 @@ static void _png_get_row_func(png_structp png_ptr,
if (!pModule->AskScanlineBufCallback(p->child_ptr, row_num, src_buf)) {
png_error(png_ptr, "Ask Scanline buffer Callback Error");
}
- if (src_buf != NULL) {
+ if (src_buf) {
png_progressive_combine_row(png_ptr, src_buf, new_row);
}
pModule->FillScanlineBufCompletedCallback(p->child_ptr, pass, row_num);
@@ -220,7 +218,7 @@ void* CCodec_PngModule::Start(void* pModule) {
return NULL;
}
if (setjmp(png_jmpbuf(p->png_ptr))) {
- if (p != NULL) {
+ if (p) {
png_destroy_read_struct(&(p->png_ptr), &(p->info_ptr), (png_infopp)NULL);
FX_Free(p);
}
@@ -234,7 +232,7 @@ void* CCodec_PngModule::Start(void* pModule) {
}
void CCodec_PngModule::Finish(void* pContext) {
FXPNG_Context* p = (FXPNG_Context*)pContext;
- if (p != NULL) {
+ if (p) {
png_destroy_read_struct(&(p->png_ptr), &(p->info_ptr), (png_infopp)NULL);
p->m_FreeFunc(p);
}
diff --git a/core/src/fxcodec/codec/fx_codec_progress.cpp b/core/src/fxcodec/codec/fx_codec_progress.cpp
index 2edf750d7f..2e9b1dce3e 100644
--- a/core/src/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/src/fxcodec/codec/fx_codec_progress.cpp
@@ -272,30 +272,24 @@ CCodec_ProgressiveDecoder::CCodec_ProgressiveDecoder(
}
CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {
m_pFile = NULL;
- if (m_pJpegContext != NULL) {
+ if (m_pJpegContext) {
m_pCodecMgr->GetJpegModule()->Finish(m_pJpegContext);
}
- if (m_pPngContext != NULL) {
+ if (m_pPngContext) {
m_pCodecMgr->GetPngModule()->Finish(m_pPngContext);
}
- if (m_pGifContext != NULL) {
+ if (m_pGifContext) {
m_pCodecMgr->GetGifModule()->Finish(m_pGifContext);
}
- if (m_pBmpContext != NULL) {
+ if (m_pBmpContext) {
m_pCodecMgr->GetBmpModule()->Finish(m_pBmpContext);
}
- if (m_pTiffContext != NULL) {
+ if (m_pTiffContext) {
m_pCodecMgr->GetTiffModule()->DestroyDecoder(m_pTiffContext);
}
- if (m_pSrcBuf != NULL) {
- FX_Free(m_pSrcBuf);
- }
- if (m_pDecodeBuf != NULL) {
- FX_Free(m_pDecodeBuf);
- }
- if (m_pSrcPalette != NULL) {
- FX_Free(m_pSrcPalette);
- }
+ FX_Free(m_pSrcBuf);
+ FX_Free(m_pDecodeBuf);
+ FX_Free(m_pSrcPalette);
}
FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData(
ICodec_JpegModule* pJpegModule,
@@ -387,8 +381,8 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule,
uint8_t*& src_buf) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
- ASSERT(pDIBitmap != NULL);
- if (pDIBitmap == NULL) {
+ if (!pDIBitmap) {
+ ASSERT(false);
return FALSE;
}
if (line >= pCodec->m_clipBox.top && line < pCodec->m_clipBox.bottom) {
@@ -418,7 +412,7 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule,
return FALSE;
case FXDIB_8bppMask:
case FXDIB_8bppRgb: {
- if (pDIBitmap->GetPalette() != NULL) {
+ if (pDIBitmap->GetPalette()) {
return FALSE;
}
FX_DWORD des_g = 0;
@@ -477,7 +471,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
return;
case FXDIB_8bppMask:
case FXDIB_8bppRgb: {
- if (pDeviceBitmap->GetPalette() != NULL) {
+ if (pDeviceBitmap->GetPalette()) {
return;
}
FX_DWORD des_g = 0;
@@ -532,7 +526,7 @@ void CCodec_ProgressiveDecoder::PngFillScanlineBufCompletedFunc(void* pModule,
int line) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
- ASSERT(pDIBitmap != NULL);
+ ASSERT(pDIBitmap);
int src_top = pCodec->m_clipBox.top;
int src_bottom = pCodec->m_clipBox.bottom;
int des_top = pCodec->m_startY;
@@ -700,7 +694,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule,
uint8_t* row_buf) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
- ASSERT(pDIBitmap != NULL);
+ ASSERT(pDIBitmap);
int32_t img_width = pCodec->m_GifFrameRect.Width();
if (!pDIBitmap->HasAlpha()) {
uint8_t* byte_ptr = row_buf;
@@ -788,7 +782,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
return;
case FXDIB_8bppMask:
case FXDIB_8bppRgb: {
- if (pDeviceBitmap->GetPalette() != NULL) {
+ if (pDeviceBitmap->GetPalette()) {
return;
}
int des_g = 0;
@@ -891,7 +885,7 @@ void CCodec_ProgressiveDecoder::BmpReadScanlineCallback(void* pModule,
uint8_t* row_buf) {
CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule;
CFX_DIBitmap* pDIBitmap = pCodec->m_pDeviceBitmap;
- ASSERT(pDIBitmap != NULL);
+ ASSERT(pDIBitmap);
FXSYS_memcpy(pCodec->m_pDecodeBuf, row_buf, pCodec->m_ScanlineSize);
int src_top = pCodec->m_clipBox.top;
int src_bottom = pCodec->m_clipBox.bottom;
@@ -953,7 +947,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
return;
case FXDIB_8bppMask:
case FXDIB_8bppRgb: {
- if (pDeviceBitmap->GetPalette() != NULL) {
+ if (pDeviceBitmap->GetPalette()) {
return;
}
int des_g = 0;
@@ -1006,15 +1000,8 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
if (size > FXCODEC_BLOCK_SIZE) {
size = FXCODEC_BLOCK_SIZE;
}
- if (m_pSrcBuf != NULL) {
- FX_Free(m_pSrcBuf);
- m_pSrcBuf = NULL;
- }
+ FX_Free(m_pSrcBuf);
m_pSrcBuf = FX_Alloc(uint8_t, size);
- if (m_pSrcBuf == NULL) {
- m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
- }
FXSYS_memset(m_pSrcBuf, 0, size);
m_SrcSize = size;
switch (imageType) {
@@ -1056,22 +1043,17 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
if (readResult == 1) {
m_SrcBPC = 8;
m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
- if (m_pSrcPalette != NULL) {
- FX_Free(m_pSrcPalette);
- m_pSrcPalette = NULL;
- }
+ FX_Free(m_pSrcPalette);
if (m_SrcPaletteNumber) {
m_pSrcPalette = FX_Alloc(FX_ARGB, m_SrcPaletteNumber);
- if (m_pSrcPalette == NULL) {
- m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
- }
FXSYS_memcpy(m_pSrcPalette, pPalette,
m_SrcPaletteNumber * sizeof(FX_DWORD));
+ } else {
+ m_pSrcPalette = nullptr;
}
return TRUE;
}
- if (m_pBmpContext != NULL) {
+ if (m_pBmpContext) {
pBmpModule->Finish(m_pBmpContext);
m_pBmpContext = NULL;
}
@@ -1114,7 +1096,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
return TRUE;
}
- if (m_pJpegContext != NULL) {
+ if (m_pJpegContext) {
pJpegModule->Finish(m_pJpegContext);
m_pJpegContext = NULL;
}
@@ -1150,20 +1132,16 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
FX_DWORD input_size =
remain_size > FXCODEC_BLOCK_SIZE ? FXCODEC_BLOCK_SIZE : remain_size;
if (input_size == 0) {
- if (m_pPngContext != NULL) {
+ if (m_pPngContext) {
pPngModule->Finish(m_pPngContext);
}
m_pPngContext = NULL;
m_status = FXCODEC_STATUS_ERR_FORMAT;
return FALSE;
}
- if (m_pSrcBuf != NULL && input_size > m_SrcSize) {
+ if (m_pSrcBuf && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
m_pSrcBuf = FX_Alloc(uint8_t, input_size);
- if (m_pSrcBuf == NULL) {
- m_status = FXCODEC_STATUS_ERR_MEMORY;
- return FALSE;
- }
FXSYS_memset(m_pSrcBuf, 0, input_size);
m_SrcSize = input_size;
}
@@ -1177,7 +1155,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
pPngModule->Input(m_pPngContext, m_pSrcBuf, input_size, pAttribute);
}
ASSERT(!bResult);
- if (m_pPngContext != NULL) {
+ if (m_pPngContext) {
pPngModule->Finish(m_pPngContext);
m_pPngContext = NULL;
}
@@ -1231,7 +1209,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType(
m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
return TRUE;
}
- if (m_pGifContext != NULL) {
+ if (m_pGifContext) {
pGifModule->Finish(m_pGifContext);
m_pGifContext = NULL;
}
@@ -1711,7 +1689,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap,
return;
case FXDIB_8bppMask:
case FXDIB_8bppRgb: {
- if (pDeviceBitmap->GetPalette() != NULL) {
+ if (pDeviceBitmap->GetPalette()) {
return;
}
int des_g = 0;
@@ -1836,7 +1814,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t& frames,
frames = m_FrameNumber;
return m_status = FXCODEC_STATUS_DECODE_READY;
}
- if (m_pGifContext != NULL) {
+ if (m_pGifContext) {
pGifModule->Finish(m_pGifContext);
m_pGifContext = NULL;
}
@@ -1921,16 +1899,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
}
int scanline_size = (m_SrcWidth + down_scale - 1) / down_scale;
scanline_size = (scanline_size * m_SrcComponents + 3) / 4 * 4;
- if (m_pDecodeBuf != NULL) {
- FX_Free(m_pDecodeBuf);
- m_pDecodeBuf = NULL;
- }
+ FX_Free(m_pDecodeBuf);
m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
- if (m_pDecodeBuf == NULL) {
- m_pDeviceBitmap = NULL;
- m_pFile = NULL;
- return m_status = FXCODEC_STATUS_ERR_MEMORY;
- }
FXSYS_memset(m_pDecodeBuf, 0, scanline_size);
m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0,
m_clipBox.Width(), m_bInterpol);
@@ -1956,7 +1926,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
m_pFile = NULL;
return m_status = FXCODEC_STATUS_ERR_MEMORY;
}
- if (m_pPngContext != NULL) {
+ if (m_pPngContext) {
pPngModule->Finish(m_pPngContext);
m_pPngContext = NULL;
}
@@ -1990,16 +1960,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
}
GetTransMethod(m_pDeviceBitmap->GetFormat(), m_SrcFormat);
int scanline_size = (m_SrcWidth * m_SrcComponents + 3) / 4 * 4;
- if (m_pDecodeBuf != NULL) {
- FX_Free(m_pDecodeBuf);
- m_pDecodeBuf = NULL;
- }
+ FX_Free(m_pDecodeBuf);
m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
- if (m_pDecodeBuf == NULL) {
- m_pDeviceBitmap = NULL;
- m_pFile = NULL;
- return m_status = FXCODEC_STATUS_ERR_MEMORY;
- }
FXSYS_memset(m_pDecodeBuf, 0, scanline_size);
m_WeightHorzOO.Calc(m_sizeX, m_clipBox.Width(), m_bInterpol);
m_WeightVert.Calc(m_sizeY, m_clipBox.Height());
@@ -2015,16 +1977,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
m_SrcFormat = FXCodec_8bppRgb;
GetTransMethod(m_pDeviceBitmap->GetFormat(), m_SrcFormat);
int scanline_size = (m_SrcWidth + 3) / 4 * 4;
- if (m_pDecodeBuf != NULL) {
- FX_Free(m_pDecodeBuf);
- m_pDecodeBuf = NULL;
- }
+ FX_Free(m_pDecodeBuf);
m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size);
- if (m_pDecodeBuf == NULL) {
- m_pDeviceBitmap = NULL;
- m_pFile = NULL;
- return m_status = FXCODEC_STATUS_ERR_MEMORY;
- }
FXSYS_memset(m_pDecodeBuf, 0, scanline_size);
m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0,
m_clipBox.Width(), m_bInterpol);
@@ -2052,16 +2006,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(CFX_DIBitmap* pDIBitmap,
}
GetTransMethod(m_pDeviceBitmap->GetFormat(), m_SrcFormat);
m_ScanlineSize = (m_SrcWidth * m_SrcComponents + 3) / 4 * 4;
- if (m_pDecodeBuf != NULL) {
- FX_Free(m_pDecodeBuf);
- m_pDecodeBuf = NULL;
- }
+ FX_Free(m_pDecodeBuf);
m_pDecodeBuf = FX_Alloc(uint8_t, m_ScanlineSize);
- if (m_pDecodeBuf == NULL) {
- m_pDeviceBitmap = NULL;
- m_pFile = NULL;
- return m_status = FXCODEC_STATUS_ERR_MEMORY;
- }
FXSYS_memset(m_pDecodeBuf, 0, m_ScanlineSize);
m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0,
m_clipBox.Width(), m_bInterpol);
@@ -2117,7 +2063,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
FX_DWORD input_size =
remain_size > FXCODEC_BLOCK_SIZE ? FXCODEC_BLOCK_SIZE : remain_size;
if (input_size == 0) {
- if (m_pPngContext != NULL) {
+ if (m_pPngContext) {
pPngModule->Finish(m_pPngContext);
}
m_pPngContext = NULL;
@@ -2125,14 +2071,9 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
m_pFile = NULL;
return m_status = FXCODEC_STATUS_DECODE_FINISH;
}
- if (m_pSrcBuf != NULL && input_size > m_SrcSize) {
+ if (m_pSrcBuf && input_size > m_SrcSize) {
FX_Free(m_pSrcBuf);
m_pSrcBuf = FX_Alloc(uint8_t, input_size);
- if (m_pSrcBuf == NULL) {
- m_pDeviceBitmap = NULL;
- m_pFile = NULL;
- return m_status = FXCODEC_STATUS_ERR_MEMORY;
- }
FXSYS_memset(m_pSrcBuf, 0, input_size);
m_SrcSize = input_size;
}
diff --git a/core/src/fxcodec/codec/fx_codec_progress.h b/core/src/fxcodec/codec/fx_codec_progress.h
index 45fde21338..4fb13640ff 100644
--- a/core/src/fxcodec/codec/fx_codec_progress.h
+++ b/core/src/fxcodec/codec/fx_codec_progress.h
@@ -21,11 +21,7 @@ struct PixelWeight {
class CFXCODEC_WeightTable {
public:
CFXCODEC_WeightTable() { m_pWeightTables = NULL; }
- ~CFXCODEC_WeightTable() {
- if (m_pWeightTables != NULL) {
- FX_Free(m_pWeightTables);
- }
- }
+ ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); }
void Calc(int dest_len,
int dest_min,
@@ -44,11 +40,7 @@ class CFXCODEC_WeightTable {
class CFXCODEC_HorzTable {
public:
CFXCODEC_HorzTable() { m_pWeightTables = NULL; }
- ~CFXCODEC_HorzTable() {
- if (m_pWeightTables != NULL) {
- FX_Free(m_pWeightTables);
- }
- }
+ ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); }
void Calc(int dest_len, int src_len, FX_BOOL bInterpol);
PixelWeight* GetPixelWeight(int pixel) {
@@ -61,11 +53,7 @@ class CFXCODEC_HorzTable {
class CFXCODEC_VertTable {
public:
CFXCODEC_VertTable() { m_pWeightTables = NULL; }
- ~CFXCODEC_VertTable() {
- if (m_pWeightTables != NULL) {
- FX_Free(m_pWeightTables);
- }
- }
+ ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); }
void Calc(int dest_len, int src_len);
PixelWeight* GetPixelWeight(int pixel) {
return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
diff --git a/core/src/fxcodec/lbmp/fx_bmp.cpp b/core/src/fxcodec/lbmp/fx_bmp.cpp
index bfcf2f4722..ec7490fdd1 100644
--- a/core/src/fxcodec/lbmp/fx_bmp.cpp
+++ b/core/src/fxcodec/lbmp/fx_bmp.cpp
@@ -32,7 +32,7 @@ void _SetWord_LSBFirst(uint8_t* p, FX_WORD v) {
p[1] = (uint8_t)(v >> 8);
}
void _bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg) {
- if (bmp_ptr != NULL && bmp_ptr->_bmp_error_fn != NULL) {
+ if (bmp_ptr && bmp_ptr->_bmp_error_fn) {
bmp_ptr->_bmp_error_fn(bmp_ptr, err_msg);
}
}
@@ -52,15 +52,11 @@ void _bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr) {
}
bmp_decompress_struct_p bmp_ptr = *bmp_ptr_ptr;
*bmp_ptr_ptr = NULL;
- if (bmp_ptr->out_row_buffer != NULL) {
+ if (bmp_ptr->out_row_buffer) {
FX_Free(bmp_ptr->out_row_buffer);
}
- if (bmp_ptr->pal_ptr != NULL) {
- FX_Free(bmp_ptr->pal_ptr);
- }
- if (bmp_ptr->bmp_header_ptr != NULL) {
- FX_Free(bmp_ptr->bmp_header_ptr);
- }
+ FX_Free(bmp_ptr->pal_ptr);
+ FX_Free(bmp_ptr->bmp_header_ptr);
FX_Free(bmp_ptr);
}
int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
@@ -218,12 +214,8 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
bmp_ptr->components = 4;
break;
}
- if (bmp_ptr->out_row_buffer != NULL) {
- FX_Free(bmp_ptr->out_row_buffer);
- bmp_ptr->out_row_buffer = NULL;
- }
+ FX_Free(bmp_ptr->out_row_buffer);
bmp_ptr->out_row_buffer = FX_Alloc(uint8_t, bmp_ptr->out_row_bytes);
- BMP_PTR_NOT_NULL(bmp_ptr->out_row_buffer, bmp_ptr);
FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes);
_bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_PAL);
}
@@ -279,12 +271,8 @@ int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
bmp_ptr->skip_size = skip_size_org;
return 2;
}
- if (bmp_ptr->pal_ptr != NULL) {
- FX_Free(bmp_ptr->pal_ptr);
- bmp_ptr->pal_ptr = NULL;
- }
+ FX_Free(bmp_ptr->pal_ptr);
bmp_ptr->pal_ptr = FX_Alloc(FX_DWORD, bmp_ptr->pal_num);
- BMP_PTR_NOT_NULL(bmp_ptr->pal_ptr, bmp_ptr);
int32_t src_pal_index = 0;
if (bmp_ptr->pal_type == BMP_PAL_OLD) {
while (src_pal_index < bmp_ptr->pal_num) {
@@ -652,7 +640,7 @@ void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr,
}
FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr,
uint8_t** avial_buf_ptr) {
- if (avial_buf_ptr != NULL) {
+ if (avial_buf_ptr) {
*avial_buf_ptr = NULL;
if (bmp_ptr->avail_in > 0) {
*avial_buf_ptr = bmp_ptr->next_in;
diff --git a/core/src/fxcodec/lbmp/fx_bmp.h b/core/src/fxcodec/lbmp/fx_bmp.h
index 610cffc0df..dc90f5f740 100644
--- a/core/src/fxcodec/lbmp/fx_bmp.h
+++ b/core/src/fxcodec/lbmp/fx_bmp.h
@@ -129,11 +129,6 @@ void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr,
FX_DWORD src_size);
FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr,
uint8_t** avial_buf_ptr);
-#define BMP_PTR_NOT_NULL(ptr, bmp_ptr) \
- if (ptr == NULL) { \
- _bmp_error(bmp_ptr, "Out Of Memory"); \
- return 0; \
- }
typedef struct tag_bmp_compress_struct bmp_compress_struct;
typedef bmp_compress_struct* bmp_compress_struct_p;
typedef bmp_compress_struct_p* bmp_compress_struct_pp;
diff --git a/core/src/fxcodec/lgif/fx_gif.cpp b/core/src/fxcodec/lgif/fx_gif.cpp
index 0be7caad12..ffac891032 100644
--- a/core/src/fxcodec/lgif/fx_gif.cpp
+++ b/core/src/fxcodec/lgif/fx_gif.cpp
@@ -376,27 +376,16 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) {
}
gif_decompress_struct_p gif_ptr = *gif_ptr_ptr;
*gif_ptr_ptr = NULL;
- if (gif_ptr->global_pal_ptr != NULL) {
- FX_Free(gif_ptr->global_pal_ptr);
- }
- if (gif_ptr->img_decoder_ptr != NULL) {
- delete gif_ptr->img_decoder_ptr;
- }
- if (gif_ptr->img_ptr_arr_ptr != NULL) {
+ FX_Free(gif_ptr->global_pal_ptr);
+ delete gif_ptr->img_decoder_ptr;
+ if (gif_ptr->img_ptr_arr_ptr) {
int32_t size_img_arr = gif_ptr->img_ptr_arr_ptr->GetSize();
for (int32_t i = 0; i < size_img_arr; i++) {
GifImage* p = gif_ptr->img_ptr_arr_ptr->GetAt(i);
- if (p->image_info_ptr != NULL) {
- FX_Free(p->image_info_ptr);
- }
- if (p->image_gce_ptr != NULL) {
- FX_Free(p->image_gce_ptr);
- }
- if (p->image_row_buf != NULL) {
- FX_Free(p->image_row_buf);
- }
- if (p->local_pal_ptr != NULL &&
- p->local_pal_ptr != gif_ptr->global_pal_ptr) {
+ FX_Free(p->image_info_ptr);
+ FX_Free(p->image_gce_ptr);
+ FX_Free(p->image_row_buf);
+ if (p->local_pal_ptr && p->local_pal_ptr != gif_ptr->global_pal_ptr) {
FX_Free(p->local_pal_ptr);
}
FX_Free(p);
@@ -405,34 +394,22 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) {
delete gif_ptr->img_ptr_arr_ptr;
}
#ifdef GIF_SUPPORT_APPLICATION_EXTENSION
- if (gif_ptr->app_data != NULL) {
- FX_Free(gif_ptr->app_data);
- }
+ FX_Free(gif_ptr->app_data);
#endif
#ifdef GIF_SUPPORT_COMMENT_EXTENSION
- if (gif_ptr->cmt_data_ptr != NULL) {
- delete gif_ptr->cmt_data_ptr;
- }
+ delete gif_ptr->cmt_data_ptr;
#endif
#ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
- if (gif_ptr->gce_ptr != NULL) {
- FX_Free(gif_ptr->gce_ptr);
- }
+ FX_Free(gif_ptr->gce_ptr);
#endif
#ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
- if (gif_ptr->pt_ptr_arr_ptr != NULL) {
+ if (gif_ptr->pt_ptr_arr_ptr) {
int32_t size_pt_arr = gif_ptr->pt_ptr_arr_ptr->GetSize();
for (int32_t i = 0; i < size_pt_arr; i++) {
GifPlainText* p = gif_ptr->pt_ptr_arr_ptr->GetAt(i);
- if (p->gce_ptr != NULL) {
- FX_Free(p->gce_ptr);
- }
- if (p->pte_ptr != NULL) {
- FX_Free(p->pte_ptr);
- }
- if (p->string_ptr != NULL) {
- delete p->string_ptr;
- }
+ FX_Free(p->gce_ptr);
+ FX_Free(p->pte_ptr);
+ delete p->string_ptr;
}
gif_ptr->pt_ptr_arr_ptr->RemoveAll();
delete gif_ptr->pt_ptr_arr_ptr;
@@ -511,48 +488,28 @@ void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr) {
}
gif_compress_struct_p gif_ptr = *gif_ptr_ptr;
*gif_ptr_ptr = NULL;
- if (gif_ptr->header_ptr != NULL) {
- FX_Free(gif_ptr->header_ptr);
- }
- if (gif_ptr->lsd_ptr != NULL) {
- FX_Free(gif_ptr->lsd_ptr);
- }
- if (gif_ptr->global_pal != NULL) {
- FX_Free(gif_ptr->global_pal);
- }
- if (gif_ptr->image_info_ptr != NULL) {
- FX_Free(gif_ptr->image_info_ptr);
- }
- if (gif_ptr->local_pal != NULL) {
- FX_Free(gif_ptr->local_pal);
- }
- if (gif_ptr->img_encoder_ptr != NULL) {
- delete gif_ptr->img_encoder_ptr;
- }
+ FX_Free(gif_ptr->header_ptr);
+ FX_Free(gif_ptr->lsd_ptr);
+ FX_Free(gif_ptr->global_pal);
+ FX_Free(gif_ptr->image_info_ptr);
+ FX_Free(gif_ptr->local_pal);
+ delete gif_ptr->img_encoder_ptr;
#ifdef GIF_SUPPORT_APPLICATION_EXTENSION
- if (gif_ptr->app_data != NULL) {
- FX_Free(gif_ptr->app_data);
- }
+ FX_Free(gif_ptr->app_data);
#endif
#ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
- if (gif_ptr->gce_ptr != NULL) {
- FX_Free(gif_ptr->gce_ptr);
- }
+ FX_Free(gif_ptr->gce_ptr);
#endif
#ifdef GIF_SUPPORT_COMMENT_EXTENSION
- if (gif_ptr->cmt_data_ptr != NULL) {
- FX_Free(gif_ptr->cmt_data_ptr);
- }
+ FX_Free(gif_ptr->cmt_data_ptr);
#endif
#ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
- if (gif_ptr->pte_ptr != NULL) {
- FX_Free(gif_ptr->pte_ptr);
- }
+ FX_Free(gif_ptr->pte_ptr);
#endif
FX_Free(gif_ptr);
}
void _gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {
- if (gif_ptr != NULL && gif_ptr->_gif_error_fn != NULL) {
+ if (gif_ptr && gif_ptr->_gif_error_fn) {
gif_ptr->_gif_error_fn(gif_ptr, err_msg);
}
}
@@ -591,12 +548,8 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) {
gif_ptr->global_sort_flag = ((GifGF*)&gif_lsd_ptr->global_flag)->sort_flag;
gif_ptr->global_color_resolution =
((GifGF*)&gif_lsd_ptr->global_flag)->color_resolution;
- if (gif_ptr->global_pal_ptr != NULL) {
- FX_Free(gif_ptr->global_pal_ptr);
- }
- gif_ptr->global_pal_ptr = NULL;
+ FX_Free(gif_ptr->global_pal_ptr);
gif_ptr->global_pal_ptr = (GifPalette*)FX_Alloc(uint8_t, global_pal_size);
- GIF_PTR_NOT_NULL(gif_ptr->global_pal_ptr, gif_ptr);
FXSYS_memcpy(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);
}
gif_ptr->width = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->width);
@@ -720,7 +673,7 @@ void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr,
GifGCE** gce_ptr_ptr) {
*gce_ptr_ptr = NULL;
#ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
- if (gif_ptr->gce_ptr != NULL && gce_ptr_ptr != NULL) {
+ if (gif_ptr->gce_ptr && gce_ptr_ptr) {
*gce_ptr_ptr = gif_ptr->gce_ptr;
gif_ptr->gce_ptr = NULL;
}
@@ -756,12 +709,8 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
FXSYS_memcpy(gif_ptr->app_authentication, gif_ae_ptr->app_authentication,
3);
gif_ptr->app_data_size = gif_ae_data_str.GetLength();
- if (gif_ptr->app_data != NULL) {
- FX_Free(gif_ptr->app_data);
- gif_ptr->app_data = NULL;
- }
+ FX_Free(gif_ptr->app_data);
gif_ptr->app_data = FX_Alloc(uint8_t, gif_ptr->app_data_size);
- GIF_PTR_NOT_NULL(gif_ptr->app_data, gif_ptr);
FXSYS_memcpy(gif_ptr->app_data, const uint8_t*(gif_ae_data_str),
gif_ptr->app_data_size);
} break;
@@ -793,13 +742,10 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
return 2;
}
GifPlainText* gif_pt_ptr = FX_Alloc(GifPlainText, 1);
- GIF_PTR_NOT_NULL(gif_pt_ptr, gif_ptr);
FXSYS_memset(gif_pt_ptr, 0, sizeof(GifPlainText));
_gif_takeover_gce_ptr(gif_ptr, &gif_pt_ptr->gce_ptr);
gif_pt_ptr->pte_ptr = (GifPTE*)FX_Alloc(uint8_t, sizeof(GifPTE));
- GIF_PTR_NOT_NULL(gif_pt_ptr->pte_ptr, gif_ptr);
gif_pt_ptr->string_ptr = new CFX_ByteString;
- GIF_PTR_NOT_NULL(gif_pt_ptr->string_ptr, gif_ptr);
gif_pt_ptr->pte_ptr->block_size = gif_pte_ptr->block_size;
gif_pt_ptr->pte_ptr->grid_left =
_GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_left);
@@ -815,16 +761,10 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
gif_pt_ptr->pte_ptr->bc_index = gif_pte_ptr->bc_index;
if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
- if (gif_pt_ptr != NULL) {
- if (gif_pt_ptr->gce_ptr != NULL) {
- FX_Free(gif_pt_ptr->gce_ptr);
- }
- if (gif_pt_ptr->pte_ptr != NULL) {
- FX_Free(gif_pt_ptr->pte_ptr);
- }
- if (gif_pt_ptr->string_ptr != NULL) {
- delete gif_pt_ptr->string_ptr;
- }
+ if (gif_pt_ptr) {
+ FX_Free(gif_pt_ptr->gce_ptr);
+ FX_Free(gif_pt_ptr->pte_ptr);
+ delete gif_pt_ptr->string_ptr;
FX_Free(gif_pt_ptr);
}
return 2;
@@ -834,16 +774,10 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
if (_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
- if (gif_pt_ptr != NULL) {
- if (gif_pt_ptr->gce_ptr != NULL) {
- FX_Free(gif_pt_ptr->gce_ptr);
- }
- if (gif_pt_ptr->pte_ptr != NULL) {
- FX_Free(gif_pt_ptr->pte_ptr);
- }
- if (gif_pt_ptr->string_ptr != NULL) {
- delete gif_pt_ptr->string_ptr;
- }
+ if (gif_pt_ptr) {
+ FX_Free(gif_pt_ptr->gce_ptr);
+ FX_Free(gif_pt_ptr->pte_ptr);
+ delete gif_pt_ptr->string_ptr;
FX_Free(gif_pt_ptr);
}
return 2;
@@ -863,7 +797,6 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
}
if (gif_ptr->gce_ptr == NULL) {
gif_ptr->gce_ptr = (GifGCE*)FX_Alloc(uint8_t, sizeof(GifGCE));
- GIF_PTR_NOT_NULL(gif_ptr->gce_ptr, gif_ptr);
}
gif_ptr->gce_ptr->block_size = gif_gce_ptr->block_size;
gif_ptr->gce_ptr->gce_flag = gif_gce_ptr->gce_flag;
@@ -874,15 +807,13 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
#endif
default: {
#ifndef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
- if (gif_ptr->decode_status == GIF_D_STATUS_EXT_PTE) {
#ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
- if (gif_ptr->gce_ptr != NULL) {
- FX_Free(gif_ptr->gce_ptr);
- gif_ptr->gce_ptr = NULL;
- }
-#endif
+ if (gif_ptr->decode_status == GIF_D_STATUS_EXT_PTE) {
+ FX_Free(gif_ptr->gce_ptr);
+ gif_ptr->gce_ptr = NULL;
}
#endif
+#endif
if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
return 2;
}
@@ -910,11 +841,9 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
return 2;
}
GifImage* gif_image_ptr = (GifImage*)FX_Alloc(uint8_t, sizeof(GifImage));
- GIF_PTR_NOT_NULL(gif_image_ptr, gif_ptr);
FXSYS_memset(gif_image_ptr, 0, sizeof(GifImage));
gif_image_ptr->image_info_ptr =
(GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));
- GIF_PTR_NOT_NULL(gif_image_ptr->image_info_ptr, gif_ptr);
gif_image_ptr->image_info_ptr->left =
_GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->left);
gif_image_ptr->image_info_ptr->top =
@@ -930,12 +859,8 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
gif_image_ptr->image_info_ptr->top +
gif_image_ptr->image_info_ptr->height >
gif_ptr->height) {
- if (gif_image_ptr->image_info_ptr != NULL) {
- FX_Free(gif_image_ptr->image_info_ptr);
- }
- if (gif_image_ptr->image_row_buf != NULL) {
- FX_Free(gif_image_ptr->image_row_buf);
- }
+ FX_Free(gif_image_ptr->image_info_ptr);
+ FX_Free(gif_image_ptr->image_row_buf);
FX_Free(gif_image_ptr);
_gif_error(gif_ptr, "Image Data Out Of LSD, The File May Be Corrupt");
return 0;
@@ -947,18 +872,14 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
uint8_t* loc_pal_ptr = NULL;
if (_gif_read_data(gif_ptr, &loc_pal_ptr, loc_pal_size) == NULL) {
gif_ptr->skip_size = skip_size_org;
- if (gif_image_ptr->image_info_ptr != NULL) {
- FX_Free(gif_image_ptr->image_info_ptr);
- }
- if (gif_image_ptr->image_row_buf != NULL) {
- FX_Free(gif_image_ptr->image_row_buf);
- }
+ FX_Free(gif_image_ptr->image_info_ptr);
+ FX_Free(gif_image_ptr->image_row_buf);
FX_Free(gif_image_ptr);
return 2;
}
gif_image_ptr->local_pal_ptr =
(GifPalette*)gif_ptr->_gif_ask_buf_for_pal_fn(gif_ptr, loc_pal_size);
- if (gif_image_ptr->local_pal_ptr != NULL) {
+ if (gif_image_ptr->local_pal_ptr) {
FXSYS_memcpy((uint8_t*)gif_image_ptr->local_pal_ptr, loc_pal_ptr,
loc_pal_size);
}
@@ -966,15 +887,9 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
uint8_t* code_size_ptr = NULL;
if (_gif_read_data(gif_ptr, &code_size_ptr, 1) == NULL) {
gif_ptr->skip_size = skip_size_org;
- if (gif_image_ptr->image_info_ptr != NULL) {
- FX_Free(gif_image_ptr->image_info_ptr);
- }
- if (gif_image_ptr->local_pal_ptr != NULL) {
- FX_Free(gif_image_ptr->local_pal_ptr);
- }
- if (gif_image_ptr->image_row_buf != NULL) {
- FX_Free(gif_image_ptr->image_row_buf);
- }
+ FX_Free(gif_image_ptr->image_info_ptr);
+ FX_Free(gif_image_ptr->local_pal_ptr);
+ FX_Free(gif_image_ptr->image_row_buf);
FX_Free(gif_image_ptr);
return 2;
}
@@ -1003,7 +918,6 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
gif_image_ptr->image_row_buf = NULL;
}
gif_image_ptr->image_row_buf = FX_Alloc(uint8_t, gif_img_row_bytes);
- GIF_PTR_NOT_NULL(gif_image_ptr->image_row_buf, gif_ptr);
GifGCE* gif_img_gce_ptr = gif_image_ptr->image_gce_ptr;
int32_t loc_pal_num =
((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->local_pal
@@ -1054,7 +968,6 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
}
if (gif_ptr->img_decoder_ptr == NULL) {
gif_ptr->img_decoder_ptr = new CGifLZWDecoder(gif_ptr->err_ptr);
- GIF_PTR_NOT_NULL(gif_ptr->img_decoder_ptr, gif_ptr);
}
gif_ptr->img_decoder_ptr->InitTable(gif_image_ptr->image_code_size);
gif_ptr->img_row_offset = 0;
@@ -1179,7 +1092,7 @@ void _gif_input_buffer(gif_decompress_struct_p gif_ptr,
}
FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr,
uint8_t** avial_buf_ptr) {
- if (avial_buf_ptr != NULL) {
+ if (avial_buf_ptr) {
*avial_buf_ptr = NULL;
if (gif_ptr->avail_in > 0) {
*avial_buf_ptr = gif_ptr->next_in;
diff --git a/core/src/fxcodec/lgif/fx_gif.h b/core/src/fxcodec/lgif/fx_gif.h
index 2c755d6cde..2b14115ede 100644
--- a/core/src/fxcodec/lgif/fx_gif.h
+++ b/core/src/fxcodec/lgif/fx_gif.h
@@ -329,10 +329,5 @@ void interlace_buf(const uint8_t* buf, FX_DWORD width, FX_DWORD height);
FX_BOOL _gif_encode(gif_compress_struct_p gif_ptr,
uint8_t*& dst_buf,
FX_DWORD& dst_len);
-#define GIF_PTR_NOT_NULL(ptr, gif_ptr) \
- if (ptr == NULL) { \
- _gif_error(gif_ptr, "Out Of Memory"); \
- return 0; \
- }
#endif // CORE_SRC_FXCODEC_LGIF_FX_GIF_H_
diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp
index 2aa63fb088..60d75b610c 100644
--- a/core/src/fxcrt/fx_basic_maps.cpp
+++ b/core/src/fxcrt/fx_basic_maps.cpp
@@ -39,7 +39,7 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition,
ASSERT(pAssocRet);
if (pAssocRet == (CAssoc*)-1) {
for (FX_DWORD nBucket = 0; nBucket < m_nHashTableSize; nBucket++) {
- if ((pAssocRet = m_pHashTable[nBucket]) != NULL)
+ if ((pAssocRet = m_pHashTable[nBucket]))
break;
}
ASSERT(pAssocRet);
@@ -48,7 +48,7 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition,
if ((pAssocNext = pAssocRet->pNext) == NULL) {
for (FX_DWORD nBucket = (HashKey(pAssocRet->key) % m_nHashTableSize) + 1;
nBucket < m_nHashTableSize; nBucket++) {
- if ((pAssocNext = m_pHashTable[nBucket]) != NULL) {
+ if ((pAssocNext = m_pHashTable[nBucket])) {
break;
}
}
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
index 96f727eee6..bba44ab639 100644
--- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
@@ -59,7 +59,7 @@ void CBA_FontMap::Initialize() {
void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
const CFX_ByteString& sFontName) {
- ASSERT(pFont != NULL);
+ ASSERT(pFont);
if (m_pDefaultFont)
return;
@@ -75,12 +75,8 @@ void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
int32_t nCharset) {
- ASSERT(m_pAnnotDict != NULL);
-
if (m_pAnnotDict->GetStringBy("Subtype") == "Widget") {
CPDF_Document* pDocument = GetDocument();
- ASSERT(pDocument != NULL);
-
CPDF_Dictionary* pRootDict = pDocument->GetRoot();
if (!pRootDict)
return NULL;
@@ -109,15 +105,12 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
if (!pResDict)
return NULL;
- CPDF_Document* pDocument = GetDocument();
- ASSERT(pDocument != NULL);
-
CPDF_Dictionary* pFonts = pResDict->GetDictBy("Font");
if (!pFonts)
return NULL;
+ CPDF_Document* pDocument = GetDocument();
CPDF_Font* pFind = NULL;
-
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
@@ -154,9 +147,6 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
if (!pFont)
return;
- ASSERT(m_pAnnotDict != NULL);
- ASSERT(m_pDocument != NULL);
-
CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictBy("AP");
if (!pAPDict) {
@@ -205,9 +195,6 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
}
CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
- ASSERT(m_pAnnotDict != NULL);
- ASSERT(m_pDocument != NULL);
-
CPDF_Dictionary* pAcroFormDict = NULL;
FX_BOOL bWidget = (m_pAnnotDict->GetStringBy("Subtype") == "Widget");
diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
index c2e1b20253..f76613ed3f 100644
--- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
@@ -100,8 +100,6 @@ void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) {
if (bNewChecked) {
CPDF_FormField* pField = m_pWidget->GetFormField();
- ASSERT(pField != NULL);
-
for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) {
if (CPDF_FormControl* pCtrl = pField->GetControl(i)) {
if (pCtrl->IsChecked()) {
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
index 36b123e165..7049fe6a97 100644
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
@@ -747,8 +747,6 @@ void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget,
FX_BOOL& bReset,
FX_BOOL& bExit,
FX_UINT nFlag) {
- ASSERT(pWidget != NULL);
-
if (!m_bNotifying) {
if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) {
m_bNotifying = TRUE;
@@ -784,8 +782,6 @@ void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget,
FX_BOOL& bReset,
FX_BOOL& bExit,
FX_UINT nFlag) {
- ASSERT(pWidget != NULL);
-
if (!m_bNotifying) {
if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) {
m_bNotifying = TRUE;
@@ -819,9 +815,9 @@ void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget,
void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData,
FX_BOOL& bExit,
FX_DWORD nFlag) {
- ASSERT(pPrivateData != NULL);
CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
- ASSERT(pData->pWidget != NULL);
+ ASSERT(pData);
+ ASSERT(pData->pWidget);
FX_BOOL bTempReset = FALSE;
FX_BOOL bTempExit = FALSE;
@@ -836,9 +832,9 @@ void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData,
void CFFL_IFormFiller::OnPopupPostOpen(void* pPrivateData,
FX_BOOL& bExit,
FX_DWORD nFlag) {
- ASSERT(pPrivateData != NULL);
CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
- ASSERT(pData->pWidget != NULL);
+ ASSERT(pData);
+ ASSERT(pData->pWidget);
FX_BOOL bTempReset = FALSE;
FX_BOOL bTempExit = FALSE;
@@ -855,8 +851,6 @@ void CFFL_IFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget,
FX_BOOL& bReset,
FX_BOOL& bExit,
FX_UINT nFlag) {
- ASSERT(pWidget != NULL);
-
if (!m_bNotifying) {
if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) {
m_bNotifying = TRUE;
@@ -892,8 +886,6 @@ void CFFL_IFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget,
FX_BOOL& bReset,
FX_BOOL& bExit,
FX_UINT nFlag) {
- ASSERT(pWidget != NULL);
-
if (!m_bNotifying) {
if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) {
m_bNotifying = TRUE;
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp
index fab90a26d3..1f6aa12126 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp
@@ -118,8 +118,6 @@ FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
}
FX_FLOAT CPDFXFA_Page::GetPageWidth() {
- ASSERT(m_pDocument != NULL);
-
if (!m_pPDFPage && !m_pXFAPageView)
return 0.0f;
@@ -145,8 +143,6 @@ FX_FLOAT CPDFXFA_Page::GetPageWidth() {
}
FX_FLOAT CPDFXFA_Page::GetPageHeight() {
- ASSERT(m_pDocument != NULL);
-
if (!m_pPDFPage && !m_pXFAPageView)
return 0.0f;
@@ -180,8 +176,6 @@ void CPDFXFA_Page::DeviceToPage(int start_x,
int device_y,
double* page_x,
double* page_y) {
- ASSERT(m_pDocument != NULL);
-
if (!m_pPDFPage && !m_pXFAPageView)
return;
@@ -229,8 +223,6 @@ void CPDFXFA_Page::GetDisplayMatrix(CFX_Matrix& matrix,
int xSize,
int ySize,
int iRotate) const {
- ASSERT(m_pDocument != NULL);
-
if (!m_pPDFPage && !m_pXFAPageView)
return;
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 2f204fe27d..661eaef1a1 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -72,8 +72,8 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot,
#ifdef PDF_ENABLE_XFA
CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot,
CPDFSDK_PageView* pPageView) {
- ASSERT(pAnnot != NULL);
- ASSERT(pPageView != NULL);
+ ASSERT(pAnnot);
+ ASSERT(pPageView);
if (IPDFSDK_AnnotHandler* pAnnotHandler =
GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) {
@@ -378,7 +378,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,
IXFA_Widget* hNextFocus = NULL;
hNextFocus =
bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious();
- if (hNextFocus == NULL && pSDKAnnot != NULL)
+ if (!hNextFocus && pSDKAnnot)
hNextFocus = pWidgetIterator->MoveToFirst();
pWidgetIterator->Release();
@@ -752,10 +752,7 @@ void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
ASSERT(pAnnot != NULL);
CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
- ASSERT(pSDKDoc != NULL);
-
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
CFX_Graphics gs;
gs.Create(pDevice);
@@ -773,12 +770,8 @@ void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
}
void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
-
CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot;
CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
- ASSERT(pInterForm != NULL);
-
pInterForm->RemoveXFAMap(pWidget->GetXFAWidget());
delete pWidget;
@@ -786,11 +779,9 @@ void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
CPDF_Rect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
+ ASSERT(pAnnot);
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
CFX_RectF rcBBox;
XFA_ELEMENT eType =
pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType();
@@ -843,8 +834,6 @@ void CPDFSDK_XFAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
if (!pPageView || !pAnnot)
return;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
pWidgetHandler->OnMouseEnter(pAnnot->GetXFAWidget());
}
@@ -855,8 +844,6 @@ void CPDFSDK_XFAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
return;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget());
}
@@ -868,13 +855,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(),
+ return pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(),
GetFWLFlags(nFlags), point.x, point.y);
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
@@ -885,13 +867,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(),
+ return pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(),
GetFWLFlags(nFlags), point.x, point.y);
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
@@ -902,13 +879,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(),
+ return pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(),
GetFWLFlags(nFlags), point.x, point.y);
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
@@ -919,13 +891,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(),
+ return pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(),
GetFWLFlags(nFlags), point.x, point.y);
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
@@ -937,13 +904,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnMouseWheel(
+ return pWidgetHandler->OnMouseWheel(
pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), zDelta, point.x, point.y);
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
@@ -954,13 +916,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(),
+ return pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(),
GetFWLFlags(nFlags), point.x, point.y);
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
@@ -971,13 +928,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(),
+ return pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(),
GetFWLFlags(nFlags), point.x, point.y);
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
@@ -988,13 +940,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(),
+ return pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(),
GetFWLFlags(nFlags), point.x, point.y);
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
@@ -1004,13 +951,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnChar(pAnnot->GetXFAWidget(), nChar,
+ return pWidgetHandler->OnChar(pAnnot->GetXFAWidget(), nChar,
GetFWLFlags(nFlags));
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
@@ -1020,13 +962,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnKeyDown(pAnnot->GetXFAWidget(), nKeyCode,
+ return pWidgetHandler->OnKeyDown(pAnnot->GetXFAWidget(), nKeyCode,
GetFWLFlags(nFlag));
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
@@ -1036,13 +973,8 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
return FALSE;
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
- ASSERT(pWidgetHandler != NULL);
-
- FX_BOOL bRet = FALSE;
- bRet = pWidgetHandler->OnKeyUp(pAnnot->GetXFAWidget(), nKeyCode,
+ return pWidgetHandler->OnKeyUp(pAnnot->GetXFAWidget(), nKeyCode,
GetFWLFlags(nFlag));
-
- return bRet;
}
FX_BOOL CPDFSDK_XFAAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index f05545a672..9da74036e1 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -260,15 +260,11 @@ void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) {
if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
CPDF_FormField* pFormField = GetFormField();
- ASSERT(pFormField != NULL);
-
if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
switch (GetFieldType()) {
case FIELDTYPE_CHECKBOX:
case FIELDTYPE_RADIOBUTTON: {
CPDF_FormControl* pFormCtrl = GetFormControl();
- ASSERT(pFormCtrl != NULL);
-
XFA_CHECKSTATE eCheckState =
pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off;
pWidgetAcc->SetCheckState(eCheckState);
@@ -340,12 +336,10 @@ void CPDFSDK_Widget::SynchronizeXFAValue(IXFA_DocView* pXFADocView,
IXFA_Widget* hWidget,
CPDF_FormField* pFormField,
CPDF_FormControl* pFormControl) {
- ASSERT(pXFADocView != NULL);
- ASSERT(hWidget != NULL);
+ ASSERT(hWidget);
if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandler()) {
- ASSERT(pFormField != NULL);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
switch (pFormField->GetFieldType()) {
case FIELDTYPE_CHECKBOX: {
@@ -414,12 +408,9 @@ void CPDFSDK_Widget::SynchronizeXFAItems(IXFA_DocView* pXFADocView,
IXFA_Widget* hWidget,
CPDF_FormField* pFormField,
CPDF_FormControl* pFormControl) {
- ASSERT(pXFADocView != NULL);
- ASSERT(hWidget != NULL);
+ ASSERT(hWidget);
if (IXFA_WidgetHandler* pXFAWidgetHandler = pXFADocView->GetWidgetHandler()) {
- ASSERT(pFormField != NULL);
-
switch (pFormField->GetFieldType()) {
case FIELDTYPE_LISTBOX: {
pFormField->ClearSelection(FALSE);
@@ -2500,17 +2491,14 @@ FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
#ifdef PDF_ENABLE_XFA
void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField,
FX_BOOL bSynchronizeElse) {
- ASSERT(pFormField != NULL);
-
int x = 0;
if (m_FieldSynchronizeMap.Lookup(pFormField, x))
return;
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
- ASSERT(pFormCtrl != NULL);
-
- ASSERT(m_pInterForm != NULL);
+ ASSERT(pFormCtrl);
+ ASSERT(m_pInterForm);
if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) {
pWidget->Synchronize(bSynchronizeElse);
}
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index fd30cf1f18..9e627167fe 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -1073,10 +1073,7 @@ void CPDFSDK_PageView::LoadFXAnnots() {
#ifdef PDF_ENABLE_XFA
m_page->AddRef();
if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
- IXFA_PageView* pageView = NULL;
- pageView = m_page->GetXFAPageView();
- ASSERT(pageView != NULL);
-
+ IXFA_PageView* pageView = m_page->GetXFAPageView();
IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator(
XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible |
XFA_WIDGETFILTER_Viewable |
@@ -1098,7 +1095,7 @@ void CPDFSDK_PageView::LoadFXAnnots() {
pWidgetHander->Release();
} else {
CPDF_Page* pPage = m_page->GetPDFPage();
- ASSERT(pPage != NULL);
+ ASSERT(pPage);
FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled();
// Disable the default AP construction.
CPDF_InterForm::EnableUpdateAP(FALSE);