Fix some sscanf cases and testcase to get wxtide32.exe running.
This commit is contained in:
parent
5d6f328e0d
commit
29c7e32f83
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 1996,1998 Marcus Meissner
|
* Copyright 1996,1998 Marcus Meissner
|
||||||
* Copyright 1996 Jukka Iivonen
|
* Copyright 1996 Jukka Iivonen
|
||||||
* Copyright 1997,2000 Uwe Bonnes
|
* Copyright 1997,2000, 2003 Uwe Bonnes
|
||||||
* Copyright 2000 Jon Griffiths
|
* Copyright 2000 Jon Griffiths
|
||||||
* Copyright 2002 Daniel Gudbjartsson
|
* Copyright 2002 Daniel Gudbjartsson
|
||||||
*
|
*
|
||||||
|
@ -82,12 +82,12 @@ int _FUNCTION_ {
|
||||||
if (!*format) return 0;
|
if (!*format) return 0;
|
||||||
#ifndef WIDE_SCANF
|
#ifndef WIDE_SCANF
|
||||||
#ifdef CONSOLE
|
#ifdef CONSOLE
|
||||||
WARN("(\"%s\"): semi-stub\n", format);
|
WARN("(%s): semi-stub\n", debugstr_a(format));
|
||||||
#else /* CONSOLE */
|
#else /* CONSOLE */
|
||||||
#ifdef STRING
|
#ifdef STRING
|
||||||
WARN("%s (\"%s\"): semi-stub\n", file, format);
|
WARN("%s (%s): semi-stub\n", file, debugstr_a(format));
|
||||||
#else /* STRING */
|
#else /* STRING */
|
||||||
WARN("%p (\"%s\"): semi-stub\n", file, format);
|
WARN("%p (%s): semi-stub\n", file, debugstr_a(format));
|
||||||
#endif /* STRING */
|
#endif /* STRING */
|
||||||
#endif /* CONSOLE */
|
#endif /* CONSOLE */
|
||||||
#endif /* WIDE_SCANF */
|
#endif /* WIDE_SCANF */
|
||||||
|
@ -260,7 +260,7 @@ int _FUNCTION_ {
|
||||||
}
|
}
|
||||||
/* get first digit. */
|
/* get first digit. */
|
||||||
if (!_ISDIGIT_(nch)) break;
|
if (!_ISDIGIT_(nch)) break;
|
||||||
cur = (nch - '0') * (negative ? -1 : 1);
|
cur = (nch - '0');
|
||||||
nch = _GETC_(file);
|
nch = _GETC_(file);
|
||||||
if (width>0) width--;
|
if (width>0) width--;
|
||||||
/* read until no more digits */
|
/* read until no more digits */
|
||||||
|
@ -409,8 +409,8 @@ int _FUNCTION_ {
|
||||||
#else /* WIDE_SCANF */
|
#else /* WIDE_SCANF */
|
||||||
*c = nch;
|
*c = nch;
|
||||||
#endif /* WIDE_SCANF */
|
#endif /* WIDE_SCANF */
|
||||||
st = 1;
|
|
||||||
}
|
}
|
||||||
|
st = 1;
|
||||||
nch = _GETC_(file);
|
nch = _GETC_(file);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -422,9 +422,9 @@ int _FUNCTION_ {
|
||||||
#else /* WIDE_SCANF */
|
#else /* WIDE_SCANF */
|
||||||
*c = _CONVERT_(nch);
|
*c = _CONVERT_(nch);
|
||||||
#endif /* WIDE_SCANF */
|
#endif /* WIDE_SCANF */
|
||||||
st = 1;
|
|
||||||
}
|
}
|
||||||
nch = _GETC_(file);
|
nch = _GETC_(file);
|
||||||
|
st = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'n': {
|
case 'n': {
|
||||||
|
|
|
@ -24,9 +24,12 @@
|
||||||
|
|
||||||
static void test_sscanf( void )
|
static void test_sscanf( void )
|
||||||
{
|
{
|
||||||
char buffer[100];
|
char buffer[100], buffer1[100];
|
||||||
char format[20];
|
char format[20];
|
||||||
int result, ret;
|
int result, ret;
|
||||||
|
float res1= -82.6267, res2= 27.76, res11, res12;
|
||||||
|
char pname[]=" St. Petersburg, Florida\n";
|
||||||
|
|
||||||
|
|
||||||
/* check EOF */
|
/* check EOF */
|
||||||
strcpy(buffer,"");
|
strcpy(buffer,"");
|
||||||
|
@ -51,6 +54,16 @@ static void test_sscanf( void )
|
||||||
strcpy(format,"%\"%%%d%@"); /* work around gcc format check */
|
strcpy(format,"%\"%%%d%@"); /* work around gcc format check */
|
||||||
ok( sscanf(buffer, format, &result) == 1, "sscanf failed" );
|
ok( sscanf(buffer, format, &result) == 1, "sscanf failed" );
|
||||||
ok( result == 12, "sscanf reads %x instead of %x", result, 12 );
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue