ntdll: Sign-compare warnings fix (2 of 2)

Andrew Talbot andrew.talbot at talbotville.com
Thu Oct 23 16:24:08 CDT 2008


Changelog:
    ntdll: Sign-compare warnings fix.

diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index 0e98588..9d393c1 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,9 @@ 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) {
+                main_idx--;
                 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 +1553,9 @@ 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) {
+                main_idx--;
                 search_idx = 0;
                 while (search_idx < search_chars->Length / sizeof(WCHAR) &&
                          main_str->Buffer[main_idx] != search_chars->Buffer[search_idx]) {



More information about the wine-patches mailing list