missing include for rand() in self-tests
[ardour.git] / libs / pbd / strsplit.cc
index 342daadaa222f67906504f5acc1c30d77dae79b3..85f0c5c310552d9d7ef30e0e81403c31dd5dcd48 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2000-2007 Paul Davis 
+    Copyright (C) 2000-2007 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
-#include <pbd/strsplit.h>
+#include "pbd/strsplit.h"
 
 using namespace std;
 using namespace Glib;
 
 void
 split (string str, vector<string>& result, char splitchar)
-{      
+{
        string::size_type pos;
        string remaining;
        string::size_type len = str.length();
@@ -50,7 +50,9 @@ split (string str, vector<string>& result, char splitchar)
        remaining = str;
 
        while ((pos = remaining.find_first_of (splitchar)) != string::npos) {
-               result.push_back (remaining.substr (0, pos));
+               if (pos != 0) {
+                       result.push_back (remaining.substr (0, pos));
+               }
                remaining = remaining.substr (pos+1);
        }
 
@@ -62,7 +64,7 @@ split (string str, vector<string>& result, char splitchar)
 
 void
 split (ustring str, vector<ustring>& result, char splitchar)
-{      
+{
        ustring::size_type pos;
        ustring remaining;
        ustring::size_type len = str.length();