Some sscanf fixes to get wxtide32.exe running

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

 



Changelog:
	dlls/msvcrt/scanf.h, wine/dlls/msvcrt/tests/scanf.c:
	Fix some sccanf cases and testcase to get wxtide32.exe running

-- 
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

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.9
diff -u -r1.9 scanf.h
--- wine/dlls/msvcrt/scanf.h	11 Jan 2003 22:50:15 -0000	1.9
+++ wine/dlls/msvcrt/scanf.h	13 May 2003 20:21:02 -0000
@@ -4,7 +4,7 @@
  *
  * Copyright 1996,1998 Marcus Meissner
  * Copyright 1996 Jukka Iivonen
- * Copyright 1997,2000 Uwe Bonnes
+ * Copyright 1997,2000, 2003 Uwe Bonnes
  * Copyright 2000 Jon Griffiths
  * Copyright 2002 Daniel Gudbjartsson
  *
@@ -82,12 +82,12 @@
     if (!*format) return 0;
 #ifndef WIDE_SCANF
 #ifdef CONSOLE
-    WARN("(\"%s\"): semi-stub\n", format);
+    WARN("(%s): semi-stub\n", debugstr_a(format));
 #else /* CONSOLE */
 #ifdef STRING
-    WARN("%s (\"%s\"): semi-stub\n", file, format);
+    WARN("%s (%s): semi-stub\n", file, debugstr_a(format));
 #else /* STRING */
-    WARN("%p (\"%s\"): semi-stub\n", file, format);
+    WARN("%p (%s): semi-stub\n", file, debugstr_a(format));
 #endif /* STRING */
 #endif /* CONSOLE */
 #endif /* WIDE_SCANF */
@@ -260,7 +260,7 @@
                     }
 		    /* get first digit. */
 		    if (!_ISDIGIT_(nch)) break;
-		    cur = (nch - '0') * (negative ? -1 : 1);
+		    cur = (nch - '0');
                     nch = _GETC_(file);
 		    if (width>0) width--;
                     /* read until no more digits */
@@ -409,8 +409,8 @@
 #else /* WIDE_SCANF */
 			*c = nch;
 #endif /* WIDE_SCANF */
-			st = 1;
 		    }
+		    st = 1;
  		    nch = _GETC_(file);
 	        }
 		break;
@@ -422,9 +422,9 @@
 #else /* WIDE_SCANF */
 			*c = _CONVERT_(nch);
 #endif /* WIDE_SCANF */
-			st = 1;
 		    }
 		    nch = _GETC_(file);
+		    st = 1;
 	        }
 		break;
 	    case 'n': {
--- wine/dlls/msvcrt/tests/scanf.c.~1.4.~	2003-01-12 14:24:51.000000000 +0100
+++ wine/dlls/msvcrt/tests/scanf.c	2003-05-13 22:13:49.000000000 +0200
@@ -24,9 +24,12 @@
 
 static void test_sscanf( void )
 {
-    char buffer[100];
+    char buffer[100], buffer1[100];
     char format[20];
     int result, ret;
+    float res1= -82.6267, res2= 27.76, res11, res12;
+    char pname[]=" St. Petersburg, Florida\n";
+    
 
     /* check EOF */
     strcpy(buffer,"");
@@ -51,6 +54,16 @@
     strcpy(format,"%\"%%%d%@");  /* work around gcc format check */
     ok( sscanf(buffer, format, &result) == 1, "sscanf failed" );
     ok( result == 12, "sscanf reads %x instead of %x", result, 12 );
+
+    /*Check float */
+    ret = sprintf(buffer,"%f %f",res1, res2);
+    ret = sscanf(buffer,"%f%f",&res11, &res12);
+    ok( (res11 == res1) && (res12 == res2), "Error reading floats");
+    ret = sprintf(buffer," %s", pname);
+    ret = sscanf(buffer,"%*c%[^\n]",buffer1);
+    ok( ret = 1, "Error with format \"%s\"","%*c%[^\n]");
+    ok( strncmp(pname,buffer1,strlen(buffer1)) == 0, "Error with \"%s\" \"%s\"",pname, buffer1);
+    
 }
 
 


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

  Powered by Linux