Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Rodolfo Ochoa
Approved revision: 11041
Merged at revision: 11190
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 40 lines (+22/-1)
1 file modified
src/zorbautils/locale.cpp (+22/-1)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Rodolfo Ochoa Approve
Paul J. Lucas Approve
Review via email: mp+143794@code.launchpad.net

Commit message

Quick-and-dirty fix for IsValidLocaleName() and Windows XP.

Description of the change

Quick-and-dirty fix for IsValidLocaleName() and Windows XP.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-01-18T20-29-03.161Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/zorbautils/locale.cpp'
--- src/zorbautils/locale.cpp 2013-01-10 02:03:05 +0000
+++ src/zorbautils/locale.cpp 2013-01-18 00:06:24 +0000
@@ -186,6 +186,27 @@
186 return zstring( info.get() );186 return zstring( info.get() );
187}187}
188188
189/**
190 * IsValidLocaleName() is available only on Windows Vista and later so we can't
191 * call it directly since we might be running on Windows XP. Hence, check to
192 * see if it's available and call it indirectly if so.
193 */
194static BOOL Zorba_IsValidLocaleName( LPCWSTR lpLocaleName ) {
195 typedef int (WINAPI *IsValidLocaleName_type)( LPCWSTR );
196
197 static IsValidLocaleName_type IsValidLocaleName_ptr;
198 static bool init;
199
200 if ( !init ) {
201 IsValidLocaleName_ptr = (IsValidLocaleName_type)::GetProcAddress(
202 ::GetModuleHandle( TEXT( "kernel32.dll" ) ), "IsValidLocaleName"
203 );
204 init = true;
205 }
206
207 return IsValidLocaleName_ptr ? IsValidLocaleName_ptr( lpLocaleName ) : 0;
208}
209
189#else /* WIN32 */210#else /* WIN32 */
190211
191/**212/**
@@ -1282,7 +1303,7 @@
1282bool is_supported( iso639_1::type lang, iso3166_1::type country ) {1303bool is_supported( iso639_1::type lang, iso3166_1::type country ) {
1283#ifdef WIN321304#ifdef WIN32
1284 unique_ptr<WCHAR[]> const wlocale_name( get_wlocale_name( lang, country ) );1305 unique_ptr<WCHAR[]> const wlocale_name( get_wlocale_name( lang, country ) );
1285 return !!::IsValidLocaleName( wlocale_name.get() );1306 return !!::Zorba_IsValidLocaleName( wlocale_name.get() );
1286#else1307#else
1287 if ( locale_t const loc = get_unix_locale_t( lang, country ) ) {1308 if ( locale_t const loc = get_unix_locale_t( lang, country ) ) {
1288 ::freelocale( loc );1309 ::freelocale( loc );

Subscribers

People subscribed via source and target branches