[crt]
authorChristoph von Wittich <christoph_vw@reactos.org>
Sun, 16 Feb 2014 05:42:42 +0000 (05:42 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sun, 16 Feb 2014 05:42:42 +0000 (05:42 +0000)
fix swscanf winetest

svn path=/trunk/; revision=62202

reactos/lib/sdk/crt/string/scanf.h

index b27eb56..69ca719 100644 (file)
@@ -26,7 +26,7 @@
 #ifdef WIDE_SCANF
 #define _CHAR_ wchar_t
 #define _EOF_ WEOF
 #ifdef WIDE_SCANF
 #define _CHAR_ wchar_t
 #define _EOF_ WEOF
-#define _EOF_RET WEOF
+#define _EOF_RET (short)WEOF
 #define _ISSPACE_(c) iswspace(c)
 #define _ISDIGIT_(c) iswdigit(c)
 #define _WIDE2SUPPORTED_(c) c /* No conversion needed (wide to wide) */
 #define _ISSPACE_(c) iswspace(c)
 #define _ISDIGIT_(c) iswdigit(c)
 #define _WIDE2SUPPORTED_(c) c /* No conversion needed (wide to wide) */
@@ -88,8 +88,11 @@ _FUNCTION_ {
 #endif /* STRING */
 #endif /* CONSOLE */
 #endif /* WIDE_SCANF */
 #endif /* STRING */
 #endif /* CONSOLE */
 #endif /* WIDE_SCANF */
+
     nch = _GETC_(file);
     nch = _GETC_(file);
-    if (nch == _EOF_) return _EOF_RET;
+    if (nch == _EOF_) {
+        return _EOF_RET;
+    }
 
     while (*format) {
        /* a whitespace character in the format string causes scanf to read,
 
     while (*format) {
        /* a whitespace character in the format string causes scanf to read,
@@ -248,11 +251,12 @@ _FUNCTION_ {
                     /* skip initial whitespace */
                     while ((nch!=_EOF_) && _ISSPACE_(nch))
                         nch = _GETC_(file);
                     /* skip initial whitespace */
                     while ((nch!=_EOF_) && _ISSPACE_(nch))
                         nch = _GETC_(file);
-                   /* get sign. */
+
+                    /* get sign. */
                     if (nch == '-' || nch == '+') {
                     if (nch == '-' || nch == '+') {
-                       negative = (nch=='-');
-                       if (width>0) width--;
-                       if (width==0) break;
+                        negative = (nch=='-');
+                        if (width>0) width--;
+                        if (width==0) break;
                         nch = _GETC_(file);
                     }
                    /* get first digit. */
                         nch = _GETC_(file);
                     }
                    /* get first digit. */
@@ -274,12 +278,12 @@ _FUNCTION_ {
                     if (width!=0 && nch == '.') {
                         long double dec = 1;
                         nch = _GETC_(file);
                     if (width!=0 && nch == '.') {
                         long double dec = 1;
                         nch = _GETC_(file);
-                       if (width>0) width--;
+                        if (width>0) width--;
                         while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {
                             dec /= 10;
                             cur += dec * (nch - '0');
                             nch = _GETC_(file);
                         while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {
                             dec /= 10;
                             cur += dec * (nch - '0');
                             nch = _GETC_(file);
-                           if (width>0) width--;
+                            if (width>0) width--;
                         }
                     }
                    /* handle exponent */
                         }
                     }
                    /* handle exponent */
@@ -287,19 +291,19 @@ _FUNCTION_ {
                        int exponent = 0, negexp = 0;
                        double expcnt, shift;
                         nch = _GETC_(file);
                        int exponent = 0, negexp = 0;
                        double expcnt, shift;
                         nch = _GETC_(file);
-                       if (width>0) width--;
+                        if (width>0) width--;
                        /* possible sign on the exponent */
                        if (width!=0 && (nch=='+' || nch=='-')) {
                            negexp = (nch=='-');
                             nch = _GETC_(file);
                        /* possible sign on the exponent */
                        if (width!=0 && (nch=='+' || nch=='-')) {
                            negexp = (nch=='-');
                             nch = _GETC_(file);
-                           if (width>0) width--;
+                            if (width>0) width--;
                        }
                        /* exponent digits */
                        while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {
                            exponent *= 10;
                            exponent += (nch - '0');
                             nch = _GETC_(file);
                        }
                        /* exponent digits */
                        while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) {
                            exponent *= 10;
                            exponent += (nch - '0');
                             nch = _GETC_(file);
-                           if (width>0) width--;
+                            if (width>0) width--;
                         }
                        /* update 'cur' with this exponent. */
                        expcnt = 10;
                         }
                        /* update 'cur' with this exponent. */
                        expcnt = 10;
@@ -315,9 +319,9 @@ _FUNCTION_ {
                     st = 1;
                     if (!suppress) {
                        if (L_prefix) _SET_NUMBER_(long double);
                     st = 1;
                     if (!suppress) {
                        if (L_prefix) _SET_NUMBER_(long double);
-                       else if (l_prefix) _SET_NUMBER_(double);
-                       else _SET_NUMBER_(float);
-                   }
+                        else if (l_prefix) _SET_NUMBER_(double);
+                        else _SET_NUMBER_(float);
+                    }
                 }
                 break;
                /* According to msdn,
                 }
                 break;
                /* According to msdn,
@@ -494,9 +498,9 @@ _FUNCTION_ {
                     /* terminate */
                     if (!suppress) *sptr = 0;
 #ifdef _LIBCNT_
                     /* terminate */
                     if (!suppress) *sptr = 0;
 #ifdef _LIBCNT_
-            RtlFreeHeap(RtlGetProcessHeap(), 0, Mask);
+                    RtlFreeHeap(RtlGetProcessHeap(), 0, Mask);
 #else
 #else
-            HeapFree(GetProcessHeap(), 0, Mask);
+                    HeapFree(GetProcessHeap(), 0, Mask);
 #endif
                 }
                 break;
 #endif
                 }
                 break;