diff --git a/configure.in b/configure.in index 2128a611..ffc2ca74 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR(m4) # user-visible library versioning IM_MAJOR_VERSION=7 IM_MINOR_VERSION=21 -IM_MICRO_VERSION=0 +IM_MICRO_VERSION=1 IM_VERSION=$IM_MAJOR_VERSION.$IM_MINOR_VERSION.$IM_MICRO_VERSION IM_VERSION_STRING=$IM_VERSION-`date` @@ -23,7 +23,7 @@ PACKAGE=vips # interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=28 -LIBRARY_REVISION=2 +LIBRARY_REVISION=3 LIBRARY_AGE=13 AM_INIT_AUTOMAKE($PACKAGE,$VERSION) diff --git a/libvips/conversion/im_system.c b/libvips/conversion/im_system.c index bca31d04..65a08d57 100644 --- a/libvips/conversion/im_system.c +++ b/libvips/conversion/im_system.c @@ -63,11 +63,6 @@ #define IM_MAX_STRSIZE (4096) -#ifdef OS_WIN32 -#define popen(b,m) _popen(b,m) -#define pclose(f) _pclose(f) -#endif /*OS_WIN32*/ - /* Run a command on an IMAGE ... copy to tmp (if necessary), run * command on it, unlink (if we copied), return stdout from command. */ diff --git a/libvips/conversion/im_system_image.c b/libvips/conversion/im_system_image.c index ccd79d2a..4524555e 100644 --- a/libvips/conversion/im_system_image.c +++ b/libvips/conversion/im_system_image.c @@ -53,18 +53,12 @@ #define IM_MAX_STRSIZE (4096) -#ifdef OS_WIN32 -#define popen(b,m) _popen(b,m) -#define pclose(f) _pclose(f) -#endif /*OS_WIN32*/ - static int system_image( IMAGE *im, - IMAGE *in_image, IMAGE *out_image, const char *cmd_format, + IMAGE *in_image, char *out_name, const char *cmd_format, char **log ) { const char *in_name = in_image->filename; - const char *out_name = out_image->filename; FILE *fp; char line[IM_MAX_STRSIZE]; char txt[IM_MAX_STRSIZE]; @@ -84,42 +78,29 @@ system_image( IMAGE *im, if( log ) *log = im_strdup( NULL, vips_buf_all( &buf ) ); - if( !result ) { - IMAGE *t; - - if( !(t = im_open_local( out_image, out_name, "r" )) || - im_copy( t, out_image ) ) - return( -1 ); - } - return( result ); } /** * im_system_image: - Run a command on an image, returning a new image. + Run a command on an image, returning a new image. Eg.: - "mycommand --dostuff %s -o %s" - - have separate format strings for input and output? - - "%s.jpg" + im_system_image A2 "%s.jpg" "%s.jpg" "convert %s -swirl 45 %s" Actions: -- create two empty temporary files -- write the image to the first +- create two temporary file names using the passed format strings to set type += expand the command, using the two expanded filenames +- write the image to the first filename - call system() on the expanded command -- capture stdout/stderr into log +- capture stdout into log - delete the temp input file +- open the output image (the output file will be auto deleted when this + IMAGE is closed. - return the output filename, or NULL if the command failed (log is still set in this case) - The caller would open the output file, either with im_open(), or with it's - own system (nip2 has it's own open file thing to give progress feedback and - use disc for format conversion), and be responsible for deleting the temp output file at some point. - */ IMAGE * @@ -128,25 +109,41 @@ im_system_image( IMAGE *im, char **log ) { IMAGE *in_image; - IMAGE *out_image; + char *out_name; + IMAGE *out; if( log ) *log = NULL; if( !(in_image = im__open_temp( in_format )) ) return( NULL ); - if( !(out_image = im__open_temp( out_format )) ) { + if( !(out_name = im__temp_name( out_format )) ) { im_close( in_image ); return( NULL ); } - if( system_image( im, in_image, out_image, cmd_format, log ) ) { - im_close( out_image ); + if( system_image( im, in_image, out_name, cmd_format, log ) ) { im_close( in_image ); + g_free( out_name ); return( NULL ); } im_close( in_image ); - return( out_image ); + if( !(out = im_open( out_name, "r" )) ) { + g_free( out_name ); + + return( NULL ); + } + if( im_add_postclose_callback( out, + (im_callback_fn) unlink, out->filename, NULL ) ) { + g_free( out_name ); + im_close( out ); + g_unlink( out_name ); + + return( NULL ); + } + g_free( out_name ); + + return( out ); } diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c index 51fff195..f10a950c 100644 --- a/libvips/iofuncs/util.c +++ b/libvips/iofuncs/util.c @@ -28,8 +28,8 @@ */ /* - */ #define DEBUG + */ #ifdef HAVE_CONFIG_H #include diff --git a/po/en_GB.gmo b/po/en_GB.gmo index d7d362d1..6fc3d601 100644 Binary files a/po/en_GB.gmo and b/po/en_GB.gmo differ diff --git a/po/en_GB.po b/po/en_GB.po index 0d4668c1..16447f06 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: vips 7.20.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-01-14 21:04+0000\n" +"POT-Creation-Date: 2010-01-15 13:45+0000\n" "PO-Revision-Date: Thu Nov 26 12:08:20 GMT 2009\n" "Last-Translator: john \n" "Language-Team: \n" @@ -1809,7 +1809,7 @@ msgstr "" msgid "func already attached" msgstr "" -#: libvips/iofuncs/im_generate.c:684 libvips/iofuncs/im_prepare.c:184 +#: libvips/iofuncs/im_generate.c:689 libvips/iofuncs/im_prepare.c:184 #: libvips/iofuncs/im_prepare.c:404 #, c-format msgid "unable to input from a %s image" @@ -1857,7 +1857,7 @@ msgstr "" msgid "flag not 0,1,2" msgstr "" -#: libvips/iofuncs/im_close.c:199 +#: libvips/iofuncs/im_close.c:201 #, c-format msgid "unable to close fd for %s" msgstr "" @@ -2278,28 +2278,28 @@ msgstr "" msgid "no such string field \"%s\"" msgstr "" -#: libvips/iofuncs/im_open.c:314 +#: libvips/iofuncs/im_open.c:316 #, c-format msgid "%s %s: %d%% complete" msgstr "" #. Spaces at end help to erase the %complete message we overwrite. #. -#: libvips/iofuncs/im_open.c:332 +#: libvips/iofuncs/im_open.c:334 #, c-format msgid "%s %s: done in %ds \n" msgstr "" -#: libvips/iofuncs/im_open.c:419 +#: libvips/iofuncs/im_open.c:421 msgid "NULL filename or mode" msgstr "" -#: libvips/iofuncs/im_open.c:468 +#: libvips/iofuncs/im_open.c:470 #, fuzzy, c-format msgid "unsupported filetype \"%s\"" msgstr "unsupported colourspace %d" -#: libvips/iofuncs/im_open.c:484 +#: libvips/iofuncs/im_open.c:486 #, c-format msgid "bad mode \"%s\"" msgstr ""