From 75c18b989c566d24c76f9f7a44271654bc07a02c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Nov 2020 14:46:32 +1100 Subject: Cleanup: remove redundant NULL checks in ImFileType.is_a callback Most of these callbacks don't do a NULL check, so there is no need to do this for bmp/png. Also correct radiance_hdr comments. --- source/blender/imbuf/intern/bmp.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'source/blender/imbuf/intern/bmp.c') diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index f897b1c6df3..f7fdc7a8e80 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -74,31 +74,27 @@ typedef struct BMPHEADER { static int checkbmp(const uchar *mem) { + if (!CHECK_HEADER_FIELD_BMP(mem)) { + return 0; + } int ret_val = 0; BMPINFOHEADER bmi; uint u; - if (mem) { - if (CHECK_HEADER_FIELD_BMP(mem)) { - /* skip fileheader */ - mem += BMP_FILEHEADER_SIZE; - } - else { - return 0; - } + /* skip fileheader */ + mem += BMP_FILEHEADER_SIZE; - /* for systems where an int needs to be 4 bytes aligned */ - memcpy(&bmi, mem, sizeof(bmi)); + /* for systems where an int needs to be 4 bytes aligned */ + memcpy(&bmi, mem, sizeof(bmi)); - u = LITTLE_LONG(bmi.biSize); - /* we only support uncompressed images for now. */ - if (u >= sizeof(BMPINFOHEADER)) { - if (bmi.biCompression == 0) { - u = LITTLE_SHORT(bmi.biBitCount); - if (u > 0 && u <= 32) { - ret_val = 1; - } + u = LITTLE_LONG(bmi.biSize); + /* we only support uncompressed images for now. */ + if (u >= sizeof(BMPINFOHEADER)) { + if (bmi.biCompression == 0) { + u = LITTLE_SHORT(bmi.biBitCount); + if (u > 0 && u <= 32) { + ret_val = 1; } } } -- cgit v1.2.3