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
9ba0cf76
Commit
9ba0cf76
authored
Jul 26, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fix base for value returned with LOCALE_RETURN_NUMBER.
parent
5b7efa8e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
locale.c
dlls/kernel32/locale.c
+6
-2
locale.c
dlls/kernel32/tests/locale.c
+14
-6
No files found.
dlls/kernel32/locale.c
View file @
9ba0cf76
...
...
@@ -1264,6 +1264,10 @@ INT WINAPI GetLocaleInfoA( LCID lcid, LCTYPE lctype, LPSTR buffer, INT len )
return
ret
;
}
static
int
get_value_base_by_lctype
(
LCTYPE
lctype
)
{
return
lctype
==
LOCALE_ILANGUAGE
||
lctype
==
LOCALE_IDEFAULTLANGUAGE
?
16
:
10
;
}
/******************************************************************************
* GetLocaleInfoW (KERNEL32.@)
...
...
@@ -1317,7 +1321,7 @@ INT WINAPI GetLocaleInfoW( LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len )
if
(
ret
>
0
)
{
WCHAR
*
end
;
UINT
number
=
strtolW
(
tmp
,
&
end
,
10
);
UINT
number
=
strtolW
(
tmp
,
&
end
,
get_value_base_by_lctype
(
lctype
)
);
if
(
*
end
)
/* invalid number */
{
SetLastError
(
ERROR_INVALID_FLAGS
);
...
...
@@ -1390,7 +1394,7 @@ INT WINAPI GetLocaleInfoW( LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len )
if
(
!
tmp
)
return
0
;
memcpy
(
tmp
,
p
+
1
,
*
p
*
sizeof
(
WCHAR
)
);
tmp
[
*
p
]
=
0
;
number
=
strtolW
(
tmp
,
&
end
,
10
);
number
=
strtolW
(
tmp
,
&
end
,
get_value_base_by_lctype
(
lctype
)
);
if
(
!*
end
)
memcpy
(
buffer
,
&
number
,
sizeof
(
number
)
);
else
/* invalid number */
...
...
dlls/kernel32/tests/locale.c
View file @
9ba0cf76
...
...
@@ -139,7 +139,6 @@ static void test_GetLocaleInfoA(void)
ret
=
GetLocaleInfoA
(
lcid
,
LOCALE_ILANGUAGE
|
LOCALE_RETURN_NUMBER
,
(
char
*
)
&
val
,
sizeof
(
val
));
ok
(
ret
,
"got %d
\n
"
,
ret
);
todo_wine
ok
(
val
==
lcid
,
"got 0x%08x
\n
"
,
val
);
/* en and ar use SUBLANG_NEUTRAL, but GetLocaleInfo assume SUBLANG_DEFAULT
...
...
@@ -204,6 +203,7 @@ struct neutralsublang_name2_t {
WCHAR
name
[
3
];
LCID
lcid
;
LCID
lcid_broken
;
int
todo
;
};
static
const
struct
neutralsublang_name2_t
neutralsublang_names2
[]
=
{
...
...
@@ -212,8 +212,8 @@ static const struct neutralsublang_name2_t neutralsublang_names2[] = {
{
{
'd'
,
'e'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_GERMAN
,
SUBLANG_GERMAN
),
SORT_DEFAULT
)
},
{
{
'e'
,
'n'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
)
},
{
{
'e'
,
's'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_SPANISH
,
SUBLANG_SPANISH_MODERN
),
SORT_DEFAULT
),
MAKELCID
(
MAKELANGID
(
LANG_SPANISH
,
SUBLANG_SPANISH
),
SORT_DEFAULT
)
/* vista */
},
{
{
'g'
,
'a'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_IRISH
,
SUBLANG_IRISH_IRELAND
),
SORT_DEFAULT
)
},
MAKELCID
(
MAKELANGID
(
LANG_SPANISH
,
SUBLANG_SPANISH
),
SORT_DEFAULT
)
/* vista */
,
1
},
{
{
'g'
,
'a'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_IRISH
,
SUBLANG_IRISH_IRELAND
),
SORT_DEFAULT
)
,
0
,
1
},
{
{
'i'
,
't'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_ITALIAN
,
SUBLANG_ITALIAN
),
SORT_DEFAULT
)
},
{
{
'm'
,
's'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_MALAY
,
SUBLANG_MALAY_MALAYSIA
),
SORT_DEFAULT
)
},
{
{
'n'
,
'l'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_DUTCH
,
SUBLANG_DUTCH
),
SORT_DEFAULT
)
},
...
...
@@ -221,7 +221,7 @@ static const struct neutralsublang_name2_t neutralsublang_names2[] = {
{
{
's'
,
'r'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_SERBIAN
,
SUBLANG_SERBIAN_CROATIA
),
SORT_DEFAULT
)
},
{
{
's'
,
'v'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_SWEDISH
,
SUBLANG_SWEDISH
),
SORT_DEFAULT
)
},
{
{
'u'
,
'z'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_UZBEK
,
SUBLANG_UZBEK_LATIN
),
SORT_DEFAULT
)
},
{
{
'z'
,
'h'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_CHINESE
,
SUBLANG_CHINESE_SIMPLIFIED
),
SORT_DEFAULT
)
},
{
{
'z'
,
'h'
,
0
},
MAKELCID
(
MAKELANGID
(
LANG_CHINESE
,
SUBLANG_CHINESE_SIMPLIFIED
),
SORT_DEFAULT
)
,
0
,
1
},
{
{
0
}
}
};
...
...
@@ -244,7 +244,6 @@ static void test_GetLocaleInfoW(void)
ret
=
GetLocaleInfoW
(
lcid_en
,
LOCALE_ILANGUAGE
|
LOCALE_RETURN_NUMBER
,
(
WCHAR
*
)
&
val
,
sizeof
(
val
)
/
sizeof
(
WCHAR
));
ok
(
ret
,
"got %d
\n
"
,
ret
);
todo_wine
ok
(
val
==
lcid_en
,
"got 0x%08x
\n
"
,
val
);
ret
=
GetLocaleInfoW
(
lcid_en_neut
,
LOCALE_SNAME
,
bufferW
,
COUNTOF
(
bufferW
));
...
...
@@ -275,8 +274,14 @@ todo_wine
val
=
0
;
GetLocaleInfoW
(
MAKELCID
(
langid
,
SORT_DEFAULT
),
LOCALE_ILANGUAGE
|
LOCALE_RETURN_NUMBER
,
(
WCHAR
*
)
&
val
,
sizeof
(
val
)
/
sizeof
(
WCHAR
));
if
(
ptr
->
todo
)
{
todo_wine
ok
(
val
==
ptr
->
lcid
||
broken
(
val
==
ptr
->
lcid_broken
),
"%s: got wrong lcid 0x%04x, expected 0x%04x
\n
"
,
ok
(
val
==
ptr
->
lcid
||
(
val
&&
broken
(
val
==
ptr
->
lcid_broken
)),
"%s: got wrong lcid 0x%04x, expected 0x%04x
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
val
,
ptr
->
lcid
);
}
else
ok
(
val
==
ptr
->
lcid
||
(
val
&&
broken
(
val
==
ptr
->
lcid_broken
)),
"%s: got wrong lcid 0x%04x, expected 0x%04x
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
val
,
ptr
->
lcid
);
ptr
++
;
}
...
...
@@ -3381,8 +3386,11 @@ todo_wine
{
val
=
0
;
pGetLocaleInfoEx
(
ptr
->
name
,
LOCALE_ILANGUAGE
|
LOCALE_RETURN_NUMBER
,
(
WCHAR
*
)
&
val
,
sizeof
(
val
)
/
sizeof
(
WCHAR
));
if
(
ptr
->
todo
)
todo_wine
ok
(
val
==
ptr
->
lcid
,
"%s: got wrong lcid 0x%04x, expected 0x%04x
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
val
,
ptr
->
lcid
);
else
ok
(
val
==
ptr
->
lcid
,
"%s: got wrong lcid 0x%04x, expected 0x%04x
\n
"
,
wine_dbgstr_w
(
ptr
->
name
),
val
,
ptr
->
lcid
);
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