diff options
author | Lei Zhang <thestig@chromium.org> | 2016-02-22 20:32:21 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-02-22 20:32:21 -0800 |
commit | 5eca305b1586b2107566a5c124baa5f2e00096c0 (patch) | |
tree | d2b6b17b62995b2249a28956a17ae87122f83124 /core/src/fxcodec/lbmp | |
parent | d2019df0a77c5d01a336f16be054d2f373e38c54 (diff) | |
download | pdfium-5eca305b1586b2107566a5c124baa5f2e00096c0.tar.xz |
Remove foo != NULL outside of xfa/
Most of these are from the XFA branch.
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1720043003 .
Diffstat (limited to 'core/src/fxcodec/lbmp')
-rw-r--r-- | core/src/fxcodec/lbmp/fx_bmp.cpp | 26 | ||||
-rw-r--r-- | core/src/fxcodec/lbmp/fx_bmp.h | 5 |
2 files changed, 7 insertions, 24 deletions
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; |