]> git.saurik.com Git - wxWidgets.git/commitdiff
simplify code to return from the end of the function
authorPaul Cornett <paulcor@bullseye.com>
Fri, 30 Nov 2012 18:21:45 +0000 (18:21 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Fri, 30 Nov 2012 18:21:45 +0000 (18:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/ctrlcmn.cpp

index af5c83292f14b37609e9fdaef016eea5fde85823..5130048c9dfb8d900c72f79e57412c0e18b61a38 100644 (file)
@@ -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() )
             // 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) )
         }
         // 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
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxStaticBitmap
 // ----------------------------------------------------------------------------