From 2deca99789cca1454b325c1e5c339f2adaa8a100 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 14 Jul 2017 19:28:33 +0200 Subject: [PATCH] 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". --- src/common/intl.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index a951a655c6..9efc542bf2 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -396,8 +396,6 @@ bool wxLocale::Init(int language, int flags) wxS("wxLOCALE_CONV_ENCODING is no longer supported, add charset to your catalogs") ); #endif - bool ret = true; - int lang = language; if (lang == wxLANGUAGE_DEFAULT) { @@ -479,9 +477,6 @@ bool wxLocale::Init(int language, int flags) } } - if ( !retloc ) - ret = false; - #ifdef __AIX__ // 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 @@ -539,9 +534,6 @@ bool wxLocale::Init(int language, int flags) } } #endif // CRT not handling Unicode-only languages - - if ( !retloc ) - ret = false; #elif defined(__WXMAC__) const wxString& locale = info->CanonicalName; @@ -559,7 +551,7 @@ bool wxLocale::Init(int language, int flags) #endif #ifndef WX_NO_LOCALE_SUPPORT - if ( !ret ) + if ( !retloc ) { wxLogWarning(_("Cannot set locale to language \"%s\"."), name); @@ -572,10 +564,7 @@ bool wxLocale::Init(int language, int flags) // this language } - if ( !DoInit(name, info->CanonicalName, retloc) ) - { - ret = false; - } + const bool ret = DoInit(name, info->CanonicalName, retloc); if (IsOk()) // setlocale() succeeded m_language = lang;