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
e022026c
Commit
e022026c
authored
Oct 15, 2002
by
György 'Nog' Jeney
Committed by
Alexandre Julliard
Oct 15, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement [ format specifier.
parent
28a7d3cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
scanf.c
dlls/msvcrt/scanf.c
+1
-0
scanf.h
dlls/msvcrt/scanf.h
+66
-0
No files found.
dlls/msvcrt/scanf.c
View file @
e022026c
...
...
@@ -24,6 +24,7 @@
*/
#include "winbase.h"
#include "winternl.h"
#include "msvcrt.h"
#include "msvcrt/conio.h"
#include "msvcrt/io.h"
...
...
dlls/msvcrt/scanf.h
View file @
e022026c
...
...
@@ -442,6 +442,72 @@ int _FUNCTION_ {
}
}
break
;
case
_L_
(
'['
):
{
_CHAR_
*
str
=
suppress
?
NULL
:
va_arg
(
ap
,
_CHAR_
*
);
_CHAR_
*
sptr
=
str
;
RTL_BITMAP
bitMask
;
LPBYTE
Mask
;
int
invert
=
0
;
/* Set if we are NOT to find the chars */
/* Init our bitmap */
#ifdef WIDE_SCANF
Mask
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
65536
/
8
);
RtlInitializeBitMap
(
&
bitMask
,
Mask
,
65536
);
#else
/* WIDE_SCANF */
Mask
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
256
/
8
);
RtlInitializeBitMap
(
&
bitMask
,
Mask
,
256
);
#endif
/* WIDE_SCANF */
/* Read the format */
format
++
;
if
(
*
format
==
'^'
)
{
invert
=
1
;
format
++
;
}
if
(
*
format
==
']'
)
{
RtlSetBits
(
&
bitMask
,
']'
,
1
);
format
++
;
}
while
(
*
format
&&
(
*
format
!=
']'
))
{
if
((
*
format
==
'-'
)
&&
(
*
(
format
+
1
)
!=
']'
))
{
int
n
=
0
;
for
(;(
n
+
*
(
format
-
1
))
<
*
(
format
+
1
);
n
++
)
RtlSetBits
(
&
bitMask
,
n
+
*
(
format
-
1
),
1
);
format
++
;
}
RtlSetBits
(
&
bitMask
,
*
format
,
1
);
format
++
;
}
/* read until char is not suitable */
while
((
width
!=
0
)
&&
(
nch
!=
_EOF_
))
{
if
(
!
invert
)
{
if
(
RtlAreBitsSet
(
&
bitMask
,
nch
,
1
))
{
#ifdef WIDE_SCANF
if
(
!
suppress
)
*
sptr
++
=
_CONVERT_
(
nch
);
#else
/* WIDE_SCANF */
if
(
!
suppress
)
*
sptr
++
=
nch
;
#endif
/* WIDE_SCANF */
}
else
break
;
}
else
{
if
(
RtlAreBitsClear
(
&
bitMask
,
nch
,
1
))
{
#ifdef WIDE_SCANF
if
(
!
suppress
)
*
sptr
++
=
_CONVERT_
(
nch
);
#else
/* WIDE_SCANF */
if
(
!
suppress
)
*
sptr
++
=
nch
;
#endif
/* WIDE_SCANF */
}
else
break
;
}
st
++
;
nch
=
_GETC_
(
file
);
if
(
width
>
0
)
width
--
;
}
/* terminate */
if
(
!
suppress
)
*
sptr
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
Mask
);
}
break
;
default
:
FIXME
(
"unhandled: %%%c
\n
"
,
*
format
);
/* From spec: "if a percent sign is followed by a character
* that has no meaning as a format-control character, that
...
...
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