[1/4] comctl32: Remove superfluous boundary checks in
ImageList_Remove
Dmitry Timoshkov
dmitry at codeweavers.com
Sat Apr 21 04:14:04 CDT 2007
Hello,
'i' is already checked for valid values in earlier lines of code,
so at this point it's guaranteed to be in bounds.
Changelog:
comctl32: Remove superfluous boundary checks in ImageList_Remove.
---
dlls/comctl32/imagelist.c | 32 ++++++++++++++------------------
1 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 0e314dd..4eec20a 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -2109,31 +2109,27 @@ ImageList_Remove (HIMAGELIST himl, INT i)
hdcBmp = CreateCompatibleDC (0);
/* copy all images and masks prior to the "removed" image */
- if (i > 0) {
- TRACE("Pre image copy: Copy %d images\n", i);
+ TRACE("Pre image copy: Copy %d images\n", i);
- SelectObject (hdcBmp, hbmNewImage);
- imagelist_copy_images( himl, himl->hdcImage, hdcBmp, 0, i, 0 );
+ SelectObject (hdcBmp, hbmNewImage);
+ imagelist_copy_images( himl, himl->hdcImage, hdcBmp, 0, i, 0 );
- if (himl->hbmMask) {
- SelectObject (hdcBmp, hbmNewMask);
- imagelist_copy_images( himl, himl->hdcMask, hdcBmp, 0, i, 0 );
- }
+ if (himl->hbmMask) {
+ SelectObject (hdcBmp, hbmNewMask);
+ imagelist_copy_images( himl, himl->hdcMask, hdcBmp, 0, i, 0 );
}
/* copy all images and masks behind the removed image */
- if (i < himl->cCurImage - 1) {
- TRACE("Post image copy!\n");
+ TRACE("Post image copy!\n");
- SelectObject (hdcBmp, hbmNewImage);
- imagelist_copy_images( himl, himl->hdcImage, hdcBmp, i,
- (himl->cCurImage - i - 1), i - 1 );
+ SelectObject (hdcBmp, hbmNewImage);
+ imagelist_copy_images( himl, himl->hdcImage, hdcBmp, i,
+ (himl->cCurImage - i - 1), i - 1 );
- if (himl->hbmMask) {
- SelectObject (hdcBmp, hbmNewMask);
- imagelist_copy_images( himl, himl->hdcMask, hdcBmp, i,
- (himl->cCurImage - i - 1), i - 1 );
- }
+ if (himl->hbmMask) {
+ SelectObject (hdcBmp, hbmNewMask);
+ imagelist_copy_images( himl, himl->hdcMask, hdcBmp, i,
+ (himl->cCurImage - i - 1), i - 1 );
}
DeleteDC (hdcBmp);
--
1.5.1.1
More information about the wine-patches
mailing list