From 055f8be3cf5a54fe71b97988af9ae13a6aceac97 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 29 Sep 2012 20:08:26 +0000 Subject: [PATCH] 2012-09-29 22:06 UTC+0200 Viktor Szakats (harbour syenar.net) * src/3rd/tiff/Makefile * src/3rd/tiff/* * updated to 4.0.3 (from 4.0.2) using 3rdpatch.hb * src/3rd/png/Makefile * src/3rd/png/* * updated to 1.5.13 (from 1.5.12) using 3rdpatch.hb --- harbour/ChangeLog | 9 ++++ harbour/src/3rd/png/LICENSE | 4 +- harbour/src/3rd/png/Makefile | 4 +- harbour/src/3rd/png/png.c | 6 +-- harbour/src/3rd/png/png.dif | 10 ++-- harbour/src/3rd/png/png.h | 87 +++++++++++++++--------------- harbour/src/3rd/png/pngconf.h | 36 +++++++------ harbour/src/3rd/png/pnglconf.h | 2 +- harbour/src/3rd/png/pngmem.c | 8 +-- harbour/src/3rd/png/pngpriv.h | 6 +-- harbour/src/3rd/png/pngrtran.c | 63 ++++++++++++++-------- harbour/src/3rd/png/pngrutil.c | 2 +- harbour/src/3rd/png/pngwtran.c | 20 +++++-- harbour/src/3rd/png/pngwutil.c | 3 +- harbour/src/3rd/tiff/Makefile | 6 +-- harbour/src/3rd/tiff/dirinfo.c | 60 +++++++++++++++++++-- harbour/src/3rd/tiff/dirread.c | 29 +++++++--- harbour/src/3rd/tiff/dirwrite.c | 6 +-- harbour/src/3rd/tiff/fax3.c | 4 +- harbour/src/3rd/tiff/jpeg.c | 9 ++-- harbour/src/3rd/tiff/packbits.c | 12 +++-- harbour/src/3rd/tiff/pixarlog.c | 4 +- harbour/src/3rd/tiff/print.c | 6 ++- harbour/src/3rd/tiff/read.c | 6 +-- harbour/src/3rd/tiff/tiff.dif | 93 +++++++++++++++++---------------- harbour/src/3rd/tiff/tiff.h | 30 ++++++++++- harbour/src/3rd/tiff/tiffio.h | 9 +++- harbour/src/3rd/tiff/tiffvers.h | 4 +- harbour/src/3rd/tiff/write.c | 40 ++++++++++---- 29 files changed, 379 insertions(+), 199 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2f5d337ab3..cb503e02ba 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2012-09-29 22:06 UTC+0200 Viktor Szakats (harbour syenar.net) + * src/3rd/tiff/Makefile + * src/3rd/tiff/* + * updated to 4.0.3 (from 4.0.2) using 3rdpatch.hb + + * src/3rd/png/Makefile + * src/3rd/png/* + * updated to 1.5.13 (from 1.5.12) using 3rdpatch.hb + 2012-09-29 19:44 UTC+0200 Viktor Szakats (harbour syenar.net) + contrib/hbnf/tests/aading.prg + contrib/hbnf/tests/aemaxlen.prg diff --git a/harbour/src/3rd/png/LICENSE b/harbour/src/3rd/png/LICENSE index 3a67d54588..16a7d9ef3f 100644 --- a/harbour/src/3rd/png/LICENSE +++ b/harbour/src/3rd/png/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.5.12, July 11, 2012, are +libpng versions 1.2.6, August 15, 2004, through 1.5.13, September 27, 2012, are Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -108,4 +108,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -July 11, 2012 +September 27, 2012 diff --git a/harbour/src/3rd/png/Makefile b/harbour/src/3rd/png/Makefile index 37bb92f6d4..27cf5d917a 100644 --- a/harbour/src/3rd/png/Makefile +++ b/harbour/src/3rd/png/Makefile @@ -69,8 +69,8 @@ else endif # ORIGIN http://www.libpng.org/pub/png/libpng.html -# VER 1.5.12 -# URL http://prdownloads.sourceforge.net/libpng/libpng-1.5.12.tar.gz?download +# VER 1.5.13 +# URL http://prdownloads.sourceforge.net/libpng/libpng-1.5.13.tar.gz?download # DIFF png.dif # # MAP LICENSE diff --git a/harbour/src/3rd/png/png.c b/harbour/src/3rd/png/png.c index 6808c5cb90..6e42c792b5 100644 --- a/harbour/src/3rd/png/png.c +++ b/harbour/src/3rd/png/png.c @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_5_12 Your_png_h_is_not_version_1_5_12; +typedef png_libpng_version_1_5_13 Your_png_h_is_not_version_1_5_13; /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another @@ -655,13 +655,13 @@ png_get_copyright(png_const_structp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.5.12 - July 11, 2012" PNG_STRING_NEWLINE \ + "libpng version 1.5.13 - September 27, 2012" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.5.12 - July 11, 2012\ + return "libpng version 1.5.13 - September 27, 2012\ Copyright (c) 1998-2012 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; diff --git a/harbour/src/3rd/png/png.dif b/harbour/src/3rd/png/png.dif index 2ebcc770e5..d18d5a7bf8 100644 --- a/harbour/src/3rd/png/png.dif +++ b/harbour/src/3rd/png/png.dif @@ -1,7 +1,7 @@ diff -urN png.orig\png.h png\png.h ---- png.orig\png.h Mon Jul 16 12:39:16 2012 -+++ png\png.h Mon Jul 16 12:39:16 2012 -@@ -436,7 +436,7 @@ +--- png.orig\png.h Sat Sep 29 21:56:24 2012 ++++ png\png.h Sat Sep 29 21:56:24 2012 +@@ -439,7 +439,7 @@ /* If pnglibconf.h is missing, you can * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h */ @@ -11,8 +11,8 @@ diff -urN png.orig\png.h png\png.h #ifndef PNG_VERSION_INFO_ONLY diff -urN png.orig\pnglconf.h png\pnglconf.h ---- png.orig\pnglconf.h Mon Jul 16 12:39:16 2012 -+++ png\pnglconf.h Mon Jul 16 12:39:16 2012 +--- png.orig\pnglconf.h Sat Sep 29 21:56:24 2012 ++++ png\pnglconf.h Sat Sep 29 21:56:24 2012 @@ -21,7 +21,11 @@ #ifndef PNGLCONF_H #define PNGLCONF_H diff --git a/harbour/src/3rd/png/png.h b/harbour/src/3rd/png/png.h index df0e3a31e2..29ae630d02 100644 --- a/harbour/src/3rd/png/png.h +++ b/harbour/src/3rd/png/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.5.12 - July 11, 2012 + * libpng version 1.5.13 - September 27, 2012 * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.5.12 - July 11, 2012: Glenn + * libpng versions 0.97, January 1998, through 1.5.13 - September 27, 2012: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -178,6 +178,9 @@ * 1.5.11rc01-05 15 10511 15.so.15.11[.0] * 1.5.11 15 10511 15.so.15.11[.0] * 1.5.12 15 10512 15.so.15.12[.0] + * 1.5.13beta01-02 15 10513 15.so.15.13[.0] + * 1.5.13rc01 15 10513 15.so.15.13[.0] + * 1.5.13 15 10513 15.so.15.13[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -209,7 +212,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.5.12, July 11, 2012, are + * libpng versions 1.2.6, August 15, 2004, through 1.5.13, September 27, 2012, are * Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -321,13 +324,13 @@ * Y2K compliance in libpng: * ========================= * - * July 11, 2012 + * September 27, 2012 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.5.12 are Y2K compliant. It is my belief that + * upward through 1.5.13 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -386,9 +389,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.5.12" +#define PNG_LIBPNG_VER_STRING "1.5.13" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.5.12 - July 11, 2012\n" + " libpng version 1.5.13 - September 27, 2012\n" #define PNG_LIBPNG_VER_SONUM 15 #define PNG_LIBPNG_VER_DLLNUM 15 @@ -396,7 +399,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 5 -#define PNG_LIBPNG_VER_RELEASE 12 +#define PNG_LIBPNG_VER_RELEASE 13 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: @@ -427,7 +430,7 @@ * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10512 /* 1.5.12 */ +#define PNG_LIBPNG_VER 10513 /* 1.5.13 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -549,7 +552,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_5_12; +typedef char* png_libpng_version_1_5_13; /* Three color definitions. The order of the red, green, and blue, (and the * exact size) is not important, although the size of the fields need to @@ -1158,9 +1161,9 @@ PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structp png_ptr)); #define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/ PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structp png_ptr, - int error_action, double red, double green)); + int error_action, double red, double green)) PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structp png_ptr, - int error_action, png_fixed_point red, png_fixed_point green)); + int error_action, png_fixed_point red, png_fixed_point green)) PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp png_ptr)); @@ -1228,9 +1231,9 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structp png_ptr, int mode, - double output_gamma)); + double output_gamma)) PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structp png_ptr, - int mode, png_fixed_point output_gamma)); + int mode, png_fixed_point output_gamma)) #endif #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) @@ -1453,10 +1456,10 @@ PNG_EXPORT(46, void, png_set_invert_mono, (png_structp png_ptr)); */ PNG_FP_EXPORT(47, void, png_set_background, (png_structp png_ptr, png_const_color_16p background_color, int background_gamma_code, - int need_expand, double background_gamma)); + int need_expand, double background_gamma)) PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr, png_const_color_16p background_color, int background_gamma_code, - int need_expand, png_fixed_point background_gamma)); + int need_expand, png_fixed_point background_gamma)) #endif #ifdef PNG_READ_BACKGROUND_SUPPORTED # define PNG_BACKGROUND_GAMMA_UNKNOWN 0 @@ -1505,9 +1508,9 @@ PNG_EXPORT(49, void, png_set_quantize, */ PNG_FP_EXPORT(50, void, png_set_gamma, (png_structp png_ptr, double screen_gamma, - double override_file_gamma)); + double override_file_gamma)) PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structp png_ptr, - png_fixed_point screen_gamma, png_fixed_point override_file_gamma)); + png_fixed_point screen_gamma, png_fixed_point override_file_gamma)) #endif #ifdef PNG_WRITE_FLUSH_SUPPORTED @@ -1667,11 +1670,11 @@ PNG_EXPORT(67, void, png_set_filter, */ PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structp png_ptr, int heuristic_method, int num_weights, png_const_doublep filter_weights, - png_const_doublep filter_costs)); + png_const_doublep filter_costs)) PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, (png_structp png_ptr, int heuristic_method, int num_weights, png_const_fixed_point_p - filter_weights, png_const_fixed_point_p filter_costs)); + filter_weights, png_const_fixed_point_p filter_costs)) #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ /* Heuristic used for row filter selection. These defines should NOT be @@ -2053,9 +2056,9 @@ PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, /* Returns pixel aspect ratio, computed from pHYs chunk data. */ PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, - (png_const_structp png_ptr, png_const_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)) PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, - (png_const_structp png_ptr, png_const_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)) /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, @@ -2088,11 +2091,11 @@ PNG_EXPORT(132, void, png_set_bKGD, (png_structp png_ptr, png_infop info_ptr, PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structp png_ptr, png_const_infop info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, - double *blue_y)); + double *blue_y)) PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_structp png_ptr, png_const_infop info_ptr, double *red_X, double *red_Y, double *red_Z, double *green_X, double *green_Y, double *green_Z, double *blue_X, - double *blue_Y, double *blue_Z)); + double *blue_Y, double *blue_Z)) #ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */ PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, (png_const_structp png_ptr, @@ -2100,7 +2103,7 @@ PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, - png_fixed_point *int_blue_y)); + png_fixed_point *int_blue_y)) #endif PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, (png_structp png_ptr, png_const_infop info_ptr, @@ -2108,46 +2111,46 @@ PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, png_fixed_point *int_red_Z, png_fixed_point *int_green_X, png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, - png_fixed_point *int_blue_Z)); + png_fixed_point *int_blue_Z)) #endif #ifdef PNG_cHRM_SUPPORTED PNG_FP_EXPORT(135, void, png_set_cHRM, (png_structp png_ptr, png_infop info_ptr, double white_x, double white_y, double red_x, double red_y, double green_x, - double green_y, double blue_x, double blue_y)); + double green_y, double blue_x, double blue_y)) PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_structp png_ptr, png_infop info_ptr, double red_X, double red_Y, double red_Z, double green_X, double green_Y, double green_Z, double blue_X, - double blue_Y, double blue_Z)); + double blue_Y, double blue_Z)) PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_structp png_ptr, png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)); + png_fixed_point int_blue_y)) PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_structp png_ptr, png_infop info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, png_fixed_point int_red_Z, png_fixed_point int_green_X, png_fixed_point int_green_Y, png_fixed_point int_green_Z, png_fixed_point int_blue_X, png_fixed_point int_blue_Y, - png_fixed_point int_blue_Z)); + png_fixed_point int_blue_Z)) #endif #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structp png_ptr, png_const_infop info_ptr, - double *file_gamma)); + double *file_gamma)) PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, (png_const_structp png_ptr, png_const_infop info_ptr, - png_fixed_point *int_file_gamma)); + png_fixed_point *int_file_gamma)) #endif #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(139, void, png_set_gAMA, (png_structp png_ptr, - png_infop info_ptr, double file_gamma)); + png_infop info_ptr, double file_gamma)) PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_structp png_ptr, - png_infop info_ptr, png_fixed_point int_file_gamma)); + png_infop info_ptr, png_fixed_point int_file_gamma)) #endif #ifdef PNG_hIST_SUPPORTED @@ -2313,7 +2316,7 @@ PNG_EXPORT(167, void, png_set_tRNS, #ifdef PNG_sCAL_SUPPORTED PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structp png_ptr, png_const_infop info_ptr, - int *unit, double *width, double *height)); + int *unit, double *width, double *height)) #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* NOTE: this API is currently implemented using floating point arithmetic, * consequently it can only be used on systems with floating point support. @@ -2323,7 +2326,7 @@ PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, (png_structp png_ptr, png_const_infop info_ptr, int *unit, png_fixed_point *width, - png_fixed_point *height)); + png_fixed_point *height)) #endif PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, (png_const_structp png_ptr, png_const_infop info_ptr, @@ -2331,10 +2334,10 @@ PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, PNG_FP_EXPORT(170, void, png_set_sCAL, (png_structp png_ptr, png_infop info_ptr, - int unit, double width, double height)); + int unit, double width, double height)) PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_structp png_ptr, png_infop info_ptr, int unit, png_fixed_point width, - png_fixed_point height)); + png_fixed_point height)) PNG_EXPORT(171, void, png_set_sCAL_s, (png_structp png_ptr, png_infop info_ptr, int unit, png_const_charp swidth, png_const_charp sheight)); @@ -2447,17 +2450,17 @@ PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_FP_EXPORT(196, float, png_get_x_offset_inches, - (png_const_structp png_ptr, png_const_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)) #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, - (png_structp png_ptr, png_const_infop info_ptr)); + (png_structp png_ptr, png_const_infop info_ptr)) #endif PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structp png_ptr, - png_const_infop info_ptr)); + png_const_infop info_ptr)) #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, - (png_structp png_ptr, png_const_infop info_ptr)); + (png_structp png_ptr, png_const_infop info_ptr)) #endif # ifdef PNG_pHYs_SUPPORTED diff --git a/harbour/src/3rd/png/pngconf.h b/harbour/src/3rd/png/pngconf.h index 5c3eb1454d..a36492817c 100644 --- a/harbour/src/3rd/png/pngconf.h +++ b/harbour/src/3rd/png/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.5.12 - July 11, 2012 + * libpng version 1.5.13 - September 27, 2012 * * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -344,21 +344,23 @@ # ifndef PNG_NORETURN # define PNG_NORETURN __attribute__((__noreturn__)) # endif -# ifndef PNG_ALLOCATED -# define PNG_ALLOCATED __attribute__((__malloc__)) -# endif -# ifndef PNG_DEPRECATED -# define PNG_DEPRECATED __attribute__((__deprecated__)) -# endif -# ifndef PNG_PRIVATE -# if 0 /* Doesn't work so we use deprecated instead*/ -# define PNG_PRIVATE \ - __attribute__((warning("This function is not exported by libpng."))) -# else -# define PNG_PRIVATE \ - __attribute__((__deprecated__)) +# if __GNUC__ >= 3 +# ifndef PNG_ALLOCATED +# define PNG_ALLOCATED __attribute__((__malloc__)) # endif -# endif +# ifndef PNG_DEPRECATED +# define PNG_DEPRECATED __attribute__((__deprecated__)) +# endif +# ifndef PNG_PRIVATE +# if 0 /* Doesn't work so we use deprecated instead*/ +# define PNG_PRIVATE \ + __attribute__((warning("This function is not exported by libpng."))) +# else +# define PNG_PRIVATE \ + __attribute__((__deprecated__)) +# endif +# endif +# endif /* __GNUC__ >= 3 */ # endif /* __GNUC__ */ # if defined(_MSC_VER) && (_MSC_VER >= 1300) @@ -400,7 +402,7 @@ #ifndef PNG_FP_EXPORT /* A floating point API. */ # ifdef PNG_FLOATING_POINT_SUPPORTED # define PNG_FP_EXPORT(ordinal, type, name, args)\ - PNG_EXPORT(ordinal, type, name, args) + PNG_EXPORT(ordinal, type, name, args); # else /* No floating point APIs */ # define PNG_FP_EXPORT(ordinal, type, name, args) # endif @@ -408,7 +410,7 @@ #ifndef PNG_FIXED_EXPORT /* A fixed point API. */ # ifdef PNG_FIXED_POINT_SUPPORTED # define PNG_FIXED_EXPORT(ordinal, type, name, args)\ - PNG_EXPORT(ordinal, type, name, args) + PNG_EXPORT(ordinal, type, name, args); # else /* No fixed point APIs */ # define PNG_FIXED_EXPORT(ordinal, type, name, args) # endif diff --git a/harbour/src/3rd/png/pnglconf.h b/harbour/src/3rd/png/pnglconf.h index 58ae00c046..f1cd3275ec 100644 --- a/harbour/src/3rd/png/pnglconf.h +++ b/harbour/src/3rd/png/pnglconf.h @@ -3,7 +3,7 @@ /* pnglibconf.h - library build configuration */ -/* Libpng 1.5.12 - July 11, 2012 */ +/* Libpng 1.5.13 - September 27, 2012 */ /* Copyright (c) 1998-2012 Glenn Randers-Pehrson */ diff --git a/harbour/src/3rd/png/pngmem.c b/harbour/src/3rd/png/pngmem.c index bf5ff037da..f885533fbb 100644 --- a/harbour/src/3rd/png/pngmem.c +++ b/harbour/src/3rd/png/pngmem.c @@ -1,8 +1,8 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.5.7 [December 15, 2011] - * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * Last changed in libpng 1.5.13 [September 27, 2012] + * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -56,7 +56,7 @@ png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr), if (malloc_fn != NULL) { png_struct dummy_struct; - memset(&dummy_struct, 0, sizeof dummy_struct); + png_memset(&dummy_struct, 0, sizeof dummy_struct); dummy_struct.mem_ptr=mem_ptr; struct_ptr = (*(malloc_fn))(&dummy_struct, (png_alloc_size_t)size); } @@ -90,7 +90,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, if (free_fn != NULL) { png_struct dummy_struct; - memset(&dummy_struct, 0, sizeof dummy_struct); + png_memset(&dummy_struct, 0, sizeof dummy_struct); dummy_struct.mem_ptr=mem_ptr; (*(free_fn))(&dummy_struct, struct_ptr); return; diff --git a/harbour/src/3rd/png/pngpriv.h b/harbour/src/3rd/png/pngpriv.h index 84baf23660..7394e4a16e 100644 --- a/harbour/src/3rd/png/pngpriv.h +++ b/harbour/src/3rd/png/pngpriv.h @@ -993,8 +993,8 @@ PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, /* Unfilter a row: check the filter value before calling this, there is no point * calling it for PNG_FILTER_VALUE_NONE. */ -PNG_EXTERN void png_read_filter_row PNGARG((png_structp pp, png_row_infop row_info, - png_bytep row, png_const_bytep prev_row, int filter)); +PNG_EXTERN void png_read_filter_row PNGARG((png_structp pp, png_row_infop + row_info, png_bytep row, png_const_bytep prev_row, int filter)); PNG_EXTERN void png_read_filter_row_up_neon PNGARG((png_row_infop row_info, png_bytep row, png_const_bytep prev_row)); @@ -1582,7 +1582,7 @@ PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr, #define PNG_FP_IS_ZERO(state) (((state) & PNG_FP_Z_MASK) == PNG_FP_SAW_DIGIT) #define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK) #define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK) - + /* The actual parser. This can be called repeatedly, it updates * the index into the string and the state variable (which must * be initialzed to 0). It returns a result code, as above. There diff --git a/harbour/src/3rd/png/pngrtran.c b/harbour/src/3rd/png/pngrtran.c index 96732b55c5..1e31c75205 100644 --- a/harbour/src/3rd/png/pngrtran.c +++ b/harbour/src/3rd/png/pngrtran.c @@ -3705,8 +3705,10 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) if (v == png_ptr->trans_color.gray) { /* Background is already in screen gamma */ - *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); - *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) + & 0xff); + *(sp + 1) = (png_byte)(png_ptr->background.gray + & 0xff); } else @@ -3729,8 +3731,10 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) if (v == png_ptr->trans_color.gray) { - *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); - *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) + & 0xff); + *(sp + 1) = (png_byte)(png_ptr->background.gray + & 0xff); } } } @@ -3810,9 +3814,12 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) /* Background is already in screen gamma */ *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); - *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); - *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); - *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) + & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green + & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) + & 0xff); *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } @@ -3853,9 +3860,12 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) { *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); - *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); - *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); - *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) + & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green + & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) + & 0xff); *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } } @@ -3938,7 +3948,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) else if (a == 0) { /* Background is already in screen gamma */ - *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) + & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); } @@ -3968,7 +3979,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) if (a == 0) { - *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) + & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); } @@ -4098,9 +4110,12 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) /* Background is already in screen gamma */ *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); - *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); - *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); - *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) + & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green + & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) + & 0xff); *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } @@ -4111,14 +4126,16 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; png_composite_16(w, v, a, png_ptr->background_1.red); if (!optimize) - w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + w = gamma_16_from_1[((w&0xff) >> gamma_shift)] + [w >> 8]; *sp = (png_byte)((w >> 8) & 0xff); *(sp + 1) = (png_byte)(w & 0xff); v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)]; png_composite_16(w, v, a, png_ptr->background_1.green); if (!optimize) - w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + w = gamma_16_from_1[((w&0xff) >> gamma_shift)] + [w >> 8]; *(sp + 2) = (png_byte)((w >> 8) & 0xff); *(sp + 3) = (png_byte)(w & 0xff); @@ -4126,7 +4143,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)]; png_composite_16(w, v, a, png_ptr->background_1.blue); if (!optimize) - w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + w = gamma_16_from_1[((w&0xff) >> gamma_shift)] + [w >> 8]; *(sp + 4) = (png_byte)((w >> 8) & 0xff); *(sp + 5) = (png_byte)(w & 0xff); @@ -4147,9 +4165,12 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr) { *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); - *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); - *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); - *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) + & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green + & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) + & 0xff); *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } diff --git a/harbour/src/3rd/png/pngrutil.c b/harbour/src/3rd/png/pngrutil.c index aa592ccfbd..4ef05fe441 100644 --- a/harbour/src/3rd/png/pngrutil.c +++ b/harbour/src/3rd/png/pngrutil.c @@ -3706,7 +3706,7 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp) { pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon; pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon; - pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = + pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_neon; } diff --git a/harbour/src/3rd/png/pngwtran.c b/harbour/src/3rd/png/pngwtran.c index 96608efcb4..743581327b 100644 --- a/harbour/src/3rd/png/pngwtran.c +++ b/harbour/src/3rd/png/pngwtran.c @@ -1,8 +1,8 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.5.6 [November 3, 2011] - * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * Last changed in libpng 1.5.13 [September 27, 2012] + * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -45,8 +45,20 @@ png_do_write_transformations(png_structp png_ptr, png_row_infop row_info) #ifdef PNG_WRITE_FILLER_SUPPORTED if (png_ptr->transformations & PNG_FILLER) - png_do_strip_channel(row_info, png_ptr->row_buf + 1, - !(png_ptr->flags & PNG_FLAG_FILLER_AFTER)); + { + if (png_ptr->color_type & (PNG_COLOR_MASK_ALPHA|PNG_COLOR_MASK_PALETTE)) + { + /* GA, RGBA or palette; in any of these cases libpng will not do the + * the correct thing (whatever that might be). + */ + png_warning(png_ptr, "incorrect png_set_filler call ignored"); + png_ptr->transformations &= ~PNG_FILLER; + } + + else + png_do_strip_channel(row_info, png_ptr->row_buf + 1, + !(png_ptr->flags & PNG_FLAG_FILLER_AFTER)); + } #endif #ifdef PNG_WRITE_PACKSWAP_SUPPORTED diff --git a/harbour/src/3rd/png/pngwutil.c b/harbour/src/3rd/png/pngwutil.c index b49704f1a5..19b75afa37 100644 --- a/harbour/src/3rd/png/pngwutil.c +++ b/harbour/src/3rd/png/pngwutil.c @@ -1370,7 +1370,8 @@ png_write_tRNS(png_structp png_ptr, png_const_bytep trans_alpha, } /* Write the chunk out as it is */ - png_write_complete_chunk(png_ptr, png_tRNS, trans_alpha, (png_size_t)num_trans); + png_write_complete_chunk(png_ptr, png_tRNS, trans_alpha, + (png_size_t)num_trans); } else if (color_type == PNG_COLOR_TYPE_GRAY) diff --git a/harbour/src/3rd/tiff/Makefile b/harbour/src/3rd/tiff/Makefile index 38342c471a..325f0e9802 100644 --- a/harbour/src/3rd/tiff/Makefile +++ b/harbour/src/3rd/tiff/Makefile @@ -107,9 +107,9 @@ else include $(TOP)$(ROOT)config/none.mk endif -# ORIGIN http://www.libtiff.org/ -# VER 4.0.2 -# URL http://download.osgeo.org/libtiff/tiff-4.0.2.zip +# ORIGIN http://www.remotesensing.org/libtiff/ +# VER 4.0.3 +# URL http://download.osgeo.org/libtiff/tiff-4.0.3.zip # DIFF tiff.dif # # MAP COPYRIGHT LICENSE diff --git a/harbour/src/3rd/tiff/dirinfo.c b/harbour/src/3rd/tiff/dirinfo.c index 06b5a5a00f..d3199318f4 100644 --- a/harbour/src/3rd/tiff/dirinfo.c +++ b/harbour/src/3rd/tiff/dirinfo.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirinfo.c,v 1.114 2011-05-17 00:21:17 fwarmerdam Exp $ */ +/* $Id: tif_dirinfo.c,v 1.117 2012-08-19 16:56:34 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -37,7 +37,7 @@ * * NOTE: The second field (field_readcount) and third field (field_writecount) * sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3) - * and TIFFTAG_SPP (-2). The macros should be used but would throw off + * and TIFF_SPP (-2). The macros should be used but would throw off * the formatting of the code, so please interprete the -1, -2 and -3 * values accordingly. */ @@ -190,9 +190,23 @@ tiffFields[] = { { TIFFTAG_ASSHOTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "AsShotPreProfileMatrix", NULL }, { TIFFTAG_CURRENTICCPROFILE, -1, -1, TIFF_UNDEFINED, 0, TIFF_SETGET_C16_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "CurrentICCProfile", NULL }, { TIFFTAG_CURRENTPREPROFILEMATRIX, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "CurrentPreProfileMatrix", NULL }, + { TIFFTAG_PERSAMPLE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "PerSample", NULL}, + /* end DNG tags */ + /* begin TIFF/FX tags */ + { TIFFTAG_INDEXED, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "Indexed" }, + { TIFFTAG_GLOBALPARAMETERSIFD, 1, 1, TIFF_IFD, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "GlobalParametersIFD", NULL }, + { TIFFTAG_PROFILETYPE, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ProfileType", NULL }, + { TIFFTAG_FAXPROFILE, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "FaxProfile", NULL }, + { TIFFTAG_CODINGMETHODS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "CodingMethods", NULL }, + { TIFFTAG_VERSIONYEAR, 4, 4, TIFF_BYTE, 0, TIFF_SETGET_C0_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "VersionYear", NULL }, + { TIFFTAG_MODENUMBER, 1, 1, TIFF_BYTE, 0, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ModeNumber", NULL }, + { TIFFTAG_DECODE, -1, -1, TIFF_SRATIONAL, 0, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "Decode", NULL }, + { TIFFTAG_IMAGEBASECOLOR, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "ImageBaseColor", NULL }, + { TIFFTAG_T82OPTIONS, 1, 1, TIFF_LONG, 0, TIFF_SETGET_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "T82Options", NULL }, + { TIFFTAG_STRIPROWCOUNTS, -1, -1, TIFF_LONG, 0, TIFF_SETGET_C16_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 1, "StripRowCounts", NULL }, + { TIFFTAG_IMAGELAYER, 2, 2, TIFF_LONG, 0, TIFF_SETGET_C0_UINT32, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "ImageLayer", NULL }, /* end DNG tags */ /* begin pseudo tags */ - { TIFFTAG_PERSAMPLE, 0, 0, TIFF_SHORT, 0, TIFF_SETGET_UNDEFINED, TIFF_SETGET_UNDEFINED, FIELD_PSEUDO, TRUE, FALSE, "PerSample", NULL}, }; static TIFFField @@ -348,7 +362,7 @@ _TIFFMergeFields(TIFF* tif, const TIFFField info[], uint32 n) { static const char module[] = "_TIFFMergeFields"; static const char reason[] = "for fields array"; - TIFFField** tp; + /* TIFFField** tp; */ uint32 i; tif->tif_foundfield = NULL; @@ -369,7 +383,7 @@ _TIFFMergeFields(TIFF* tif, const TIFFField info[], uint32 n) return 0; } - tp = tif->tif_fields + tif->tif_nfields; + /* tp = tif->tif_fields + tif->tif_nfields; */ for (i = 0; i < n; i++) { const TIFFField *fip = TIFFFindField(tif, info[i].field_tag, TIFF_ANY); @@ -556,6 +570,42 @@ TIFFFieldWithName(TIFF* tif, const char *field_name) return (fip); } +uint32 +TIFFFieldTag(const TIFFField* fip) +{ + return fip->field_tag; +} + +const char * +TIFFFieldName(const TIFFField* fip) +{ + return fip->field_name; +} + +TIFFDataType +TIFFFieldDataType(const TIFFField* fip) +{ + return fip->field_type; +} + +int +TIFFFieldPassCount(const TIFFField* fip) +{ + return fip->field_passcount; +} + +int +TIFFFieldReadCount(const TIFFField* fip) +{ + return fip->field_readcount; +} + +int +TIFFFieldWriteCount(const TIFFField* fip) +{ + return fip->field_writecount; +} + const TIFFField* _TIFFFindOrRegisterField(TIFF *tif, uint32 tag, TIFFDataType dt) diff --git a/harbour/src/3rd/tiff/dirread.c b/harbour/src/3rd/tiff/dirread.c index 02700a4ba5..14a15a1f4f 100644 --- a/harbour/src/3rd/tiff/dirread.c +++ b/harbour/src/3rd/tiff/dirread.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirread.c,v 1.174 2012-02-01 02:24:47 fwarmerdam Exp $ */ +/* $Id: tif_dirread.c,v 1.178 2012-08-19 16:56:34 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -3305,10 +3305,15 @@ TIFFReadDirEntryData(TIFF* tif, uint64 offset, tmsize_t size, void* dest) if (!ReadOK(tif,dest,size)) return(TIFFReadDirEntryErrIo); } else { - tmsize_t ma,mb; - ma=(tmsize_t)offset; + size_t ma,mb; + ma=(size_t)offset; mb=ma+size; - if (((uint64)ma!=offset)||(mbtif->tif_size)) + if (((uint64)ma!=offset) + || (mb < ma) + || (mb - ma != (size_t) size) + || (mb < (size_t)size) + || (mb > (size_t)tif->tif_size) + ) return(TIFFReadDirEntryErrIo); _TIFFmemcpy(dest,tif->tif_base+ma,size); } @@ -4753,7 +4758,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) break; case TIFF_SETGET_UINT8: { - uint8 data; + uint8 data=0; assert(fip->field_readcount==1); assert(fip->field_passcount==0); err=TIFFReadDirEntryByte(tif,dp,&data); @@ -4847,8 +4852,12 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) uint16* data; assert(fip->field_readcount==2); assert(fip->field_passcount==0); - if (dp->tdir_count!=2) + if (dp->tdir_count!=2) { + TIFFWarningExt(tif->tif_clientdata,module, + "incorrect count for field \"%s\", expected 2, got %d", + fip->field_name,(int)dp->tdir_count); return(0); + } err=TIFFReadDirEntryShortArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { @@ -4865,8 +4874,12 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) uint8* data; assert(fip->field_readcount>=1); assert(fip->field_passcount==0); - if (dp->tdir_count!=(uint64)fip->field_readcount) - /* corrupt file */; + if (dp->tdir_count!=(uint64)fip->field_readcount) { + TIFFWarningExt(tif->tif_clientdata,module, + "incorrect count for field \"%s\", expected %d, got %d", + fip->field_name,(int) fip->field_readcount, (int)dp->tdir_count); + return 0; + } else { err=TIFFReadDirEntryByteArray(tif,dp,&data); diff --git a/harbour/src/3rd/tiff/dirwrite.c b/harbour/src/3rd/tiff/dirwrite.c index 2435a0fad0..56592bd4f1 100644 --- a/harbour/src/3rd/tiff/dirwrite.c +++ b/harbour/src/3rd/tiff/dirwrite.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirwrite.c,v 1.76 2011-02-18 20:53:04 fwarmerdam Exp $ */ +/* $Id: tif_dirwrite.c,v 1.77 2012-07-06 19:18:31 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -2570,7 +2570,7 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype, tmsize_t count, void* data) { static const char module[] = "TIFFResetField"; - const TIFFField* fip = NULL; + /* const TIFFField* fip = NULL; */ uint16 dircount; tmsize_t dirsize; uint8 direntry_raw[20]; @@ -2586,7 +2586,7 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype, /* -------------------------------------------------------------------- */ /* Find field definition. */ /* -------------------------------------------------------------------- */ - fip = TIFFFindField(tif, tag, TIFF_ANY); + /*fip =*/ TIFFFindField(tif, tag, TIFF_ANY); /* -------------------------------------------------------------------- */ /* Do some checking this is a straight forward case. */ diff --git a/harbour/src/3rd/tiff/fax3.c b/harbour/src/3rd/tiff/fax3.c index ed80ba7cb9..ebee0308b9 100644 --- a/harbour/src/3rd/tiff/fax3.c +++ b/harbour/src/3rd/tiff/fax3.c @@ -1,4 +1,4 @@ -/* $Id: tif_fax3.c,v 1.73 2012-06-13 00:27:20 fwarmerdam Exp $ */ +/* $Id: tif_fax3.c,v 1.74 2012-06-21 02:01:31 fwarmerdam Exp $ */ /* * Copyright (c) 1990-1997 Sam Leffler @@ -526,7 +526,7 @@ Fax3SetupState(TIFF* tif) "for Group 3/4 run arrays"); if (dsp->runs == NULL) return (0); - memset( dsp->runs, 0, TIFFSafeMultiply(uint32,nruns,2)); + memset( dsp->runs, 0, TIFFSafeMultiply(uint32,nruns,2)*sizeof(uint32)); dsp->curruns = dsp->runs; if (needsRefLine) dsp->refruns = dsp->runs + nruns; diff --git a/harbour/src/3rd/tiff/jpeg.c b/harbour/src/3rd/tiff/jpeg.c index 3c8d3bf765..b61b91b0dc 100644 --- a/harbour/src/3rd/tiff/jpeg.c +++ b/harbour/src/3rd/tiff/jpeg.c @@ -1,4 +1,4 @@ -/* $Id: tif_jpeg.c,v 1.108 2012-06-05 03:24:30 fwarmerdam Exp $ */ +/* $Id: tif_jpeg.c,v 1.111 2012-07-06 18:48:04 bfriesen Exp $ */ /* * Copyright (c) 1994-1997 Sam Leffler @@ -1138,6 +1138,9 @@ JPEGPreDecode(TIFF* tif, uint16 s) if (downsampled_output) { /* Need to use raw-data interface to libjpeg */ sp->cinfo.d.raw_data_out = TRUE; +#if JPEG_LIB_VERSION >= 70 + sp->cinfo.d.do_fancy_upsampling = FALSE; +#endif /* JPEG_LIB_VERSION >= 70 */ tif->tif_decoderow = DecodeRowError; tif->tif_decodestrip = JPEGDecodeRaw; tif->tif_decodetile = JPEGDecodeRaw; @@ -1357,7 +1360,7 @@ JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s) JSAMPLE *outptr = (JSAMPLE*)tmpbuf + clumpoffset; #else JSAMPLE *outptr = (JSAMPLE*)buf + clumpoffset; - if (cc < clumpoffset + samples_per_clump*(clumps_per_line-1) + hsamp) { + if (cc < (tmsize_t) (clumpoffset + samples_per_clump*(clumps_per_line-1) + hsamp)) { TIFFErrorExt(tif->tif_clientdata, "JPEGDecodeRaw", "application buffer not large enough for all data, possible subsampling issue"); return 0; @@ -1695,7 +1698,7 @@ JPEGPreEncode(TIFF* tif, uint16 s) } else { if ((td->td_photometric == PHOTOMETRIC_MINISWHITE || td->td_photometric == PHOTOMETRIC_MINISBLACK) && td->td_samplesperpixel == 1) sp->cinfo.c.in_color_space = JCS_GRAYSCALE; - else if (td->td_photometric == PHOTOMETRIC_RGB) + else if (td->td_photometric == PHOTOMETRIC_RGB && td->td_samplesperpixel == 3) sp->cinfo.c.in_color_space = JCS_RGB; else if (td->td_photometric == PHOTOMETRIC_SEPARATED && td->td_samplesperpixel == 4) sp->cinfo.c.in_color_space = JCS_CMYK; diff --git a/harbour/src/3rd/tiff/packbits.c b/harbour/src/3rd/tiff/packbits.c index a79abe860f..9e77190131 100644 --- a/harbour/src/3rd/tiff/packbits.c +++ b/harbour/src/3rd/tiff/packbits.c @@ -1,4 +1,4 @@ -/* $Id: tif_packbits.c,v 1.20 2010-03-10 18:56:49 bfriesen Exp $ */ +/* $Id: tif_packbits.c,v 1.22 2012-06-20 05:25:33 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -241,7 +241,7 @@ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s) n = (long)occ; } occ -= n; - b = *bp++, cc--; /* TODO: may be reading past input buffer here when input data is corrupt or ends prematurely */ + b = *bp++, cc--; while (n-- > 0) *op++ = (uint8) b; } else { /* copy next n+1 bytes literally */ @@ -252,7 +252,13 @@ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s) (unsigned long) ((tmsize_t)n - occ + 1)); n = (long)occ - 1; } - _TIFFmemcpy(op, bp, ++n); /* TODO: may be reading past input buffer here when input data is corrupt or ends prematurely */ + if (cc < (tmsize_t) (n+1)) + { + TIFFWarningExt(tif->tif_clientdata, module, + "Terminating PackBitsDecode due to lack of data."); + break; + } + _TIFFmemcpy(op, bp, ++n); op += n; occ -= n; bp += n; cc -= n; } diff --git a/harbour/src/3rd/tiff/pixarlog.c b/harbour/src/3rd/tiff/pixarlog.c index c70873075d..73cb0469d9 100644 --- a/harbour/src/3rd/tiff/pixarlog.c +++ b/harbour/src/3rd/tiff/pixarlog.c @@ -1,4 +1,4 @@ -/* $Id: tif_pixarlog.c,v 1.37 2012-05-24 23:21:45 fwarmerdam Exp $ */ +/* $Id: tif_pixarlog.c,v 1.38 2012-06-21 01:01:53 fwarmerdam Exp $ */ /* * Copyright (c) 1996-1997 Sam Leffler @@ -673,7 +673,7 @@ PixarLogSetupDecode(TIFF* tif) td->td_rowsperstrip), sizeof(uint16)); if (tbuf_size == 0) return (0); /* TODO: this is an error return without error report through TIFFErrorExt */ - sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size+sizeof(uint16)); + sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size+sizeof(uint16)*sp->stride); if (sp->tbuf == NULL) return (0); if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) diff --git a/harbour/src/3rd/tiff/print.c b/harbour/src/3rd/tiff/print.c index a9ce2c4fb1..cdc3c5d6e8 100644 --- a/harbour/src/3rd/tiff/print.c +++ b/harbour/src/3rd/tiff/print.c @@ -1,4 +1,4 @@ -/* $Id: tif_print.c,v 1.59 2012-06-13 01:08:51 fwarmerdam Exp $ */ +/* $Id: tif_print.c,v 1.60 2012-08-19 16:56:35 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -47,6 +47,8 @@ static const char *photoNames[] = { "YCbCr", /* PHOTOMETRIC_YCBCR */ "7 (0x7)", "CIE L*a*b*", /* PHOTOMETRIC_CIELAB */ + "ICC L*a*b*", /* PHOTOMETRIC_ICCLAB */ + "ITU L*a*b*" /* PHOTOMETRIC_ITULAB */ }; #define NPHOTONAMES (sizeof (photoNames) / sizeof (photoNames[0])) @@ -555,7 +557,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) continue; if(fip->field_passcount) { - if (fip->field_readcount == TIFF_VARIABLE2 ) { + if (fip->field_readcount == TIFF_VARIABLE ) { if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1) continue; } else if (fip->field_readcount == TIFF_VARIABLE2 ) { diff --git a/harbour/src/3rd/tiff/read.c b/harbour/src/3rd/tiff/read.c index b224e838e4..a625ddc63f 100644 --- a/harbour/src/3rd/tiff/read.c +++ b/harbour/src/3rd/tiff/read.c @@ -1,4 +1,4 @@ -/* $Id: tif_read.c,v 1.40 2012-06-01 00:55:09 fwarmerdam Exp $ */ +/* $Id: tif_read.c,v 1.41 2012-07-06 19:22:58 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -50,7 +50,7 @@ TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart ) uint64 unused_data; uint64 read_offset; tmsize_t cc, to_read; - tmsize_t bytecountm; + /* tmsize_t bytecountm; */ if (!_TIFFFillStriles( tif ) || !tif->tif_dir.td_stripbytecount) return 0; @@ -61,7 +61,7 @@ TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart ) * bound on the size of a buffer we'll use?). */ - bytecountm=(tmsize_t) td->td_stripbytecount[strip]; + /* bytecountm=(tmsize_t) td->td_stripbytecount[strip]; */ if (read_ahead*2 > tif->tif_rawdatasize) { assert( restart ); diff --git a/harbour/src/3rd/tiff/tiff.dif b/harbour/src/3rd/tiff/tiff.dif index 8c78923095..046dc24496 100644 --- a/harbour/src/3rd/tiff/tiff.dif +++ b/harbour/src/3rd/tiff/tiff.dif @@ -1,6 +1,6 @@ -diff -urN tiff.orig/dirread.c tiff/dirread.c ---- tiff.orig/dirread.c 2012-08-24 14:22:17.600008843 +0200 -+++ tiff/dirread.c 2012-08-24 14:22:17.600008843 +0200 +diff -urN tiff.orig\dirread.c tiff\dirread.c +--- tiff.orig\dirread.c Sat Sep 29 22:03:17 2012 ++++ tiff\dirread.c Sat Sep 29 22:03:18 2012 @@ -2216,7 +2216,7 @@ case TIFF_FLOAT: if (tif->tif_flags&TIFF_SWAB) @@ -36,9 +36,9 @@ diff -urN tiff.orig/dirread.c tiff/dirread.c static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlong8Long8(uint64 value) -diff -urN tiff.orig/dirwrite.c tiff/dirwrite.c ---- tiff.orig/dirwrite.c 2012-08-24 14:22:17.612008843 +0200 -+++ tiff/dirwrite.c 2012-08-24 14:22:17.612008843 +0200 +diff -urN tiff.orig\dirwrite.c tiff\dirwrite.c +--- tiff.orig\dirwrite.c Sat Sep 29 22:03:17 2012 ++++ tiff\dirwrite.c Sat Sep 29 22:03:18 2012 @@ -2238,7 +2238,7 @@ { assert(count<0x40000000); @@ -57,9 +57,9 @@ diff -urN tiff.orig/dirwrite.c tiff/dirwrite.c if (tif->tif_flags&TIFF_SWAB) TIFFSwabArrayOfDouble(value,count); return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_DOUBLE,count,count*8,value)); -diff -urN tiff.orig/dumpmode.c tiff/dumpmode.c ---- tiff.orig/dumpmode.c 2012-08-24 14:22:17.612008843 +0200 -+++ tiff/dumpmode.c 2012-08-24 14:22:17.612008843 +0200 +diff -urN tiff.orig\dumpmode.c tiff\dumpmode.c +--- tiff.orig\dumpmode.c Sat Sep 29 22:03:17 2012 ++++ tiff\dumpmode.c Sat Sep 29 22:03:18 2012 @@ -80,19 +80,11 @@ static const char module[] = "DumpModeDecode"; (void) s; @@ -83,9 +83,9 @@ diff -urN tiff.orig/dumpmode.c tiff/dumpmode.c return (0); } /* -diff -urN tiff.orig/luv.c tiff/luv.c ---- tiff.orig/luv.c 2012-08-24 14:22:17.656008844 +0200 -+++ tiff/luv.c 2012-08-24 14:22:17.656008844 +0200 +diff -urN tiff.orig\luv.c tiff\luv.c +--- tiff.orig\luv.c Sat Sep 29 22:03:18 2012 ++++ tiff\luv.c Sat Sep 29 22:03:18 2012 @@ -224,17 +224,10 @@ tp[i++] |= (int16)*bp++ << shft; } @@ -146,9 +146,9 @@ diff -urN tiff.orig/luv.c tiff/luv.c tif->tif_rawcp = (uint8*) bp; tif->tif_rawcc = cc; return (0); -diff -urN tiff.orig/lzw.c tiff/lzw.c ---- tiff.orig/lzw.c 2012-08-24 14:22:17.660008844 +0200 -+++ tiff/lzw.c 2012-08-24 14:22:17.660008844 +0200 +diff -urN tiff.orig\lzw.c tiff\lzw.c +--- tiff.orig\lzw.c Sat Sep 29 22:03:18 2012 ++++ tiff\lzw.c Sat Sep 29 22:03:18 2012 @@ -549,15 +549,9 @@ sp->dec_maxcodep = maxcodep; @@ -185,10 +185,10 @@ diff -urN tiff.orig/lzw.c tiff/lzw.c return (0); } return (1); -diff -urN tiff.orig/print.c tiff/print.c ---- tiff.orig/print.c 2012-08-24 14:22:17.684008845 +0200 -+++ tiff/print.c 2012-08-24 14:22:17.684008845 +0200 -@@ -96,27 +96,13 @@ +diff -urN tiff.orig\print.c tiff\print.c +--- tiff.orig\print.c Sat Sep 29 22:03:18 2012 ++++ tiff\print.c Sat Sep 29 22:03:18 2012 +@@ -98,27 +98,13 @@ || fip->field_type == TIFF_FLOAT) fprintf(fd, "%f", ((float *) raw_data)[j]); else if(fip->field_type == TIFF_LONG8) @@ -221,7 +221,7 @@ diff -urN tiff.orig/print.c tiff/print.c else if(fip->field_type == TIFF_FLOAT) fprintf(fd, "%f", ((float *)raw_data)[j]); else if(fip->field_type == TIFF_DOUBLE) -@@ -238,15 +224,9 @@ +@@ -240,15 +226,9 @@ uint16 i; long l, n; @@ -240,7 +240,7 @@ diff -urN tiff.orig/print.c tiff/print.c if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) { fprintf(fd, " Subfile Type:"); sep = " "; -@@ -550,13 +530,8 @@ +@@ -552,13 +532,8 @@ if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) { fprintf(fd, " SubIFD Offsets:"); for (i = 0; i < td->td_nsubifd; i++) @@ -256,7 +256,7 @@ diff -urN tiff.orig/print.c tiff/print.c fputc('\n', fd); } -@@ -656,17 +631,10 @@ +@@ -658,17 +633,10 @@ (long) td->td_nstrips, isTiled(tif) ? "Tiles" : "Strips"); for (s = 0; s < td->td_nstrips; s++) @@ -277,9 +277,9 @@ diff -urN tiff.orig/print.c tiff/print.c } } -diff -urN tiff.orig/read.c tiff/read.c ---- tiff.orig/read.c 2012-08-24 14:22:17.688008845 +0200 -+++ tiff/read.c 2012-08-24 14:22:17.688008845 +0200 +diff -urN tiff.orig\read.c tiff\read.c +--- tiff.orig\read.c Sat Sep 29 22:03:18 2012 ++++ tiff\read.c Sat Sep 29 22:03:18 2012 @@ -125,19 +125,11 @@ cc = TIFFReadFile(tif, tif->tif_rawdata + unused_data, to_read); @@ -490,9 +490,9 @@ diff -urN tiff.orig/read.c tiff/read.c return (0); } if (isMapped(tif) && -diff -urN tiff.orig/strip.c tiff/strip.c ---- tiff.orig/strip.c 2012-08-24 14:22:17.692008845 +0200 -+++ tiff/strip.c 2012-08-24 14:22:17.692008845 +0200 +diff -urN tiff.orig\strip.c tiff\strip.c +--- tiff.orig\strip.c Sat Sep 29 22:03:18 2012 ++++ tiff\strip.c Sat Sep 29 22:03:18 2012 @@ -154,17 +154,10 @@ if (bytecount == 0) @@ -513,9 +513,9 @@ diff -urN tiff.orig/strip.c tiff/strip.c bytecount = (uint64) -1; } -diff -urN tiff.orig/thunder.c tiff/thunder.c ---- tiff.orig/thunder.c 2012-08-24 14:22:17.692008845 +0200 -+++ tiff/thunder.c 2012-08-24 14:22:17.692008845 +0200 +diff -urN tiff.orig\thunder.c tiff\thunder.c +--- tiff.orig\thunder.c Sat Sep 29 22:03:18 2012 ++++ tiff\thunder.c Sat Sep 29 22:03:18 2012 @@ -143,21 +143,12 @@ tif->tif_rawcp = (uint8*) bp; tif->tif_rawcc = cc; @@ -541,9 +541,9 @@ diff -urN tiff.orig/thunder.c tiff/thunder.c return (0); } -diff -urN tiff.orig/tiffconf.h tiff/tiffconf.h ---- tiff.orig/tiffconf.h 2012-08-24 14:22:17.720008845 +0200 -+++ tiff/tiffconf.h 2012-08-24 14:22:17.720008845 +0200 +diff -urN tiff.orig\tiffconf.h tiff\tiffconf.h +--- tiff.orig\tiffconf.h Sat Sep 29 22:03:18 2012 ++++ tiff\tiffconf.h Sat Sep 29 22:03:18 2012 @@ -7,44 +7,65 @@ #ifndef _TIFFCONF_ #define _TIFFCONF_ @@ -682,10 +682,11 @@ diff -urN tiff.orig/tiffconf.h tiff/tiffconf.h /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage) */ -@@ -124,4 +163,20 @@ +@@ -123,5 +162,21 @@ + #define ICC_SUPPORT #define PHOTOSHOP_SUPPORT #define IPTC_SUPPORT - ++ +#ifndef O_RDONLY +#define O_RDONLY 0 +#endif @@ -701,11 +702,11 @@ diff -urN tiff.orig/tiffconf.h tiff/tiffconf.h +#ifndef O_TRUNC +#define O_TRUNC 001000 +#endif -+ + #endif /* _TIFFCONF_ */ -diff -urN tiff.orig/tiffio.h tiff/tiffio.h ---- tiff.orig/tiffio.h 2012-08-24 14:22:17.712008845 +0200 -+++ tiff/tiffio.h 2012-08-24 14:22:17.712008845 +0200 +diff -urN tiff.orig\tiffio.h tiff\tiffio.h +--- tiff.orig\tiffio.h Sat Sep 29 22:03:18 2012 ++++ tiff\tiffio.h Sat Sep 29 22:03:18 2012 @@ -102,6 +102,8 @@ # else typedef HFILE thandle_t; /* client data handle */ @@ -715,9 +716,9 @@ diff -urN tiff.orig/tiffio.h tiff/tiffio.h #else typedef void* thandle_t; /* client data handle */ #endif /* USE_WIN32_FILEIO */ -diff -urN tiff.orig/tiffiop.h tiff/tiffiop.h ---- tiff.orig/tiffiop.h 2012-08-24 14:22:17.712008845 +0200 -+++ tiff/tiffiop.h 2012-08-24 14:22:17.712008845 +0200 +diff -urN tiff.orig\tiffiop.h tiff\tiffiop.h +--- tiff.orig\tiffiop.h Sat Sep 29 22:03:18 2012 ++++ tiff\tiffiop.h Sat Sep 29 22:03:18 2012 @@ -30,7 +30,7 @@ * ``Library-private'' definitions. */ @@ -727,9 +728,9 @@ diff -urN tiff.orig/tiffiop.h tiff/tiffiop.h #ifdef HAVE_FCNTL_H # include -diff -urN tiff.orig/unix.c tiff/unix.c ---- tiff.orig/unix.c 2012-08-24 14:22:17.696008845 +0200 -+++ tiff/unix.c 2012-08-24 14:22:17.696008845 +0200 +diff -urN tiff.orig\unix.c tiff\unix.c +--- tiff.orig\unix.c Sat Sep 29 22:03:18 2012 ++++ tiff\unix.c Sat Sep 29 22:03:18 2012 @@ -29,7 +29,7 @@ * Windows Common RunTime Library. */ diff --git a/harbour/src/3rd/tiff/tiff.h b/harbour/src/3rd/tiff/tiff.h index 5c32d3ae98..19b4e7976d 100644 --- a/harbour/src/3rd/tiff/tiff.h +++ b/harbour/src/3rd/tiff/tiff.h @@ -1,4 +1,4 @@ -/* $Id: tiff.h,v 1.67 2011-01-24 21:06:32 olivier Exp $ */ +/* $Id: tiff.h,v 1.68 2012-08-19 16:56:35 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -166,6 +166,8 @@ typedef enum { #define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ #define COMPRESSION_OJPEG 6 /* !6.0 JPEG */ #define COMPRESSION_JPEG 7 /* %JPEG DCT compression */ +#define COMPRESSION_T85 9 /* !TIFF/FX T.85 JBIG compression */ +#define COMPRESSION_T43 10 /* !TIFF/FX T.43 colour by layered JBIG compression */ #define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ #define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ @@ -319,6 +321,30 @@ typedef enum { [Adobe TIFF Technote 3] */ #define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */ #define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */ +/* Tags 400-435 are from the TIFF/FX spec */ +#define TIFFTAG_GLOBALPARAMETERSIFD 400 /* ! */ +#define TIFFTAG_PROFILETYPE 401 /* ! */ +#define PROFILETYPE_UNSPECIFIED 0 /* ! */ +#define PROFILETYPE_G3_FAX 1 /* ! */ +#define TIFFTAG_FAXPROFILE 402 /* ! */ +#define FAXPROFILE_S 1 /* !TIFF/FX FAX profile S */ +#define FAXPROFILE_F 2 /* !TIFF/FX FAX profile F */ +#define FAXPROFILE_J 3 /* !TIFF/FX FAX profile J */ +#define FAXPROFILE_C 4 /* !TIFF/FX FAX profile C */ +#define FAXPROFILE_L 5 /* !TIFF/FX FAX profile L */ +#define FAXPROFILE_M 6 /* !TIFF/FX FAX profile LM */ +#define TIFFTAG_CODINGMETHODS 403 /* !TIFF/FX coding methods */ +#define CODINGMETHODS_T4_1D (1 << 1) /* !T.4 1D */ +#define CODINGMETHODS_T4_2D (1 << 2) /* !T.4 2D */ +#define CODINGMETHODS_T6 (1 << 3) /* !T.6 */ +#define CODINGMETHODS_T85 (1 << 4) /* !T.85 JBIG */ +#define CODINGMETHODS_T42 (1 << 5) /* !T.42 JPEG */ +#define CODINGMETHODS_T43 (1 << 6) /* !T.43 colour by layered JBIG */ +#define TIFFTAG_VERSIONYEAR 404 /* !TIFF/FX version year */ +#define TIFFTAG_MODENUMBER 405 /* !TIFF/FX mode number */ +#define TIFFTAG_DECODE 433 /* !TIFF/FX decode */ +#define TIFFTAG_IMAGEBASECOLOR 434 /* !TIFF/FX image base colour */ +#define TIFFTAG_T82OPTIONS 435 /* !TIFF/FX T.82 options */ /* * Tags 512-521 are obsoleted by Technical Note #2 which specifies a * revised JPEG-in-TIFF scheme. @@ -340,6 +366,7 @@ typedef enum { #define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ #define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ #define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ +#define TIFFTAG_STRIPROWCOUNTS 559 /* !TIFF/FX strip row counts */ #define TIFFTAG_XMLPACKET 700 /* %XML packet [Adobe XMP Specification, January 2004 */ @@ -406,6 +433,7 @@ typedef enum { #define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */ /* tag 34750 is a private tag registered to Adobe? */ #define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */ +#define TIFFTAG_IMAGELAYER 34732 /* !TIFF/FX image layer information */ /* tag 34750 is a private tag registered to Pixel Magic */ #define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */ #define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */ diff --git a/harbour/src/3rd/tiff/tiffio.h b/harbour/src/3rd/tiff/tiffio.h index 3eb24ee2a8..de60a8539c 100644 --- a/harbour/src/3rd/tiff/tiffio.h +++ b/harbour/src/3rd/tiff/tiffio.h @@ -1,4 +1,4 @@ -/* $Id: tiffio.h,v 1.90 2012-06-06 04:58:00 fwarmerdam Exp $ */ +/* $Id: tiffio.h,v 1.91 2012-07-29 15:45:29 tgl Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -321,6 +321,13 @@ extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType); extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32); extern const TIFFField* TIFFFieldWithName(TIFF*, const char *); +extern uint32 TIFFFieldTag(const TIFFField*); +extern const char* TIFFFieldName(const TIFFField*); +extern TIFFDataType TIFFFieldDataType(const TIFFField*); +extern int TIFFFieldPassCount(const TIFFField*); +extern int TIFFFieldReadCount(const TIFFField*); +extern int TIFFFieldWriteCount(const TIFFField*); + typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list); typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list); typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long); diff --git a/harbour/src/3rd/tiff/tiffvers.h b/harbour/src/3rd/tiff/tiffvers.h index 38ee9fab34..40edc813d5 100644 --- a/harbour/src/3rd/tiff/tiffvers.h +++ b/harbour/src/3rd/tiff/tiffvers.h @@ -1,4 +1,4 @@ -#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." +#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.3\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." /* * This define can be used in code that requires * compilation-related definitions specific to a @@ -6,4 +6,4 @@ * version checking should be done based on the * string returned by TIFFGetVersion. */ -#define TIFFLIB_VERSION 20120615 +#define TIFFLIB_VERSION 20120922 diff --git a/harbour/src/3rd/tiff/write.c b/harbour/src/3rd/tiff/write.c index eaa1f8143c..8792123ca0 100644 --- a/harbour/src/3rd/tiff/write.c +++ b/harbour/src/3rd/tiff/write.c @@ -1,4 +1,4 @@ -/* $Id: tif_write.c,v 1.36 2011-02-18 20:53:04 fwarmerdam Exp $ */ +/* $Id: tif_write.c,v 1.37 2012-08-13 22:10:17 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -226,17 +226,28 @@ TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc) return ((tmsize_t) -1); tif->tif_flags |= TIFF_CODERSETUP; } - - tif->tif_rawcc = 0; - tif->tif_rawcp = tif->tif_rawdata; if( td->td_stripbytecount[strip] > 0 ) { + /* Make sure that at the first attempt of rewriting the tile, we will have */ + /* more bytes available in the output buffer than the previous byte count, */ + /* so that TIFFAppendToStrip() will detect the overflow when it is called the first */ + /* time if the new compressed tile is bigger than the older one. (GDAL #4771) */ + if( tif->tif_rawdatasize <= td->td_stripbytecount[strip] ) + { + if( !(TIFFWriteBufferSetup(tif, NULL, + (tmsize_t)TIFFroundup_64((uint64)(td->td_stripbytecount[strip] + 1), 1024))) ) + return ((tmsize_t)(-1)); + } + /* Force TIFFAppendToStrip() to consider placing data at end of file. */ tif->tif_curoff = 0; } - + + tif->tif_rawcc = 0; + tif->tif_rawcp = tif->tif_rawdata; + tif->tif_flags &= ~TIFF_POSTENCODE; sample = (uint16)(strip / td->td_stripsperimage); if (!(*tif->tif_preencode)(tif, sample)) @@ -362,16 +373,27 @@ TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) tif->tif_flags |= TIFF_BUF4WRITE; tif->tif_curtile = tile; - tif->tif_rawcc = 0; - tif->tif_rawcp = tif->tif_rawdata; - if( td->td_stripbytecount[tile] > 0 ) { + /* Make sure that at the first attempt of rewriting the tile, we will have */ + /* more bytes available in the output buffer than the previous byte count, */ + /* so that TIFFAppendToStrip() will detect the overflow when it is called the first */ + /* time if the new compressed tile is bigger than the older one. (GDAL #4771) */ + if( tif->tif_rawdatasize <= td->td_stripbytecount[tile] ) + { + if( !(TIFFWriteBufferSetup(tif, NULL, + (tmsize_t)TIFFroundup_64((uint64)(td->td_stripbytecount[tile] + 1), 1024))) ) + return ((tmsize_t)(-1)); + } + /* Force TIFFAppendToStrip() to consider placing data at end of file. */ tif->tif_curoff = 0; } - + + tif->tif_rawcc = 0; + tif->tif_rawcp = tif->tif_rawdata; + /* * Compute tiles per row & per column to compute * current row and column