Fix 1818856: External application render targets seem to be broken. We can't use...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 24 Oct 2007 01:14:08 +0000 (01:14 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 24 Oct 2007 01:14:08 +0000 (01:14 +0000)
git-svn-id: http://svn.voria.com/code@958 1f10aa63-cdf2-0310-b900-c93c546f37ac

ETL/trunk/ETL/_stringf.h
synfig-core/trunk/src/modules/mod_bmp/trgt_bmp.cpp
synfig-core/trunk/src/modules/mod_dv/trgt_dv.cpp
synfig-core/trunk/src/modules/mod_ffmpeg/trgt_ffmpeg.cpp
synfig-core/trunk/src/modules/mod_gif/trgt_gif.cpp
synfig-core/trunk/src/modules/mod_imagemagick/trgt_imagemagick.cpp
synfig-core/trunk/src/modules/mod_jpeg/trgt_jpeg.cpp
synfig-core/trunk/src/modules/mod_mng/trgt_mng.cpp
synfig-core/trunk/src/modules/mod_png/trgt_png.cpp
synfig-core/trunk/src/modules/mod_ppm/trgt_ppm.cpp
synfig-core/trunk/src/modules/mod_yuv420p/trgt_yuv.cpp

index 8173214..aaa87fd 100644 (file)
 #define ETL_STRPRINTF_MAX_LENGTH       (800)
 #endif
 
+#ifdef WIN32
+#define POPEN_BINARY_WRITE_TYPE "wb"
+#else
+#define POPEN_BINARY_WRITE_TYPE "w"
+#endif
+
 /* === T Y P E D E F S ===================================================== */
 
 _ETL_BEGIN_CDECLS
index cb51db2..71a84a7 100644 (file)
@@ -178,12 +178,12 @@ bmp::start_frame(synfig::ProgressCallback *callback)
                String newfilename(filename_sans_extension(filename) +
                                                   etl::strprintf("%04d",imagecount) +
                                                   filename_extension(filename));
-               file=fopen(newfilename.c_str(),"wb");
+               file=fopen(newfilename.c_str(),POPEN_BINARY_WRITE_TYPE);
                if(callback)callback->task(newfilename+_(" (animated)"));
        }
        else
        {
-               file=fopen(filename.c_str(),"wb");
+               file=fopen(filename.c_str(),POPEN_BINARY_WRITE_TYPE);
                if(callback)callback->task(filename);
        }
 
index 720736c..18dc1cd 100644 (file)
@@ -128,7 +128,7 @@ dv_trgt::init()
                command=strprintf("encodedv - > \"%s\"\n",filename.c_str());
 
        // Open the pipe to encodedv
