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
This commit is contained in:
Paul Cornett
2012-11-30 18:21:45 +00:00
parent 40a66cfd6a
commit 88932ec82d

View File

@@ -540,15 +540,10 @@ wxString wxControlBase::Ellipsize(const wxString& label, const wxDC& dc,
// add this (ellipsized) row to the rest of the label // add this (ellipsized) row to the rest of the label
ret << curLine; ret << curLine;
if ( pc == label.end() ) if ( pc == label.end() )
{ break;
// NOTE: this is the return which always exits the function
return ret; ret << *pc;
} curLine.clear();
else
{
ret << *pc;
curLine.clear();
}
} }
// we need to remove mnemonics from the label for correct calculations // we need to remove mnemonics from the label for correct calculations
else if ( *pc == wxS('&') && (flags & wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS) ) 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 return ret;
// warning C4702: unreachable code
// with MSVC since the function always exits from inside the loop
//return ret;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxStaticBitmap // wxStaticBitmap
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------