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
ba43e4cf
Commit
ba43e4cf
authored
Mar 29, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Reimplement number formatting values in GetLocaleInfoW/Ex using the locale.nls data.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bc54bcf8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
9 deletions
+45
-9
locale.c
dlls/kernelbase/locale.c
+45
-9
No files found.
dlls/kernelbase/locale.c
View file @
ba43e4cf
...
@@ -887,6 +887,42 @@ static int locale_return_number( UINT val, LCTYPE type, WCHAR *buffer, int len )
...
@@ -887,6 +887,42 @@ static int locale_return_number( UINT val, LCTYPE type, WCHAR *buffer, int len )
}
}
static
int
locale_return_grouping
(
DWORD
pos
,
LCTYPE
type
,
WCHAR
*
buffer
,
int
len
)
{
WORD
i
,
count
=
locale_strings
[
pos
];
const
WCHAR
*
str
=
locale_strings
+
pos
+
1
;
int
ret
;
if
(
type
&
LOCALE_RETURN_NUMBER
)
{
SetLastError
(
ERROR_INVALID_FLAGS
);
return
0
;
}
ret
=
2
*
count
;
if
(
str
[
count
-
1
])
ret
+=
2
;
/* for final zero */
if
(
!
len
)
return
ret
;
if
(
ret
>
len
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
0
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
!
str
[
i
])
/* explicit null termination */
{
buffer
[
-
1
]
=
0
;
return
ret
;
}
*
buffer
++
=
'0'
+
str
[
i
];
*
buffer
++
=
';'
;
}
*
buffer
++
=
'0'
;
*
buffer
=
0
;
return
ret
;
}
static
int
locale_return_strarray
(
DWORD
pos
,
WORD
idx
,
LCTYPE
type
,
WCHAR
*
buffer
,
int
len
)
static
int
locale_return_strarray
(
DWORD
pos
,
WORD
idx
,
LCTYPE
type
,
WCHAR
*
buffer
,
int
len
)
{
{
const
DWORD
*
array
=
(
const
DWORD
*
)(
locale_strings
+
pos
+
1
);
const
DWORD
*
array
=
(
const
DWORD
*
)(
locale_strings
+
pos
+
1
);
...
@@ -1052,25 +1088,25 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
...
@@ -1052,25 +1088,25 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
return
locale_return_number
(
val
,
type
,
buffer
,
len
);
return
locale_return_number
(
val
,
type
,
buffer
,
len
);
case
LOCALE_SLIST
:
case
LOCALE_SLIST
:
return
-
1
;
return
locale_return_string
(
locale
->
slist
,
type
,
buffer
,
len
)
;
case
LOCALE_IMEASURE
:
case
LOCALE_IMEASURE
:
return
locale_return_number
(
locale
->
imeasure
,
type
,
buffer
,
len
);
return
locale_return_number
(
locale
->
imeasure
,
type
,
buffer
,
len
);
case
LOCALE_SDECIMAL
:
case
LOCALE_SDECIMAL
:
return
-
1
;
return
locale_return_string
(
locale
->
sdecimal
,
type
,
buffer
,
len
)
;
case
LOCALE_STHOUSAND
:
case
LOCALE_STHOUSAND
:
return
-
1
;
return
locale_return_string
(
locale
->
sthousand
,
type
,
buffer
,
len
)
;
case
LOCALE_SGROUPING
:
case
LOCALE_SGROUPING
:
return
-
1
;
return
locale_return_grouping
(
locale
->
sgrouping
,
type
,
buffer
,
len
)
;
case
LOCALE_IDIGITS
:
case
LOCALE_IDIGITS
:
return
-
1
;
return
locale_return_number
(
locale
->
idigits
,
type
,
buffer
,
len
)
;
case
LOCALE_ILZERO
:
case
LOCALE_ILZERO
:
return
-
1
;
return
locale_return_number
(
locale
->
ilzero
,
type
,
buffer
,
len
)
;
case
LOCALE_SNATIVEDIGITS
:
case
LOCALE_SNATIVEDIGITS
:
return
locale_return_strarray_concat
(
locale
->
snativedigits
,
type
,
buffer
,
len
);
return
locale_return_strarray_concat
(
locale
->
snativedigits
,
type
,
buffer
,
len
);
...
@@ -1192,10 +1228,10 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
...
@@ -1192,10 +1228,10 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
type
-
LOCALE_SABBREVMONTHNAME1
,
type
,
buffer
,
len
);
type
-
LOCALE_SABBREVMONTHNAME1
,
type
,
buffer
,
len
);
case
LOCALE_SPOSITIVESIGN
:
case
LOCALE_SPOSITIVESIGN
:
return
-
1
;
return
locale_return_string
(
locale
->
spositivesign
,
type
,
buffer
,
len
)
;
case
LOCALE_SNEGATIVESIGN
:
case
LOCALE_SNEGATIVESIGN
:
return
-
1
;
return
locale_return_string
(
locale
->
snegativesign
,
type
,
buffer
,
len
)
;
case
LOCALE_IPOSSIGNPOSN
:
case
LOCALE_IPOSSIGNPOSN
:
return
-
1
;
return
-
1
;
...
@@ -1379,7 +1415,7 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
...
@@ -1379,7 +1415,7 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
12
,
type
,
buffer
,
len
);
12
,
type
,
buffer
,
len
);
case
LOCALE_INEGNUMBER
:
case
LOCALE_INEGNUMBER
:
return
-
1
;
return
locale_return_number
(
locale
->
inegnumber
,
type
,
buffer
,
len
)
;
case
LOCALE_IDEFAULTMACCODEPAGE
:
case
LOCALE_IDEFAULTMACCODEPAGE
:
val
=
locale
->
idefaultmaccodepage
==
CP_UTF8
?
CP_MACCP
:
locale
->
idefaultmaccodepage
;
val
=
locale
->
idefaultmaccodepage
==
CP_UTF8
?
CP_MACCP
:
locale
->
idefaultmaccodepage
;
...
...
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