From 13b6ce6da80eafe44f3de98b767d2135b6d7bcb8 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 9 Aug 2004 18:54:23 +0000 Subject: [PATCH] Fix warnings generated with -Wsign-compare. --- dlls/wininet/ftp.c | 9 +++++---- dlls/wininet/http.c | 35 +++++++++++++++++------------------ dlls/wininet/internet.c | 16 ++++++++-------- dlls/wininet/internet.h | 4 ++-- dlls/wininet/netconnection.c | 8 ++++---- dlls/wininet/urlcache.c | 10 +++++----- dlls/wininet/utility.c | 2 +- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 78031a9e7d9..d1a8ec6af38 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -849,7 +849,7 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPWSTR lpszC { 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 @@ BOOL FTP_SendCommandA(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam, 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 @@ BOOL FTP_SendData(LPWININETFTPSESSIONW lpwfs, INT nDataSocket, HANDLE hFile) 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_CloseSessionHandle(LPWININETHANDLEHEADER hdr) static void FTP_CloseFindNextHandle(LPWININETHANDLEHEADER hdr) { LPWININETFINDNEXTW lpwfn = (LPWININETFINDNEXTW) hdr; - INT i; + DWORD i; TRACE("\n"); diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 9862c6b1292..6bb362e9a61 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -97,7 +97,7 @@ BOOL HTTP_InterpretHttpHeader(LPWSTR buffer, LPWSTR field, INT fieldlen, LPWSTR 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 @@ static LPWSTR * HTTP_Tokenize(LPCWSTR string, LPCWSTR token_string) 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 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest, 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 @@ BOOL WINAPI HTTP_HttpQueryInfoW( LPWININETHTTPREQW lpwhr, DWORD dwInfoLevel, 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 @@ BOOL WINAPI HTTP_HttpQueryInfoW( LPWININETHTTPREQW lpwhr, DWORD dwInfoLevel, { 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 @@ BOOL WINAPI HTTP_HttpQueryInfoW( LPWININETHTTPREQW lpwhr, DWORD dwInfoLevel, 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 @@ BOOL WINAPI HTTP_HttpQueryInfoW( LPWININETHTTPREQW lpwhr, DWORD dwInfoLevel, } else { - INT len = (strlenW(lphttpHdr->lpszValue) + 1) * sizeof(WCHAR); + DWORD len = (strlenW(lphttpHdr->lpszValue) + 1) * sizeof(WCHAR); if (len > *lpdwBufferLength) { @@ -1087,7 +1086,7 @@ BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, #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 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional ,DWORD dwOptionalLength) { INT cnt; - INT i; + DWORD i; BOOL bSuccess = FALSE; LPWSTR requestString = NULL; INT responseLen; @@ -1514,7 +1513,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders, 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 @@ BOOL HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr) 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 HTTP_ProcessHeader(LPWININETHTTPREQW lpwhr, LPCWSTR field, LPCWSTR value, D 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 @@ VOID HTTP_CloseConnection(LPWININETHTTPREQW lpwhr) */ static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr) { - int i; + DWORD i; LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hdr; TRACE("\n"); @@ -2519,7 +2518,7 @@ void HTTP_CloseHTTPSessionHandle(LPWININETHANDLEHEADER hdr) */ INT HTTP_GetCustomHeaderIndex(LPWININETHTTPREQW lpwhr, LPCWSTR lpszField) { - INT index; + DWORD index; TRACE("%s\n", debugstr_w(lpszField)); @@ -2533,7 +2532,7 @@ INT HTTP_GetCustomHeaderIndex(LPWININETHTTPREQW lpwhr, LPCWSTR lpszField) if (index >= lpwhr->nCustHeaders) index = -1; - TRACE("Return: %d\n", index); + TRACE("Return: %lu\n", index); return index; } @@ -2582,7 +2581,7 @@ BOOL HTTP_InsertCustomHeader(LPWININETHTTPREQW lpwhr, LPHTTPHEADERW lpHdr) * 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; diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 3783d008dbb..587f386e29f 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -451,7 +451,7 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, FE(INTERNET_FLAG_OFFLINE) }; #undef FE - int i; + DWORD i; const char *access_type_str = "Unknown"; DWORD flag_val = dwFlags; @@ -873,7 +873,7 @@ BOOL WINAPI INTERNET_FindNextFileW(LPWININETFINDNEXTW lpwh, LPVOID lpvFindData) 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 @@ void ConvertUrlComponentValue(LPSTR* lppszComponent, LPDWORD dwComponentLen, { 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 @@ void ConvertUrlComponentValue(LPSTR* lppszComponent, LPDWORD dwComponentLen, } 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 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, * 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 @@ INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, INT nMaxCmp) * 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 @@ BOOL SetUrlComponentValueW(LPWSTR* lppszComponent, LPDWORD dwComponentLen, LPCWS } else { - INT ncpylen = min((*dwComponentLen)-1, len); + DWORD ncpylen = min((*dwComponentLen)-1, len); strncpyW(*lppszComponent, lpszStart, ncpylen); (*lppszComponent)[ncpylen] = '\0'; *dwComponentLen = ncpylen; diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 88780308a55..ccbab953a53 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -184,7 +184,7 @@ typedef struct WININET_NETCONNECTION netConnection; HTTPHEADERW StdHeaders[HTTP_QUERY_MAX+1]; HTTPHEADERW *pCustHeaders; - INT nCustHeaders; + DWORD nCustHeaders; } WININETHTTPREQW, *LPWININETHTTPREQW; @@ -224,7 +224,7 @@ typedef struct typedef struct { WININETHANDLEHEADER hdr; - int index; + DWORD index; DWORD size; LPFILEPROPERTIESW lpafp; } WININETFINDNEXTW, *LPWININETFINDNEXTW; diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index 4ad372d2103..6b338a0a337 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -413,7 +413,7 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD 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 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD { lpszBuffer[nRecv++] = '\0'; *dwBuffer = nRecv; - TRACE(":%d %s\n", nRecv, lpszBuffer); + TRACE(":%lu %s\n", nRecv, lpszBuffer); return TRUE; } else @@ -462,7 +462,7 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD { #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 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD { lpszBuffer[nRecv++] = '\0'; *dwBuffer = nRecv; - TRACE("_SSL:%d %s\n", nRecv, lpszBuffer); + TRACE("_SSL:%lu %s\n", nRecv, lpszBuffer); return TRUE; } return FALSE; diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c index 32bf64a4ca7..80d2d0e50fc 100644 --- a/dlls/wininet/urlcache.c +++ b/dlls/wininet/urlcache.c @@ -345,7 +345,7 @@ void URLCacheContainers_CreateDefaults() { 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 @@ void URLCacheContainers_CreateDefaults() 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 @@ static DWORD URLCache_HashKey(LPCSTR lpszKey) 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 @@ BOOL WINAPI CommitUrlCacheEntryA( /* 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 @@ BOOL WINAPI ReadUrlCacheEntryStream( 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); } diff --git a/dlls/wininet/utility.c b/dlls/wininet/utility.c index de8c02fd54a..e6415868744 100644 --- a/dlls/wininet/utility.c +++ b/dlls/wininet/utility.c @@ -207,7 +207,7 @@ static const char *get_callback_name(DWORD dwInternetStatus) { 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;