diff options
Diffstat (limited to 'source/blender/imbuf/intern/util.c')
-rw-r--r-- | source/blender/imbuf/intern/util.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 5b9aa9ed88a..c18321ae2fe 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -180,14 +180,13 @@ bool IMB_ispic_type_matches(const char *filepath, int filetype) return false; } - for (const ImFileType *type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) { - if (type->filetype == filetype) { - /* Requesting to load a type that can't check it's own header doesn't make sense. - * Keep the check for developers. */ - BLI_assert(type->is_a != NULL); - if (type->is_a != NULL) { - return type->is_a(buf, (size_t)buf_size); - } + const ImFileType *type = IMB_file_type_from_ftype(filetype); + if (type != NULL) { + /* Requesting to load a type that can't check it's own header doesn't make sense. + * Keep the check for developers. */ + BLI_assert(type->is_a != NULL); + if (type->is_a != NULL) { + return type->is_a(buf, (size_t)buf_size); } } return false; @@ -416,11 +415,10 @@ bool IMB_isanim(const char *filepath) bool IMB_isfloat(const ImBuf *ibuf) { - const ImFileType *type; - - for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) { - if (type->ftype(type, ibuf)) { - return (type->flag & IM_FTYPE_FLOAT) != 0; + const ImFileType *type = IMB_file_type_from_ibuf(ibuf); + if (type != NULL) { + if (type->flag & IM_FTYPE_FLOAT) { + return true; } } return false; |