From dee359e26e7dd6eb0b51594497d90421801ed877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 7 Aug 2020 12:40:12 +0200 Subject: Cleanup: IO, Clang-Tidy else-after-return fixes This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/io` module. No functional changes. --- source/blender/io/avi/intern/avi.c | 10 +++----- source/blender/io/avi/intern/avi_rgb.c | 45 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 29 deletions(-) (limited to 'source/blender/io/avi') diff --git a/source/blender/io/avi/intern/avi.c b/source/blender/io/avi/intern/avi.c index e829a15deba..0ab51b7a084 100644 --- a/source/blender/io/avi/intern/avi.c +++ b/source/blender/io/avi/intern/avi.c @@ -116,9 +116,8 @@ int AVI_get_stream(AviMovie *movie, int avist_type, int stream_num) if (stream_num == 0) { return cur_stream; } - else { - stream_num--; - } + + stream_num--; } } @@ -572,9 +571,8 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) if (GET_FCC(movie->fp) == FCC("movi")) { break; } - else { - BLI_fseek(movie->fp, size - 4, SEEK_CUR); - } + + BLI_fseek(movie->fp, size - 4, SEEK_CUR); } else { BLI_fseek(movie->fp, size, SEEK_CUR); diff --git a/source/blender/io/avi/intern/avi_rgb.c b/source/blender/io/avi/intern/avi_rgb.c index 44542af96ae..8af728f0737 100644 --- a/source/blender/io/avi/intern/avi_rgb.c +++ b/source/blender/io/avi/intern/avi_rgb.c @@ -96,35 +96,34 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, return buf; } - else { - buf = imb_alloc_pixels( - movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf"); - - if (buf) { - size_t rowstride = movie->header->Width * 3; - BLI_assert(bits != 16); - if (movie->header->Width % 2) { - rowstride++; - } - for (size_t y = 0; y < movie->header->Height; y++) { - memcpy(&buf[y * movie->header->Width * 3], - &buffer[((movie->header->Height - 1) - y) * rowstride], - movie->header->Width * 3); - } + buf = imb_alloc_pixels( + movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf"); - for (size_t y = 0; y < (size_t)movie->header->Height * (size_t)movie->header->Width * 3; - y += 3) { - int i = buf[y]; - buf[y] = buf[y + 2]; - buf[y + 2] = i; - } + if (buf) { + size_t rowstride = movie->header->Width * 3; + BLI_assert(bits != 16); + if (movie->header->Width % 2) { + rowstride++; } - MEM_freeN(buffer); + for (size_t y = 0; y < movie->header->Height; y++) { + memcpy(&buf[y * movie->header->Width * 3], + &buffer[((movie->header->Height - 1) - y) * rowstride], + movie->header->Width * 3); + } - return buf; + for (size_t y = 0; y < (size_t)movie->header->Height * (size_t)movie->header->Width * 3; + y += 3) { + int i = buf[y]; + buf[y] = buf[y + 2]; + buf[y + 2] = i; + } } + + MEM_freeN(buffer); + + return buf; } void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size) -- cgit v1.2.3