From b4475c881a2d3f2984d4ee0e4320bac262bb9f6e Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 21 Mar 2022 11:54:30 -0700 Subject: [PATCH] Avoid some -Wduplicated-branches warnings --- include/wx/private/wxprintf.h | 44 +++++++++++++++++++---------------- src/common/datetime.cpp | 14 +---------- src/gtk/window.cpp | 11 +-------- 3 files changed, 26 insertions(+), 43 deletions(-) diff --git a/include/wx/private/wxprintf.h b/include/wx/private/wxprintf.h index 2d06abffa6..05be4142ca 100644 --- a/include/wx/private/wxprintf.h +++ b/include/wx/private/wxprintf.h @@ -428,52 +428,56 @@ bool wxPrintfConvSpec::Parse(const CharType *format) break; case wxT('c'): +#if wxUSE_UNICODE if (ilen == -1) { - // in Unicode mode %hc == ANSI character - // and in ANSI mode, %hc == %c == ANSI... + // %hc == ANSI character m_type = wxPAT_CHAR; } - else if (ilen == 1) + else { - // in ANSI mode %lc == Unicode character - // and in Unicode mode, %lc == %c == Unicode... + // %lc == %c == Unicode character + m_type = wxPAT_WCHAR; + } +#else + if (ilen == 1) + { + // %lc == Unicode character m_type = wxPAT_WCHAR; } else { -#if wxUSE_UNICODE - // in Unicode mode, %c == Unicode character - m_type = wxPAT_WCHAR; -#else - // in ANSI mode, %c == ANSI character + // %hc == %c == ANSI character m_type = wxPAT_CHAR; -#endif } +#endif done = true; break; case wxT('s'): +#if wxUSE_UNICODE if (ilen == -1) { - // Unicode mode wx extension: we'll let %hs mean non-Unicode - // strings (when in ANSI mode, %s == %hs == ANSI string) + // wx extension: we'll let %hs mean non-Unicode strings m_type = wxPAT_PCHAR; } - else if (ilen == 1) + else { - // in Unicode mode, %ls == %s == Unicode string - // in ANSI mode, %ls == Unicode string + // %ls == %s == Unicode string + m_type = wxPAT_PWCHAR; + } +#else + if (ilen == 1) + { + // %ls == Unicode string m_type = wxPAT_PWCHAR; } else { -#if wxUSE_UNICODE - m_type = wxPAT_PWCHAR; -#else + // %s == %hs == ANSI string m_type = wxPAT_PCHAR; -#endif } +#endif done = true; break; diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index 7600ed3c40..f28cc46d91 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -885,6 +885,7 @@ wxDateTime::Country wxDateTime::GetCountry() struct tm *tm = wxLocaltime_r(&t, &tmstruct); wxString tz = wxCallStrftime(wxS("%Z"), tm); + ms_country = USA; if ( tz == wxT("WET") || tz == wxT("WEST") || tz == wxT("BST") || tz == wxT("GMT") ) { @@ -898,19 +899,6 @@ wxDateTime::Country wxDateTime::GetCountry() { ms_country = Russia; } - else if ( tz == wxT("AST") || tz == wxT("ADT") || - tz == wxT("EST") || tz == wxT("EDT") || - tz == wxT("CST") || tz == wxT("CDT") || - tz == wxT("MST") || tz == wxT("MDT") || - tz == wxT("PST") || tz == wxT("PDT") ) - { - ms_country = USA; - } - else - { - // well, choose a default one - ms_country = USA; - } } return ms_country; diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 8f725ab563..9a56692b87 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -6368,19 +6368,10 @@ void wxWindowGTK::GTKScrolledWindowSetBorder(GtkWidget* w, int wxstyle) //as well... if (!(wxstyle & wxNO_BORDER) && !(wxstyle & wxBORDER_STATIC)) { - GtkShadowType gtkstyle; + GtkShadowType gtkstyle = GTK_SHADOW_IN; if(wxstyle & wxBORDER_RAISED) gtkstyle = GTK_SHADOW_OUT; - else if ((wxstyle & wxBORDER_SUNKEN) || (wxstyle & wxBORDER_THEME)) - gtkstyle = GTK_SHADOW_IN; -#if 0 - // Now obsolete - else if (wxstyle & wxBORDER_DOUBLE) - gtkstyle = GTK_SHADOW_ETCHED_IN; -#endif - else //default - gtkstyle = GTK_SHADOW_IN; gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(w), gtkstyle );