msvcp100: Avoid signed-unsigned integer comparisons

Andrew Talbot andrew.talbot at talbotville.com
Sat Dec 8 12:36:29 CST 2012


Changelog:
    msvcp100: Avoid signed-unsigned integer comparisons.

diff --git a/dlls/msvcp100/ios.c b/dlls/msvcp100/ios.c
index 58b60db..7c7e578 100644
--- a/dlls/msvcp100/ios.c
+++ b/dlls/msvcp100/ios.c
@@ -2074,7 +2074,7 @@ FILE* __cdecl _Fiopen_wchar(const wchar_t *name, int mode, int prot)
     };
 
     int real_mode = mode & ~(OPENMODE_ate|OPENMODE__Nocreate|OPENMODE__Noreplace|OPENMODE_binary);
-    int mode_idx;
+    size_t mode_idx;
     FILE *f = NULL;
 
     TRACE("(%s %d %d)\n", debugstr_w(name), mode, prot);
@@ -2218,7 +2218,9 @@ int __thiscall basic_filebuf_char_uflow(basic_filebuf_char *this)
 {
     char ch, buf[128], *to_next;
     const char *buf_next;
-    int c, i;
+    int c;
+    size_t i;
+    ptrdiff_t j;
 
     TRACE("(%p)\n", this);
 
@@ -2247,8 +2249,8 @@ int __thiscall basic_filebuf_char_uflow(basic_filebuf_char *this)
                 continue;
             }
 
-            for(i--; i>=buf_next-buf; i--)
-                ungetc(buf[i], this->file);
+            for(j = --i; j>=buf_next-buf; j--)
+                ungetc(buf[j], this->file);
             return ch;
         case CODECVT_noconv:
             return (unsigned char)buf[0];
@@ -2666,7 +2668,9 @@ unsigned short __thiscall basic_filebuf_wchar_uflow(basic_filebuf_wchar *this)
     wchar_t ch, *to_next;
     char buf[128];
     const char *buf_next;
-    int c, i;
+    int c;
+    size_t i;
+    ptrdiff_t j;
 
     TRACE("(%p)\n", this);
 
@@ -2692,8 +2696,8 @@ unsigned short __thiscall basic_filebuf_wchar_uflow(basic_filebuf_wchar *this)
             if(to_next == &ch)
                 continue;
 
-            for(i--; i>=buf_next-buf; i--)
-                ungetc(buf[i], this->file);
+            for(j = --i; j>=buf_next-buf; j--)
+                ungetc(buf[j], this->file);
             return ch;
         case CODECVT_noconv:
             if(i+1 < sizeof(wchar_t))




More information about the wine-patches mailing list