Andrew Talbot : ntdll: Sign-compare warnings fix.

Alexandre Julliard julliard at winehq.org
Fri Oct 24 08:12:50 CDT 2008


Module: wine
Branch: master
Commit: a63749cce0330fe3e4ee193395dfca3a17a35e8e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a63749cce0330fe3e4ee193395dfca3a17a35e8e

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Thu Oct 23 22:24:04 2008 +0100

ntdll: Sign-compare warnings fix.

---

 dlls/ntdll/cdrom.c  |    2 +-
 dlls/ntdll/heap.c   |    6 +++---
 dlls/ntdll/reg.c    |    2 +-
 dlls/ntdll/rtlstr.c |    9 +++++----
 dlls/ntdll/thread.c |    4 ++--
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c
index f6fed81..998b2dc 100644
--- a/dlls/ntdll/cdrom.c
+++ b/dlls/ntdll/cdrom.c
@@ -1370,7 +1370,7 @@ static NTSTATUS CDROM_RawRead(int fd, const RAW_READ_INFO* raw, void* buffer, DW
         DWORD lba = raw->DiskOffset.QuadPart >> 11;
         struct cdrom_msf*       msf;
         PBYTE                   *bp; /* current buffer pointer */
-        int i;
+        DWORD i;
 
         if ((lba + raw->SectorCount) >
             ((1 << 8*sizeof(msf->cdmsf_min0)) * CD_SECS * CD_FRAMES
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 44b88b2..cd3fdd7 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -256,7 +256,7 @@ static RTL_CRITICAL_SECTION_DEBUG process_heap_critsect_debug =
  */
 static void HEAP_Dump( HEAP *heap )
 {
-    int i;
+    unsigned int i;
     SUBHEAP *subheap;
     char *ptr;
 
@@ -620,7 +620,7 @@ static SUBHEAP *HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
 {
     SUBHEAP *subheap;
     FREE_LIST_ENTRY *pEntry;
-    int i;
+    unsigned int i;
 
     /* Commit memory */
 
@@ -819,7 +819,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
  */
 static BOOL HEAP_IsValidArenaPtr( const HEAP *heap, const ARENA_FREE *ptr )
 {
-    int i;
+    unsigned int i;
     const SUBHEAP *subheap = HEAP_FindSubHeap( heap, ptr );
     if (!subheap) return FALSE;
     if ((const char *)ptr >= (const char *)subheap->base + subheap->headerSize) return TRUE;
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 425ddf8..af0f200 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -899,7 +899,7 @@ static NTSTATUS RTL_ReportRegistryValue(PKEY_VALUE_FULL_INFORMATION pInfo,
     NTSTATUS status = STATUS_SUCCESS;
     ULONG len;
     LPWSTR String;
-    INT count = 0;
+    ULONG count = 0;
 
     if (pInfo == NULL)
     {
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index 0e98588..3a50155 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -1511,8 +1511,7 @@ NTSTATUS WINAPI RtlFindCharInUnicodeString(
     const UNICODE_STRING *search_chars, /* [I] Unicode string which contains the characters to search for */
     USHORT *pos)                        /* [O] Position of the first character found + 2 */
 {
-    int main_idx;
-    unsigned int search_idx;
+    unsigned int main_idx, search_idx;
 
     switch (flags) {
         case 0:
@@ -1527,7 +1526,8 @@ NTSTATUS WINAPI RtlFindCharInUnicodeString(
             *pos = 0;
             return STATUS_NOT_FOUND;
         case 1:
-            for (main_idx = main_str->Length / sizeof(WCHAR) - 1; main_idx >= 0; main_idx--) {
+            main_idx = main_str->Length / sizeof(WCHAR);
+            while (main_idx-- > 0) {
                 for (search_idx = 0; search_idx < search_chars->Length / sizeof(WCHAR); search_idx++) {
                     if (main_str->Buffer[main_idx] == search_chars->Buffer[search_idx]) {
                         *pos = main_idx * sizeof(WCHAR);
@@ -1552,7 +1552,8 @@ NTSTATUS WINAPI RtlFindCharInUnicodeString(
             *pos = 0;
             return STATUS_NOT_FOUND;
         case 3:
-            for (main_idx = main_str->Length / sizeof(WCHAR) - 1; main_idx >= 0; main_idx--) {
+            main_idx = main_str->Length / sizeof(WCHAR);
+            while (main_idx-- > 0) {
                 search_idx = 0;
                 while (search_idx < search_chars->Length / sizeof(WCHAR) &&
                          main_str->Buffer[main_idx] != search_chars->Buffer[search_idx]) {
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 9411db1..47e0196 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -274,8 +274,8 @@ HANDLE thread_init(void)
     /* allocate and initialize the initial TEB */
 
     sigstack_total_size = get_signal_stack_total_size();
-    while (1 << sigstack_zero_bits < sigstack_total_size) sigstack_zero_bits++;
-    assert( 1 << sigstack_zero_bits == sigstack_total_size );  /* must be a power of 2 */
+    while (1U << sigstack_zero_bits < sigstack_total_size) sigstack_zero_bits++;
+    assert( 1U << sigstack_zero_bits == sigstack_total_size );  /* must be a power of 2 */
     assert( sigstack_total_size >= sizeof(TEB) + sizeof(struct startup_info) );
     thread_info.teb_size = sigstack_total_size;
 




More information about the wine-cvs mailing list