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>2018-04-02 18:30:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-02 18:34:52 +0300
commit4041385ddd68460d4dd04825431c4e2495c0c2a9 (patch)
treecb90f6c9128bf9a521c29f4ae004fabd9bfc19ea /source/blender/imbuf/intern/writeimage.c
parent888a04c7e4e6002ac7d757fdb6d443561de696dd (diff)
Cleanup: remove redundant imbuf return values
Some functions always returned the input argument which was never used. This made code read as if there might be a leak. Now return a boolean (true the imbuf is modified).
Diffstat (limited to 'source/blender/imbuf/intern/writeimage.c')
-rw-r--r--source/blender/imbuf/intern/writeimage.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index 84ec2534e7f..c019b0b1363 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -46,7 +46,7 @@
#include "IMB_colormanagement.h"
#include "IMB_colormanagement_intern.h"
-static ImBuf *prepare_write_imbuf(const ImFileType *type, ImBuf *ibuf)
+static bool prepare_write_imbuf(const ImFileType *type, ImBuf *ibuf)
{
return IMB_prepare_write_ImBuf((type->flag & IM_FTYPE_FLOAT), ibuf);
}
@@ -64,15 +64,11 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
if (type->save && type->ftype(type, ibuf)) {
- ImBuf *write_ibuf;
short result = false;
- write_ibuf = prepare_write_imbuf(type, ibuf);
+ prepare_write_imbuf(type, ibuf);
- result = type->save(write_ibuf, name, flags);
-
- if (write_ibuf != ibuf)
- IMB_freeImBuf(write_ibuf);
+ result = type->save(ibuf, name, flags);
return result;
}
@@ -83,9 +79,9 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
return false;
}
-ImBuf *IMB_prepare_write_ImBuf(const bool isfloat, ImBuf *ibuf)
+bool IMB_prepare_write_ImBuf(const bool isfloat, ImBuf *ibuf)
{
- ImBuf *write_ibuf = ibuf;
+ bool changed = false;
if (isfloat) {
/* pass */
@@ -94,8 +90,11 @@ ImBuf *IMB_prepare_write_ImBuf(const bool isfloat, ImBuf *ibuf)
if (ibuf->rect == NULL && ibuf->rect_float) {
ibuf->rect_colorspace = colormanage_colorspace_get_roled(COLOR_ROLE_DEFAULT_BYTE);
IMB_rect_from_float(ibuf);
+ if (ibuf->rect != NULL) {
+ changed = true;
+ }
}
}
- return write_ibuf;
+ return changed;
}