d3d8: Sign-compare warnings fix (try 2)
Andrew Talbot
andrew.talbot at talbotville.com
Mon Aug 25 09:36:07 CDT 2008
Changelog:
d3d8: Sign-compare warnings fix.
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 6ecd7af..521ba56 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -18,6 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include <assert.h>
+#include <limits.h>
+
#include "config.h"
#include "d3d8_private.h"
@@ -179,14 +182,19 @@ static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D
EnterCriticalSection(&d3d8_cs);
if (pRect) {
D3DSURFACE_DESC desc;
- IDirect3DSurface8_GetDesc(iface, &desc);
+ INT desc_width;
+ INT desc_height;
+ IDirect3DSurface8_GetDesc(iface, &desc);
+ assert(desc.Width <= INT_MAX && desc.Height <= INT_MAX);
+ desc_width = desc.Width;
+ desc_height = desc.Height;
if ((pRect->left < 0)
|| (pRect->top < 0)
|| (pRect->left >= pRect->right)
|| (pRect->top >= pRect->bottom)
- || (pRect->right > desc.Width)
- || (pRect->bottom > desc.Height)) {
+ || (pRect->right > desc_width)
+ || (pRect->bottom > desc_height)) {
WARN("Trying to lock an invalid rectangle, returning D3DERR_INVALIDCALL\n");
LeaveCriticalSection(&d3d8_cs);
return D3DERR_INVALIDCALL;
More information about the wine-patches
mailing list