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
80445efa
Commit
80445efa
authored
Apr 06, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Simplify Get/SetCalendarInfoA() implementation.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bf83236b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
39 deletions
+35
-39
lcformat.c
dlls/kernel32/lcformat.c
+0
-32
locale.c
dlls/kernel32/locale.c
+35
-7
No files found.
dlls/kernel32/lcformat.c
View file @
80445efa
...
...
@@ -1754,35 +1754,3 @@ int WINAPI GetCurrencyFormatEx(LPCWSTR localename, DWORD flags, LPCWSTR value,
return
GetCurrencyFormatW
(
LocaleNameToLCID
(
localename
,
0
),
flags
,
value
,
format
,
str
,
len
);
}
/*********************************************************************
* GetCalendarInfoA (KERNEL32.@)
*/
int
WINAPI
GetCalendarInfoA
(
LCID
lcid
,
CALID
id
,
CALTYPE
type
,
LPSTR
data
,
int
size
,
DWORD
*
val
)
{
int
ret
,
sizeW
=
size
;
LPWSTR
dataW
=
NULL
;
if
(
type
&
CAL_RETURN_NUMBER
)
return
GetCalendarInfoW
(
lcid
,
id
,
type
,
(
WCHAR
*
)
data
,
size
,
val
)
*
sizeof
(
WCHAR
);
if
(
!
size
)
sizeW
=
GetCalendarInfoW
(
lcid
,
id
,
type
,
NULL
,
0
,
NULL
);
if
(
!
(
dataW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeW
*
sizeof
(
WCHAR
))))
return
0
;
ret
=
GetCalendarInfoW
(
lcid
,
id
,
type
,
dataW
,
sizeW
,
val
);
if
(
ret
&&
dataW
&&
data
)
ret
=
WideCharToMultiByte
(
CP_ACP
,
0
,
dataW
,
-
1
,
data
,
size
,
NULL
,
NULL
);
else
if
(
type
&
CAL_RETURN_NUMBER
)
ret
*=
sizeof
(
WCHAR
);
HeapFree
(
GetProcessHeap
(),
0
,
dataW
);
return
ret
;
}
/*********************************************************************
* SetCalendarInfoA (KERNEL32.@)
*/
int
WINAPI
SetCalendarInfoA
(
LCID
lcid
,
CALID
id
,
CALTYPE
type
,
LPCSTR
data
)
{
FIXME
(
"(%08lx,%08lx,%08lx,%s): stub
\n
"
,
lcid
,
id
,
type
,
debugstr_a
(
data
));
return
0
;
}
dlls/kernel32/locale.c
View file @
80445efa
...
...
@@ -63,11 +63,13 @@ extern BOOL WINAPI Internal_EnumUILanguages( UILANGUAGE_ENUMPROCW proc, DWORD fl
*
* Retrieve the ANSI codepage for a given locale.
*/
static
inline
UINT
get_lcid_codepage
(
LCID
lcid
)
static
UINT
get_lcid_codepage
(
LCID
lcid
,
UINT
flags
)
{
UINT
ret
;
if
(
!
GetLocaleInfoW
(
lcid
,
LOCALE_IDEFAULTANSICODEPAGE
|
LOCALE_RETURN_NUMBER
,
(
WCHAR
*
)
&
ret
,
sizeof
(
ret
)
/
sizeof
(
WCHAR
)
))
ret
=
0
;
UINT
ret
=
0
;
if
(
flags
&
LOCALE_USE_CP_ACP
)
return
CP_ACP
;
GetLocaleInfoW
(
lcid
,
LOCALE_IDEFAULTANSICODEPAGE
|
LOCALE_RETURN_NUMBER
,
(
WCHAR
*
)
&
ret
,
sizeof
(
ret
)
/
sizeof
(
WCHAR
)
);
return
ret
;
}
...
...
@@ -98,13 +100,11 @@ static inline UINT get_lcid_codepage( LCID lcid )
*/
BOOL
WINAPI
SetLocaleInfoA
(
LCID
lcid
,
LCTYPE
lctype
,
LPCSTR
data
)
{
UINT
codepage
=
CP_ACP
;
UINT
codepage
=
get_lcid_codepage
(
lcid
,
lctype
)
;
WCHAR
*
strW
;
DWORD
len
;
BOOL
ret
;
if
(
!
(
lctype
&
LOCALE_USE_CP_ACP
))
codepage
=
get_lcid_codepage
(
lcid
);
if
(
!
data
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
...
...
@@ -376,6 +376,34 @@ BOOL WINAPI EnumUILanguagesA( UILANGUAGE_ENUMPROCA proc, DWORD flags, LONG_PTR p
}
/*********************************************************************
* GetCalendarInfoA (KERNEL32.@)
*/
int
WINAPI
GetCalendarInfoA
(
LCID
lcid
,
CALID
id
,
CALTYPE
type
,
LPSTR
data
,
int
data_len
,
DWORD
*
val
)
{
WCHAR
buffer
[
256
];
if
(
type
&
CAL_RETURN_NUMBER
)
return
GetCalendarInfoW
(
lcid
,
id
,
type
,
(
WCHAR
*
)
data
,
data_len
,
val
)
*
sizeof
(
WCHAR
);
if
(
!
GetCalendarInfoW
(
lcid
,
id
,
type
,
buffer
,
ARRAY_SIZE
(
buffer
),
val
))
return
0
;
return
WideCharToMultiByte
(
get_lcid_codepage
(
lcid
,
type
),
0
,
buffer
,
-
1
,
data
,
data_len
,
NULL
,
NULL
);
}
/*********************************************************************
* SetCalendarInfoA (KERNEL32.@)
*/
int
WINAPI
SetCalendarInfoA
(
LCID
lcid
,
CALID
id
,
CALTYPE
type
,
LPCSTR
data
)
{
WCHAR
buffer
[
256
];
if
(
!
MultiByteToWideChar
(
get_lcid_codepage
(
lcid
,
type
),
0
,
data
,
-
1
,
buffer
,
ARRAY_SIZE
(
buffer
)
))
return
0
;
return
SetCalendarInfoW
(
lcid
,
id
,
type
,
buffer
);
}
/******************************************************************************
* GetGeoInfoA (KERNEL32.@)
*/
...
...
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