From 915b5212f8c4e4d026b4ae6c761572cc0a19f79f Mon Sep 17 00:00:00 2001 From: pavel-t <36256989+pavel-t@users.noreply.github.com> Date: Thu, 12 Jul 2018 11:15:10 +0300 Subject: [PATCH] Avoid unsafe casts to enum type --- src/generic/statusbr.cpp | 6 +++--- src/msw/statusbar.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp index f364677c7b..c0581dd679 100644 --- a/src/generic/statusbr.cpp +++ b/src/generic/statusbr.cpp @@ -231,12 +231,12 @@ void wxStatusBarGeneric::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int // eventually ellipsize the text so that it fits the field width - wxEllipsizeMode ellmode = (wxEllipsizeMode)-1; + wxEllipsizeMode ellmode = wxELLIPSIZE_NONE; if (HasFlag(wxSTB_ELLIPSIZE_START)) ellmode = wxELLIPSIZE_START; else if (HasFlag(wxSTB_ELLIPSIZE_MIDDLE)) ellmode = wxELLIPSIZE_MIDDLE; else if (HasFlag(wxSTB_ELLIPSIZE_END)) ellmode = wxELLIPSIZE_END; - if (ellmode == (wxEllipsizeMode)-1) + if (ellmode == wxELLIPSIZE_NONE) { // if we have the wxSTB_SHOW_TIPS we must set the ellipsized flag even if // we don't ellipsize the text but just truncate it @@ -267,7 +267,7 @@ void wxStatusBarGeneric::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int // draw the text dc.DrawText(text, xpos, ypos); - if (ellmode == (wxEllipsizeMode)-1) + if (ellmode == wxELLIPSIZE_NONE) dc.DestroyClippingRegion(); } diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index 52ed30fa79..ad9b4eff96 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -287,12 +287,12 @@ void wxStatusBar::DoUpdateStatusText(int nField) wxString text = GetStatusText(nField); // do we need to ellipsize this string? - wxEllipsizeMode ellmode = (wxEllipsizeMode)-1; + wxEllipsizeMode ellmode = wxELLIPSIZE_NONE; if (HasFlag(wxSTB_ELLIPSIZE_START)) ellmode = wxELLIPSIZE_START; else if (HasFlag(wxSTB_ELLIPSIZE_MIDDLE)) ellmode = wxELLIPSIZE_MIDDLE; else if (HasFlag(wxSTB_ELLIPSIZE_END)) ellmode = wxELLIPSIZE_END; - if (ellmode == (wxEllipsizeMode)-1) + if (ellmode == wxELLIPSIZE_NONE) { // if we have the wxSTB_SHOW_TIPS we must set the ellipsized flag even if // we don't ellipsize the text but just truncate it