diff --git a/ChangeLog b/ChangeLog index 2a321999..57cd97b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 7/10/15 started 8.2.0 - added im_bufmagick2vips(), a vips7 wrapper for magick load from buffer +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 e6139305..3c6b8a5e 100644 --- a/configure.ac +++ b/configure.ac @@ -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=43 +LIBRARY_CURRENT=44 LIBRARY_REVISION=0 -LIBRARY_AGE=1 +LIBRARY_AGE=2 # patched into include/vips/version.h AC_SUBST(VIPS_VERSION) diff --git a/doc/libvips-docs.xml b/doc/libvips-docs.xml index 7020e734..e799e5b7 100644 --- a/doc/libvips-docs.xml +++ b/doc/libvips-docs.xml @@ -9,7 +9,11 @@ VIPS Reference Manual +<<<<<<< HEAD For VIPS 8.2.0. +======= + For VIPS 8.1.1. +>>>>>>> 8.1 The latest version of this documentation can be found on the VIPS website. diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index aabae8e6..41a58c92 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -55,11 +55,24 @@ * 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 "" + * C:\fixtures\2569067123_aca715a2ee_o.jpg + * -> C:\fixtures\2569067123_aca715a2ee_o.jpg "" * + * vips8 handles this in a much better way :( */ void im_filename_split( const char *path, char *name, char *mode ) @@ -74,11 +87,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,13 +103,19 @@ 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; } - 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'; } @@ -100,6 +123,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..2182cf9d --- /dev/null +++ b/test/test_iofuncs.py @@ -0,0 +1,64 @@ +#!/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"]], + ["C:\\fixtures\\2569067123_aca715a2ee_o.jpg", + ["C:\\fixtures\\2569067123_aca715a2ee_o.jpg", + ""]] + ] + + for case in cases: + self.assertEqualObjects(split(case[0]), case[1]) + +if __name__ == '__main__': + unittest.main() 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