Fix a bug found by g++ 4.3, and add a few comments.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 25 Jan 2008 17:57:53 +0000 (17:57 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Fri, 25 Jan 2008 17:57:53 +0000 (17:57 +0000)
git-svn-id: http://svn.voria.com/code@1490 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/ipc.cpp

index bf9f890..4c9797f 100644 (file)
@@ -262,11 +262,17 @@ IPC::process_command(const synfig::String& command_line)
        if(command_line.empty())
                return false;
 
-       char cmd=command_line[0];
+       char cmd = command_line[0];
 
        String args(command_line.begin()+1,command_line.end());
-       while(!args.empty() && args[0]==' ') args.erase(args.begin());
-       while(!args.empty() && args[args.size()-1]=='\n' || args[args.size()-1]==' ') args.erase(args.end()-1);
+
+       // erase leading spaces
+       while (!args.empty() && args[0] == ' ')
+               args.erase(args.begin());
+
+       // erase trailing newlines and spaces
+       while (!args.empty() && (args[args.size()-1] == '\n' || args[args.size()-1] == ' '))
+               args.erase(args.end()-1);
 
        switch(toupper(cmd))
        {