]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filefn.cpp
Spelling corrections
[wxWidgets.git] / src / common / filefn.cpp
index c33c44c174052fb5e606aaf6fc581b52ad2643a1..0a2241edd8a14b058e049c13963376c930e8698a 100644 (file)
@@ -361,17 +361,16 @@ void wxStripExtension(wxChar *buffer)
 
 void wxStripExtension(wxString& buffer)
 {
-  size_t len = buffer.Length();
-  size_t i = len-1;
-  while (i > 0)
-  {
-    if (buffer.GetChar(i) == wxT('.'))
+    //RN:  Be careful about the handling the case where 
+    //buffer.Length() == 0
+    for(size_t i = buffer.Length() - 1; i != wxString::npos; --i)
     {
-      buffer = buffer.Left(i);
-      break;
+        if (buffer.GetChar(i) == wxT('.'))
+        {
+          buffer = buffer.Left(i);
+          break;
+        }
     }
-    i --;
-  }
 }
 
 // Destructive removal of /./ and /../ stuff