Avoid some -Wduplicated-branches warnings

This commit is contained in:
Paul Cornett
2022-03-21 11:54:30 -07:00
parent e9e1023393
commit b4475c881a
3 changed files with 26 additions and 43 deletions

View File

@@ -428,52 +428,56 @@ bool wxPrintfConvSpec<CharType>::Parse(const CharType *format)
break; break;
case wxT('c'): case wxT('c'):
#if wxUSE_UNICODE
if (ilen == -1) if (ilen == -1)
{ {
// in Unicode mode %hc == ANSI character // %hc == ANSI character
// and in ANSI mode, %hc == %c == ANSI...
m_type = wxPAT_CHAR; m_type = wxPAT_CHAR;
} }
else if (ilen == 1) else
{ {
// in ANSI mode %lc == Unicode character // %lc == %c == Unicode character
// and in Unicode mode, %lc == %c == Unicode... m_type = wxPAT_WCHAR;
}
#else
if (ilen == 1)
{
// %lc == Unicode character
m_type = wxPAT_WCHAR; m_type = wxPAT_WCHAR;
} }
else else
{ {
#if wxUSE_UNICODE // %hc == %c == ANSI character
// in Unicode mode, %c == Unicode character
m_type = wxPAT_WCHAR;
#else
// in ANSI mode, %c == ANSI character
m_type = wxPAT_CHAR; m_type = wxPAT_CHAR;
#endif
} }
#endif
done = true; done = true;
break; break;
case wxT('s'): case wxT('s'):
#if wxUSE_UNICODE
if (ilen == -1) if (ilen == -1)
{ {
// Unicode mode wx extension: we'll let %hs mean non-Unicode // wx extension: we'll let %hs mean non-Unicode strings
// strings (when in ANSI mode, %s == %hs == ANSI string)
m_type = wxPAT_PCHAR; m_type = wxPAT_PCHAR;
} }
else if (ilen == 1) else
{ {
// in Unicode mode, %ls == %s == Unicode string // %ls == %s == Unicode string
// in ANSI mode, %ls == Unicode string m_type = wxPAT_PWCHAR;
}
#else
if (ilen == 1)
{
// %ls == Unicode string
m_type = wxPAT_PWCHAR; m_type = wxPAT_PWCHAR;
} }
else else
{ {
#if wxUSE_UNICODE // %s == %hs == ANSI string
m_type = wxPAT_PWCHAR;
#else
m_type = wxPAT_PCHAR; m_type = wxPAT_PCHAR;
#endif
} }
#endif
done = true; done = true;
break; break;

View File

@@ -885,6 +885,7 @@ wxDateTime::Country wxDateTime::GetCountry()
struct tm *tm = wxLocaltime_r(&t, &tmstruct); struct tm *tm = wxLocaltime_r(&t, &tmstruct);
wxString tz = wxCallStrftime(wxS("%Z"), tm); wxString tz = wxCallStrftime(wxS("%Z"), tm);
ms_country = USA;
if ( tz == wxT("WET") || tz == wxT("WEST") || if ( tz == wxT("WET") || tz == wxT("WEST") ||
tz == wxT("BST") || tz == wxT("GMT") ) tz == wxT("BST") || tz == wxT("GMT") )
{ {
@@ -898,19 +899,6 @@ wxDateTime::Country wxDateTime::GetCountry()
{ {
ms_country = Russia; 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; return ms_country;

View File

@@ -6368,19 +6368,10 @@ void wxWindowGTK::GTKScrolledWindowSetBorder(GtkWidget* w, int wxstyle)
//as well... //as well...
if (!(wxstyle & wxNO_BORDER) && !(wxstyle & wxBORDER_STATIC)) if (!(wxstyle & wxNO_BORDER) && !(wxstyle & wxBORDER_STATIC))
{ {
GtkShadowType gtkstyle; GtkShadowType gtkstyle = GTK_SHADOW_IN;
if(wxstyle & wxBORDER_RAISED) if(wxstyle & wxBORDER_RAISED)
gtkstyle = GTK_SHADOW_OUT; 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), gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(w),
gtkstyle ); gtkstyle );