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
2097c5dd
Commit
2097c5dd
authored
Aug 26, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Handle neutral locale names better in GetLocaleInfoEx.
parent
debc356a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
10 deletions
+44
-10
locale.c
dlls/kernel32/locale.c
+20
-1
locale.c
dlls/kernel32/tests/locale.c
+24
-9
No files found.
dlls/kernel32/locale.c
View file @
2097c5dd
...
...
@@ -1427,7 +1427,26 @@ INT WINAPI GetLocaleInfoW( LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len )
*/
INT
WINAPI
GetLocaleInfoEx
(
LPCWSTR
locale
,
LCTYPE
info
,
LPWSTR
buffer
,
INT
len
)
{
return
GetLocaleInfoW
(
LocaleNameToLCID
(
locale
,
0
),
info
,
buffer
,
len
);
LCID
lcid
=
LocaleNameToLCID
(
locale
,
0
);
TRACE
(
"%s, lcid=0x%x, 0x%x
\n
"
,
debugstr_w
(
locale
),
lcid
,
info
);
if
(
!
lcid
)
return
0
;
/* special handling for neutral locale names */
if
(
info
==
LOCALE_SNAME
&&
strlenW
(
locale
)
==
2
)
{
if
(
len
&&
len
<
3
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
0
;
}
if
(
len
)
strcpyW
(
buffer
,
locale
);
return
3
;
}
return
GetLocaleInfoW
(
lcid
,
info
,
buffer
,
len
);
}
/******************************************************************************
...
...
dlls/kernel32/tests/locale.c
View file @
2097c5dd
...
...
@@ -1918,6 +1918,13 @@ static void test_LocaleNameToLCID(void)
else
ok
(
lcid
==
ptr
->
lcid
,
"%s: got wrong lcid 0x%04x, expected 0x%04x
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
lcid
,
ptr
->
lcid
);
*
buffer
=
0
;
ret
=
pLCIDToLocaleName
(
lcid
,
buffer
,
sizeof
(
buffer
)
/
sizeof
(
WCHAR
),
0
);
ok
(
ret
>
0
,
"%s: got %d
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
ret
);
ok
(
lstrcmpW
(
ptr
->
name
,
buffer
),
"%s: got wrong locale name %s
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
wine_dbgstr_w
(
buffer
));
ptr
++
;
}
}
...
...
@@ -3400,29 +3407,37 @@ static void test_GetLocaleInfoEx(void)
const
struct
neutralsublang_name_t
*
ptr
=
neutralsublang_names
;
DWORD
val
;
todo_wine
ok
(
ret
==
lstrlenW
(
bufferW
)
+
1
,
"got %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
bufferW
,
enW
),
"got %s
\n
"
,
wine_dbgstr_w
(
bufferW
));
SetLastError
(
0xdeadbeef
);
ret
=
pGetLocaleInfoEx
(
enW
,
LOCALE_SNAME
,
bufferW
,
2
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got %d, %d
\n
"
,
ret
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pGetLocaleInfoEx
(
enW
,
LOCALE_SNAME
,
NULL
,
0
);
ok
(
ret
==
3
&&
GetLastError
()
==
0xdeadbeef
,
"got %d, %d
\n
"
,
ret
,
GetLastError
());
ret
=
pGetLocaleInfoEx
(
enusW
,
LOCALE_SNAME
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
WCHAR
));
ok
(
ret
,
"got %d
\n
"
,
ret
);
ok
(
ret
==
lstrlenW
(
bufferW
)
+
1
,
"got %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
bufferW
,
enusW
),
"got %s
\n
"
,
wine_dbgstr_w
(
bufferW
));
ret
=
pGetLocaleInfoEx
(
enW
,
LOCALE_SABBREVCTRYNAME
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
WCHAR
));
ok
(
ret
,
"got %d
\n
"
,
ret
);
ok
(
ret
==
lstrlenW
(
bufferW
)
+
1
,
"got %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
bufferW
,
usaW
),
"got %s
\n
"
,
wine_dbgstr_w
(
bufferW
));
ret
=
pGetLocaleInfoEx
(
enW
,
LOCALE_SABBREVLANGNAME
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
WCHAR
));
ok
(
ret
,
"got %d
\n
"
,
ret
);
ok
(
ret
==
lstrlenW
(
bufferW
)
+
1
,
"got %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
bufferW
,
enuW
),
"got %s
\n
"
,
wine_dbgstr_w
(
bufferW
));
ret
=
pGetLocaleInfoEx
(
enW
,
LOCALE_SCOUNTRY
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
WCHAR
));
ok
(
ret
,
"got %d
\n
"
,
ret
);
ok
(
ret
==
lstrlenW
(
bufferW
)
+
1
,
"got %d
\n
"
,
ret
);
ok
(
!
lstrcmpW
(
bufferW
,
statesW
),
"got %s
\n
"
,
wine_dbgstr_w
(
bufferW
));
bufferW
[
0
]
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
pGetLocaleInfoEx
(
dummyW
,
LOCALE_SNAME
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
WCHAR
));
todo_wine
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got %d, error %d
\n
"
,
ret
,
GetLastError
());
while
(
*
ptr
->
name
)
{
...
...
@@ -3434,8 +3449,8 @@ todo_wine
else
ok
(
val
==
ptr
->
lcid
,
"%s: got wrong lcid 0x%04x, expected 0x%04x
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
val
,
ptr
->
lcid
);
bufferW
[
0
]
=
0
;
pGetLocaleInfoEx
(
ptr
->
name
,
LOCALE_SNAME
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
WCHAR
));
todo_wine
ret
=
pGetLocaleInfoEx
(
ptr
->
name
,
LOCALE_SNAME
,
bufferW
,
sizeof
(
bufferW
)
/
sizeof
(
WCHAR
));
ok
(
ret
==
lstrlenW
(
bufferW
)
+
1
,
"%s: got ret value %d
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
ret
);
ok
(
!
lstrcmpW
(
bufferW
,
ptr
->
name
),
"%s: got wrong LOCALE_SNAME %s
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
wine_dbgstr_w
(
bufferW
));
ptr
++
;
}
...
...
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