popen() doesn't like type "rb" on Linux, either.
[synfig.git] / synfig-core / trunk / src / modules / mod_imagemagick / mptr_imagemagick.cpp
index 439eedd..a077230 100644 (file)
@@ -1,8 +1,10 @@
-/*! ========================================================================
-** Synfig
-** ppm Target Module
-** $Id: mptr_imagemagick.cpp,v 1.1.1.1 2005/01/04 01:23:11 darco Exp $
+/* === S Y N F I G ========================================================= */
+/*!    \file mptr_imagemagick.cpp
+**     \brief ppm Target Module
 **
+**     $Id$
+**
+**     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **
 **     This package is free software; you can redistribute it and/or
@@ -14,6 +16,7 @@
 **     but WITHOUT ANY WARRANTY; without even the implied warranty of
 **     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 **     General Public License for more details.
+**     \endlegal
 **
 ** === N O T E S ===========================================================
 **
@@ -50,7 +53,7 @@ SYNFIG_IMPORTER_INIT(imagemagick_mptr);
 SYNFIG_IMPORTER_SET_NAME(imagemagick_mptr,"imagemagick");
 SYNFIG_IMPORTER_SET_EXT(imagemagick_mptr,"miff");
 SYNFIG_IMPORTER_SET_VERSION(imagemagick_mptr,"0.1");
-SYNFIG_IMPORTER_SET_CVS_ID(imagemagick_mptr,"$Id: mptr_imagemagick.cpp,v 1.1.1.1 2005/01/04 01:23:11 darco Exp $");
+SYNFIG_IMPORTER_SET_CVS_ID(imagemagick_mptr,"$Id$");
 
 /* === M E T H O D S ======================================================= */
 
@@ -69,7 +72,7 @@ imagemagick_mptr::~imagemagick_mptr()
 }
 
 bool
-imagemagick_mptr::get_frame(synfig::Surface &surface,Time time, synfig::ProgressCallback *cb)
+imagemagick_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::ProgressCallback *cb)
 {
 //#define HAS_LIBPNG 1
 
@@ -86,19 +89,19 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time time, synfig::Progress
                return false;
        }
        string temp_file="/tmp/deleteme.png";
-       
+
        if(filename.find("psd")!=String::npos)
                command=strprintf("convert \"%s\" -flatten \"png32:%s\"\n",filename.c_str(),temp_file.c_str());
        else
                command=strprintf("convert \"%s\" \"png32:%s\"\n",filename.c_str(),temp_file.c_str());
-       
+
        synfig::info("command=%s",command.c_str());
-       
+
        if(system(command.c_str())!=0)
                return false;
 
        Importer::Handle importer(Importer::open(temp_file));
-       
+
        DEBUGPOINT();
 
        if(!importer)
@@ -107,7 +110,7 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time time, synfig::Progress
                else synfig::error(_("Unable to open ")+temp_file);
                return false;
        }
-       
+
        DEBUGPOINT();
 
        if(!importer->get_frame(surface,0,cb))
@@ -116,12 +119,12 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time time, synfig::Progress
                else synfig::error(_("Unable to get frame from ")+temp_file);
                return false;
        }
-       
+
        if(!surface)
        {
                if(cb)cb->error(_("Bad surface from ")+temp_file);
                else synfig::error(_("Bad surface from ")+temp_file);
-               return false;           
+               return false;
        }
 
        if(1)
@@ -149,12 +152,12 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time time, synfig::Progress
 
        Surface bleh(surface);
        surface=bleh;
-       
+
 
        //remove(temp_file.c_str());
        DEBUGPOINT();
        return true;
-       
+
 #else
        if(file)
                pclose(file);
@@ -170,7 +173,7 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time time, synfig::Progress
 
        command=strprintf("convert \"%s\" -flatten ppm:-\n",filename.c_str());
 
-       file=popen(command.c_str(),"r");
+       file=popen(command.c_str(),POPEN_BINARY_READ_TYPE);
 
        if(!file)
        {
@@ -244,6 +247,6 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time time, synfig::Progress
 
        return true;
 #endif
-               
-       
+
+
 }