[cmake-commits] alex committed cmSourceGroupCommand.cxx 1.16 1.17

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Aug 24 10:58:55 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv24159

Modified Files:
	cmSourceGroupCommand.cxx 
Log Message:
BUG: handle source_group names which consist only of the delimiter the same was as empty source group names

Alex


Index: cmSourceGroupCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSourceGroupCommand.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cmSourceGroupCommand.cxx	15 Mar 2006 16:02:07 -0000	1.16
+++ cmSourceGroupCommand.cxx	24 Aug 2007 14:58:53 -0000	1.17
@@ -20,17 +20,11 @@
                                          const std::string& sep)
 {
   std::vector<std::string> tokens;
-  if(str.size() == 0)
-    {
-    tokens.push_back("");
-    return tokens;
-    }
-  std::string::size_type tokstart,tokend;
+  std::string::size_type tokend = 0;
 
-  tokend=0;
   do
     {
-    tokstart=str.find_first_not_of(sep,tokend);
+    std::string::size_type tokstart=str.find_first_not_of(sep, tokend);
     if (tokstart==std::string::npos) 
       {
       break;    // no more tokens
@@ -45,6 +39,11 @@
       tokens.push_back(str.substr(tokstart,tokend-tokstart));
       }
     } while (tokend!=std::string::npos);
+
+  if (tokens.empty())
+    {
+    tokens.push_back("");
+    }
   return tokens;
 }
 



More information about the Cmake-commits mailing list