From 5f50c6d93bffe17f2ec2a0e51b01d2ec27cf8f5a Mon Sep 17 00:00:00 2001 From: dooglus Date: Fri, 25 Jan 2008 17:57:53 +0000 Subject: [PATCH] Fix a bug found by g++ 4.3, and add a few comments. git-svn-id: http://svn.voria.com/code@1490 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/ipc.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/ipc.cpp b/synfig-studio/trunk/src/gtkmm/ipc.cpp index bf9f890..4c9797f 100644 --- a/synfig-studio/trunk/src/gtkmm/ipc.cpp +++ b/synfig-studio/trunk/src/gtkmm/ipc.cpp @@ -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)) { -- 2.7.4