Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1095)

Unified Diff: core/src/fxcodec/lbmp/fx_bmp.cpp

Issue 1720043003: Remove foo != NULL outside of xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxcodec/lbmp/fx_bmp.h ('k') | core/src/fxcodec/lgif/fx_gif.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/lbmp/fx_bmp.cpp
diff --git a/core/src/fxcodec/lbmp/fx_bmp.cpp b/core/src/fxcodec/lbmp/fx_bmp.cpp
index bfcf2f4722b04c6115b52fca13a8038b6e973d7c..ec7490fdd122e8bc3fd53fa3f43643d71761a646 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;
« no previous file with comments | « core/src/fxcodec/lbmp/fx_bmp.h ('k') | core/src/fxcodec/lgif/fx_gif.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698