Skip to content

Commit

Permalink
PVS43: two if with same condition in BBitmap::SetBits
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkomandy committed May 1, 2015
1 parent 744ab98 commit 487d015
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/build/libbe/interface/Bitmap.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}


Expand Down
11 changes: 7 additions & 4 deletions src/kits/interface/Bitmap.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}


Expand Down

0 comments on commit 487d015

Please sign in to comment.