]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/string.cpp
Add a comment about covariant returns
[wxWidgets.git] / src / common / string.cpp
index b4857f3b57fe3bdcecda123dc5f49ff48a2fc873..bd9857e5cce92f2e26ba32f28ec5172e9d6e8c54 100644 (file)
@@ -742,11 +742,8 @@ wxStringBase& wxStringBase::replace(size_t nStart, size_t nLen,
   //
   //Also, we can't use append with the full character pointer and must
   //do it manually because this string can contain null characters
-  if ( nStart != 0 )
-  {
-      for(size_t i1 = 0; i1 < nStart; ++i1)
-          strTmp.append(1, this->c_str()[i1]);
-  }
+  for(size_t i1 = 0; i1 < nStart; ++i1)
+      strTmp.append(1, this->c_str()[i1]);
   
   //its safe to do the full version here because
   //sz must be a normal c string
@@ -1554,8 +1551,8 @@ size_t wxString::Replace(const wxChar *szOld,
             //replace this occurance of the old string with the new one
             replace(dwPos, uiOldLen, szNew, uiNewLen);
 
-            //move up pos past the old string
-            dwPos += uiOldLen;
+            //move up pos past the string that was replaced
+            dwPos += uiNewLen;
 
             //increase replace count
             ++uiCount;