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
231fc114
Commit
231fc114
authored
Apr 22, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add support for locales in scanf helper functions.
parent
93f970ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
19 deletions
+22
-19
scanf.c
dlls/msvcrt/scanf.c
+12
-12
scanf.h
dlls/msvcrt/scanf.h
+10
-7
No files found.
dlls/msvcrt/scanf.c
View file @
231fc114
...
...
@@ -57,31 +57,31 @@ static int wchar2digit(MSVCRT_wchar_t c, int base) {
return
-
1
;
}
/* vfscanf */
/* vfscanf
_l
*/
#undef WIDE_SCANF
#undef CONSOLE
#undef STRING
#include "scanf.h"
/* vfwscanf */
/* vfwscanf
_l
*/
#define WIDE_SCANF 1
#undef CONSOLE
#undef STRING
#include "scanf.h"
/* vsscanf */
/* vsscanf
_l
*/
#undef WIDE_SCANF
#undef CONSOLE
#define STRING 1
#include "scanf.h"
/* vswscanf */
/* vswscanf
_l
*/
#define WIDE_SCANF 1
#undef CONSOLE
#define STRING 1
#include "scanf.h"
/* vcscanf */
/* vcscanf
_l
*/
#undef WIDE_SCANF
#define CONSOLE 1
#undef STRING
...
...
@@ -97,7 +97,7 @@ int CDECL MSVCRT_fscanf(MSVCRT_FILE *file, const char *format, ...)
int
res
;
__ms_va_start
(
valist
,
format
);
res
=
MSVCRT_vfscanf
(
file
,
format
,
valist
);
res
=
MSVCRT_vfscanf
_l
(
file
,
format
,
NULL
,
valist
);
__ms_va_end
(
valist
);
return
res
;
}
...
...
@@ -111,7 +111,7 @@ int CDECL MSVCRT_scanf(const char *format, ...)
int
res
;
__ms_va_start
(
valist
,
format
);
res
=
MSVCRT_vfscanf
(
MSVCRT_stdin
,
format
,
valist
);
res
=
MSVCRT_vfscanf
_l
(
MSVCRT_stdin
,
format
,
NULL
,
valist
);
__ms_va_end
(
valist
);
return
res
;
}
...
...
@@ -125,7 +125,7 @@ int CDECL MSVCRT_fwscanf(MSVCRT_FILE *file, const MSVCRT_wchar_t *format, ...)
int
res
;
__ms_va_start
(
valist
,
format
);
res
=
MSVCRT_vfwscanf
(
file
,
format
,
valist
);
res
=
MSVCRT_vfwscanf
_l
(
file
,
format
,
NULL
,
valist
);
__ms_va_end
(
valist
);
return
res
;
}
...
...
@@ -140,7 +140,7 @@ int CDECL MSVCRT_wscanf(const MSVCRT_wchar_t *format, ...)
int
res
;
__ms_va_start
(
valist
,
format
);
res
=
MSVCRT_vfwscanf
(
MSVCRT_stdin
,
format
,
valist
);
res
=
MSVCRT_vfwscanf
_l
(
MSVCRT_stdin
,
format
,
NULL
,
valist
);
__ms_va_end
(
valist
);
return
res
;
}
...
...
@@ -155,7 +155,7 @@ int CDECL MSVCRT_sscanf(const char *str, const char *format, ...)
int
res
;
__ms_va_start
(
valist
,
format
);
res
=
MSVCRT_vsscanf
(
str
,
format
,
valist
);
res
=
MSVCRT_vsscanf
_l
(
str
,
format
,
NULL
,
valist
);
__ms_va_end
(
valist
);
return
res
;
}
...
...
@@ -170,7 +170,7 @@ int CDECL MSVCRT_swscanf(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format
int
res
;
__ms_va_start
(
valist
,
format
);
res
=
MSVCRT_vswscanf
(
str
,
format
,
valist
);
res
=
MSVCRT_vswscanf
_l
(
str
,
format
,
NULL
,
valist
);
__ms_va_end
(
valist
);
return
res
;
}
...
...
@@ -185,7 +185,7 @@ int CDECL _cscanf(const char *format, ...)
int
res
;
__ms_va_start
(
valist
,
format
);
res
=
MSVCRT_vcscanf
(
format
,
valist
);
res
=
MSVCRT_vcscanf
_l
(
format
,
NULL
,
valist
);
__ms_va_end
(
valist
);
return
res
;
}
dlls/msvcrt/scanf.h
View file @
231fc114
...
...
@@ -48,7 +48,7 @@
#ifdef CONSOLE
#define _GETC_(file) (consumed++, _getch())
#define _UNGETC_(nch, file) do { _ungetch(nch); consumed--; } while(0)
#define _FUNCTION_ static int MSVCRT_vcscanf
(const char *format
, __ms_va_list ap)
#define _FUNCTION_ static int MSVCRT_vcscanf
_l(const char *format, MSVCRT__locale_t locale
, __ms_va_list ap)
#else
#ifdef STRING
#undef _EOF_
...
...
@@ -56,19 +56,19 @@
#define _GETC_(file) (consumed++, *file++)
#define _UNGETC_(nch, file) do { file--; consumed--; } while(0)
#ifdef WIDE_SCANF
#define _FUNCTION_ static int MSVCRT_vswscanf
(const MSVCRT_wchar_t *file, const MSVCRT_wchar_t *format
, __ms_va_list ap)
#define _FUNCTION_ static int MSVCRT_vswscanf
_l(const MSVCRT_wchar_t *file, const MSVCRT_wchar_t *format, MSVCRT__locale_t locale
, __ms_va_list ap)
#else
/* WIDE_SCANF */
#define _FUNCTION_ static int MSVCRT_vsscanf
(const char *file, const char *format
, __ms_va_list ap)
#define _FUNCTION_ static int MSVCRT_vsscanf
_l(const char *file, const char *format, MSVCRT__locale_t locale
, __ms_va_list ap)
#endif
/* WIDE_SCANF */
#else
/* STRING */
#ifdef WIDE_SCANF
#define _GETC_(file) (consumed++, MSVCRT_fgetwc(file))
#define _UNGETC_(nch, file) do { MSVCRT_ungetwc(nch, file); consumed--; } while(0)
#define _FUNCTION_ static int MSVCRT_vfwscanf
(MSVCRT_FILE* file, const MSVCRT_wchar_t *format
, __ms_va_list ap)
#define _FUNCTION_ static int MSVCRT_vfwscanf
_l(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, MSVCRT__locale_t locale
, __ms_va_list ap)
#else
/* WIDE_SCANF */
#define _GETC_(file) (consumed++, MSVCRT_fgetc(file))
#define _UNGETC_(nch, file) do { MSVCRT_ungetc(nch, file); consumed--; } while(0)
#define _FUNCTION_ static int MSVCRT_vfscanf
(MSVCRT_FILE* file, const char *format
, __ms_va_list ap)
#define _FUNCTION_ static int MSVCRT_vfscanf
_l(MSVCRT_FILE* file, const char *format, MSVCRT__locale_t locale
, __ms_va_list ap)
#endif
/* WIDE_SCANF */
#endif
/* STRING */
#endif
/* CONSOLE */
...
...
@@ -91,6 +91,9 @@ _FUNCTION_ {
nch
=
_GETC_
(
file
);
if
(
nch
==
_EOF_
)
return
_EOF_RET
;
if
(
!
locale
)
locale
=
get_locale
();
while
(
*
format
)
{
/* a whitespace character in the format string causes scanf to read,
* but not store, all consecutive white-space characters in the input
...
...
@@ -250,7 +253,7 @@ _FUNCTION_ {
nch
=
_GETC_
(
file
);
}
/* get first digit. */
if
(
'.'
!=
nch
)
{
if
(
*
locale
->
locinfo
->
lconv
->
decimal_point
!=
nch
)
{
if
(
!
_ISDIGIT_
(
nch
))
break
;
cur
=
(
nch
-
'0'
);
nch
=
_GETC_
(
file
);
...
...
@@ -265,7 +268,7 @@ _FUNCTION_ {
cur
=
0
;
/* MaxPayneDemo Fix: .8 -> 0.8 */
}
/* handle decimals */
if
(
width
!=
0
&&
nch
==
'.'
)
{
if
(
width
!=
0
&&
nch
==
*
locale
->
locinfo
->
lconv
->
decimal_point
)
{
long
double
dec
=
1
;
nch
=
_GETC_
(
file
);
if
(
width
>
0
)
width
--
;
...
...
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