Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-11 06:46:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-11 06:54:04 +0300
commit75c18b989c566d24c76f9f7a44271654bc07a02c (patch)
tree6abb42e2f30a50ff3c17b8a23ce6ac3ea758902b /source/blender/imbuf/intern/bmp.c
parent36e5c9e026a49d0ead2290ae8c1d3ec27205b4a5 (diff)
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.
Diffstat (limited to 'source/blender/imbuf/intern/bmp.c')
-rw-r--r--source/blender/imbuf/intern/bmp.c32
1 files changed, 14 insertions, 18 deletions
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;
}
}
}