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
ff90dbc0
Commit
ff90dbc0
authored
Nov 28, 2006
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 28, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mlang: Implement LcidToRfc1766 and GetRfc1766FromLcid.
parent
884e7eed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
24 deletions
+71
-24
Makefile.in
dlls/mlang/Makefile.in
+1
-0
mlang.c
dlls/mlang/mlang.c
+62
-18
mlang.c
dlls/mlang/tests/mlang.c
+8
-6
No files found.
dlls/mlang/Makefile.in
View file @
ff90dbc0
...
...
@@ -5,6 +5,7 @@ VPATH = @srcdir@
MODULE
=
mlang.dll
IMPORTLIB
=
libmlang.
$(IMPLIBEXT)
IMPORTS
=
ole32 user32 gdi32 advapi32 kernel32 ntdll
DELAYIMPORTS
=
oleaut32
EXTRALIBS
=
-luuid
EXTRADEFS
=
-DCOM_NO_WINDOWS_H
...
...
dlls/mlang/mlang.c
View file @
ff90dbc0
...
...
@@ -654,21 +654,55 @@ HRESULT WINAPI IsConvertINetStringAvailable(
return
S_FALSE
;
}
static
inline
INT
lcid_to_rfc1766A
(
LCID
lcid
,
LPSTR
rfc1766
,
INT
len
)
{
INT
n
=
GetLocaleInfoA
(
lcid
,
LOCALE_SISO639LANGNAME
,
rfc1766
,
len
);
if
(
n
)
{
rfc1766
[
n
-
1
]
=
'-'
;
n
+=
GetLocaleInfoA
(
lcid
,
LOCALE_SISO3166CTRYNAME
,
rfc1766
+
n
,
len
-
n
)
+
1
;
LCMapStringA
(
LOCALE_USER_DEFAULT
,
LCMAP_LOWERCASE
,
rfc1766
,
n
,
rfc1766
,
len
);
return
n
;
}
return
0
;
}
static
inline
INT
lcid_to_rfc1766W
(
LCID
lcid
,
LPWSTR
rfc1766
,
INT
len
)
{
INT
n
=
GetLocaleInfoW
(
lcid
,
LOCALE_SISO639LANGNAME
,
rfc1766
,
len
);
if
(
n
)
{
rfc1766
[
n
-
1
]
=
'-'
;
n
+=
GetLocaleInfoW
(
lcid
,
LOCALE_SISO3166CTRYNAME
,
rfc1766
+
n
,
len
-
n
)
+
1
;
LCMapStringW
(
LOCALE_USER_DEFAULT
,
LCMAP_LOWERCASE
,
rfc1766
,
n
,
rfc1766
,
len
);
return
n
;
}
return
0
;
}
HRESULT
WINAPI
LcidToRfc1766A
(
LCID
Locale
,
LCID
lcid
,
LPSTR
pszRfc1766
,
INT
nChar
)
{
FIXME
(
"%d %s %u
\n
"
,
Locale
,
pszRfc1766
,
nChar
);
TRACE
(
"%04x %p %u
\n
"
,
lcid
,
pszRfc1766
,
nChar
);
if
(
lcid_to_rfc1766A
(
lcid
,
pszRfc1766
,
nChar
))
return
S_OK
;
return
S_FALSE
;
}
HRESULT
WINAPI
LcidToRfc1766W
(
LCID
Locale
,
LCID
lcid
,
LPWSTR
pszRfc1766
,
INT
nChar
)
{
FIXME
(
"%d %p %u
\n
"
,
Locale
,
pszRfc1766
,
nChar
);
TRACE
(
"%04x %p %u
\n
"
,
lcid
,
pszRfc1766
,
nChar
);
if
(
lcid_to_rfc1766W
(
lcid
,
pszRfc1766
,
nChar
))
return
S_OK
;
return
S_FALSE
;
}
...
...
@@ -1552,11 +1586,19 @@ static HRESULT WINAPI fnIMultiLanguage_ConvertStringReset(
static
HRESULT
WINAPI
fnIMultiLanguage_GetRfc1766FromLcid
(
IMultiLanguage
*
iface
,
LCID
Locale
,
LCID
lcid
,
BSTR
*
pbstrRfc1766
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
WCHAR
buf
[
MAX_RFC1766_NAME
];
TRACE
(
"%p %04x %p
\n
"
,
iface
,
lcid
,
pbstrRfc1766
);
if
(
lcid_to_rfc1766W
(
lcid
,
buf
,
MAX_RFC1766_NAME
))
{
*
pbstrRfc1766
=
SysAllocString
(
buf
);
return
S_OK
;
}
return
E_FAIL
;
}
static
HRESULT
WINAPI
fnIMultiLanguage_GetLcidFromRfc1766
(
...
...
@@ -1709,7 +1751,6 @@ struct enum_locales_data
static
BOOL
CALLBACK
enum_locales_proc
(
LPWSTR
locale
)
{
DWORD
n
;
WCHAR
*
end
;
struct
enum_locales_data
*
data
=
TlsGetValue
(
MLANG_tls_index
);
RFC1766INFO
*
info
;
...
...
@@ -1730,13 +1771,8 @@ static BOOL CALLBACK enum_locales_proc(LPWSTR locale)
return
FALSE
;
info
->
wszRfc1766
[
0
]
=
0
;
n
=
GetLocaleInfoW
(
info
->
lcid
,
LOCALE_SISO639LANGNAME
,
info
->
wszRfc1766
,
MAX_RFC1766_NAME
);
if
(
n
&&
n
<
MAX_RFC1766_NAME
)
{
info
->
wszRfc1766
[
n
-
1
]
=
'-'
;
GetLocaleInfoW
(
info
->
lcid
,
LOCALE_SISO3166CTRYNAME
,
info
->
wszRfc1766
+
n
,
MAX_RFC1766_NAME
-
n
);
LCMapStringW
(
LOCALE_USER_DEFAULT
,
LCMAP_LOWERCASE
,
info
->
wszRfc1766
+
n
,
-
1
,
info
->
wszRfc1766
+
n
,
MAX_RFC1766_NAME
-
n
);
}
lcid_to_rfc1766W
(
info
->
lcid
,
info
->
wszRfc1766
,
MAX_RFC1766_NAME
);
info
->
wszLocaleName
[
0
]
=
0
;
GetLocaleInfoW
(
info
->
lcid
,
LOCALE_SLANGUAGE
,
info
->
wszLocaleName
,
MAX_LOCALE_NAME
);
TRACE
(
"ISO639: %s SLANGUAGE: %s
\n
"
,
wine_dbgstr_w
(
info
->
wszRfc1766
),
wine_dbgstr_w
(
info
->
wszLocaleName
));
...
...
@@ -2066,11 +2102,19 @@ static HRESULT WINAPI fnIMultiLanguage2_ConvertStringReset(
static
HRESULT
WINAPI
fnIMultiLanguage2_GetRfc1766FromLcid
(
IMultiLanguage3
*
iface
,
LCID
Locale
,
LCID
lcid
,
BSTR
*
pbstrRfc1766
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
WCHAR
buf
[
MAX_RFC1766_NAME
];
TRACE
(
"%p %04x %p
\n
"
,
iface
,
lcid
,
pbstrRfc1766
);
if
(
lcid_to_rfc1766W
(
lcid
,
buf
,
MAX_RFC1766_NAME
))
{
*
pbstrRfc1766
=
SysAllocString
(
buf
);
return
S_OK
;
}
return
E_FAIL
;
}
static
HRESULT
WINAPI
fnIMultiLanguage2_GetLcidFromRfc1766
(
...
...
dlls/mlang/tests/mlang.c
View file @
ff90dbc0
...
...
@@ -33,12 +33,14 @@
#define CP_UNICODE 1200
#endif
/*#define DUMP_CP_INFO*/
/*#define DUMP_SCRIPT_INFO*/
#if 0
#define DUMP_CP_INFO
#define DUMP_SCRIPT_INFO
#if defined DUMP_CP_INFO || defined DUMP_SCRIPT_INFO
#include "wine/debug.h"
#endif
#endif /* 0 */
#define TRACE_2 OutputDebugStringA
...
...
@@ -314,8 +316,8 @@ static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags)
static
const
WCHAR
autoW
[]
=
{
'_'
,
'a'
,
'u'
,
't'
,
'o'
,
0
};
#ifdef DUMP_CP_INFO
trace
(
"MIMECPINFO #%
l
u:
\n
"
"dwFlags %08
l
x %s
\n
"
trace
(
"MIMECPINFO #%u:
\n
"
"dwFlags %08x %s
\n
"
"uiCodePage %u
\n
"
"uiFamilyCodePage %u
\n
"
"wszDescription %s
\n
"
...
...
@@ -554,7 +556,7 @@ static void test_EnumScripts(IMultiLanguage2 *iML2, DWORD flags)
{
CPINFOEXA
cpinfoex
;
#ifdef DUMP_SCRIPT_INFO
trace
(
"SCRIPTINFO #%
l
u:
\n
"
trace
(
"SCRIPTINFO #%u:
\n
"
"ScriptId %08x
\n
"
"uiCodePage %u
\n
"
"wszDescription %s
\n
"
...
...
@@ -657,7 +659,7 @@ static void test_rfc1766(IMultiLanguage2 *iML2)
if
(
ret
!=
S_OK
)
break
;
#ifdef DUMP_CP_INFO
trace
(
"lcid %04
l
x rfc_name %s locale_name %s
\n
"
,
trace
(
"lcid %04x rfc_name %s locale_name %s
\n
"
,
info
.
lcid
,
wine_dbgstr_w
(
info
.
wszRfc1766
),
wine_dbgstr_w
(
info
.
wszLocaleName
));
#endif
...
...
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