Patches for various unsigned comparisons
Vincent Béron
vberon at mecano.gme.usherb.ca
Sun Jun 9 22:33:41 CDT 2002
This fixes some of the issues uncovered by tenthumbs at cybernex.net as
part of bug #778. There are a couple more, especially in shlwapi and
ole32/oleaut32. See the bug for details.
Changelog:
- Fixes some various comparisons wrt signedness.
Vincent
-------------- next part --------------
--- wine-orig/controls/button.c Fri May 31 19:28:56 2002
+++ wine/controls/button.c Sun Jun 9 22:41:33 2002
@@ -198,7 +198,7 @@
checkBoxWidth = bmp.bmWidth / 4;
checkBoxHeight = bmp.bmHeight / 3;
}
- if (btn_type < 0L || btn_type >= MAX_BTN_TYPE)
+ if (btn_type >= MAX_BTN_TYPE)
return -1; /* abort */
set_button_state( hWnd, BUTTON_UNCHECKED );
return 0;
-------------- next part --------------
--- wine-orig/dlls/advapi32/crypt.c Fri May 24 22:13:14 2002
+++ wine/dlls/advapi32/crypt.c Sun Jun 9 22:39:56 2002
@@ -842,7 +842,7 @@
CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER);
if (dwFlags & ~(CRYPT_USER_DEFAULT | CRYPT_MACHINE_DEFAULT))
CRYPT_ReturnLastError(NTE_BAD_FLAGS);
- if (dwProvType < 0 || dwProvType > 999)
+ if (dwProvType > 999)
CRYPT_ReturnLastError(NTE_BAD_PROV_TYPE);
if ( !(keyname = CRYPT_GetTypeKeyName(dwProvType, dwFlags & CRYPT_USER_DEFAULT)) )
CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY);
@@ -1129,7 +1129,7 @@
if (!pszProvName || pdwReserved)
CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER);
- if (dwProvType < 0 || dwProvType > MAXPROVTYPES)
+ if (dwProvType > MAXPROVTYPES)
CRYPT_ReturnLastError(NTE_BAD_PROV_TYPE);
if (dwFlags & ~(CRYPT_MACHINE_DEFAULT | CRYPT_USER_DEFAULT | CRYPT_DELETE_DEFAULT)
|| dwFlags == CRYPT_DELETE_DEFAULT)
-------------- next part --------------
--- wine-orig/dlls/wininet/internet.c Fri May 31 20:20:38 2002
+++ wine/dlls/wininet/internet.c Sun Jun 9 23:25:07 2002
@@ -852,7 +852,7 @@
if (nSocket != -1)
{
*lpdwNumOfBytesWritten = INTERNET_WriteDataToStream(nSocket, lpBuffer, dwNumOfBytesToWrite);
- if (*lpdwNumOfBytesWritten < 0)
+ if ((int) *lpdwNumOfBytesWritten < 0)
*lpdwNumOfBytesWritten = 0;
else
retval = TRUE;
@@ -873,7 +873,7 @@
*
*/
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
- DWORD dwNumOfBytesToRead, LPDWORD dwNumOfBytesRead)
+ DWORD dwNumOfBytesToRead, LPDWORD lpdwNumOfBytesRead)
{
BOOL retval = FALSE;
int nSocket = -1;
@@ -899,9 +899,9 @@
if (nSocket != -1)
{
- *dwNumOfBytesRead = INTERNET_ReadDataFromStream(nSocket, lpBuffer, dwNumOfBytesToRead);
- if (*dwNumOfBytesRead < 0)
- *dwNumOfBytesRead = 0;
+ *lpdwNumOfBytesRead = INTERNET_ReadDataFromStream(nSocket, lpBuffer, dwNumOfBytesToRead);
+ if ((int) *lpdwNumOfBytesRead < 0)
+ *lpdwNumOfBytesRead = 0;
else
retval = TRUE;
}
-------------- next part --------------
--- wine-orig/dlls/comctl32/listview.c Fri May 31 19:32:14 2002
+++ wine/dlls/comctl32/listview.c Sun Jun 9 22:50:52 2002
@@ -1832,10 +1832,10 @@
{
checkselection = DPA_GetPtr(infoPtr->hdpaSelectionRanges,index);
if ((checkselection->lower >= nItem)&&
- (checkselection->lower + direction >= 0))
+ ((int)(checkselection->lower + direction) >= 0))
checkselection->lower += direction;
if ((checkselection->upper >= nItem)&&
- (checkselection->upper + direction >=0))
+ ((int)(checkselection->upper + direction) >= 0))
checkselection->upper += direction;
index ++;
}
-------------- next part --------------
--- wine-orig/dlls/ole32/oleobj.c Fri May 31 19:32:17 2002
+++ wine/dlls/ole32/oleobj.c Sun Jun 9 23:00:24 2002
@@ -288,8 +288,7 @@
/*
* Check for invalid cookies.
*/
- if ( (dwConnection < 0) ||
- (dwConnection >= This->maxSinks) )
+ if (dwConnection >= This->maxSinks)
return OLE_E_NOCONNECTION;
if (This->arrayOfSinks[dwConnection] == NULL)
@@ -647,8 +646,7 @@
/*
* Check for invalid cookies.
*/
- if ( (dwConnection < 0) ||
- (dwConnection >= This->maxCons) )
+ if (dwConnection >= This->maxCons)
return OLE_E_NOCONNECTION;
if (This->Connections[dwConnection].sink == NULL)
-------------- next part --------------
--- wine-orig/dlls/oleaut32/variant.c Fri May 31 19:32:17 2002
+++ wine/dlls/oleaut32/variant.c Sun Jun 9 23:17:34 2002
@@ -3932,7 +3932,7 @@
{
TRACE("( %ld, %p ), stub\n", ulIn, puiOut );
- if( ulIn < UI2_MIN || ulIn > UI2_MAX )
+ if( ulIn > UI2_MAX )
{
return DISP_E_OVERFLOW;
}
@@ -4032,7 +4032,7 @@
{
TRACE("( %ld, %p ), stub\n", lIn, pulOut );
- if( lIn < UI4_MIN )
+ if( lIn < (LONG) UI4_MIN )
{
return DISP_E_OVERFLOW;
}
@@ -4632,7 +4632,7 @@
*/
HRESULT WINAPI VarBstrCmp(BSTR left, BSTR right, LCID lcid, DWORD flags)
{
- DWORD r;
+ INT r;
FIXME("( %s %s %ld %lx ) partial stub\n", debugstr_w(left), debugstr_w(right), lcid, flags);
-------------- next part --------------
--- wine-orig/dlls/x11drv/winpos.c Sun Jun 2 23:28:33 2002
+++ wine/dlls/x11drv/winpos.c Sun Jun 9 22:45:16 2002
@@ -1402,7 +1402,7 @@
static unsigned __td_lookup( Window w, Window* list, unsigned max )
{
unsigned i;
- for( i = max - 1; i >= 0; i-- ) if( list[i] == w ) break;
+ for( i = max; i > 0; i-- ) if( list[i - 1] == w ) break;
return i;
}
More information about the wine-patches
mailing list