From 88932ec82d048d006cdc81bd309f5e59aee799ac Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Fri, 30 Nov 2012 18:21:45 +0000 Subject: [PATCH] simplify code to return from the end of the function git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/ctrlcmn.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/common/ctrlcmn.cpp b/src/common/ctrlcmn.cpp index af5c83292f..5130048c9d 100644 --- a/src/common/ctrlcmn.cpp +++ b/src/common/ctrlcmn.cpp @@ -540,15 +540,10 @@ wxString wxControlBase::Ellipsize(const wxString& label, const wxDC& dc, // add this (ellipsized) row to the rest of the label ret << curLine; if ( pc == label.end() ) - { - // NOTE: this is the return which always exits the function - return ret; - } - else - { - ret << *pc; - curLine.clear(); - } + break; + + ret << *pc; + curLine.clear(); } // we need to remove mnemonics from the label for correct calculations else if ( *pc == wxS('&') && (flags & wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS) ) @@ -571,14 +566,9 @@ wxString wxControlBase::Ellipsize(const wxString& label, const wxDC& dc, } } - // this return would generate a - // warning C4702: unreachable code - // with MSVC since the function always exits from inside the loop - //return ret; + return ret; } - - // ---------------------------------------------------------------------------- // wxStaticBitmap // ---------------------------------------------------------------------------- -- 2.45.2