From 454b7876ff18c5103cad7d1ebc4e7bef5b1bff4b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 13 Nov 2020 11:24:02 +1100 Subject: Cleanup: remove unnecessary ImFileType.ftype callback This callback made some sense before moving the file-type information from a bit-flag to an enum: e142ae77cadf04103fbc643f21cf60891862f6a8 Since then, we can compare the type value directly. Also replace loops over file types with IMB_file_type_from_{ibuf/ftype}. --- source/blender/imbuf/intern/writeimage.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source/blender/imbuf/intern/writeimage.c') diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c index 71ecc8b14ae..f21d274f8fd 100644 --- a/source/blender/imbuf/intern/writeimage.c +++ b/source/blender/imbuf/intern/writeimage.c @@ -43,8 +43,6 @@ static bool prepare_write_imbuf(const ImFileType *type, ImBuf *ibuf) bool IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags) { - const ImFileType *type; - errno = 0; BLI_assert(!BLI_path_is_rel(filepath)); @@ -54,8 +52,9 @@ bool IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags) } ibuf->flags = flags; - for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) { - if (type->save && type->ftype(type, ibuf)) { + const ImFileType *type = IMB_file_type_from_ibuf(ibuf); + if (type != NULL) { + if (type->save != NULL) { prepare_write_imbuf(type, ibuf); return type->save(ibuf, filepath, flags); } -- cgit v1.2.3