Test and fix for Bug 1878

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
	wine/dlls/msvcrt/scanf.h  wine/dlls/msvcrt/tests/scanf.c
	Patch and test for bug # 1878 (scanf %i handledd wrong)
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/msvcrt/scanf.h
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/scanf.h,v
retrieving revision 1.11
diff -u -r1.11 scanf.h
--- wine/dlls/msvcrt/scanf.h	10 Oct 2003 00:00:19 -0000	1.11
+++ wine/dlls/msvcrt/scanf.h	13 Dec 2003 22:20:19 -0000
@@ -168,7 +168,7 @@
 		base = 10; number_signed = 1;
 		goto number;
 	    case 'i': /* generic integer */
-		base = 0; number_signed = 1;
+		base = 10; number_signed = 1;
 	    number: {
 		    /* read an integer */
                     long unsigned int cur = 0;
Index: wine/dlls/msvcrt/tests/scanf.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/tests/scanf.c,v
retrieving revision 1.9
diff -u -r1.9 scanf.c
--- wine/dlls/msvcrt/tests/scanf.c	28 Oct 2003 00:04:42 -0000	1.9
+++ wine/dlls/msvcrt/tests/scanf.c	13 Dec 2003 22:20:20 -0000
@@ -73,6 +73,15 @@
     ret = sscanf(buffer+2,"%*c%n",&number_so_far);
     ok(ret == 0 , "problem with format arg \"%%*c%%n\"");
     ok(number_so_far == 1,"Read wrong arg for \"%%n\" %d instead of 2",number_so_far);
+
+    /* Check %i according to bug 1878 */
+    strcpy(buffer,"123");
+    ret = sscanf(buffer, "%i", &result);
+    ok( ret == 1 , "Wrong number of arguments read");
+    ok(result == 123, "Wrong number read");
+    ret = sscanf(buffer, "%d", &result);
+    ok( ret == 1 , "Wrong number of arguments read");
+    ok(result == 123, "Wrong number read");
 }
 
 static void test_sprintf( void )


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux