[Orxonox-commit 2627] r7332 - code/branches/doc/src/libraries/util

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Sep 3 02:23:19 CEST 2010


Author: rgrieder
Date: 2010-09-03 02:23:18 +0200 (Fri, 03 Sep 2010)
New Revision: 7332

Modified:
   code/branches/doc/src/libraries/util/SubString.cc
Log:
Fixed bug in SubString. "a (),b" was split in "a (" and "b" instead of "a ()" and "b".
For the sake of performance, I just inserted a few lines instead of a generic solution at the end of SL_NORMAL.
(And please don't cite Donald Knuth for that optimisation...).

Modified: code/branches/doc/src/libraries/util/SubString.cc
===================================================================
--- code/branches/doc/src/libraries/util/SubString.cc	2010-09-02 23:06:52 UTC (rev 7331)
+++ code/branches/doc/src/libraries/util/SubString.cc	2010-09-03 00:23:18 UTC (rev 7332)
@@ -319,6 +319,7 @@
                     state = SL_ESCAPE;
                     if (!bRemoveEscapeChar)
                         token += line[i];
+                    fallBackNeighbours = 0;
                 }
                 else if(line[i] == safemodeChar)
                 {
@@ -326,6 +327,7 @@
                     inSafemode = true;
                     if (!bRemoveSafemodeChar)
                         token += line[i];
+                    fallBackNeighbours = 0;
                 }
                 else if(line[i] == openparenthesisChar)
                 {
@@ -333,11 +335,13 @@
                     inSafemode = true;
                     if (!bRemoveParenthesisChars)
                         token += line[i];
+                    fallBackNeighbours = 0;
                 }
                 else if(line[i] == commentChar)
                 {
                     if (fallBackNeighbours > 0)
                         token = token.substr(0, token.size() - fallBackNeighbours);
+                    fallBackNeighbours = 0;
                     // FINISH
                     if(bAllowEmptyEntries || token.size() > 0)
                     {
@@ -354,6 +358,7 @@
                     // line[i] is a delimiter
                     if (fallBackNeighbours > 0)
                         token = token.substr(0, token.size() - fallBackNeighbours);
+                    fallBackNeighbours = 0;
                     // FINISH
                     if(bAllowEmptyEntries || token.size() > 0)
                     {




More information about the Orxonox-commit mailing list