Fix the error about being unable to parse the grid_size metadata. It was previously...
[synfig.git] / synfig-studio / trunk / src / gtkmm / ipc.cpp
index 7b5cfbd..4c9797f 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -66,6 +67,8 @@
 #include <synfig/string.h>
 #include <glibmm/thread.h>
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -259,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))
        {
@@ -329,7 +338,7 @@ IPC::make_connection()
                ret=SmartFILE(fdopen(fd,"w"));
 
 #ifdef _DEBUG
-       synfig::info("uplink fd=%d",fd);
+       // synfig::info("uplink fd=%d",fd);
 #endif
 
        return ret;