From ee423a157c2e7eab457797384547ce55d7aa6403 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 15 Feb 2015 11:24:52 +0000 Subject: [PATCH] [LIBS] Fix some MSVC warnings (and potential bugs) regarding signed/unsigned comparison. svn path=/trunk/; revision=66286 --- reactos/lib/drivers/sound/mmixer/sup.c | 3 ++- reactos/lib/fslib/ext2lib/Super.c | 16 ++++++++-------- reactos/lib/fslib/vfatlib/check/check.c | 2 +- reactos/lib/fslib/vfatlib/check/dosfsck.h | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/reactos/lib/drivers/sound/mmixer/sup.c b/reactos/lib/drivers/sound/mmixer/sup.c index bc72673f3c9..401e776b1e1 100644 --- a/reactos/lib/drivers/sound/mmixer/sup.c +++ b/reactos/lib/drivers/sound/mmixer/sup.c @@ -675,7 +675,8 @@ MMixerSetGetVolumeControlDetails( LPMIXERLINE_EXT MixerLine) { LPMIXERCONTROLDETAILS_UNSIGNED Input; - LONG Value, Index, Channel = 0; + LONG Value; + ULONG Index, Channel = 0; ULONG dwValue; MIXER_STATUS Status; LPMIXERVOLUME_DATA VolumeData; diff --git a/reactos/lib/fslib/ext2lib/Super.c b/reactos/lib/fslib/ext2lib/Super.c index 2f5aacb0411..433f0108bde 100644 --- a/reactos/lib/fslib/ext2lib/Super.c +++ b/reactos/lib/fslib/ext2lib/Super.c @@ -47,7 +47,7 @@ void ext2_print_super(PEXT2_SUPER_BLOCK pExt2Sb) DPRINT(" Creator OS: %lu\n", pExt2Sb->s_creator_os); DPRINT(" Revision Level: %lu\n", pExt2Sb->s_rev_level); DPRINT(" Reserved Block Default UID: %u\n", pExt2Sb->s_def_resuid); - DPRINT(" Reserved Block Default GID: %u\n", pExt2Sb->s_def_resgid); + DPRINT(" Reserved Block Default GID: %u\n", pExt2Sb->s_def_resgid); DPRINT(" uuid = "); for (i=0; i < 16; i++) DbgPrint("%x ", pExt2Sb->s_uuid[i]); @@ -75,13 +75,13 @@ bool ext2_initialize_sb(PEXT2_FILESYS Ext2Sys) { int frags_per_block = 0; ULONG overhead = 0; - int rem = 0; + ULONG rem = 0; ULONG i = 0; ULONG group_block = 0; ULONG numblocks = 0; PEXT2_SUPER_BLOCK pExt2Sb = Ext2Sys->ext2_sb; LARGE_INTEGER SysTime; - + NtQuerySystemTime(&SysTime); Ext2Sys->blocksize = EXT2_BLOCK_SIZE(pExt2Sb); @@ -201,14 +201,14 @@ retry: * XXX Not all block groups need the descriptor blocks, but * being clever is tricky... */ - overhead = (int) (3 + Ext2Sys->desc_blocks + Ext2Sys->inode_blocks_per_group); + overhead = (3 + Ext2Sys->desc_blocks + Ext2Sys->inode_blocks_per_group); /* * See if the last group is big enough to support the * necessary data structures. If not, we need to get rid of * it. */ - rem = (int) ((pExt2Sb->s_blocks_count - pExt2Sb->s_first_data_block) % + rem = ((pExt2Sb->s_blocks_count - pExt2Sb->s_first_data_block) % pExt2Sb->s_blocks_per_group); if ((Ext2Sys->group_desc_count == 1) && rem && (rem < overhead)) @@ -279,14 +279,14 @@ retry: numblocks -= 1 + Ext2Sys->desc_blocks; } - + numblocks -= 2 + Ext2Sys->inode_blocks_per_group; - + pExt2Sb->s_free_blocks_count += numblocks; Ext2Sys->group_desc[i].bg_free_blocks_count = (__u16)numblocks; Ext2Sys->group_desc[i].bg_free_inodes_count = (__u16)pExt2Sb->s_inodes_per_group; Ext2Sys->group_desc[i].bg_used_dirs_count = 0; - + group_block += pExt2Sb->s_blocks_per_group; } diff --git a/reactos/lib/fslib/vfatlib/check/check.c b/reactos/lib/fslib/vfatlib/check/check.c index 133028f8eb6..556a3a0ab47 100644 --- a/reactos/lib/fslib/vfatlib/check/check.c +++ b/reactos/lib/fslib/vfatlib/check/check.c @@ -838,7 +838,7 @@ static int subdirs(DOS_FS *fs,DOS_FILE *parent,FDSC **cp) int scan_root(DOS_FS *fs) { DOS_FILE **chain; - int i; + ULONG i; root = NULL; chain = &root; diff --git a/reactos/lib/fslib/vfatlib/check/dosfsck.h b/reactos/lib/fslib/vfatlib/check/dosfsck.h index 0ddbf2ba35e..5ae875c1cbd 100644 --- a/reactos/lib/fslib/vfatlib/check/dosfsck.h +++ b/reactos/lib/fslib/vfatlib/check/dosfsck.h @@ -178,8 +178,8 @@ extern void *FsCheckMemQueue; #define FAT_MAX_BAD(fs) (0xff7 | FAT_EXTD(fs)) #define FAT_IS_BAD(fs,v) ((v) >= FAT_MIN_BAD(fs) && (v) <= FAT_MAX_BAD(fs)) -/* return -16 as a number with fs->fat_bits bits */ -#define FAT_EXTD(fs) (((1 << fs->eff_fat_bits)-1) & ~0xf) +/* return -16 as an unsigned number with fs->fat_bits bits */ +#define FAT_EXTD(fs) (((1UL << fs->eff_fat_bits)-1) & ~0xf) #endif