Fix signed/unsigned comparison warnings.

This commit is contained in:
Hans Leidekker 2004-08-10 23:43:21 +00:00 committed by Alexandre Julliard
parent 8322fc6a57
commit 9baafec900
10 changed files with 27 additions and 29 deletions

View File

@ -358,7 +358,7 @@ UINT16 WINAPI GetAtomName16( ATOM atom, LPSTR buffer, INT16 count )
ATOMENTRY * entryPtr; ATOMENTRY * entryPtr;
HANDLE16 entry; HANDLE16 entry;
char * strPtr; char * strPtr;
UINT len; INT len;
char text[8]; char text[8];
TRACE("%x\n",atom); TRACE("%x\n",atom);

View File

@ -100,7 +100,7 @@ static BOOL dns_gethostbyname ( char *name, int *size )
WARN ("Error in gethostbyname_r %d (%d)\n", res, locerr); WARN ("Error in gethostbyname_r %d (%d)\n", res, locerr);
else else
{ {
size_t len = strlen ( host->h_name ); int len = strlen ( host->h_name );
if ( len < *size ) if ( len < *size )
{ {
strcpy ( name, host->h_name ); strcpy ( name, host->h_name );
@ -382,7 +382,7 @@ BOOL WINAPI GetComputerNameA(LPSTR name, LPDWORD size)
{ {
WCHAR nameW[ MAX_COMPUTERNAME_LENGTH + 1 ]; WCHAR nameW[ MAX_COMPUTERNAME_LENGTH + 1 ];
DWORD sizeW = MAX_COMPUTERNAME_LENGTH; DWORD sizeW = MAX_COMPUTERNAME_LENGTH;
int len; unsigned int len;
BOOL ret; BOOL ret;
if ( !GetComputerNameW (nameW, &sizeW) ) return FALSE; if ( !GetComputerNameW (nameW, &sizeW) ) return FALSE;
@ -515,7 +515,7 @@ BOOL WINAPI GetComputerNameExW( COMPUTER_NAME_FORMAT type, LPWSTR name, LPDWORD
TRACE ("-> %s (%d)\n", debugstr_a (buf), len); TRACE ("-> %s (%d)\n", debugstr_a (buf), len);
__TRY __TRY
{ {
int lenW = MultiByteToWideChar( CP_ACP, 0, buf, len, NULL, 0 ); unsigned int lenW = MultiByteToWideChar( CP_ACP, 0, buf, len, NULL, 0 );
if ( *size < lenW ) if ( *size < lenW )
{ {
MultiByteToWideChar( CP_ACP, 0, buf, len, name, *size ); MultiByteToWideChar( CP_ACP, 0, buf, len, name, *size );
@ -550,7 +550,7 @@ static WCHAR netbios_char ( WCHAR wc )
{ {
static const WCHAR special[] = {'!','@','#','$','%','^','&','\'',')','(','-','_','{','}','~'}; static const WCHAR special[] = {'!','@','#','$','%','^','&','\'',')','(','-','_','{','}','~'};
static const WCHAR deflt = '_'; static const WCHAR deflt = '_';
int i; unsigned int i;
if ( isalnumW ( wc ) ) return wc; if ( isalnumW ( wc ) ) return wc;
for ( i = 0; i < sizeof (special) / sizeof (WCHAR); i++ ) for ( i = 0; i < sizeof (special) / sizeof (WCHAR); i++ )

View File

@ -1891,7 +1891,7 @@ BOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput, LPCVOID lpBuffer, DWORD nNumber
if (mode & ENABLE_PROCESSED_OUTPUT) if (mode & ENABLE_PROCESSED_OUTPUT)
{ {
int i; unsigned int i;
for (i = 0; i < nNumberOfCharsToWrite; i++) for (i = 0; i < nNumberOfCharsToWrite; i++)
{ {

View File

@ -112,7 +112,7 @@ static void create_registry_keys( const SYSTEM_INFO *info )
static const WCHAR SysidW[] = {'A','T',' ','c','o','m','p','a','t','i','b','l','e',0}; static const WCHAR SysidW[] = {'A','T',' ','c','o','m','p','a','t','i','b','l','e',0};
static const WCHAR mhzKeyW[] = {'~','M','H','z',0}; static const WCHAR mhzKeyW[] = {'~','M','H','z',0};
int i; unsigned int i;
HKEY hkey, system_key, cpu_key; HKEY hkey, system_key, cpu_key;
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW, valueW; UNICODE_STRING nameW, valueW;

View File

@ -108,7 +108,7 @@ static inline BOOL WCEL_IsSingleLine(WCEL_Context* ctx, size_t len)
static inline COORD WCEL_GetCoord(WCEL_Context* ctx, int ofs) static inline COORD WCEL_GetCoord(WCEL_Context* ctx, int ofs)
{ {
COORD c; COORD c;
unsigned len = ctx->csbi.dwSize.X - ctx->csbi.dwCursorPosition.X; int len = ctx->csbi.dwSize.X - ctx->csbi.dwCursorPosition.X;
c.Y = ctx->csbi.dwCursorPosition.Y; c.Y = ctx->csbi.dwCursorPosition.Y;
if (ofs >= len) if (ofs >= len)
@ -330,7 +330,7 @@ static void WCEL_FindPrevInHist(WCEL_Context* ctx)
{ {
int startPos = ctx->histPos; int startPos = ctx->histPos;
WCHAR* data; WCHAR* data;
int len, oldofs; unsigned int len, oldofs;
if (ctx->histPos && ctx->histPos == ctx->histSize) { if (ctx->histPos && ctx->histPos == ctx->histSize) {
startPos--; startPos--;
@ -394,13 +394,13 @@ static void WCEL_MoveRight(WCEL_Context* ctx)
static void WCEL_MoveToLeftWord(WCEL_Context* ctx) static void WCEL_MoveToLeftWord(WCEL_Context* ctx)
{ {
int new_ofs = WCEL_GetLeftWordTransition(ctx, ctx->ofs); unsigned int new_ofs = WCEL_GetLeftWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs) ctx->ofs = new_ofs; if (new_ofs != ctx->ofs) ctx->ofs = new_ofs;
} }
static void WCEL_MoveToRightWord(WCEL_Context* ctx) static void WCEL_MoveToRightWord(WCEL_Context* ctx)
{ {
int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs); unsigned int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs) ctx->ofs = new_ofs; if (new_ofs != ctx->ofs) ctx->ofs = new_ofs;
} }
@ -461,7 +461,7 @@ static void WCEL_TransposeChar(WCEL_Context* ctx)
static void WCEL_TransposeWords(WCEL_Context* ctx) static void WCEL_TransposeWords(WCEL_Context* ctx)
{ {
int left_ofs = WCEL_GetLeftWordTransition(ctx, ctx->ofs), unsigned int left_ofs = WCEL_GetLeftWordTransition(ctx, ctx->ofs),
right_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs); right_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (left_ofs < ctx->ofs && right_ofs > ctx->ofs) if (left_ofs < ctx->ofs && right_ofs > ctx->ofs)
{ {
@ -483,10 +483,10 @@ static void WCEL_TransposeWords(WCEL_Context* ctx)
static void WCEL_LowerCaseWord(WCEL_Context* ctx) static void WCEL_LowerCaseWord(WCEL_Context* ctx)
{ {
int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs); unsigned int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs) if (new_ofs != ctx->ofs)
{ {
int i; unsigned int i;
for (i = ctx->ofs; i <= new_ofs; i++) for (i = ctx->ofs; i <= new_ofs; i++)
ctx->line[i] = tolowerW(ctx->line[i]); ctx->line[i] = tolowerW(ctx->line[i]);
WCEL_Update(ctx, ctx->ofs, new_ofs - ctx->ofs + 1); WCEL_Update(ctx, ctx->ofs, new_ofs - ctx->ofs + 1);
@ -496,10 +496,10 @@ static void WCEL_LowerCaseWord(WCEL_Context* ctx)
static void WCEL_UpperCaseWord(WCEL_Context* ctx) static void WCEL_UpperCaseWord(WCEL_Context* ctx)
{ {
int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs); unsigned int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs) if (new_ofs != ctx->ofs)
{ {
int i; unsigned int i;
for (i = ctx->ofs; i <= new_ofs; i++) for (i = ctx->ofs; i <= new_ofs; i++)
ctx->line[i] = toupperW(ctx->line[i]); ctx->line[i] = toupperW(ctx->line[i]);
WCEL_Update(ctx, ctx->ofs, new_ofs - ctx->ofs + 1); WCEL_Update(ctx, ctx->ofs, new_ofs - ctx->ofs + 1);
@ -509,10 +509,10 @@ static void WCEL_UpperCaseWord(WCEL_Context* ctx)
static void WCEL_CapitalizeWord(WCEL_Context* ctx) static void WCEL_CapitalizeWord(WCEL_Context* ctx)
{ {
int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs); unsigned int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs) if (new_ofs != ctx->ofs)
{ {
int i; unsigned int i;
ctx->line[ctx->ofs] = toupperW(ctx->line[ctx->ofs]); ctx->line[ctx->ofs] = toupperW(ctx->line[ctx->ofs]);
for (i = ctx->ofs + 1; i <= new_ofs; i++) for (i = ctx->ofs + 1; i <= new_ofs; i++)
@ -568,7 +568,7 @@ static void WCEL_DeleteCurrChar(WCEL_Context* ctx)
static void WCEL_DeleteLeftWord(WCEL_Context* ctx) static void WCEL_DeleteLeftWord(WCEL_Context* ctx)
{ {
int new_ofs = WCEL_GetLeftWordTransition(ctx, ctx->ofs); unsigned int new_ofs = WCEL_GetLeftWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs) if (new_ofs != ctx->ofs)
{ {
WCEL_DeleteString(ctx, new_ofs, ctx->ofs); WCEL_DeleteString(ctx, new_ofs, ctx->ofs);
@ -578,7 +578,7 @@ static void WCEL_DeleteLeftWord(WCEL_Context* ctx)
static void WCEL_DeleteRightWord(WCEL_Context* ctx) static void WCEL_DeleteRightWord(WCEL_Context* ctx)
{ {
int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs); unsigned int new_ofs = WCEL_GetRightWordTransition(ctx, ctx->ofs);
if (new_ofs != ctx->ofs) if (new_ofs != ctx->ofs)
{ {
WCEL_DeleteString(ctx, ctx->ofs, new_ofs); WCEL_DeleteString(ctx, ctx->ofs, new_ofs);

View File

@ -674,7 +674,7 @@ DWORD WINAPI GlobalCompact16( DWORD desired )
*/ */
void WINAPI GlobalFreeAll16( HGLOBAL16 owner ) void WINAPI GlobalFreeAll16( HGLOBAL16 owner )
{ {
DWORD i; int i;
GLOBALARENA *pArena; GLOBALARENA *pArena;
pArena = pGlobalArena; pArena = pGlobalArena;

View File

@ -623,7 +623,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
NE_MODULE *pModule; NE_MODULE *pModule;
BYTE *pData, *pTempEntryTable; BYTE *pData, *pTempEntryTable;
char *buffer, *fastload = NULL; char *buffer, *fastload = NULL;
int fastload_offset = 0, fastload_length = 0; unsigned int fastload_offset = 0, fastload_length = 0;
ET_ENTRY *entry; ET_ENTRY *entry;
ET_BUNDLE *bundle, *oldbundle; ET_BUNDLE *bundle, *oldbundle;
OFSTRUCT *ofs; OFSTRUCT *ofs;

View File

@ -309,9 +309,8 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG_PTR l
*/ */
BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR lparam ) BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR lparam )
{ {
int i; int i, len = 0;
BOOL ret = FALSE; BOOL ret = FALSE;
DWORD len = 0;
LPWSTR type = NULL; LPWSTR type = NULL;
NTSTATUS status; NTSTATUS status;
const IMAGE_RESOURCE_DIRECTORY *resdir; const IMAGE_RESOURCE_DIRECTORY *resdir;
@ -422,10 +421,9 @@ done:
*/ */
BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam ) BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam )
{ {
int i; int i, len = 0;
BOOL ret = FALSE; BOOL ret = FALSE;
LPWSTR name = NULL; LPWSTR name = NULL;
DWORD len = 0;
NTSTATUS status; NTSTATUS status;
UNICODE_STRING typeW; UNICODE_STRING typeW;
LDR_RESOURCE_INFO info; LDR_RESOURCE_INFO info;

View File

@ -129,7 +129,7 @@ DWORD WINAPI WaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
{ {
NTSTATUS status; NTSTATUS status;
HANDLE hloc[MAXIMUM_WAIT_OBJECTS]; HANDLE hloc[MAXIMUM_WAIT_OBJECTS];
int i; unsigned int i;
if (count >= MAXIMUM_WAIT_OBJECTS) if (count >= MAXIMUM_WAIT_OBJECTS)
{ {

View File

@ -198,7 +198,7 @@ static UINT get_registry_drive_type( const WCHAR *root )
RtlInitUnicodeString( &nameW, driveW ); RtlInitUnicodeString( &nameW, driveW );
if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy )) if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy ))
{ {
int i; unsigned int i;
WCHAR *data = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data; WCHAR *data = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data;
for (i = 0; i < sizeof(drive_types)/sizeof(drive_types[0]); i++) for (i = 0; i < sizeof(drive_types)/sizeof(drive_types[0]); i++)
@ -569,7 +569,7 @@ static void VOLUME_GetSuperblockLabel( enum fs_type type, const BYTE *superblock
if (superblock[0x58] == 0x25 && superblock[0x59] == 0x2f && /* Unicode ID */ if (superblock[0x58] == 0x25 && superblock[0x59] == 0x2f && /* Unicode ID */
((ver == 0x40) || (ver == 0x43) || (ver == 0x45))) ((ver == 0x40) || (ver == 0x43) || (ver == 0x45)))
{ /* yippee, unicode */ { /* yippee, unicode */
int i; unsigned int i;
if (len > 17) len = 17; if (len > 17) len = 17;
for (i = 0; i < len-1; i++) for (i = 0; i < len-1; i++)