Don't duplicate "ret" flag in wxLocale::Init()
Simplify the code by just using "retloc != NULL" as success indicator until the call to DoInit() instead of keeping a separate "bool ret" variable in sync with "retloc".
This commit is contained in:
@@ -396,8 +396,6 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
wxS("wxLOCALE_CONV_ENCODING is no longer supported, add charset to your catalogs") );
|
wxS("wxLOCALE_CONV_ENCODING is no longer supported, add charset to your catalogs") );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool ret = true;
|
|
||||||
|
|
||||||
int lang = language;
|
int lang = language;
|
||||||
if (lang == wxLANGUAGE_DEFAULT)
|
if (lang == wxLANGUAGE_DEFAULT)
|
||||||
{
|
{
|
||||||
@@ -479,9 +477,6 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !retloc )
|
|
||||||
ret = false;
|
|
||||||
|
|
||||||
#ifdef __AIX__
|
#ifdef __AIX__
|
||||||
// at least in AIX 5.2 libc is buggy and the string returned from
|
// at least in AIX 5.2 libc is buggy and the string returned from
|
||||||
// setlocale(LC_ALL) can't be passed back to it because it returns 6
|
// setlocale(LC_ALL) can't be passed back to it because it returns 6
|
||||||
@@ -539,9 +534,6 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CRT not handling Unicode-only languages
|
#endif // CRT not handling Unicode-only languages
|
||||||
|
|
||||||
if ( !retloc )
|
|
||||||
ret = false;
|
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
const wxString& locale = info->CanonicalName;
|
const wxString& locale = info->CanonicalName;
|
||||||
|
|
||||||
@@ -559,7 +551,7 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WX_NO_LOCALE_SUPPORT
|
#ifndef WX_NO_LOCALE_SUPPORT
|
||||||
if ( !ret )
|
if ( !retloc )
|
||||||
{
|
{
|
||||||
wxLogWarning(_("Cannot set locale to language \"%s\"."), name);
|
wxLogWarning(_("Cannot set locale to language \"%s\"."), name);
|
||||||
|
|
||||||
@@ -572,10 +564,7 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
// this language
|
// this language
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !DoInit(name, info->CanonicalName, retloc) )
|
const bool ret = DoInit(name, info->CanonicalName, retloc);
|
||||||
{
|
|
||||||
ret = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsOk()) // setlocale() succeeded
|
if (IsOk()) // setlocale() succeeded
|
||||||
m_language = lang;
|
m_language = lang;
|
||||||
|
Reference in New Issue
Block a user