From 487d015ab7568556aa8bd703baf34f3896a6847d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Thu, 30 Apr 2015 18:40:25 +0200 Subject: [PATCH] PVS43: two if with same condition in BBitmap::SetBits --- src/build/libbe/interface/Bitmap.cpp | 10 ++++++---- src/kits/interface/Bitmap.cpp | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/build/libbe/interface/Bitmap.cpp b/src/build/libbe/interface/Bitmap.cpp index 044aa89abaa..3f8bb0fea5e 100644 --- a/src/build/libbe/interface/Bitmap.cpp +++ b/src/build/libbe/interface/Bitmap.cpp @@ -216,9 +216,11 @@ get_raw_bytes_per_row(color_space colorSpace, int32 width) case B_YCbCr420: case B_YUV420: bpr = (width + 3) / 4 * 6; break; + case B_YUV9: + bpr = (width + 15) / 16 * 18; // unsupported case B_NO_COLOR_SPACE: - case B_YUV9: case B_YUV12: + case B_YUV12: break; } return bpr; @@ -1761,10 +1763,10 @@ BBitmap::SetBits(const void *data, int32 length, int32 offset, // ignore source data row padding. } else if (colorSpace == B_CMAP8 && fColorSpace != B_CMAP8) inBPR = width; - } - // call the sane method, which does the actual work - if (error == B_OK) + + // call the sane method, which does the actual work error = ImportBits(data, length, inBPR, offset, colorSpace); + } } diff --git a/src/kits/interface/Bitmap.cpp b/src/kits/interface/Bitmap.cpp index 95d94916a12..33f60ca16bd 100644 --- a/src/kits/interface/Bitmap.cpp +++ b/src/kits/interface/Bitmap.cpp @@ -124,9 +124,12 @@ get_raw_bytes_per_row(color_space colorSpace, int32 width) case B_YCbCr420: case B_YUV420: bpr = (width + 3) / 4 * 6; break; + case B_YUV9: + bpr = (width + 15) / 16 * 18; + break; // unsupported case B_NO_COLOR_SPACE: - case B_YUV9: case B_YUV12: + case B_YUV12: break; } return bpr; @@ -644,10 +647,10 @@ BBitmap::SetBits(const void* data, int32 length, int32 offset, // ignore source data row padding. inBPR = width; } - } - // call the sane method, which does the actual work - if (error == B_OK) + + // call the sane method, which does the actual work error = ImportBits(data, length, inBPR, offset, colorSpace); + } }