From 77287a938f571aed71b403d88f741ef2f097df86 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 31 Dec 2017 10:23:27 +0000 Subject: [PATCH] fix misspelling of IPTC as IPCT the letters have been accidentally swapped for years add a compat macro so older code still works --- ChangeLog | 5 +++-- libvips/foreign/jpeg2vips.c | 8 ++++---- libvips/foreign/jpegload.c | 4 ++-- libvips/foreign/jpegsave.c | 4 ++-- libvips/foreign/tiff2vips.c | 8 ++++---- libvips/foreign/tiffload.c | 2 +- libvips/foreign/tiffsave.c | 2 +- libvips/foreign/vips2jpeg.c | 4 ++-- libvips/foreign/vips2tiff.c | 12 ++++++------ libvips/include/vips/header.h | 6 +++--- libvips/include/vips/vips7compat.h | 4 ++++ 11 files changed, 32 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3214a921..100d044a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,11 @@ 10/12/17 started 8.6.1 -- stop window new/free cycling .. faster zoom out on large images in nip2 +- stop window new/free cycling .. faster zoom out on some large images in nip2 - fix some compiler warnings - remove the 64-image limit on bandary operations - better version date [bmwiedemann] - bump wrapper script version [bgilbert] -- fix a memleak with an error during jpeg buffer write [lovell] +- fix a memleak on error during jpeg buffer write [lovell] +- fix misspelling of IPTC as IPCT [lovell] 15/4/17 started 8.6.0 - supports fits images with leading non-image HDUs, thanks benepo diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index 1bca9fb7..6fcd4a11 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -52,7 +52,7 @@ * - attach rationals as a/b, don't convert to double * 21/11/12 * - don't insist exif must have data - * - attach IPCT data (app13), thanks Gary + * - attach IPTC data (app13), thanks Gary * 6/7/13 * - null-terminate exif strings, thanks Mike * 24/2/14 @@ -468,11 +468,11 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out ) break; case JPEG_APP0 + 13: - /* Possible IPCT data block. + /* Possible IPTC data block. */ if( p->data_length > 5 && vips_isprefix( "Photo", (char *) p->data ) && - attach_blob( out, VIPS_META_IPCT_NAME, + attach_blob( out, VIPS_META_IPTC_NAME, p->data, p->data_length ) ) return( -1 ); break; @@ -703,7 +703,7 @@ static int vips__jpeg_read( ReadJpeg *jpeg, VipsImage *out, gboolean header_only ) { /* Need to read in APP1 (EXIF metadata), APP2 (ICC profile), APP13 - * (photoshop IPCT). + * (photoshop IPTC). */ jpeg_save_markers( &jpeg->cinfo, JPEG_APP0 + 1, 0xffff ); jpeg_save_markers( &jpeg->cinfo, JPEG_APP0 + 2, 0xffff ); diff --git a/libvips/foreign/jpegload.c b/libvips/foreign/jpegload.c index dfe5b868..c0c5319d 100644 --- a/libvips/foreign/jpegload.c +++ b/libvips/foreign/jpegload.c @@ -368,8 +368,8 @@ vips_foreign_load_jpeg_buffer_init( VipsForeignLoadJpegBuffer *buffer ) * #VIPS_META_ICC_NAME. You need to use something like * vips_icc_import() to get CIE values from the file. * - * EXIF metadata is attached as #VIPS_META_EXIF_NAME, IPCT as - * #VIPS_META_IPCT_NAME, and XMP as #VIPS_META_XMP_NAME. + * EXIF metadata is attached as #VIPS_META_EXIF_NAME, IPTC as + * #VIPS_META_IPTC_NAME, and XMP as #VIPS_META_XMP_NAME. * * The int metadata item "jpeg-multiscan" is set to the result of * jpeg_has_multiple_scans(). Interlaced jpeg images need a large amount of diff --git a/libvips/foreign/jpegsave.c b/libvips/foreign/jpegsave.c index 17732f07..d93cf5b2 100644 --- a/libvips/foreign/jpegsave.c +++ b/libvips/foreign/jpegsave.c @@ -450,7 +450,7 @@ vips_foreign_save_jpeg_mime_init( VipsForeignSaveJpegMime *mime ) * in jpg parlance). These files may be better for display over a slow network * conection, but need much more memory to encode and decode. * - * If @strip is set, no EXIF data, IPCT data, ICC profile or XMP metadata is + * If @strip is set, no EXIF data, IPTC data, ICC profile or XMP metadata is * written into the output file. * * If @no_subsample is set, chrominance subsampling is disabled. This will @@ -505,7 +505,7 @@ vips_foreign_save_jpeg_mime_init( VipsForeignSaveJpegMime *mime ) * the file. #VIPS_META_RESOLUTION_UNIT is used to set the EXIF resolution * unit. #VIPS_META_ORIENTATION is used to set the EXIF orientation tag. * - * IPCT as #VIPS_META_IPCT_NAME and XMP as #VIPS_META_XMP_NAME + * IPTC as #VIPS_META_IPTC_NAME and XMP as #VIPS_META_XMP_NAME * are coded and attached. * * See also: vips_jpegsave_buffer(), vips_image_write_to_file(). diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 8330d3e9..bd9688b4 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -158,7 +158,7 @@ * - close the read down early for a header read ... this saves an * fd during file read, handy for large numbers of input images * 29/9/15 - * - load IPCT metadata + * - load IPTC metadata * - load photoshop metadata * 21/12/15 * - load TIFFTAG_IMAGEDESCRIPTION @@ -1283,7 +1283,7 @@ rtiff_set_header( Rtiff *rtiff, VipsImage *out ) (VipsCallbackFn) vips_free, data_copy, data_length ); } - /* Read any IPCT metadata. + /* Read any IPTC metadata. */ if( TIFFGetField( rtiff->tiff, TIFFTAG_RICHTIFFIPTC, &data_length, &data ) && @@ -1291,7 +1291,7 @@ rtiff_set_header( Rtiff *rtiff, VipsImage *out ) data_length ) { void *data_copy; - /* For no very good reason, libtiff stores IPCT as an array of + /* For no very good reason, libtiff stores IPTC as an array of * long, not byte. */ data_length *= 4; @@ -1299,7 +1299,7 @@ rtiff_set_header( Rtiff *rtiff, VipsImage *out ) if( !(data_copy = vips_malloc( NULL, data_length )) ) return( -1 ); memcpy( data_copy, data, data_length ); - vips_image_set_blob( out, VIPS_META_IPCT_NAME, + vips_image_set_blob( out, VIPS_META_IPTC_NAME, (VipsCallbackFn) vips_free, data_copy, data_length ); } diff --git a/libvips/foreign/tiffload.c b/libvips/foreign/tiffload.c index 081a4cc3..f7aeaef9 100644 --- a/libvips/foreign/tiffload.c +++ b/libvips/foreign/tiffload.c @@ -361,7 +361,7 @@ vips_foreign_load_tiff_buffer_init( VipsForeignLoadTiffBuffer *buffer ) * * Any ICC profile is read and attached to the VIPS image as * #VIPS_META_ICC_NAME. Any XMP metadata is read and attached to the image - * as #VIPS_META_XMP_NAME. Any IPCT is attached as #VIPS_META_IPCT_NAME. The + * as #VIPS_META_XMP_NAME. Any IPTC is attached as #VIPS_META_IPTC_NAME. The * image description is * attached as #VIPS_META_IMAGEDESCRIPTION. Data in the photoshop tag is * attached as #VIPS_META_PHOTOSHOP_NAME. diff --git a/libvips/foreign/tiffsave.c b/libvips/foreign/tiffsave.c index 553f54c2..09b55615 100644 --- a/libvips/foreign/tiffsave.c +++ b/libvips/foreign/tiffsave.c @@ -539,7 +539,7 @@ vips_foreign_save_tiff_buffer_init( VipsForeignSaveTiffBuffer *buffer ) * The value of #VIPS_META_XMP_NAME is written to * the XMP tag. #VIPS_META_ORIENTATION (if set) is used to set the value of * the orientation - * tag. #VIPS_META_IPCT (if set) is used to set the value of the IPCT tag. + * tag. #VIPS_META_IPTC (if set) is used to set the value of the IPTC tag. * #VIPS_META_PHOTOSHOP_NAME (if set) is used to set the value of the PHOTOSHOP * tag. * diff --git a/libvips/foreign/vips2jpeg.c b/libvips/foreign/vips2jpeg.c index cba26e04..d68af286 100644 --- a/libvips/foreign/vips2jpeg.c +++ b/libvips/foreign/vips2jpeg.c @@ -55,7 +55,7 @@ * - optionally parse rationals as a/b * - update exif image dimensions * 21/11/12 - * - attach IPCT data (app13), thanks Gary + * - attach IPTC data (app13), thanks Gary * 2/10/13 Lovell Fuller * - add optimize_coding parameter * - add progressive mode @@ -594,7 +594,7 @@ write_vips( Write *write, int qfac, const char *profile, write_blob( write, VIPS_META_XMP_NAME, JPEG_APP0 + 1 ) || write_blob( write, - VIPS_META_IPCT_NAME, JPEG_APP0 + 13 ) ) + VIPS_META_IPTC_NAME, JPEG_APP0 + 13 ) ) return( -1 ); /* A profile supplied as an argument overrides an embedded diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index b384df12..1350befe 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -154,7 +154,7 @@ * - squash >128 rather than >0, nicer results for shrink * - add miniswhite option * 29/9/15 - * - try to write IPCT metadata + * - try to write IPTC metadata * - try to write photoshop metadata * 11/11/15 * - better alpha handling, thanks sadaqatullahn @@ -462,17 +462,17 @@ wtiff_embed_ipct( Wtiff *wtiff, TIFF *tif ) void *data; size_t data_length; - if( !vips_image_get_typeof( wtiff->im, VIPS_META_IPCT_NAME ) ) + if( !vips_image_get_typeof( wtiff->im, VIPS_META_IPTC_NAME ) ) return( 0 ); - if( vips_image_get_blob( wtiff->im, VIPS_META_IPCT_NAME, + if( vips_image_get_blob( wtiff->im, VIPS_META_IPTC_NAME, &data, &data_length ) ) return( -1 ); - /* For no very good reason, libtiff stores IPCT as an array of + /* For no very good reason, libtiff stores IPTC as an array of * long, not byte. */ if( data_length & 3 ) { - g_warning( "%s", _( "rounding up IPCT data length" ) ); + g_warning( "%s", _( "rounding up IPTC data length" ) ); data_length /= 4; data_length += 1; } @@ -482,7 +482,7 @@ wtiff_embed_ipct( Wtiff *wtiff, TIFF *tif ) TIFFSetField( tif, TIFFTAG_RICHTIFFIPTC, data_length, data ); #ifdef DEBUG - printf( "vips2tiff: attached IPCT from meta\n" ); + printf( "vips2tiff: attached IPTC from meta\n" ); #endif /*DEBUG*/ return( 0 ); diff --git a/libvips/include/vips/header.h b/libvips/include/vips/header.h index b445428a..922f92ba 100644 --- a/libvips/include/vips/header.h +++ b/libvips/include/vips/header.h @@ -53,11 +53,11 @@ extern "C" { #define VIPS_META_XMP_NAME "xmp-data" /** - * VIPS_META_IPCT_NAME: + * VIPS_META_IPTC_NAME: * - * The name that read and write operations use for the image's IPCT data. + * The name that read and write operations use for the image's IPTC data. */ -#define VIPS_META_IPCT_NAME "ipct-data" +#define VIPS_META_IPTC_NAME "iptc-data" /** * VIPS_META_PHOTOSHOP_NAME: diff --git a/libvips/include/vips/vips7compat.h b/libvips/include/vips/vips7compat.h index 762c46fa..95c94b72 100644 --- a/libvips/include/vips/vips7compat.h +++ b/libvips/include/vips/vips7compat.h @@ -41,6 +41,10 @@ extern "C" { /* Renamed types. */ +/* We have this misspelt in earlier versions :( + */ +#define VIPS_META_IPCT_NAME VIPS_META_IPTC_NAME + #define IM_D93_X0 VIPS_D93_X0 #define IM_D93_Y0 VIPS_D93_Y0 #define IM_D93_Z0 VIPS_D93_Z0