]> git.lyx.org Git - features.git/commitdiff
new SpaceLess function
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 3 Nov 1999 12:24:23 +0000 (12:24 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 3 Nov 1999 12:24:23 +0000 (12:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@279 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/support/filetools.C

index 3d697972ed8f69b027aa303c8650f9c0337e6f58..bb3b0416a1dafea06989daa993e3d5dc7ed103f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-11-03  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/support/filetools.C (SpaceLess): yet another version of the
+       algorithm...now per Jean-Marc's suggestions.
+
 1999-11-02  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * src/support/filetools.C (SpaceLess): new version of the
index 0ffc353683146e38e708a18275d3791f61f90a2a..311606bbbac8126b51ff03ef6a5123e6eec1823f 100644 (file)
@@ -74,16 +74,18 @@ string SpaceLess(string const & file)
        
        for (string::size_type i = 0; i < name.length(); ++i) {
                name[i] &= 0x7f; // set 8th bit to 0
-               if (!isgraph(name[i])) name[i] = '_'; // get rid of cntrl chars
        };
+
        // ok so we scan through the string twice, but who cares.
-       string change("/");
+       string keep("abcdefghijklmnopqrstuvwxyz"
+               "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+               "@!\"'()*+,-./0123456789:;<=>?[]`|");
+       
        string::size_type pos = 0;
-       while ((pos = name.find_first_of(change, pos)) != string::npos) {
-               name[pos] = '-';
+       while ((pos = name.find_first_not_of(change, pos)) != string::npos) {
+               name[pos] = '_';
        }
-       string temp = AddName(path, name);
-       return temp;
+       return AddName(path, name);
 }