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
6991ac03
Commit
6991ac03
authored
May 24, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
May 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Use get_locinfo instead of get_locale.
parent
11bfced5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
123 additions
and
75 deletions
+123
-75
ctype.c
dlls/msvcrt/ctype.c
+28
-16
file.c
dlls/msvcrt/file.c
+1
-1
locale.c
dlls/msvcrt/locale.c
+11
-1
mbcs.c
dlls/msvcrt/mbcs.c
+0
-0
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-1
printf.h
dlls/msvcrt/printf.h
+29
-26
scanf.h
dlls/msvcrt/scanf.h
+6
-3
string.c
dlls/msvcrt/string.c
+34
-18
wcs.c
dlls/msvcrt/wcs.c
+13
-9
No files found.
dlls/msvcrt/ctype.c
View file @
6991ac03
...
...
@@ -63,7 +63,7 @@ unsigned short *MSVCRT__pctype = NULL;
*/
const
unsigned
short
*
CDECL
MSVCRT___pctype_func
(
void
)
{
return
get_loc
ale
()
->
locinfo
->
pctype
;
return
get_loc
info
()
->
pctype
;
}
/*********************************************************************
...
...
@@ -71,24 +71,28 @@ const unsigned short* CDECL MSVCRT___pctype_func(void)
*/
int
CDECL
_isctype_l
(
int
c
,
int
type
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
if
(
c
>=
-
1
&&
c
<=
255
)
return
loc
ale
->
loc
info
->
pctype
[
c
]
&
type
;
return
locinfo
->
pctype
[
c
]
&
type
;
if
(
loc
ale
->
loc
info
->
mb_cur_max
!=
1
&&
c
>
0
)
if
(
locinfo
->
mb_cur_max
!=
1
&&
c
>
0
)
{
/* FIXME: Is there a faster way to do this? */
WORD
typeInfo
;
char
convert
[
3
],
*
pconv
=
convert
;
if
(
loc
ale
->
loc
info
->
pctype
[(
UINT
)
c
>>
8
]
&
MSVCRT__LEADBYTE
)
if
(
locinfo
->
pctype
[(
UINT
)
c
>>
8
]
&
MSVCRT__LEADBYTE
)
*
pconv
++
=
(
UINT
)
c
>>
8
;
*
pconv
++
=
c
&
0xff
;
*
pconv
=
0
;
if
(
GetStringTypeExA
(
loc
ale
->
loc
info
->
lc_handle
[
MSVCRT_LC_CTYPE
],
if
(
GetStringTypeExA
(
locinfo
->
lc_handle
[
MSVCRT_LC_CTYPE
],
CT_CTYPE1
,
convert
,
convert
[
1
]
?
2
:
1
,
&
typeInfo
))
return
typeInfo
&
type
;
}
...
...
@@ -333,20 +337,24 @@ int CDECL MSVCRT___iscsymf(int c)
*/
int
CDECL
MSVCRT__toupper_l
(
int
c
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
if
(
c
<
256
)
return
loc
ale
->
loc
info
->
pcumap
[
c
];
return
locinfo
->
pcumap
[
c
];
if
(
loc
ale
->
loc
info
->
pctype
[(
c
>>
8
)
&
255
]
&
MSVCRT__LEADBYTE
)
if
(
locinfo
->
pctype
[(
c
>>
8
)
&
255
]
&
MSVCRT__LEADBYTE
)
{
WCHAR
wide
,
upper
;
char
str
[
2
],
*
p
=
str
;
*
p
++
=
(
c
>>
8
)
&
255
;
*
p
++
=
c
&
255
;
if
(
!
MultiByteToWideChar
(
loc
ale
->
loc
info
->
lc_codepage
,
if
(
!
MultiByteToWideChar
(
locinfo
->
lc_codepage
,
MB_ERR_INVALID_CHARS
,
str
,
2
,
&
wide
,
1
))
return
c
;
...
...
@@ -354,7 +362,7 @@ int CDECL MSVCRT__toupper_l(int c, MSVCRT__locale_t locale)
if
(
upper
==
wide
)
return
c
;
WideCharToMultiByte
(
loc
ale
->
loc
info
->
lc_codepage
,
0
,
WideCharToMultiByte
(
locinfo
->
lc_codepage
,
0
,
&
upper
,
1
,
str
,
2
,
NULL
,
NULL
);
return
str
[
0
]
+
(
str
[
1
]
<<
8
);
...
...
@@ -384,20 +392,24 @@ int CDECL MSVCRT__toupper(int c)
*/
int
CDECL
MSVCRT__tolower_l
(
int
c
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
if
(
c
<
256
)
return
loc
ale
->
loc
info
->
pclmap
[
c
];
return
locinfo
->
pclmap
[
c
];
if
(
loc
ale
->
loc
info
->
pctype
[(
c
>>
8
)
&
255
]
&
MSVCRT__LEADBYTE
)
if
(
locinfo
->
pctype
[(
c
>>
8
)
&
255
]
&
MSVCRT__LEADBYTE
)
{
WCHAR
wide
,
upper
;
char
str
[
2
],
*
p
=
str
;
*
p
++
=
(
c
>>
8
)
&
255
;
*
p
++
=
c
&
255
;
if
(
!
MultiByteToWideChar
(
loc
ale
->
loc
info
->
lc_codepage
,
if
(
!
MultiByteToWideChar
(
locinfo
->
lc_codepage
,
MB_ERR_INVALID_CHARS
,
str
,
2
,
&
wide
,
1
))
return
c
;
...
...
@@ -405,7 +417,7 @@ int CDECL MSVCRT__tolower_l(int c, MSVCRT__locale_t locale)
if
(
upper
==
wide
)
return
c
;
WideCharToMultiByte
(
loc
ale
->
loc
info
->
lc_codepage
,
0
,
WideCharToMultiByte
(
locinfo
->
lc_codepage
,
0
,
&
upper
,
1
,
str
,
2
,
NULL
,
NULL
);
return
str
[
0
]
+
(
str
[
1
]
<<
8
);
...
...
dlls/msvcrt/file.c
View file @
6991ac03
...
...
@@ -2792,7 +2792,7 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file)
}
c
=
MSVCRT_fgetc
(
file
);
if
((
get_loc
ale
()
->
locinfo
->
mb_cur_max
>
1
)
&&
MSVCRT_isleadbyte
(
c
))
if
((
get_loc
info
()
->
mb_cur_max
>
1
)
&&
MSVCRT_isleadbyte
(
c
))
{
FIXME
(
"Treat Multibyte characters
\n
"
);
}
...
...
dlls/msvcrt/locale.c
View file @
6991ac03
...
...
@@ -354,7 +354,7 @@ static inline void swap_pointers(void **p1, void **p2) {
}
/* INTERNAL: returns _locale_t struct for current locale */
MSVCRT__locale_t
get_locale
(
void
)
{
static
MSVCRT__locale_t
get_locale
(
void
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
if
(
!
data
||
!
data
->
locale
)
...
...
@@ -363,6 +363,16 @@ MSVCRT__locale_t get_locale(void) {
return
data
->
locale
;
}
/* INTERNAL: returns pthreadlocinfo struct */
MSVCRT_pthreadlocinfo
get_locinfo
(
void
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
if
(
!
data
||
!
data
->
locale
)
return
MSVCRT_locale
->
locinfo
;
return
data
->
locale
->
locinfo
;
}
/* INTERNAL: constructs string returned by setlocale */
static
inline
char
*
construct_lc_all
(
MSVCRT__locale_t
cur
)
{
static
char
current_lc_all
[
MAX_LOCALE_LENGTH
];
...
...
dlls/msvcrt/mbcs.c
View file @
6991ac03
This diff is collapsed.
Click to expand it.
dlls/msvcrt/msvcrt.h
View file @
6991ac03
...
...
@@ -877,7 +877,7 @@ typedef struct MSVCRT_localeinfo_struct
extern
MSVCRT__locale_t
MSVCRT_locale
;
MSVCRT__locale_t
MSVCRT__create_locale
(
int
,
const
char
*
);
MSVCRT_
_locale_t
get_locale
(
void
);
MSVCRT_
pthreadlocinfo
get_locinfo
(
void
);
void
__cdecl
MSVCRT__free_locale
(
MSVCRT__locale_t
);
#ifndef __WINE_MSVCRT_TEST
...
...
dlls/msvcrt/printf.h
View file @
6991ac03
...
...
@@ -111,19 +111,19 @@ static inline int FUNC_NAME(pf_fill)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ct
}
static
inline
int
FUNC_NAME
(
pf_output_wstr
)(
FUNC_NAME
(
puts_clbk
)
pf_puts
,
void
*
puts_ctx
,
const
MSVCRT_wchar_t
*
str
,
int
len
,
MSVCRT_
_locale_t
locale
)
const
MSVCRT_wchar_t
*
str
,
int
len
,
MSVCRT_
pthreadlocinfo
locinfo
)
{
#ifdef PRINTF_WIDE
return
pf_puts
(
puts_ctx
,
len
,
str
);
#else
LPSTR
out
;
int
len_a
=
WideCharToMultiByte
(
loc
ale
->
loc
info
->
lc_codepage
,
0
,
str
,
len
,
NULL
,
0
,
NULL
,
NULL
);
int
len_a
=
WideCharToMultiByte
(
locinfo
->
lc_codepage
,
0
,
str
,
len
,
NULL
,
0
,
NULL
,
NULL
);
out
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len_a
);
if
(
!
out
)
return
-
1
;
WideCharToMultiByte
(
loc
ale
->
loc
info
->
lc_codepage
,
0
,
str
,
len
,
out
,
len_a
,
NULL
,
NULL
);
WideCharToMultiByte
(
locinfo
->
lc_codepage
,
0
,
str
,
len
,
out
,
len_a
,
NULL
,
NULL
);
len
=
pf_puts
(
puts_ctx
,
len_a
,
out
);
HeapFree
(
GetProcessHeap
(),
0
,
out
);
return
len
;
...
...
@@ -131,17 +131,17 @@ static inline int FUNC_NAME(pf_output_wstr)(FUNC_NAME(puts_clbk) pf_puts, void *
}
static
inline
int
FUNC_NAME
(
pf_output_str
)(
FUNC_NAME
(
puts_clbk
)
pf_puts
,
void
*
puts_ctx
,
const
char
*
str
,
int
len
,
MSVCRT_
_locale_t
locale
)
const
char
*
str
,
int
len
,
MSVCRT_
pthreadlocinfo
locinfo
)
{
#ifdef PRINTF_WIDE
LPWSTR
out
;
int
len_w
=
MultiByteToWideChar
(
loc
ale
->
loc
info
->
lc_codepage
,
0
,
str
,
len
,
NULL
,
0
);
int
len_w
=
MultiByteToWideChar
(
locinfo
->
lc_codepage
,
0
,
str
,
len
,
NULL
,
0
);
out
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len_w
*
sizeof
(
WCHAR
));
if
(
!
out
)
return
-
1
;
MultiByteToWideChar
(
loc
ale
->
loc
info
->
lc_codepage
,
0
,
str
,
len
,
out
,
len_w
);
MultiByteToWideChar
(
locinfo
->
lc_codepage
,
0
,
str
,
len
,
out
,
len_w
);
len
=
pf_puts
(
puts_ctx
,
len_w
,
out
);
HeapFree
(
GetProcessHeap
(),
0
,
out
);
return
len
;
...
...
@@ -151,7 +151,7 @@ static inline int FUNC_NAME(pf_output_str)(FUNC_NAME(puts_clbk) pf_puts, void *p
}
static
inline
int
FUNC_NAME
(
pf_output_format_wstr
)(
FUNC_NAME
(
puts_clbk
)
pf_puts
,
void
*
puts_ctx
,
const
MSVCRT_wchar_t
*
str
,
int
len
,
FUNC_NAME
(
pf_flags
)
*
flags
,
MSVCRT_
_locale_t
locale
)
const
MSVCRT_wchar_t
*
str
,
int
len
,
FUNC_NAME
(
pf_flags
)
*
flags
,
MSVCRT_
pthreadlocinfo
locinfo
)
{
int
r
,
ret
;
...
...
@@ -164,7 +164,7 @@ static inline int FUNC_NAME(pf_output_format_wstr)(FUNC_NAME(puts_clbk) pf_puts,
r
=
FUNC_NAME
(
pf_fill
)(
pf_puts
,
puts_ctx
,
len
,
flags
,
TRUE
);
ret
=
r
;
if
(
r
>=
0
)
{
r
=
FUNC_NAME
(
pf_output_wstr
)(
pf_puts
,
puts_ctx
,
str
,
len
,
loc
ale
);
r
=
FUNC_NAME
(
pf_output_wstr
)(
pf_puts
,
puts_ctx
,
str
,
len
,
loc
info
);
ret
+=
r
;
}
if
(
r
>=
0
)
{
...
...
@@ -176,7 +176,7 @@ static inline int FUNC_NAME(pf_output_format_wstr)(FUNC_NAME(puts_clbk) pf_puts,
}
static
inline
int
FUNC_NAME
(
pf_output_format_str
)(
FUNC_NAME
(
puts_clbk
)
pf_puts
,
void
*
puts_ctx
,
const
char
*
str
,
int
len
,
FUNC_NAME
(
pf_flags
)
*
flags
,
MSVCRT_
_locale_t
locale
)
const
char
*
str
,
int
len
,
FUNC_NAME
(
pf_flags
)
*
flags
,
MSVCRT_
pthreadlocinfo
locinfo
)
{
int
r
,
ret
;
...
...
@@ -189,7 +189,7 @@ static inline int FUNC_NAME(pf_output_format_str)(FUNC_NAME(puts_clbk) pf_puts,
r
=
FUNC_NAME
(
pf_fill
)(
pf_puts
,
puts_ctx
,
len
,
flags
,
TRUE
);
ret
=
r
;
if
(
r
>=
0
)
{
r
=
FUNC_NAME
(
pf_output_str
)(
pf_puts
,
puts_ctx
,
str
,
len
,
loc
ale
);
r
=
FUNC_NAME
(
pf_output_str
)(
pf_puts
,
puts_ctx
,
str
,
len
,
loc
info
);
ret
+=
r
;
}
if
(
r
>=
0
)
{
...
...
@@ -201,27 +201,27 @@ static inline int FUNC_NAME(pf_output_format_str)(FUNC_NAME(puts_clbk) pf_puts,
}
static
inline
int
FUNC_NAME
(
pf_handle_string
)(
FUNC_NAME
(
puts_clbk
)
pf_puts
,
void
*
puts_ctx
,
const
void
*
str
,
int
len
,
FUNC_NAME
(
pf_flags
)
*
flags
,
MSVCRT_
_locale_t
locale
)
const
void
*
str
,
int
len
,
FUNC_NAME
(
pf_flags
)
*
flags
,
MSVCRT_
pthreadlocinfo
locinfo
)
{
#ifdef PRINTF_WIDE
static
const
MSVCRT_wchar_t
nullW
[]
=
{
'('
,
'n'
,
'u'
,
'l'
,
'l'
,
')'
,
0
};
if
(
!
str
)
return
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
nullW
,
6
,
flags
,
loc
ale
);
return
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
nullW
,
6
,
flags
,
loc
info
);
#else
if
(
!
str
)
return
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
"(null)"
,
6
,
flags
,
loc
ale
);
return
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
"(null)"
,
6
,
flags
,
loc
info
);
#endif
if
(
flags
->
WideString
||
flags
->
IntegerLength
==
'l'
)
return
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
str
,
len
,
flags
,
loc
ale
);
return
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
str
,
len
,
flags
,
loc
info
);
if
(
flags
->
IntegerLength
==
'h'
)
return
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
str
,
len
,
flags
,
loc
ale
);
return
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
str
,
len
,
flags
,
loc
info
);
if
((
flags
->
Format
==
'S'
||
flags
->
Format
==
'C'
)
==
(
sizeof
(
APICHAR
)
==
sizeof
(
MSVCRT_wchar_t
)))
return
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
str
,
len
,
flags
,
loc
ale
);
return
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
str
,
len
,
flags
,
loc
info
);
else
return
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
str
,
len
,
flags
,
loc
ale
);
return
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
str
,
len
,
flags
,
loc
info
);
}
static
inline
void
FUNC_NAME
(
pf_rebuild_format_string
)(
char
*
p
,
FUNC_NAME
(
pf_flags
)
*
flags
)
...
...
@@ -339,6 +339,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
MSVCRT__locale_t
locale
,
BOOL
positional_params
,
BOOL
invoke_invalid_param_handler
,
args_clbk
pf_args
,
void
*
args_ctx
,
__ms_va_list
*
valist
)
{
MSVCRT_pthreadlocinfo
locinfo
;
const
APICHAR
*
q
,
*
p
=
fmt
;
APICHAR
buf
[
32
];
int
written
=
0
,
pos
,
i
;
...
...
@@ -347,7 +348,9 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
TRACE
(
"Format is: %s
\n
"
,
FUNC_NAME
(
debugstr
)(
fmt
));
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
while
(
*
p
)
{
/* output characters before '%' */
...
...
@@ -467,14 +470,14 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
if
(
flags
.
Format
==
's'
||
flags
.
Format
==
'S'
)
{
i
=
FUNC_NAME
(
pf_handle_string
)(
pf_puts
,
puts_ctx
,
pf_args
(
args_ctx
,
pos
,
VT_PTR
,
valist
).
get_ptr
,
-
1
,
&
flags
,
loc
ale
);
-
1
,
&
flags
,
loc
info
);
}
else
if
(
flags
.
Format
==
'c'
||
flags
.
Format
==
'C'
)
{
int
ch
=
pf_args
(
args_ctx
,
pos
,
VT_INT
,
valist
).
get_int
;
if
((
ch
&
0xff
)
!=
ch
)
FIXME
(
"multibyte characters printing not supported
\n
"
);
i
=
FUNC_NAME
(
pf_handle_string
)(
pf_puts
,
puts_ctx
,
&
ch
,
1
,
&
flags
,
loc
ale
);
i
=
FUNC_NAME
(
pf_handle_string
)(
pf_puts
,
puts_ctx
,
&
ch
,
1
,
&
flags
,
loc
info
);
}
else
if
(
flags
.
Format
==
'p'
)
{
flags
.
Format
=
'X'
;
flags
.
PadZero
=
'0'
;
...
...
@@ -486,9 +489,9 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
flags
.
Precision
=
i
;
#ifdef PRINTF_WIDE
i
=
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
buf
,
-
1
,
&
flags
,
loc
ale
);
i
=
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
buf
,
-
1
,
&
flags
,
loc
info
);
#else
i
=
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
buf
,
-
1
,
&
flags
,
loc
ale
);
i
=
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
buf
,
-
1
,
&
flags
,
loc
info
);
#endif
}
else
if
(
flags
.
Format
==
'n'
)
{
int
*
used
;
...
...
@@ -522,9 +525,9 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
args_ctx
,
pos
,
VT_INT
,
valist
).
get_int
);
#ifdef PRINTF_WIDE
i
=
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
tmp
,
-
1
,
&
flags
,
loc
ale
);
i
=
FUNC_NAME
(
pf_output_format_wstr
)(
pf_puts
,
puts_ctx
,
tmp
,
-
1
,
&
flags
,
loc
info
);
#else
i
=
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
tmp
,
-
1
,
&
flags
,
loc
ale
);
i
=
FUNC_NAME
(
pf_output_format_str
)(
pf_puts
,
puts_ctx
,
tmp
,
-
1
,
&
flags
,
loc
info
);
#endif
if
(
tmp
!=
buf
)
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
...
...
@@ -545,9 +548,9 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
decimal_point
=
strchr
(
tmp
,
'.'
);
if
(
decimal_point
)
*
decimal_point
=
*
loc
ale
->
loc
info
->
lconv
->
decimal_point
;
*
decimal_point
=
*
locinfo
->
lconv
->
decimal_point
;
i
=
FUNC_NAME
(
pf_output_str
)(
pf_puts
,
puts_ctx
,
tmp
,
strlen
(
tmp
),
loc
ale
);
i
=
FUNC_NAME
(
pf_output_str
)(
pf_puts
,
puts_ctx
,
tmp
,
strlen
(
tmp
),
loc
info
);
if
(
tmp
!=
buf_a
)
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
}
else
{
...
...
dlls/msvcrt/scanf.h
View file @
6991ac03
...
...
@@ -130,6 +130,7 @@
#endif
/* CONSOLE */
_FUNCTION_
{
MSVCRT_pthreadlocinfo
locinfo
;
int
rd
=
0
,
consumed
=
0
;
int
nch
;
if
(
!*
format
)
return
0
;
...
...
@@ -153,7 +154,9 @@ _FUNCTION_ {
}
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
while
(
*
format
)
{
/* a whitespace character in the format string causes scanf to read,
...
...
@@ -314,7 +317,7 @@ _FUNCTION_ {
nch
=
_GETC_
(
file
);
}
/* get first digit. */
if
(
*
loc
ale
->
loc
info
->
lconv
->
decimal_point
!=
nch
)
{
if
(
*
locinfo
->
lconv
->
decimal_point
!=
nch
)
{
if
(
!
_ISDIGIT_
(
nch
))
break
;
cur
=
(
nch
-
'0'
);
nch
=
_GETC_
(
file
);
...
...
@@ -329,7 +332,7 @@ _FUNCTION_ {
cur
=
0
;
/* Fix: .8 -> 0.8 */
}
/* handle decimals */
if
(
width
!=
0
&&
nch
==
*
loc
ale
->
loc
info
->
lconv
->
decimal_point
)
{
if
(
width
!=
0
&&
nch
==
*
locinfo
->
lconv
->
decimal_point
)
{
long
double
dec
=
1
;
nch
=
_GETC_
(
file
);
if
(
width
>
0
)
width
--
;
...
...
dlls/msvcrt/string.c
View file @
6991ac03
...
...
@@ -58,9 +58,6 @@ int CDECL _strlwr_s_l(char *str, MSVCRT_size_t len, MSVCRT__locale_t locale)
{
char
*
ptr
=
str
;
if
(
!
locale
)
locale
=
get_locale
();
if
(
!
str
||
!
len
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
...
...
@@ -122,9 +119,6 @@ int CDECL _strupr_s_l(char *str, MSVCRT_size_t len, MSVCRT__locale_t locale)
{
char
*
ptr
=
str
;
if
(
!
locale
)
locale
=
get_locale
();
if
(
!
str
||
!
len
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
...
...
@@ -293,6 +287,7 @@ void CDECL MSVCRT__swab(char* src, char* dst, int len)
*/
double
CDECL
MSVCRT_strtod_l
(
const
char
*
str
,
char
**
end
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
unsigned
__int64
d
=
0
,
hlp
;
unsigned
fpcontrol
;
int
exp
=
0
,
sign
=
1
;
...
...
@@ -306,7 +301,9 @@ double CDECL MSVCRT_strtod_l( const char *str, char **end, MSVCRT__locale_t loca
}
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
/* FIXME: use *_l functions */
p
=
str
;
...
...
@@ -333,7 +330,7 @@ double CDECL MSVCRT_strtod_l( const char *str, char **end, MSVCRT__locale_t loca
p
++
;
}
if
(
*
p
==
*
loc
ale
->
loc
info
->
lconv
->
decimal_point
)
if
(
*
p
==
*
locinfo
->
lconv
->
decimal_point
)
p
++
;
while
(
isdigit
(
*
p
))
{
...
...
@@ -431,6 +428,7 @@ double CDECL MSVCRT__atof_l( const char *str, MSVCRT__locale_t locale)
*/
int
CDECL
MSVCRT__atoflt_l
(
MSVCRT__CRT_FLOAT
*
value
,
char
*
str
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
unsigned
__int64
d
=
0
,
hlp
;
unsigned
fpcontrol
;
int
exp
=
0
,
sign
=
1
;
...
...
@@ -439,7 +437,9 @@ int CDECL MSVCRT__atoflt_l( MSVCRT__CRT_FLOAT *value, char *str, MSVCRT__locale_
BOOL
found_digit
=
FALSE
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
/* FIXME: use *_l functions */
p
=
str
;
...
...
@@ -466,7 +466,7 @@ int CDECL MSVCRT__atoflt_l( MSVCRT__CRT_FLOAT *value, char *str, MSVCRT__locale_
p
++
;
}
if
(
*
p
==
*
loc
ale
->
loc
info
->
lconv
->
decimal_point
)
if
(
*
p
==
*
locinfo
->
lconv
->
decimal_point
)
p
++
;
while
(
isdigit
(
*
p
))
{
...
...
@@ -536,10 +536,14 @@ int CDECL MSVCRT__atoflt_l( MSVCRT__CRT_FLOAT *value, char *str, MSVCRT__locale_
*/
int
CDECL
MSVCRT_strcoll_l
(
const
char
*
str1
,
const
char
*
str2
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
return
CompareStringA
(
loc
ale
->
loc
info
->
lc_handle
[
MSVCRT_LC_CTYPE
],
0
,
str1
,
-
1
,
str2
,
-
1
)
-
2
;
return
CompareStringA
(
locinfo
->
lc_handle
[
MSVCRT_LC_CTYPE
],
0
,
str1
,
-
1
,
str2
,
-
1
)
-
2
;
}
/*********************************************************************
...
...
@@ -555,10 +559,14 @@ int CDECL MSVCRT_strcoll( const char* str1, const char* str2 )
*/
int
CDECL
MSVCRT__stricoll_l
(
const
char
*
str1
,
const
char
*
str2
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
return
CompareStringA
(
loc
ale
->
loc
info
->
lc_handle
[
MSVCRT_LC_CTYPE
],
NORM_IGNORECASE
,
return
CompareStringA
(
locinfo
->
lc_handle
[
MSVCRT_LC_CTYPE
],
NORM_IGNORECASE
,
str1
,
-
1
,
str2
,
-
1
)
-
2
;
}
...
...
@@ -575,10 +583,14 @@ int CDECL MSVCRT__stricoll( const char* str1, const char* str2 )
*/
int
CDECL
MSVCRT_strncoll_l
(
const
char
*
str1
,
const
char
*
str2
,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
return
CompareStringA
(
loc
ale
->
loc
info
->
lc_handle
[
MSVCRT_LC_CTYPE
],
0
,
str1
,
count
,
str2
,
count
)
-
2
;
return
CompareStringA
(
locinfo
->
lc_handle
[
MSVCRT_LC_CTYPE
],
0
,
str1
,
count
,
str2
,
count
)
-
2
;
}
/*********************************************************************
...
...
@@ -594,10 +606,14 @@ int CDECL MSVCRT_strncoll( const char* str1, const char* str2, MSVCRT_size_t cou
*/
int
CDECL
MSVCRT__strnicoll_l
(
const
char
*
str1
,
const
char
*
str2
,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
return
CompareStringA
(
loc
ale
->
loc
info
->
lc_handle
[
MSVCRT_LC_CTYPE
],
NORM_IGNORECASE
,
return
CompareStringA
(
locinfo
->
lc_handle
[
MSVCRT_LC_CTYPE
],
NORM_IGNORECASE
,
str1
,
count
,
str2
,
count
)
-
2
;
}
...
...
dlls/msvcrt/wcs.c
View file @
6991ac03
...
...
@@ -196,6 +196,7 @@ int CDECL MSVCRT__wcslwr_s( MSVCRT_wchar_t* str, MSVCRT_size_t n )
double
CDECL
MSVCRT__wcstod_l
(
const
MSVCRT_wchar_t
*
str
,
MSVCRT_wchar_t
**
end
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
unsigned
__int64
d
=
0
,
hlp
;
unsigned
fpcontrol
;
int
exp
=
0
,
sign
=
1
;
...
...
@@ -209,7 +210,9 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
}
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
p
=
str
;
while
(
isspaceW
(
*
p
))
...
...
@@ -234,7 +237,7 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
exp
++
;
p
++
;
}
if
(
*
p
==
*
loc
ale
->
loc
info
->
lconv
->
decimal_point
)
if
(
*
p
==
*
locinfo
->
lconv
->
decimal_point
)
p
++
;
while
(
isdigitW
(
*
p
))
{
...
...
@@ -309,22 +312,25 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
static
MSVCRT_size_t
CDECL
MSVCRT_wcsrtombs_l
(
char
*
mbstr
,
const
MSVCRT_wchar_t
**
wcstr
,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
char
default_char
=
'\0'
;
MSVCRT_size_t
tmp
=
0
;
BOOL
used_default
;
if
(
!
locale
)
locale
=
get_locale
();
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
if
(
!
mbstr
)
return
WideCharToMultiByte
(
loc
ale
->
loc
info
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
return
WideCharToMultiByte
(
locinfo
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
*
wcstr
,
-
1
,
NULL
,
0
,
&
default_char
,
&
used_default
)
-
1
;
while
(
**
wcstr
)
{
char
buf
[
3
];
MSVCRT_size_t
i
,
size
;
size
=
WideCharToMultiByte
(
loc
ale
->
loc
info
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
size
=
WideCharToMultiByte
(
locinfo
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
*
wcstr
,
1
,
buf
,
3
,
&
default_char
,
&
used_default
);
if
(
used_default
)
return
-
1
;
...
...
@@ -1020,11 +1026,10 @@ MSVCRT_wchar_t * CDECL MSVCRT_wcstok( MSVCRT_wchar_t *str, const MSVCRT_wchar_t
*/
INT
CDECL
MSVCRT_wctob
(
MSVCRT_wint_t
wchar
)
{
MSVCRT__locale_t
locale
=
get_locale
();
char
out
;
BOOL
error
;
if
(
WideCharToMultiByte
(
locale
->
locinfo
->
lc_codepage
,
0
,
&
wchar
,
1
,
&
out
,
1
,
NULL
,
&
error
)
&&
!
error
)
if
(
WideCharToMultiByte
(
get_locinfo
()
->
lc_codepage
,
0
,
&
wchar
,
1
,
&
out
,
1
,
NULL
,
&
error
)
&&
!
error
)
return
(
INT
)
out
;
return
MSVCRT_EOF
;
}
...
...
@@ -1034,8 +1039,7 @@ INT CDECL MSVCRT_wctob( MSVCRT_wint_t wchar )
*/
INT
CDECL
MSVCRT_wctomb
(
char
*
dst
,
MSVCRT_wchar_t
ch
)
{
MSVCRT__locale_t
locale
=
get_locale
();
return
WideCharToMultiByte
(
locale
->
locinfo
->
lc_codepage
,
0
,
&
ch
,
1
,
dst
,
6
,
NULL
,
NULL
);
return
WideCharToMultiByte
(
get_locinfo
()
->
lc_codepage
,
0
,
&
ch
,
1
,
dst
,
6
,
NULL
,
NULL
);
}
/*********************************************************************
...
...
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