Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
168265eb
Commit
168265eb
authored
Jan 28, 2005
by
Francois Gouget
Committed by
Alexandre Julliard
Jan 28, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of EOF for the '%c' and '%C' cases in scanf().
Add conformance tests to verify the behavior of '%c'. Improve some of the test's error messages.
parent
fe59db7c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
16 deletions
+42
-16
scanf.h
dlls/msvcrt/scanf.h
+18
-14
scanf.c
dlls/msvcrt/tests/scanf.c
+24
-2
No files found.
dlls/msvcrt/scanf.h
View file @
168265eb
...
...
@@ -401,21 +401,25 @@ _FUNCTION_ {
else
goto
widecharacter
;
#endif
/* WIDE_SCANF */
character
:
{
/* read single character into char */
if
(
!
suppress
)
{
char
*
c
=
va_arg
(
ap
,
char
*
);
*
c
=
_CHAR2SUPPORTED_
(
nch
);
}
st
=
1
;
nch
=
_GETC_
(
file
);
}
if
(
nch
!=
_EOF_
)
{
if
(
!
suppress
)
{
char
*
c
=
va_arg
(
ap
,
char
*
);
*
c
=
_CHAR2SUPPORTED_
(
nch
);
}
st
=
1
;
nch
=
_GETC_
(
file
);
}
}
break
;
widecharacter
:
{
if
(
!
suppress
)
{
/* read single character into a wchar_t */
MSVCRT_wchar_t
*
c
=
va_arg
(
ap
,
MSVCRT_wchar_t
*
);
*
c
=
_WIDE2SUPPORTED_
(
nch
);
}
nch
=
_GETC_
(
file
);
st
=
1
;
widecharacter
:
{
/* read single character into a wchar_t */
if
(
nch
!=
_EOF_
)
{
if
(
!
suppress
)
{
MSVCRT_wchar_t
*
c
=
va_arg
(
ap
,
MSVCRT_wchar_t
*
);
*
c
=
_WIDE2SUPPORTED_
(
nch
);
}
nch
=
_GETC_
(
file
);
st
=
1
;
}
}
break
;
case
'n'
:
{
...
...
dlls/msvcrt/tests/scanf.c
View file @
168265eb
...
...
@@ -27,6 +27,7 @@ static void test_sscanf( void )
char
buffer
[
100
],
buffer1
[
100
];
char
format
[
20
];
int
result
,
ret
;
char
c
;
float
res1
=
-
82
.
6267
f
,
res2
=
27
.
76
f
,
res11
,
res12
;
static
const
char
pname
[]
=
" St. Petersburg, Florida
\n
"
;
int
hour
=
21
,
min
=
59
,
sec
=
20
;
...
...
@@ -90,11 +91,32 @@ static void test_sscanf( void )
/* Check %i according to bug 1878 */
strcpy
(
buffer
,
"123"
);
ret
=
sscanf
(
buffer
,
"%i"
,
&
result
);
ok
(
ret
==
1
,
"Wrong number of arguments read
\n
"
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
result
==
123
,
"Wrong number read
\n
"
);
ret
=
sscanf
(
buffer
,
"%d"
,
&
result
);
ok
(
ret
==
1
,
"Wrong number of arguments read
\n
"
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
result
==
123
,
"Wrong number read
\n
"
);
/* Check %c */
strcpy
(
buffer
,
"a"
);
c
=
0x55
;
ret
=
sscanf
(
buffer
,
"%c"
,
&
c
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
c
==
'a'
,
"Field incorrect: '%c'
\n
"
,
c
);
strcpy
(
buffer
,
" a"
);
c
=
0x55
;
ret
=
sscanf
(
buffer
,
"%c"
,
&
c
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
c
==
' '
,
"Field incorrect: '%c'
\n
"
,
c
);
strcpy
(
buffer
,
"18:59"
);
c
=
0x55
;
ret
=
sscanf
(
buffer
,
"%d:%d%c"
,
&
hour
,
&
min
,
&
c
);
ok
(
ret
==
2
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
hour
==
18
,
"Field 1 incorrect: %d
\n
"
,
hour
);
ok
(
min
==
59
,
"Field 2 incorrect: %d
\n
"
,
min
);
ok
(
c
==
0x55
,
"Field 3 incorrect: 0x%02x
\n
"
,
c
);
}
START_TEST
(
scanf
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment