diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-08-07 13:39:50 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-08-07 14:38:06 +0300 |
commit | dbf4f52fe0b7644ab607a6edd66facc6f1736693 (patch) | |
tree | 51d003842c620ddeb7258ebd863fd60eed972e7d /source/blender/imbuf/intern/cineon | |
parent | c889d93c80c52603a501b6b76f6e251b7a6112d2 (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/intern/cineon')
-rw-r--r-- | source/blender/imbuf/intern/cineon/logImageCore.c | 29 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logmemfile.c | 36 |
2 files changed, 31 insertions, 34 deletions
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) |