WININET: fix warnings generated with -Wsign-compare
Mike McCormack
mike at codeweavers.com
Fri Aug 6 22:01:21 CDT 2004
ChangeLog:
* fix warnings generated with -Wsign-compare
-------------- next part --------------
Index: dlls/wininet/ftp.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/ftp.c,v
retrieving revision 1.44
diff -u -r1.44 ftp.c
--- dlls/wininet/ftp.c 19 Jul 2004 21:49:39 -0000 1.44
+++ dlls/wininet/ftp.c 7 Aug 2004 01:39:24 -0000
@@ -849,7 +849,7 @@
{
if (nResCode == 257) /* Extract directory name */
{
- INT firstpos, lastpos, len;
+ DWORD firstpos, lastpos, len;
LPWSTR lpszResponseBuffer = WININET_strdup_AtoW(INTERNET_GetResponseBuffer());
for (firstpos = 0, lastpos = 0; lpszResponseBuffer[lastpos]; lastpos++)
@@ -1823,7 +1823,7 @@
DWORD len;
CHAR *buf;
DWORD nBytesSent = 0;
- DWORD nRC = 0;
+ int nRC = 0;
DWORD dwParamLen;
TRACE("%d: (%s) %d\n", ftpCmd, lpszParam, nSocket);
@@ -2409,7 +2409,8 @@
DWORD nBytesRead = 0;
DWORD nBytesSent = 0;
DWORD nTotalSent = 0;
- DWORD nBytesToSend, nLen, nRC = 1;
+ DWORD nBytesToSend, nLen;
+ int nRC = 1;
time_t s_long_time, e_long_time;
LONG nSeconds;
CHAR *lpszBuffer;
@@ -2627,7 +2628,7 @@
static void FTP_CloseFindNextHandle(LPWININETHANDLEHEADER hdr)
{
LPWININETFINDNEXTW lpwfn = (LPWININETFINDNEXTW) hdr;
- INT i;
+ DWORD i;
TRACE("\n");
Index: dlls/wininet/http.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/http.c,v
retrieving revision 1.75
diff -u -r1.75 http.c
--- dlls/wininet/http.c 22 Jul 2004 20:36:36 -0000 1.75
+++ dlls/wininet/http.c 7 Aug 2004 01:39:25 -0000
@@ -97,7 +97,7 @@
INT HTTP_GetStdHeaderIndex(LPCWSTR lpszField);
BOOL HTTP_InsertCustomHeader(LPWININETHTTPREQW lpwhr, LPHTTPHEADERW lpHdr);
INT HTTP_GetCustomHeaderIndex(LPWININETHTTPREQW lpwhr, LPCWSTR lpszField);
-BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, INT index);
+BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, DWORD index);
/***********************************************************************
* HTTP_Tokenize (internal)
@@ -118,7 +118,7 @@
for (i = 0; string[i]; i++)
if (!strncmpW(string+i, token_string, strlenW(token_string)))
{
- int j;
+ DWORD j;
tokens++;
/* we want to skip over separators, but not the null terminator */
for (j = 0; j < strlenW(token_string) - 1; j++)
@@ -266,7 +266,7 @@
len = MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, NULL, 0 );
hdr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, hdr, len );
- if( dwHeaderLength != -1 )
+ if( dwHeaderLength != ~0UL )
dwHeaderLength = len;
r = HttpAddRequestHeadersW( hHttpRequest, hdr, dwHeaderLength, dwModifier );
@@ -854,7 +854,7 @@
if (index == HTTP_QUERY_RAW_HEADERS_CRLF)
{
- int len = strlenW(lpwhr->lpszRawHeaders);
+ DWORD len = strlenW(lpwhr->lpszRawHeaders);
if (len + 1 > *lpdwBufferLength/sizeof(WCHAR))
{
*lpdwBufferLength = (len + 1) * sizeof(WCHAR);
@@ -872,8 +872,7 @@
{
static const WCHAR szCrLf[] = {'\r','\n',0};
LPWSTR * ppszRawHeaderLines = HTTP_Tokenize(lpwhr->lpszRawHeaders, szCrLf);
- int size = 0;
- int i;
+ DWORD i, size = 0;
LPWSTR pszString = (WCHAR*)lpBuffer;
for (i = 0; ppszRawHeaderLines[i]; i++)
@@ -889,7 +888,7 @@
for (i = 0; ppszRawHeaderLines[i]; i++)
{
- int len = strlenW(ppszRawHeaderLines[i]);
+ DWORD len = strlenW(ppszRawHeaderLines[i]);
memcpy(pszString, ppszRawHeaderLines[i], (len+1)*sizeof(WCHAR));
pszString += len+1;
}
@@ -971,7 +970,7 @@
}
else
{
- INT len = (strlenW(lphttpHdr->lpszValue) + 1) * sizeof(WCHAR);
+ DWORD len = (strlenW(lphttpHdr->lpszValue) + 1) * sizeof(WCHAR);
if (len > *lpdwBufferLength)
{
@@ -1087,7 +1086,7 @@
#undef FE
DWORD info_mod = dwInfoLevel & HTTP_QUERY_MODIFIER_FLAGS_MASK;
DWORD info = dwInfoLevel & HTTP_QUERY_HEADER_MASK;
- int i;
+ DWORD i;
TRACE("(%p, 0x%08lx)--> %ld\n", hHttpRequest, dwInfoLevel, dwInfoLevel);
TRACE(" Attribute:");
@@ -1456,7 +1455,7 @@
DWORD dwHeaderLength, LPVOID lpOptional ,DWORD dwOptionalLength)
{
INT cnt;
- INT i;
+ DWORD i;
BOOL bSuccess = FALSE;
LPWSTR requestString = NULL;
INT responseLen;
@@ -1514,7 +1513,7 @@
static const WCHAR szColon[] = { ':',' ',0 };
LPCWSTR *req;
LPWSTR p, szCookedHeaders = NULL;
- int len, n;
+ DWORD len, n;
char *ascii_req;
TRACE("Going to url %s %s\n", debugstr_w(lpwhr->lpszHostName), debugstr_w(lpwhr->lpszPath));
@@ -1996,9 +1995,9 @@
static const WCHAR szCrLf[] = {'\r','\n',0};
char bufferA[MAX_REPLY_LEN];
LPWSTR status_code, status_text;
- int cchMaxRawHeaders = 1024;
+ DWORD cchMaxRawHeaders = 1024;
LPWSTR lpszRawHeaders = HeapAlloc(GetProcessHeap(), 0, (cchMaxRawHeaders+1)*sizeof(WCHAR));
- int cchRawHeaders = 0;
+ DWORD cchRawHeaders = 0;
TRACE("-->\n");
@@ -2298,7 +2297,7 @@
BOOL bSuccess = FALSE;
INT index;
- TRACE("--> %s: %s - 0x%08x\n", debugstr_w(field), debugstr_w(value), (unsigned int)dwModifier);
+ TRACE("--> %s: %s - 0x%08lx\n", debugstr_w(field), debugstr_w(value), dwModifier);
/* Adjust modifier flags */
if (dwModifier & COALESCEFLASG)
@@ -2453,7 +2452,7 @@
*/
static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr)
{
- int i;
+ DWORD i;
LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hdr;
TRACE("\n");
@@ -2519,7 +2518,7 @@
*/
INT HTTP_GetCustomHeaderIndex(LPWININETHTTPREQW lpwhr, LPCWSTR lpszField)
{
- INT index;
+ DWORD index;
TRACE("%s\n", debugstr_w(lpszField));
@@ -2533,7 +2532,7 @@
if (index >= lpwhr->nCustHeaders)
index = -1;
- TRACE("Return: %d\n", index);
+ TRACE("Return: %lu\n", index);
return index;
}
@@ -2582,7 +2581,7 @@
* Delete header from array
* If this function is called, the indexs may change.
*/
-BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, INT index)
+BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, DWORD index)
{
if( lpwhr->nCustHeaders <= 0 )
return FALSE;
Index: dlls/wininet/internet.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/internet.c,v
retrieving revision 1.93
diff -u -r1.93 internet.c
--- dlls/wininet/internet.c 6 Aug 2004 18:57:53 -0000 1.93
+++ dlls/wininet/internet.c 7 Aug 2004 01:39:25 -0000
@@ -451,7 +451,7 @@
FE(INTERNET_FLAG_OFFLINE)
};
#undef FE
- int i;
+ DWORD i;
const char *access_type_str = "Unknown";
DWORD flag_val = dwFlags;
@@ -873,7 +873,7 @@
return FALSE;
}
- TRACE("index(%d) size(%ld)\n", lpwh->index, lpwh->size);
+ TRACE("index(%ld) size(%ld)\n", lpwh->index, lpwh->size);
lpFindFileData = (LPWIN32_FIND_DATAW) lpvFindData;
ZeroMemory(lpFindFileData, sizeof(WIN32_FIND_DATAA));
@@ -999,7 +999,7 @@
{
if (*dwComponentLen != 0)
{
- int nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL);
+ DWORD nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL);
if (*lppszComponent == NULL)
{
int nASCIIOffset=WideCharToMultiByte(CP_ACP,0,lpwszStart,lpwszComponent-lpwszStart,NULL,0,NULL,NULL);
@@ -1008,7 +1008,7 @@
}
else
{
- INT ncpylen = min((*dwComponentLen)-1, nASCIILength);
+ DWORD ncpylen = min((*dwComponentLen)-1, nASCIILength);
WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,*lppszComponent,ncpylen+1,NULL,NULL);
(*lppszComponent)[ncpylen]=0;
*dwComponentLen = ncpylen;
@@ -1101,7 +1101,7 @@
* INTERNET_SCHEME_UNKNOWN on failure
*
*/
-INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, INT nMaxCmp)
+static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
{
INTERNET_SCHEME iScheme=INTERNET_SCHEME_UNKNOWN;
static const WCHAR lpszFtp[]={'f','t','p',0};
@@ -1151,9 +1151,9 @@
* FALSE on failure
*
*/
-BOOL SetUrlComponentValueW(LPWSTR* lppszComponent, LPDWORD dwComponentLen, LPCWSTR lpszStart, INT len)
+static BOOL SetUrlComponentValueW(LPWSTR* lppszComponent, LPDWORD dwComponentLen, LPCWSTR lpszStart, DWORD len)
{
- TRACE("%s (%d)\n", debugstr_wn(lpszStart,len), len);
+ TRACE("%s (%ld)\n", debugstr_wn(lpszStart,len), len);
if ( (*dwComponentLen == 0) && (*lppszComponent == NULL) )
return FALSE;
@@ -1167,7 +1167,7 @@
}
else
{
- INT ncpylen = min((*dwComponentLen)-1, len);
+ DWORD ncpylen = min((*dwComponentLen)-1, len);
strncpyW(*lppszComponent, lpszStart, ncpylen);
(*lppszComponent)[ncpylen] = '\0';
*dwComponentLen = ncpylen;
Index: dlls/wininet/internet.h
===================================================================
RCS file: /home/wine/wine/dlls/wininet/internet.h,v
retrieving revision 1.27
diff -u -r1.27 internet.h
--- dlls/wininet/internet.h 19 Jul 2004 21:49:39 -0000 1.27
+++ dlls/wininet/internet.h 7 Aug 2004 01:39:25 -0000
@@ -184,7 +184,7 @@
WININET_NETCONNECTION netConnection;
HTTPHEADERW StdHeaders[HTTP_QUERY_MAX+1];
HTTPHEADERW *pCustHeaders;
- INT nCustHeaders;
+ DWORD nCustHeaders;
} WININETHTTPREQW, *LPWININETHTTPREQW;
@@ -224,7 +224,7 @@
typedef struct
{
WININETHANDLEHEADER hdr;
- int index;
+ DWORD index;
DWORD size;
LPFILEPROPERTIESW lpafp;
} WININETFINDNEXTW, *LPWININETFINDNEXTW;
Index: dlls/wininet/netconnection.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/netconnection.c,v
retrieving revision 1.7
diff -u -r1.7 netconnection.c
--- dlls/wininet/netconnection.c 30 Mar 2004 04:36:09 -0000 1.7
+++ dlls/wininet/netconnection.c 7 Aug 2004 01:39:25 -0000
@@ -413,7 +413,7 @@
struct timeval tv;
fd_set infd;
BOOL bSuccess = FALSE;
- INT nRecv = 0;
+ DWORD nRecv = 0;
FD_ZERO(&infd);
FD_SET(connection->socketFD, &infd);
@@ -450,7 +450,7 @@
{
lpszBuffer[nRecv++] = '\0';
*dwBuffer = nRecv;
- TRACE(":%d %s\n", nRecv, lpszBuffer);
+ TRACE(":%lu %s\n", nRecv, lpszBuffer);
return TRUE;
}
else
@@ -462,7 +462,7 @@
{
#ifdef HAVE_OPENSSL_SSL_H
long prev_timeout;
- INT nRecv = 0;
+ DWORD nRecv = 0;
BOOL success = TRUE;
prev_timeout = pSSL_CTX_get_timeout(ctx);
@@ -491,7 +491,7 @@
{
lpszBuffer[nRecv++] = '\0';
*dwBuffer = nRecv;
- TRACE("_SSL:%d %s\n", nRecv, lpszBuffer);
+ TRACE("_SSL:%lu %s\n", nRecv, lpszBuffer);
return TRUE;
}
return FALSE;
Index: dlls/wininet/urlcache.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/urlcache.c,v
retrieving revision 1.17
diff -u -r1.17 urlcache.c
--- dlls/wininet/urlcache.c 27 Jan 2004 00:01:43 -0000 1.17
+++ dlls/wininet/urlcache.c 7 Aug 2004 01:39:25 -0000
@@ -345,7 +345,7 @@
{ CSIDL_HISTORY, HistorySuffix, HistoryPrefix },
{ CSIDL_COOKIES, CookieSuffix, CookiePrefix },
};
- int i;
+ DWORD i;
for (i = 0; i < sizeof(DefaultContainerData) / sizeof(DefaultContainerData[0]); i++)
{
@@ -355,7 +355,7 @@
if (FAILED(SHGetSpecialFolderPathW(NULL, wszCachePath, DefaultContainerData[i].nFolder, TRUE)))
{
- ERR("Couldn't get path for default container %d\n", i);
+ ERR("Couldn't get path for default container %lu\n", i);
continue;
}
path_len = strlenW(wszCachePath);
@@ -878,7 +878,7 @@
0x98, 0x83, 0x7B, 0xE5, 0xCB, 0x4C, 0x78, 0xD1
};
BYTE key[4];
- int i;
+ DWORD i;
int subscript[sizeof(key) / sizeof(key[0])];
subscript[0] = *lpszKey;
@@ -1732,7 +1732,7 @@
/* Get file size */
dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh);
- if ((dwFileSizeLow == -1) && (GetLastError() != NO_ERROR))
+ if ((dwFileSizeLow == INVALID_FILE_SIZE) && (GetLastError() != NO_ERROR))
{
ERR("couldn't get file size (error is %ld)\n", GetLastError());
CloseHandle(hFile);
@@ -1904,7 +1904,7 @@
return FALSE;
}
- if (SetFilePointer(pStream->hFile, dwLocation, NULL, FILE_CURRENT) == -1)
+ if (SetFilePointer(pStream->hFile, dwLocation, NULL, FILE_CURRENT) == INVALID_SET_FILE_POINTER)
return FALSE;
return ReadFile(pStream->hFile, lpBuffer, *lpdwLen, lpdwLen, NULL);
}
Index: dlls/wininet/utility.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/utility.c,v
retrieving revision 1.19
diff -u -r1.19 utility.c
--- dlls/wininet/utility.c 19 Jul 2004 21:49:39 -0000 1.19
+++ dlls/wininet/utility.c 7 Aug 2004 01:39:25 -0000
@@ -207,7 +207,7 @@
FE(INTERNET_STATE_BUSY)
#undef FE
};
- int i;
+ DWORD i;
for (i = 0; i < (sizeof(internet_status) / sizeof(internet_status[0])); i++) {
if (internet_status[i].val == dwInternetStatus) return internet_status[i].name;
More information about the wine-patches
mailing list