libcvd-members
[Top][All Lists]
Advanced

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

[libcvd-members] gvars3/src GUI.cc GUI_impl_readline.cc GUI_lang...


From: Georg Klein
Subject: [libcvd-members] gvars3/src GUI.cc GUI_impl_readline.cc GUI_lang...
Date: Thu, 21 Aug 2008 14:53:28 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    gvars3
Changes by:     Georg Klein <georgklein>        08/08/21 14:53:28

Modified files:
        src            : GUI.cc GUI_impl_readline.cc GUI_language.cc 
                         GUI_readline.cc gvars2.cc serialize.cc 

Log message:
        Some warning cleanups for -Wall, and I think maybe a bugfix in 
whitespace
        trimming as well

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gvars3/src/GUI.cc?cvsroot=libcvd&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gvars3/src/GUI_impl_readline.cc?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gvars3/src/GUI_language.cc?cvsroot=libcvd&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gvars3/src/GUI_readline.cc?cvsroot=libcvd&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gvars3/src/gvars2.cc?cvsroot=libcvd&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gvars3/src/serialize.cc?cvsroot=libcvd&r1=1.9&r2=1.10

Patches:
Index: GUI.cc
===================================================================
RCS file: /cvsroot/libcvd/gvars3/src/GUI.cc,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- GUI.cc      12 Jun 2008 10:58:44 -0000      1.29
+++ GUI.cc      21 Aug 2008 14:53:27 -0000      1.30
@@ -35,7 +35,7 @@
 namespace GVars3
 {
 
-    GUI::GUI(GVars2* v2){
+  GUI::GUI(GVars2* /* v2 */){
     }
 
        GUI_impl& GUI::I()
@@ -129,8 +129,9 @@
        //Strip whitespace from around var;
        string::size_type s=0, e = var.length()-1; 
        for(; isspace(var[s]) && s < var.length(); s++);
-       for(; isspace(var[e]) && e >=0; e--);
-
+       if(s==var.length()) // All whitespace before the `='?
+         return false; 
+       for(; isspace(var[e]); e--);
        if(e >= s)
          {
            var = var.substr(s, e-s+1);
@@ -138,9 +139,12 @@
            //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--);
-
+           if( s < val.length())
+             {
+               for(; isspace(val[e]); e--);
            val = val.substr(s, e-s+1);
+             }
+           else val = "";
 
            GV3::set_var(var, val);
            return true;
@@ -169,7 +173,7 @@
   void GUI_impl::UnRegisterCommand(string sCommandName, void* thisptr)
   {
     CallbackVector &cbv = mmCallBackMap[sCommandName];
-    for(size_t i = cbv.size() - 1; i>=0; i--)
+    for(int i = static_cast<int>(cbv.size()) - 1; i>=0; i--)
       if(cbv[i].thisptr == thisptr)
        cbv.erase(cbv.begin() + i);
   };
@@ -441,7 +445,7 @@
   //
   // Builtin commands
 
-  void builtin_shell(void* ptr, string sCommand, string sParams)
+  void builtin_shell(void* /* ptr */, string /* sCommand */, string sParams)
   {
     vector<string> v = ChopAndUnquoteString(sParams);
 
@@ -454,41 +458,41 @@
     system(sParams.c_str());
   }
 
-  void builtin_ls(void* ptr, string sCommand, string sParams)
+  void builtin_ls(void* ptr, string /*sCommand*/, string sParams)
   {
     GUI_impl* p = (GUI_impl*)ptr;
     p->ParseLine("shell ls " + sParams);       
   }
 
-  void builtin_ll(void* ptr, string sCommand, string sParams)
+  void builtin_ll(void* ptr, string /*sCommand*/, string sParams)
   {
     GUI_impl* p = (GUI_impl*)ptr;
     p->ParseLine("shell ls -l " + sParams);    
   }
 
-  void builtin_try(void* ptr, string sCommand, string sParams)
+  void builtin_try(void* ptr, string /*sCommand*/, string sParams)
   {
     GUI_impl* p = (GUI_impl*)ptr;
     p->ParseLine(sParams, true);
   }
 
-  void builtin_exec(void* ptr, string sCommand, string sParams)
+  void builtin_exec(void* ptr, string /*sCommand*/, string sParams)
   {
     GUI_impl* p = (GUI_impl*)ptr;
     p->LoadFile(sParams);
   }
 
-  void builtin_echo(void* ptr, string sCommand, string sParams)
+  void builtin_echo(void* /*ptr*/, string /*sCommand*/, string sParams)
   {
     cout << sParams << endl;
   }
 
-  void builtin_qmark(void* ptr, string sCommand, string sParams)
+  void builtin_qmark(void* /*ptr*/, string /*sCommand*/, string /*sParams*/)
   {
     cout << "  Perhaps you'd like to type \"commandlist\" or \"gvarlist\"." << 
endl;
   }
 
-  void builtin_if(void* ptr, string sCommand, string sParams)
+  void builtin_if(void* ptr, string /*sCommand*/, string sParams)
   {
     GUI_impl* p = (GUI_impl*)ptr;
     vector<string> v = ChopAndUnquoteString(sParams);
@@ -518,7 +522,7 @@
     return;
   }
 
-  void builtin_ifnot(void* ptr, string sCommand, string sParams)
+  void builtin_ifnot(void* ptr, string /*sCommand*/, string sParams)
   {
     GUI_impl* p = (GUI_impl*)ptr;
     vector<string> v = ChopAndUnquoteString(sParams);
@@ -548,7 +552,7 @@
     return;
   }
 
-  void builtin_ifeq(void* ptr, string sCommand, string sParams)
+  void builtin_ifeq(void* ptr, string /*sCommand*/, string sParams)
   {
     GUI_impl* p = (GUI_impl*)ptr;
     vector<string> v = ChopAndUnquoteString(sParams);
@@ -579,9 +583,8 @@
     return;
   }
 
-  void builtin_toggle(void* ptr, string sCommand, string sParams)
+  void builtin_toggle(void* /*ptr*/, string /*sCommand*/, string sParams)
   {
-    GUI_impl* p = (GUI_impl*)ptr;
     vector<string> v = ChopAndUnquoteString(sParams);
     if(v.size()!=1) 
       {
@@ -597,13 +600,13 @@
   
   };
 
-  void builtin_set(void* ptr, string sCommand, string sParams)
+  void builtin_set(void* /*ptr*/, string /*sCommand*/, string sParams)
   {
     setvar(sParams);
   }
 
 
-  void builtin_gvarlist(void* ptr, string sCommand, string sParams)
+  void builtin_gvarlist(void* /*ptr*/, string sCommand, string sParams)
   {
     bool error = false;
     bool print_all = false;
@@ -639,13 +642,13 @@
   }
 
 
-  void builtin_printvar(void* ptr, string sCommand, string sParams)
+  void builtin_printvar(void* /*ptr*/, string /*sCommand*/, string sParams)
   {
     cout << sParams << "=" << GV3::get_var(sParams) << endl;;
   }
 
 
-  void builtin_commandlist(void* ptr, string sCommand, string sParams)
+  void builtin_commandlist(void* ptr, string /*sCommand*/, string /*sParams*/)
   {
     GUI_impl* p = (GUI_impl*)ptr;
 
@@ -662,7 +665,7 @@
        cout << "    " << i->first << endl;
   }
 
-  void builtin_queue(void* ptr, string sCommand, string sParams)
+  void builtin_queue(void* ptr, string /*sCommand*/, string sParams)
   {
     vector<string> vs = ChopAndUnquoteString(sParams);
     if(vs.size() < 2)
@@ -744,13 +747,13 @@
   }
 
   void print_history(ostream &ost);
-  void builtin_history(void* ptr, string sCommand, string sParams)
+  void builtin_history(void* /*ptr*/, string /*sCommand*/, string /*sParams*/)
   {
     cout << "History: " << endl;
     print_history(cout);
   };
 
-  void builtin_save_history(void* ptr, string sCommand, string sParams)
+  void builtin_save_history(void* /*ptr*/, string /*sCommand*/, string sParams)
   {
     vector<string> v = ChopAndUnquoteString(sParams);
     if(v.size()!=1) 

Index: GUI_impl_readline.cc
===================================================================
RCS file: /cvsroot/libcvd/gvars3/src/GUI_impl_readline.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- GUI_impl_readline.cc        20 Mar 2008 02:09:15 -0000      1.1
+++ GUI_impl_readline.cc        21 Aug 2008 14:53:27 -0000      1.2
@@ -29,7 +29,7 @@
     rl_basic_word_break_characters = " \t\n\"\\'address@hidden><;|&{("; 
   }
   
-  char ** GUI_impl::ReadlineCompletionFunction (const char *text, int start, 
int end)
+  char ** GUI_impl::ReadlineCompletionFunction (const char *text, int 
/*start*/, int /*end*/)
   {
     rl_completion_append_character=0;
     char **matches;

Index: GUI_language.cc
===================================================================
RCS file: /cvsroot/libcvd/gvars3/src/GUI_language.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- GUI_language.cc     21 Feb 2008 19:29:21 -0000      1.1
+++ GUI_language.cc     21 Aug 2008 14:53:27 -0000      1.2
@@ -176,7 +176,7 @@
                        }
                        
                        CallBack(runfunc)
-                       void runfunc(string name, string args)
+                       void runfunc(string name, string /*args*/)
                        {
                                vector<string> v = functions.get(name);
                                for(unsigned int i=0; i < v.size(); i++)
@@ -201,7 +201,7 @@
 
 
                        CallBack(gui_if_else)
-                       void gui_if_else(string name, string args)
+                       void gui_if_else(string /*name*/, string /*args*/)
                        {
                                ifbit() = collection();
                                if(ifbit().empty())
@@ -210,7 +210,7 @@
                        }
                        
                        CallBack(gui_endif)
-                       void gui_endif(string name, string args)
+                       void gui_endif(string /*name*/, string /*args*/)
                        {
                                if(ifbit().empty())
                                        ifbit() = collection();

Index: GUI_readline.cc
===================================================================
RCS file: /cvsroot/libcvd/gvars3/src/GUI_readline.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- GUI_readline.cc     30 Jul 2008 00:02:19 -0000      1.12
+++ GUI_readline.cc     21 Aug 2008 14:53:27 -0000      1.13
@@ -165,7 +165,7 @@
 
        while(tag_i != tags.end())
        {
-               int text_len = strlen(szText);
+               size_t text_len = strlen(szText);
                bool bEqualsAtEnd = false;
                if(text_len>0)
                  if(szText[text_len-1]=='=')
@@ -207,7 +207,6 @@
   static int nTextLength;
   static int nOffset;
   const char *pcName;
-  static char acMyTextCopy[1000];
   
   if(!nState)
   {

Index: gvars2.cc
===================================================================
RCS file: /cvsroot/libcvd/gvars3/src/gvars2.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gvars2.cc   11 Feb 2007 00:09:14 -0000      1.5
+++ gvars2.cc   21 Aug 2008 14:53:27 -0000      1.6
@@ -39,7 +39,7 @@
          // So crack the string in two at the equals sign. Easy.
          // SetVar(string,string) is quite tolerant to whitespace.
          
-         int n;
+         string::size_type n;
          n=s.find("=");
          if(n>=s.find("//"))  // Perhaps the line is a comment?
                return;

Index: serialize.cc
===================================================================
RCS file: /cvsroot/libcvd/gvars3/src/serialize.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- serialize.cc        23 Jun 2008 10:59:41 -0000      1.9
+++ serialize.cc        21 Aug 2008 14:53:27 -0000      1.10
@@ -52,7 +52,7 @@
        int from_string(string s, Matrix<>& mat)
        {
                 // Format expected is: [ num .. num; ... ;  num .. num ]
-               int n;
+               string::size_type n;
 
                //First, find opening angle bracket.
                //Trim up to and including this. Abort if it can't be found.
@@ -96,7 +96,7 @@
                        while(ist>>d)
                                vd.push_back(d);
 
-                       if(vd.size()!=nRows*nCols) // Were there the right 
number of elements?
+                       if(static_cast<int>(vd.size())!=nRows*nCols) // Were 
there the right number of elements?
                                return 1;
                };
 
@@ -129,7 +129,7 @@
        int from_string(string s, Vector<>& vec)
        {
                // Format expected is: [ num num num .. num ]
-               int n;
+               string::size_type n;
 
                //First, find opening angle bracket.
                //Trim up to and including this. Abort if it can't be found.
@@ -159,7 +159,7 @@
                // Now transfer the STL-vector over to a TooN - Vector.
                Vector<> v(vd.size());
 
-               for(int i=0;i<vd.size();i++)
+               for(size_t i=0;i<vd.size();i++)
                        v[i]=vd[i];
                
                vec.resize(v.size());




reply via email to

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