libcvd-members
[Top][All Lists]
Advanced

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

[libcvd-members] gvars3/src GUI.cc


From: Colin Starr
Subject: [libcvd-members] gvars3/src GUI.cc
Date: Wed, 21 Jun 2006 15:30:45 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    gvars3
Changes by:     Colin Starr <ccs36>     06/06/21 15:30:45

Modified files:
        src            : GUI.cc 

Log message:
        When parsing a config file, GVars will now strip whitespace from around 
the value, as well as the name, of a "name = value" line.
        
        Hopefully no-one is relying on such whitespace for their code to work.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gvars3/src/GUI.cc?cvsroot=libcvd&r1=1.10&r2=1.11

Patches:
Index: GUI.cc
===================================================================
RCS file: /cvsroot/libcvd/gvars3/src/GUI.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- GUI.cc      31 May 2006 10:28:25 -0000      1.10
+++ GUI.cc      21 Jun 2006 15:30:44 -0000      1.11
@@ -57,6 +57,14 @@
                if(e >= s)
                {
                        var = var.substr(s, e-s+1);
+                       
+                       //Strip whitespace from around val;                     
+                       s = 0, e = val.length() - 1;
+                       for(; isspace(val[s]) && s < val.length(); s++);
+                       for(; isspace(val[e]) && e >=0; e--);
+
+                       val = val.substr(s, e-s+1);
+
                        GV3::set_var(var, val);
                        return true;
                }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]