-       file=popen(command.c_str(),"wb");
+       file=popen(command.c_str(),POPEN_BINARY_WRITE_TYPE);
 
        if(!file)
        {
index 5585878..e41d1a5 100644 (file)
@@ -128,7 +128,7 @@ ffmpeg_trgt::init()
 
        command=strprintf("ffmpeg -f image2pipe -vcodec ppm -an -r %f -i pipe: -loop -hq -title \"%s\" -vcodec mpeg1video -y \"%s\"\n",desc.get_frame_rate(),get_canvas()->get_name().c_str(),filename.c_str());
 
-       file=popen(command.c_str(),"wb");
+       file=popen(command.c_str(),POPEN_BINARY_WRITE_TYPE);
 
        // etl::yield();
 
index 0801310..6a3502c 100644 (file)
@@ -58,7 +58,7 @@ SYNFIG_TARGET_SET_CVS_ID(gif,"$Id$");
 
 gif::gif(const char *filename_):
        filename(filename_),
-       file( (filename=="-")?stdout:fopen(filename_,"wb") ),
+       file( (filename=="-")?stdout:fopen(filename_,POPEN_BINARY_WRITE_TYPE) ),
        imagecount(0),
 
        lossy(true),
index 7478001..aaf015f 100644 (file)
@@ -125,7 +125,7 @@ imagemagick_trgt::start_frame(synfig::ProgressCallback *cb)
        else
                command=strprintf("convert -depth 8 -size %dx%d rgb:-[0] -density %dx%d \"%s\"\n",desc.get_w(),desc.get_h(),round_to_int(desc.get_x_res()/39.3700787402),round_to_int(desc.get_y_res()/39.3700787402),filename.c_str());
 
-       file=popen(command.c_str(),"wb");
+       file=popen(command.c_str(),POPEN_BINARY_WRITE_TYPE);
 
        if(!file)
        {
index 013a99a..28994e1 100644 (file)
@@ -112,12 +112,12 @@ jpeg_trgt::start_frame(synfig::ProgressCallback *callback)
                String newfilename(filename_sans_extension(filename) +
                                                   etl::strprintf("%04d",imagecount) +
                                                   filename_extension(filename));
-               file=fopen(newfilename.c_str(),"wb");
+               file=fopen(newfilename.c_str(),POPEN_BINARY_WRITE_TYPE);
                if(callback)callback->task(newfilename);
        }
        else
        {
-               file=fopen(filename.c_str(),"wb");
+               file=fopen(filename.c_str(),POPEN_BINARY_WRITE_TYPE);
                if(callback)callback->task(filename);
        }
 
index d925846..01bebf4 100644 (file)
@@ -148,7 +148,7 @@ mng_trgt::init(){
        struct tm* gmt = gmtime(&t);
        w=desc.get_w(); h=desc.get_h();
        //synfig::error("mng_trgt: init %d %d",w,h); 
-       file = fopen(filename.c_str(), "wb");
+       file = fopen(filename.c_str(), POPEN_BINARY_WRITE_TYPE);
        if( file == NULL ) goto cleanup_on_error;
        mng = mng_initialize((mng_ptr)file, mng_alloc_proc, mng_free_proc, MNG_NULL);
        if(mng == MNG_NULL) goto cleanup_on_error;
index dcaa538..e2646be 100644 (file)
@@ -143,12 +143,12 @@ png_trgt::start_frame(synfig::ProgressCallback *callback)
                String newfilename(filename_sans_extension(filename) +
                                                   etl::strprintf("%04d",imagecount) +
                                                   filename_extension(filename));
-               file=fopen(newfilename.c_str(),"wb");
+               file=fopen(newfilename.c_str(),POPEN_BINARY_WRITE_TYPE);
                if(callback)callback->task(newfilename);
        }
        else
        {
-               file=fopen(filename.c_str(),"wb");
+               file=fopen(filename.c_str(),POPEN_BINARY_WRITE_TYPE);
                if(callback)callback->task(filename);
        }
 
index effe64d..14dba1d 100644 (file)
@@ -106,12 +106,12 @@ ppm::start_frame(synfig::ProgressCallback *callback)
                String newfilename(filename_sans_extension(filename) +
                                                   etl::strprintf("%04d",imagecount) +
                                                   filename_extension(filename));
-               file=SmartFILE(fopen(newfilename.c_str(),"wb"));
+               file=SmartFILE(fopen(newfilename.c_str(),POPEN_BINARY_WRITE_TYPE));
                if(callback)callback->task(newfilename);
        }
        else
        {
-               file=SmartFILE(fopen(filename.c_str(),"wb"));
+               file=SmartFILE(fopen(filename.c_str(),POPEN_BINARY_WRITE_TYPE));
                if(callback)callback->task(filename);
        }
 
index 3f65801..81482c9 100644 (file)
@@ -64,7 +64,7 @@ SYNFIG_TARGET_SET_CVS_ID(yuv,"$Id$");
 
 yuv::yuv(const char *FILENAME):
        filename(FILENAME),
-       file( (filename=="-")?stdout:fopen(filename.c_str(),"wb") ),
+       file( (filename=="-")?stdout:fopen(filename.c_str(),POPEN_BINARY_WRITE_TYPE) ),
        dithering(true)
 {
        // YUV420P doesn't have an alpha channel