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:
authorSybren A. Stüvel <sybren@blender.org>2020-08-07 13:39:50 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-08-07 14:38:06 +0300
commitdbf4f52fe0b7644ab607a6edd66facc6f1736693 (patch)
tree51d003842c620ddeb7258ebd863fd60eed972e7d /source/blender/imbuf
parentc889d93c80c52603a501b6b76f6e251b7a6112d2 (diff)
Cleanup: ImBuf, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/imbuf` module. No functional changes.
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c5
-rw-r--r--source/blender/imbuf/intern/cineon/logImageCore.c29
-rw-r--r--source/blender/imbuf/intern/cineon/logmemfile.c36
-rw-r--r--source/blender/imbuf/intern/colormanagement.c10
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp50
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp115
-rw-r--r--source/blender/imbuf/intern/dds/FlipDXT.cpp2
-rw-r--r--source/blender/imbuf/intern/filter.c5
-rw-r--r--source/blender/imbuf/intern/indexer.c10
-rw-r--r--source/blender/imbuf/intern/iris.c7
-rw-r--r--source/blender/imbuf/intern/jp2.c21
-rw-r--r--source/blender/imbuf/intern/moviecache.c5
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp26
-rw-r--r--source/blender/imbuf/intern/tiff.c14
-rw-r--r--source/blender/imbuf/intern/util_gpu.c5
15 files changed, 154 insertions, 186 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 4b3858e6d5a..4205a6ecc39 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -423,9 +423,8 @@ bool imb_addrectImBuf(ImBuf *ibuf)
if (ibuf->planes > 32) {
return (addzbufImBuf(ibuf));
}
- else {
- return true;
- }
+
+ return true;
}
return false;
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c
index e9030496498..362a558b505 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.c
+++ b/source/blender/imbuf/intern/cineon/logImageCore.c
@@ -119,7 +119,7 @@ LogImageFile *logImageOpenFromFile(const char *filename, int cineon)
if (logImageIsDpx(&magicNum)) {
return dpxOpen((const unsigned char *)filename, 0, 0);
}
- else if (logImageIsCineon(&magicNum)) {
+ if (logImageIsCineon(&magicNum)) {
return cineonOpen((const unsigned char *)filename, 0, 0);
}
@@ -131,7 +131,7 @@ LogImageFile *logImageOpenFromMemory(const unsigned char *buffer, unsigned int s
if (logImageIsDpx(buffer)) {
return dpxOpen(buffer, 1, size);
}
- else if (logImageIsCineon(buffer)) {
+ if (logImageIsCineon(buffer)) {
return cineonOpen(buffer, 1, size);
}
@@ -154,18 +154,17 @@ LogImageFile *logImageCreate(const char *filename,
if (cineon) {
return cineonCreate(filename, width, height, bitsPerSample, creator);
}
- else {
- return dpxCreate(filename,
- width,
- height,
- bitsPerSample,
- isLogarithmic,
- hasAlpha,
- referenceWhite,
- referenceBlack,
- gamma,
- creator);
- }
+
+ return dpxCreate(filename,
+ width,
+ height,
+ bitsPerSample,
+ isLogarithmic,
+ hasAlpha,
+ referenceWhite,
+ referenceBlack,
+ gamma,
+ creator);
return NULL;
}
@@ -1677,7 +1676,7 @@ static int convertLogElementToRGBA(
if (rvalue == 1) {
return 1;
}
- else if (dstIsLinearRGB) {
+ if (dstIsLinearRGB) {
/* convert data from sRGB to Linear RGB via lut */
float *lut = getSrgbToLinLut(logElement);
src_ptr = dst; // no error here
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c
index 91351d309de..aca84df91ca 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.c
+++ b/source/blender/imbuf/intern/cineon/logmemfile.c
@@ -64,10 +64,9 @@ int logimage_fwrite(void *buffer, size_t size, unsigned int count, LogImageFile
if (logFile->file) {
return fwrite(buffer, size, count, logFile->file);
}
- else { /* we're writing to memory */
- /* do nothing as this isn't supported yet */
- return count;
- }
+ /* we're writing to memory */
+ /* do nothing as this isn't supported yet */
+ return count;
}
int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile *logFile)
@@ -75,23 +74,22 @@ int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile *
if (logFile->file) {
return fread(buffer, size, count, logFile->file);
}
- else { /* we're reading from memory */
- unsigned char *buf = (unsigned char *)buffer;
- uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
- size_t total_size = size * count;
- if (pos + total_size > logFile->memBufferSize) {
- /* how many elements can we read without overflow ? */
- count = (logFile->memBufferSize - pos) / size;
- /* recompute the size */
- total_size = size * count;
- }
-
- if (total_size != 0) {
- memcpy(buf, logFile->memCursor, total_size);
- }
+ /* we're reading from memory */
+ unsigned char *buf = (unsigned char *)buffer;
+ uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
+ size_t total_size = size * count;
+ if (pos + total_size > logFile->memBufferSize) {
+ /* how many elements can we read without overflow ? */
+ count = (logFile->memBufferSize - pos) / size;
+ /* recompute the size */
+ total_size = size * count;
+ }
- return count;
+ if (total_size != 0) {
+ memcpy(buf, logFile->memCursor, total_size);
}
+
+ return count;
}
int logimage_read_uchar(unsigned char *x, LogImageFile *logFile)
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 136d191c6a0..08e1bc5f674 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -1399,9 +1399,8 @@ const char *IMB_colormanagement_get_float_colorspace(ImBuf *ibuf)
if (ibuf->float_colorspace) {
return ibuf->float_colorspace->name;
}
- else {
- return IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
- }
+
+ return IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
}
const char *IMB_colormanagement_get_rect_colorspace(ImBuf *ibuf)
@@ -1409,9 +1408,8 @@ const char *IMB_colormanagement_get_rect_colorspace(ImBuf *ibuf)
if (ibuf->rect_colorspace) {
return ibuf->rect_colorspace->name;
}
- else {
- return IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_BYTE);
- }
+
+ return IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_BYTE);
}
bool IMB_colormanagement_space_is_data(ColorSpace *colorspace)
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 9fd6d71e091..1fbe7b46963 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -97,21 +97,20 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
return 4;
}
- else {
- // Three-color block: derive the other color.
- color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
- color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
- color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
- color_array[2].a = 0xFF;
- // Set all components to 0 to match DXT specs.
- color_array[3].r = 0x00; // color_array[2].r;
- color_array[3].g = 0x00; // color_array[2].g;
- color_array[3].b = 0x00; // color_array[2].b;
- color_array[3].a = 0x00;
+ // Three-color block: derive the other color.
+ color_array[2].r = (color_array[0].r + color_array[1].r) / 2;
+ color_array[2].g = (color_array[0].g + color_array[1].g) / 2;
+ color_array[2].b = (color_array[0].b + color_array[1].b) / 2;
+ color_array[2].a = 0xFF;
- return 3;
- }
+ // Set all components to 0 to match DXT specs.
+ color_array[3].r = 0x00; // color_array[2].r;
+ color_array[3].g = 0x00; // color_array[2].g;
+ color_array[3].b = 0x00; // color_array[2].b;
+ color_array[3].a = 0x00;
+
+ return 3;
}
uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
@@ -143,21 +142,20 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
return 4;
}
- else {
- // Three-color block: derive the other color.
- color_array[2].r = ((col0.r + col1.r) * 33) / 8;
- color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
- color_array[2].b = ((col0.b + col1.b) * 33) / 8;
- color_array[2].a = 0xFF;
- // Set all components to 0 to match DXT specs.
- color_array[3].r = 0x00; // color_array[2].r;
- color_array[3].g = 0x00; // color_array[2].g;
- color_array[3].b = 0x00; // color_array[2].b;
- color_array[3].a = 0x00;
+ // Three-color block: derive the other color.
+ color_array[2].r = ((col0.r + col1.r) * 33) / 8;
+ color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
+ color_array[2].b = ((col0.b + col1.b) * 33) / 8;
+ color_array[2].a = 0xFF;
- return 3;
- }
+ // Set all components to 0 to match DXT specs.
+ color_array[3].r = 0x00; // color_array[2].r;
+ color_array[3].g = 0x00; // color_array[2].g;
+ color_array[3].b = 0x00; // color_array[2].b;
+ color_array[3].a = 0x00;
+
+ return 3;
}
// Evaluate palette assuming 3 color block.
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index 9730153819e..92dd475813a 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -864,9 +864,8 @@ uint DDSHeader::d3d9Format() const
if (pf.flags & DDPF_FOURCC) {
return pf.fourcc;
}
- else {
- return findD3D9Format(pf.bitcount, pf.rmask, pf.gmask, pf.bmask, pf.amask);
- }
+
+ return findD3D9Format(pf.bitcount, pf.rmask, pf.gmask, pf.bmask, pf.amask);
}
DirectDrawSurface::DirectDrawSurface(unsigned char *mem, uint size) : stream(mem, size), header()
@@ -923,33 +922,32 @@ bool DirectDrawSurface::isSupported() const
return false;
}
- else {
- if (header.pf.flags & DDPF_FOURCC) {
- if (header.pf.fourcc != FOURCC_DXT1 && header.pf.fourcc != FOURCC_DXT2 &&
- header.pf.fourcc != FOURCC_DXT3 && header.pf.fourcc != FOURCC_DXT4 &&
- header.pf.fourcc != FOURCC_DXT5 && header.pf.fourcc != FOURCC_RXGB &&
- header.pf.fourcc != FOURCC_ATI1 && header.pf.fourcc != FOURCC_ATI2) {
- // Unknown fourcc code.
- return false;
- }
- }
- else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE)) {
- // All RGB and luminance formats are supported now.
- }
- else {
- return false;
- }
- if (isTextureCube() &&
- (header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES) {
- // Cubemaps must contain all faces.
+ if (header.pf.flags & DDPF_FOURCC) {
+ if (header.pf.fourcc != FOURCC_DXT1 && header.pf.fourcc != FOURCC_DXT2 &&
+ header.pf.fourcc != FOURCC_DXT3 && header.pf.fourcc != FOURCC_DXT4 &&
+ header.pf.fourcc != FOURCC_DXT5 && header.pf.fourcc != FOURCC_RXGB &&
+ header.pf.fourcc != FOURCC_ATI1 && header.pf.fourcc != FOURCC_ATI2) {
+ // Unknown fourcc code.
return false;
}
+ }
+ else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE)) {
+ // All RGB and luminance formats are supported now.
+ }
+ else {
+ return false;
+ }
- if (isTexture3D()) {
- // @@ 3D textures not supported yet.
- return false;
- }
+ if (isTextureCube() &&
+ (header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES) {
+ // Cubemaps must contain all faces.
+ return false;
+ }
+
+ if (isTexture3D()) {
+ // @@ 3D textures not supported yet.
+ return false;
}
return true;
@@ -963,23 +961,21 @@ bool DirectDrawSurface::hasAlpha() const
header.header10.dxgiFormat == DXGI_FORMAT_BC2_UNORM ||
header.header10.dxgiFormat == DXGI_FORMAT_BC3_UNORM;
}
- else {
- if (header.pf.flags & DDPF_RGB) {
- return header.pf.amask != 0;
- }
- else if (header.pf.flags & DDPF_FOURCC) {
- if (header.pf.fourcc == FOURCC_RXGB || header.pf.fourcc == FOURCC_ATI1 ||
- header.pf.fourcc == FOURCC_ATI2 || header.pf.flags & DDPF_NORMAL) {
- return false;
- }
- else {
- // @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?)
- return true;
- }
+
+ if (header.pf.flags & DDPF_RGB) {
+ return header.pf.amask != 0;
+ }
+ if (header.pf.flags & DDPF_FOURCC) {
+ if (header.pf.fourcc == FOURCC_RXGB || header.pf.fourcc == FOURCC_ATI1 ||
+ header.pf.fourcc == FOURCC_ATI2 || header.pf.flags & DDPF_NORMAL) {
+ return false;
}
- return false;
+ // @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?)
+ return true;
}
+
+ return false;
}
uint DirectDrawSurface::mipmapCount() const
@@ -987,9 +983,8 @@ uint DirectDrawSurface::mipmapCount() const
if (header.flags & DDSD_MIPMAPCOUNT) {
return header.mipmapcount;
}
- else {
- return 1;
- }
+
+ return 1;
}
uint DirectDrawSurface::fourCC() const
@@ -1002,9 +997,8 @@ uint DirectDrawSurface::width() const
if (header.flags & DDSD_WIDTH) {
return header.width;
}
- else {
- return 1;
- }
+
+ return 1;
}
uint DirectDrawSurface::height() const
@@ -1012,9 +1006,8 @@ uint DirectDrawSurface::height() const
if (header.flags & DDSD_HEIGHT) {
return header.height;
}
- else {
- return 1;
- }
+
+ return 1;
}
uint DirectDrawSurface::depth() const
@@ -1022,9 +1015,8 @@ uint DirectDrawSurface::depth() const
if (header.flags & DDSD_DEPTH) {
return header.depth;
}
- else {
- return 1;
- }
+
+ return 1;
}
bool DirectDrawSurface::isTexture1D() const
@@ -1040,9 +1032,8 @@ bool DirectDrawSurface::isTexture2D() const
if (header.hasDX10Header()) {
return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE2D;
}
- else {
- return !isTexture3D() && !isTextureCube();
- }
+
+ return !isTexture3D() && !isTextureCube();
}
bool DirectDrawSurface::isTexture3D() const
@@ -1050,9 +1041,8 @@ bool DirectDrawSurface::isTexture3D() const
if (header.hasDX10Header()) {
return header.header10.resourceDimension == D3D10_RESOURCE_DIMENSION_TEXTURE3D;
}
- else {
- return (header.caps.caps2 & DDSCAPS2_VOLUME) != 0;
- }
+
+ return (header.caps.caps2 & DDSCAPS2_VOLUME) != 0;
}
bool DirectDrawSurface::isTextureCube() const
@@ -1355,16 +1345,15 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const
h = (h + 3) / 4;
return blockSize() * w * h;
}
- else if (header.pf.flags & DDPF_RGB || (header.pf.flags & DDPF_LUMINANCE)) {
+ if (header.pf.flags & DDPF_RGB || (header.pf.flags & DDPF_LUMINANCE)) {
uint pitch = computePitch(
w, header.pf.bitcount, 8); // Assuming 8 bit alignment, which is the same D3DX expects.
return pitch * h * d;
}
- else {
- printf("DDS: mipmap format not supported\n");
- return (0);
- }
+
+ printf("DDS: mipmap format not supported\n");
+ return (0);
}
uint DirectDrawSurface::faceSize() const
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp
index f5c937654b3..f46f50eb2b9 100644
--- a/source/blender/imbuf/intern/dds/FlipDXT.cpp
+++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp
@@ -217,7 +217,7 @@ int FlipDXTCImage(
// no flip to do, and we're done.
break;
}
- else if (mip_height == 2) {
+ if (mip_height == 2) {
// flip the first 2 lines in each block.
for (unsigned int i = 0; i < blocks_per_row; i++) {
half_block_function(data + i * block_bytes);
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index d8a5096af71..12f90f27309 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -394,9 +394,8 @@ static int filter_make_index(const int x, const int y, const int w, const int h)
if (x < 0 || x >= w || y < 0 || y >= h) {
return -1; /* return bad index */
}
- else {
- return y * w + x;
- }
+
+ return y * w + x;
}
static int check_pixel_assigned(
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 7cc31b99077..dd2edebedff 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -268,9 +268,8 @@ int IMB_indexer_get_frame_index(struct anim_index *idx, int frameno)
if (first == idx->num_entries) {
return idx->num_entries - 1;
}
- else {
- return first;
- }
+
+ return first;
}
unsigned long long IMB_indexer_get_pts(struct anim_index *idx, int frame_index)
@@ -633,9 +632,8 @@ static int add_to_proxy_output_ffmpeg(struct proxy_output_ctx *ctx, AVFrame *fra
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx, int rollback)
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index 2516df22151..5f698543aa9 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -892,10 +892,9 @@ static int output_iris(uint *lptr, int xsize, int ysize, int zsize, const char *
if (goodwrite) {
return 1;
}
- else {
- fprintf(stderr, "output_iris: not enough space for image!!\n");
- return 0;
- }
+
+ fprintf(stderr, "output_iris: not enough space for image!!\n");
+ return 0;
}
/* static utility functions for output_iris */
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index f81c005bf06..a5b977be2ce 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -73,12 +73,11 @@ static OPJ_CODEC_FORMAT format_from_header(const unsigned char mem[JP2_FILEHEADE
if (check_jp2(mem)) {
return OPJ_CODEC_JP2;
}
- else if (check_j2k(mem)) {
+ if (check_j2k(mem)) {
return OPJ_CODEC_J2K;
}
- else {
- return OPJ_CODEC_UNKNOWN;
- }
+
+ return OPJ_CODEC_UNKNOWN;
}
int imb_is_a_jp2(const unsigned char *buf)
@@ -339,16 +338,14 @@ ImBuf *imb_load_jp2_filepath(const char *filepath, int flags, char colorspace[IM
if (stream) {
return NULL;
}
- else {
- if (fread(mem, sizeof(mem), 1, p_file) != sizeof(mem)) {
- opj_stream_destroy(stream);
- return NULL;
- }
- else {
- fseek(p_file, 0, SEEK_SET);
- }
+
+ if (fread(mem, sizeof(mem), 1, p_file) != sizeof(mem)) {
+ opj_stream_destroy(stream);
+ return NULL;
}
+ fseek(p_file, 0, SEEK_SET);
+
const OPJ_CODEC_FORMAT format = format_from_header(mem);
ImBuf *ibuf = imb_load_jp2_stream(stream, format, flags, colorspace);
opj_stream_destroy(stream);
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index 96ecbdce9cc..f7b033869e3 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -192,9 +192,8 @@ static size_t get_size_in_memory(ImBuf *ibuf)
if (ibuf->userflags & IB_PERSISTENT) {
return 0;
}
- else {
- return IMB_get_size_in_memory(ibuf);
- }
+
+ return IMB_get_size_in_memory(ibuf);
}
static size_t get_item_size(void *p)
{
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index a781c616b1c..05592a7d408 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -131,9 +131,8 @@ class IMemStream : public Imf::IStream {
_exrpos += n;
return true;
}
- else {
- return false;
- }
+
+ return false;
}
virtual Int64 tellg()
@@ -597,15 +596,13 @@ int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
if (ibuf->foptions.flag & OPENEXR_HALF) {
return (int)imb_save_openexr_half(ibuf, name, flags);
}
- else {
- /* when no float rect, we save as half (16 bits is sufficient) */
- if (ibuf->rect_float == NULL) {
- return (int)imb_save_openexr_half(ibuf, name, flags);
- }
- else {
- return (int)imb_save_openexr_float(ibuf, name, flags);
- }
+
+ /* when no float rect, we save as half (16 bits is sufficient) */
+ if (ibuf->rect_float == NULL) {
+ return (int)imb_save_openexr_half(ibuf, name, flags);
}
+
+ return (int)imb_save_openexr_float(ibuf, name, flags);
}
/* ******* Nicer API, MultiLayer and with Tile file support ************************************ */
@@ -719,9 +716,8 @@ static int imb_exr_get_multiView_id(StringVector &views, const std::string &name
if (name == *i) {
return count;
}
- else {
- count++;
- }
+
+ count++;
}
/* no views or wrong name */
@@ -1421,7 +1417,7 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
printf("multilayer read: bad channel name: %s\n", name);
return 0;
}
- else if (len == 1) {
+ if (len == 1) {
echan->chan_id = token[0];
}
else if (len > 1) {
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 715f2aaf621..dc7a9594f4f 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -792,16 +792,16 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
"not yet supported.\n");
return (0);
}
- else {
- /* create image as a file */
+
+ /* create image as a file */
#ifdef WIN32
- wchar_t *wname = alloc_utf16_from_8(name, 0);
- image = TIFFOpenW(wname, "w");
- free(wname);
+ wchar_t *wname = alloc_utf16_from_8(name, 0);
+ image = TIFFOpenW(wname, "w");
+ free(wname);
#else
- image = TIFFOpen(name, "w");
+ image = TIFFOpen(name, "w");
#endif
- }
+
if (image == NULL) {
fprintf(stderr, "imb_savetiff: could not open TIFF for writing.\n");
return (0);
diff --git a/source/blender/imbuf/intern/util_gpu.c b/source/blender/imbuf/intern/util_gpu.c
index 52628f5aaad..c52f671f59f 100644
--- a/source/blender/imbuf/intern/util_gpu.c
+++ b/source/blender/imbuf/intern/util_gpu.c
@@ -230,9 +230,8 @@ GPUTexture *IMB_create_gpu_texture(ImBuf *ibuf, bool use_high_bitdepth, bool use
if (tex != NULL) {
return tex;
}
- else {
- fprintf(stderr, "ST3C support not found,");
- }
+
+ fprintf(stderr, "ST3C support not found,");
}
/* Fallback to uncompressed texture. */
fprintf(stderr, " falling back to uncompressed.\n");