From 34b7557400c28782fbad1c475d18a737443be5a0 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Wed, 20 Apr 2011 15:23:38 +0000 Subject: [PATCH] Remove obsolete field info api, add missing items in libtiff.def (#2315, #2316) --- ChangeLog | 9 +++ libtiff/libtiff.def | 14 +++-- libtiff/tif_dirinfo.c | 141 +----------------------------------------- libtiff/tiffio.h | 24 +------ 4 files changed, 21 insertions(+), 167 deletions(-) diff --git a/ChangeLog b/ChangeLog index d954ddcd..f151e3ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-04-20 Frank Warmerdam + + * libtiff/tif_dirinfo.c,tiffio.h: Remove the obsolete + TIFFMergeFieldInfo/TIFFFindFieldInfo/TIFFFindFieldInfoByName API. + http://bugzilla.maptools.org/show_bug.cgi?id=2315 + + * libtiff/libtiff.def: add some missing (64bit) APIs. + http://bugzilla.maptools.org/show_bug.cgi?id=2316 + 2011-04-09 Bob Friesenhahn * libtiff 4.0.0beta7 released. diff --git a/libtiff/libtiff.def b/libtiff/libtiff.def index 808ba91f..d7373188 100644 --- a/libtiff/libtiff.def +++ b/libtiff/libtiff.def @@ -12,12 +12,19 @@ EXPORTS TIFFOpen TIFFGetTagListEntry TIFFGetTagListCount TIFFReadDirectory + TIFFScanlineSize64 TIFFScanlineSize + TIFFStripSize64 TIFFStripSize + TIFFVStripSize64 TIFFVStripSize + TIFFRawStripSize64 TIFFRawStripSize + TIFFTileRowSize64 TIFFTileRowSize + TIFFTileSize64 TIFFTileSize + TIFFVTileSize64 TIFFVTileSize TIFFFileno TIFFSetFileno @@ -86,17 +93,20 @@ EXPORTS TIFFOpen TIFFWriteEncodedTile TIFFWriteRawTile TIFFSetWriteOffset + TIFFSwabFloat TIFFSwabDouble TIFFSwabShort TIFFSwabLong TIFFSwabArrayOfShort TIFFSwabArrayOfLong + TIFFSwabArrayOfFloat TIFFSwabArrayOfDouble TIFFSwabArrayOfTriples TIFFReverseBits TIFFGetBitRevTable TIFFDefaultStripSize TIFFDefaultTileSize + TIFFRasterScanlineSize64 TIFFRasterScanlineSize _TIFFmalloc _TIFFrealloc @@ -106,9 +116,6 @@ EXPORTS TIFFOpen _TIFFmemcmp TIFFCreateDirectory TIFFSetTagExtender - TIFFMergeFieldInfo - TIFFFindFieldInfo - TIFFFindFieldInfoByName TIFFFieldWithName TIFFFieldWithTag TIFFCurrentDirOffset @@ -141,4 +148,3 @@ EXPORTS TIFFOpen TIFFSwabArrayOfLong8 TIFFFindField TIFFUnsetField - _TIFFCheckMalloc diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c index 4e4324c0..73840d14 100644 --- a/libtiff/tif_dirinfo.c +++ b/libtiff/tif_dirinfo.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirinfo.c,v 1.112 2011-01-24 21:06:31 olivier Exp $ */ +/* $Id: tif_dirinfo.c,v 1.113 2011-04-20 15:23:38 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -826,145 +826,6 @@ _TIFFSetGetType(TIFFDataType type, short count, unsigned char passcount) return TIFF_SETGET_UNDEFINED; } -int -TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], uint32 n) -{ - static const char module[] = "TIFFMergeFieldInfo"; - static const char reason[] = "for fields array"; - TIFFField *tp; - size_t nfields; - uint32 i; - - if (tif->tif_nfieldscompat > 0) { - tif->tif_fieldscompat = (TIFFFieldArray *) - _TIFFCheckRealloc(tif, tif->tif_fieldscompat, - tif->tif_nfieldscompat + 1, - sizeof(TIFFFieldArray), reason); - } else { - tif->tif_fieldscompat = (TIFFFieldArray *) - _TIFFCheckMalloc(tif, 1, sizeof(TIFFFieldArray), - reason); - } - if (!tif->tif_fieldscompat) { - TIFFErrorExt(tif->tif_clientdata, module, - "Failed to allocate fields array"); - return -1; - } - nfields = tif->tif_nfieldscompat++; - - tif->tif_fieldscompat[nfields].type = tfiatOther; - tif->tif_fieldscompat[nfields].allocated_size = n; - tif->tif_fieldscompat[nfields].count = n; - tif->tif_fieldscompat[nfields].fields = - (TIFFField *)_TIFFCheckMalloc(tif, n, sizeof(TIFFField), - reason); - if (!tif->tif_fieldscompat[nfields].fields) { - TIFFErrorExt(tif->tif_clientdata, module, - "Failed to allocate fields array"); - return -1; - } - - tp = tif->tif_fieldscompat[nfields].fields; - for (i = 0; i < n; i++) { - tp->field_tag = info[i].field_tag; - tp->field_readcount = info[i].field_readcount; - tp->field_writecount = info[i].field_writecount; - tp->field_type = info[i].field_type; - tp->reserved = 0; - tp->set_field_type = - _TIFFSetGetType(info[i].field_type, - info[i].field_readcount, - info[i].field_passcount); - tp->get_field_type = - _TIFFSetGetType(info[i].field_type, - info[i].field_readcount, - info[i].field_passcount); - tp->field_bit = info[i].field_bit; - tp->field_oktochange = info[i].field_oktochange; - tp->field_passcount = info[i].field_passcount; - tp->field_name = info[i].field_name; - tp->field_subfields = NULL; - tp++; - } - - if (!_TIFFMergeFields(tif, tif->tif_fieldscompat[nfields].fields, n)) { - TIFFErrorExt(tif->tif_clientdata, module, - "Setting up field info failed"); - return -1; - } - - return 0; -} - -const TIFFFieldInfo* -TIFFFindFieldInfoByName(TIFF* tif, const char *field_name, TIFFDataType dt) -{ -#if 0 - TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL}; - TIFFFieldInfo* pkey = &key; - const TIFFFieldInfo **ret; - if (tif->tif_foundfield - && streq(tif->tif_foundfield->field_name, field_name) - && (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type)) - return (tif->tif_foundfield); - - /* If we are invoked with no field information, then just return. */ - if ( !tif->tif_fields ) { - return NULL; - } - - /* NB: use sorted search (e.g. binary search) */ - - key.field_name = (char *)field_name; - key.field_type = dt; - - ret = (const TIFFFieldInfo **) - td_lfind(&pkey, tif->tif_fields, &tif->tif_nfields, - sizeof(TIFFFieldInfo *), tagNameCompare ); - return tif->tif_foundfield = (ret ? *ret : NULL); -#else - (void) tif; - (void) field_name; - (void) dt; -#endif - return NULL; -} - -const TIFFFieldInfo* -TIFFFindFieldInfo(TIFF* tif, uint32 tag, TIFFDataType dt) -{ -#if 0 - TIFFFieldInfo key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL}; - TIFFFieldInfo* pkey = &key; - const TIFFFieldInfo **ret; - if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag && - (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type)) - return tif->tif_foundfield; - - /* If we are invoked with no field information, then just return. */ - if ( !tif->tif_fields ) { - return NULL; - } - - /* NB: use sorted search (e.g. binary search) */ - - key.field_tag = tag; - key.field_type = dt; - - ret = (const TIFFFieldInfo **) bsearch(&pkey, - tif->tif_fields, - tif->tif_nfields, - sizeof(TIFFFieldInfo *), - tagCompare); - return tif->tif_foundfield = (ret ? *ret : NULL); -#else - (void) tif; - (void) tag; - (void) dt; -#endif - return NULL; -} - /* vim: set ts=8 sts=8 sw=8 noet: */ /* diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h index af6082f6..263b156f 100644 --- a/libtiff/tiffio.h +++ b/libtiff/tiffio.h @@ -1,4 +1,4 @@ -/* $Id: tiffio.h,v 1.86 2010-03-10 18:56:49 bfriesen Exp $ */ +/* $Id: tiffio.h,v 1.87 2011-04-20 15:23:38 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -512,28 +512,6 @@ extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*); extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32, uint32 *, uint32 *, uint32 *); -/**************************************************************************** - * O B S O L E T E D I N T E R F A C E S - * - * Don't use this stuff in your applications, it may be removed in the future - * libtiff versions. - ****************************************************************************/ -typedef struct { - ttag_t field_tag; /* field's tag */ - short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */ - short field_writecount; /* write count/TIFF_VARIABLE */ - TIFFDataType field_type; /* type of associated data */ - unsigned short field_bit; /* bit in fieldsset bit vector */ - unsigned char field_oktochange; /* if true, can change while writing */ - unsigned char field_passcount; /* if true, pass dir count on set */ - char *field_name; /* ASCII name */ -} TIFFFieldInfo; - -extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32); -extern const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, uint32, TIFFDataType); -extern const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *, - TIFFDataType); - #if defined(c_plusplus) || defined(__cplusplus) } #endif