From 2b2ac1b0772ee80b0ac437bb7014bc5e8c2485b7 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 13 Oct 2015 08:55:54 +0100 Subject: [PATCH 1/3] rename vips-8.0 as vips-8.1 also bump configure version thanks Danilo! --- ChangeLog | 3 +++ configure.ac | 8 ++++---- doc/libvips-docs.xml | 2 +- tools/Makefile.am | 4 ++-- tools/{vips-8.0 => vips-8.1} | 0 5 files changed, 10 insertions(+), 7 deletions(-) rename tools/{vips-8.0 => vips-8.1} (100%) diff --git a/ChangeLog b/ChangeLog index 2e19248f..67156757 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +7/5/15 starteld 8.1.1 +- oop, vips-8.0 should be vips-8.1, thanks Danilo + 7/5/15 starteld 8.1.0 - add vips_premultiply(), vips_unpremultiply() - change the alpha range rules for vips_flatten() to match vips_premultiply() diff --git a/configure.ac b/configure.ac index 0a2edac2..ced5d2a1 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [8.1.0], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [8.1.1], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [8]) m4_define([vips_minor_version], [1]) -m4_define([vips_micro_version], [0]) +m4_define([vips_micro_version], [1]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -37,9 +37,9 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date` # binary interface changes backwards compatible?: increment age # binary interface changes not backwards compatible?: reset age to 0 -LIBRARY_CURRENT=42 +LIBRARY_CURRENT=43 LIBRARY_REVISION=0 -LIBRARY_AGE=0 +LIBRARY_AGE=1 # patched into include/vips/version.h AC_SUBST(VIPS_VERSION) diff --git a/doc/libvips-docs.xml b/doc/libvips-docs.xml index 4b6ebb80..59834de7 100644 --- a/doc/libvips-docs.xml +++ b/doc/libvips-docs.xml @@ -9,7 +9,7 @@ VIPS Reference Manual - For VIPS 8.1.0. + For VIPS 8.1.1. The latest version of this documentation can be found on the VIPS website. diff --git a/tools/Makefile.am b/tools/Makefile.am index f8425dec..00984d43 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -20,11 +20,11 @@ bin_SCRIPTS = \ batch_rubber_sheet \ batch_crop \ vipsprofile \ - vips-8.0 + vips-8.1 EXTRA_DIST = \ vipsprofile \ - vips-8.0 \ + vips-8.1 \ light_correct.in \ shrink_width.in \ batch_image_convert.in \ diff --git a/tools/vips-8.0 b/tools/vips-8.1 similarity index 100% rename from tools/vips-8.0 rename to tools/vips-8.1 From 368a74abcd3d152f22bae8de5e4221c22236f34c Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 13 Oct 2015 10:29:53 +0100 Subject: [PATCH 2/3] better vips7 filename splitting helps windows, see https://github.com/jcupitt/build-win32/issues/11 also add some tests --- libvips/deprecated/vips7compat.c | 61 +++++++++++++++++++++++++++++--- libvips/include/vips/basic.h | 5 +++ test/Makefile.am | 1 + test/test_all.py | 1 + test/test_iofuncs.py | 61 ++++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+), 5 deletions(-) create mode 100755 test/test_iofuncs.py diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index aabae8e6..13e5914d 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -55,11 +55,22 @@ * FILENAME_MAX chars. * * We look for the ':' splitting the name and mode by searching for the - * rightmost occurence of the regexp ".[A-Za-z0-9]+:". Example: consider the - * horror that is + * rightmost occurrence of the regexp "\.[A-Za-z0-9]+:". The initial dot can + * be missing if there's a dirsep or start of string, meaning this is a + * filename without an extension. + * + * Examples: * * c:\silly:dir:name\fr:ed.tif:jpeg:95,,,,c:\icc\srgb.icc + * -> c:\silly:dir:name\fr:ed.tif jpeg:95,,,,c:\icc\srgb.icc + * I180: + * -> I180 "" + * c:\silly: + * -> c:\silly "" + * c:\silly + * -> c:\silly "" * + * vips8 handles this in a much better way :( */ void im_filename_split( const char *path, char *name, char *mode ) @@ -74,11 +85,15 @@ im_filename_split( const char *path, char *name, char *mode ) if( *p == ':' ) { char *q; + /* We are skipping back over the file extension, + * isalnum() is probably sufficient. + */ for( q = p - 1; isalnum( *q ) && q > name; q -= 1 ) ; - if( *q == '.' ) + if( *q == '.' ) { break; + } /* All the way back to the start? We probably have a * filename with no extension, eg. "I180:" @@ -86,9 +101,11 @@ im_filename_split( const char *path, char *name, char *mode ) if( q == name ) break; - /* .. or we could hit a dirsep. + /* .. or we could hit a dirsep. Allow win or nix + * separators. */ - if( *q == G_DIR_SEPARATOR ) + if( *q == '/' || + *q == '\\' ) break; } @@ -100,6 +117,40 @@ im_filename_split( const char *path, char *name, char *mode ) strcpy( mode, "" ); } +/** + * vips_path_filename7: + * @path: path to split + * + * Return the filename part of a vips7 path. For testing only. + */ +char * +vips_path_filename7( const char *path ) +{ + char name[FILENAME_MAX]; + char mode[FILENAME_MAX]; + + im_filename_split( path, name, mode ); + + return( g_strdup( name ) ); +} + +/** + * vips_path_mode7: + * @path: path to split + * + * Return the mode part of a vips7 path. For testing only. + */ +char * +vips_path_mode7( const char *path ) +{ + char name[FILENAME_MAX]; + char mode[FILENAME_MAX]; + + im_filename_split( path, name, mode ); + + return( g_strdup( mode ) ); +} + /* Skip any leading path stuff. Horrible: if this is a filename which came * from win32 and we're a *nix machine, it'll have '\\' not '/' as the * separator :-( diff --git a/libvips/include/vips/basic.h b/libvips/include/vips/basic.h index 8f846531..a0adf4b4 100644 --- a/libvips/include/vips/basic.h +++ b/libvips/include/vips/basic.h @@ -66,6 +66,11 @@ typedef enum { VIPS_PRECISION_LAST } VipsPrecision; +/* Just for testing. + */ +char *vips_path_filename7( const char *path ); +char *vips_path_mode7( const char *path ); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/test/Makefile.am b/test/Makefile.am index ee0b0c41..bd82e2ca 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -13,6 +13,7 @@ EXTRA_DIST = \ test_colour.py \ test_conversion.py \ test_convolution.py \ + test_iofuncs.py \ test_create.py \ test_foreign.py \ test_draw.py \ diff --git a/test/test_all.py b/test/test_all.py index 3fefe8ef..98fcf747 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -12,6 +12,7 @@ from test_foreign import * from test_histogram import * from test_morphology import * from test_resample import * +from test_iofuncs import * if __name__ == '__main__': unittest.main() diff --git a/test/test_iofuncs.py b/test/test_iofuncs.py new file mode 100755 index 00000000..0f1bba44 --- /dev/null +++ b/test/test_iofuncs.py @@ -0,0 +1,61 @@ +#!/usr/bin/python3 + +from __future__ import division +import unittest +import math + +#import logging +#logging.basicConfig(level = logging.DEBUG) + +from gi.repository import Vips + +Vips.leak_set(True) + +# an expanding zip ... if either of the args is not a list, duplicate it down +# the other +def zip_expand(x, y): + if isinstance(x, list) and isinstance(y, list): + return list(zip(x, y)) + elif isinstance(x, list): + return [[i, y] for i in x] + elif isinstance(y, list): + return [[x, j] for j in y] + else: + return [[x, y]] + +class TestIofuncs(unittest.TestCase): + # test a pair of things which can be lists for approx. equality + def assertEqualObjects(self, a, b, msg = ''): + #print('assertEqualObjects %s = %s' % (a, b)) + for x, y in zip_expand(a, b): + self.assertEqual(x, y, msg = msg) + + # test the vips7 filename splitter ... this is very fragile and annoying + # code with lots of cases + def test_split7(self): + def split(path): + filename7 = Vips.path_filename7(path) + mode7 = Vips.path_mode7(path) + + return [filename7, mode7] + + cases = [ + ["c:\\silly:dir:name\\fr:ed.tif:jpeg:95,,,,c:\\icc\\srgb.icc", + ["c:\\silly:dir:name\\fr:ed.tif", + "jpeg:95,,,,c:\\icc\\srgb.icc"]], + ["I180:", + ["I180", + ""]], + ["c:\\silly:", + ["c:\\silly", + ""]], + ["c:\\program files\\x:hello", + ["c:\\program files\\x", + "hello"]] + ] + + for case in cases: + self.assertEqualObjects(split(case[0]), case[1]) + +if __name__ == '__main__': + unittest.main() From 9a4d82653c708004789000797f97ca60f2931877 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 13 Oct 2015 14:21:17 +0100 Subject: [PATCH 3/3] ignore ':' in col 1 of vips7 paths oh argh, we were mangling windows paths see https://github.com/jcupitt/build-win32/issues/11 --- libvips/deprecated/vips7compat.c | 8 +++++++- test/test_iofuncs.py | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 13e5914d..41a58c92 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -69,6 +69,8 @@ * -> c:\silly "" * c:\silly * -> c:\silly "" + * C:\fixtures\2569067123_aca715a2ee_o.jpg + * -> C:\fixtures\2569067123_aca715a2ee_o.jpg "" * * vips8 handles this in a much better way :( */ @@ -109,7 +111,11 @@ im_filename_split( const char *path, char *name, char *mode ) break; } - if( *p == ':' ) { + /* Ignore a ':' in column 1, it's probably a drive letter on a + * Windows path. + */ + if( *p == ':' && + p - name != 1 ) { vips_strncpy( mode, p + 1, FILENAME_MAX ); *p = '\0'; } diff --git a/test/test_iofuncs.py b/test/test_iofuncs.py index 0f1bba44..2182cf9d 100755 --- a/test/test_iofuncs.py +++ b/test/test_iofuncs.py @@ -51,7 +51,10 @@ class TestIofuncs(unittest.TestCase): ""]], ["c:\\program files\\x:hello", ["c:\\program files\\x", - "hello"]] + "hello"]], + ["C:\\fixtures\\2569067123_aca715a2ee_o.jpg", + ["C:\\fixtures\\2569067123_aca715a2ee_o.jpg", + ""]] ] for case in cases: