Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
7240170c
Commit
7240170c
authored
Apr 16, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added more length modifiers in scanf function.
parent
0cc16fc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
scanf.h
dlls/msvcrt/scanf.h
+9
-3
scanf.c
dlls/msvcrt/tests/scanf.c
+20
-0
No files found.
dlls/msvcrt/scanf.h
View file @
7240170c
...
...
@@ -198,8 +198,14 @@ _FUNCTION_ {
/* read prefix (if any) */
while
(
!
prefix_finished
)
{
switch
(
*
format
)
{
case
'h'
:
h_prefix
=
1
;
break
;
case
'l'
:
l_prefix
=
1
;
break
;
case
'h'
:
h_prefix
++
;
break
;
case
'l'
:
if
(
*
(
format
+
1
)
==
'l'
)
{
I64_prefix
=
1
;
format
++
;
}
l_prefix
=
1
;
break
;
case
'w'
:
w_prefix
=
1
;
break
;
case
'L'
:
L_prefix
=
1
;
break
;
case
'I'
:
...
...
@@ -294,7 +300,7 @@ _FUNCTION_ {
#define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur
if
(
I64_prefix
)
_SET_NUMBER_
(
LONGLONG
);
else
if
(
l_prefix
)
_SET_NUMBER_
(
LONG
);
else
if
(
h_prefix
)
_SET_NUMBER_
(
short
int
);
else
if
(
h_prefix
==
1
)
_SET_NUMBER_
(
short
int
);
else
_SET_NUMBER_
(
int
);
}
}
...
...
dlls/msvcrt/tests/scanf.c
View file @
7240170c
...
...
@@ -27,6 +27,7 @@ static void test_sscanf( void )
char
buffer
[
100
],
buffer1
[
100
];
char
format
[
20
];
int
result
,
ret
;
LONGLONG
result64
;
char
c
;
void
*
ptr
;
float
res1
=
-
82
.
6267
f
,
res2
=
27
.
76
f
,
res11
,
res12
;
...
...
@@ -125,6 +126,25 @@ static void test_sscanf( void )
ok
(
ret
==
0
,
"problem with format arg
\"
%%*c%%n
\"\n
"
);
ok
(
number_so_far
==
1
,
"Read wrong arg for
\"
%%n
\"
%d instead of 2
\n
"
,
number_so_far
);
result
=
0xdeadbeef
;
strcpy
(
buffer
,
"12345678"
);
ret
=
sscanf
(
buffer
,
"%hd"
,
&
result
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
result
==
0xdead614e
,
"Wrong number read (%x)
\n
"
,
result
);
result
=
0xdeadbeef
;
ret
=
sscanf
(
buffer
,
"%hhd"
,
&
result
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ok
(
result
==
0xbc614e
,
"Wrong number read (%x)
\n
"
,
result
);
strcpy
(
buffer
,
"12345678901234"
);
ret
=
sscanf
(
buffer
,
"%lld"
,
&
result64
);
ok
(
ret
==
1
,
"Wrong number of arguments read: %d
\n
"
,
ret
);
ret
=
sprintf
(
buffer1
,
"%lld"
,
result64
);
ok
(
ret
==
14
||
broken
(
ret
==
10
),
"sprintf retuned %d
\n
"
,
ret
);
if
(
ret
==
14
)
ok
(
!
strcmp
(
buffer
,
buffer1
),
"got %s, expected %s
\n
"
,
buffer1
,
buffer
);
/* Check %i according to bug 1878 */
strcpy
(
buffer
,
"123"
);
ret
=
sscanf
(
buffer
,
"%i"
,
&
result
);
...
...
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