[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

kdenonbeta/kdedebian/kapture/kapture



CVS commit by domi: 

found a bug: when escaping a val ending in "::", you got wrong results with explode


  M +14 -1     stl_util.cpp   1.3


--- kdenonbeta/kdedebian/kapture/kapture/stl_util.cpp  #1.2:1.3
@@ -20,4 +20,8 @@
 
 #include <iostream>
+#ifdef DOMI_DEBUG
+#include <algorithm>
+#include <iterator>
+#endif
 
 #include "stl_util.h"
@@ -67,5 +71,5 @@ list<string> capture::explode (string s,
             //cerr << "orig: " << s . substr (0, pos) << endl;
             //cerr << "unesc: " << unescape (s . substr (0, pos), delim) << endl;
-        } else minpos = pos + 1;
+        } else minpos = pos + delim.length();
         //cerr << "pos = " << pos << ", minpos = " << minpos << endl;
     }
@@ -128,2 +132,11 @@ argmap capture::string2argmap (string s)
     return res;
 }
+
+#ifdef DOMI_DEBUG
+int main() {
+    string test = "appels@::met@::::frieten!!@@";
+    list<string> ret = explode( test, "::" );
+    std::copy( ret.begin(), ret.end(), std::ostream_iterator<std::string>( cout, "\n" ) );
+    return 0;
+}
+#endif




Reply to: