Few cleanups.

This commit is contained in:
Andrey Kiselev 2003-12-26 10:19:41 +00:00
parent 1a50c01fdb
commit 5300539ac6
2 changed files with 23 additions and 82 deletions

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.c,v 1.31 2003-12-02 16:40:01 dron Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.c,v 1.32 2003-12-26 10:19:41 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -84,7 +84,6 @@ setExtraSamples(TIFFDirectory* td, va_list ap, int* v)
return (1);
}
#ifdef CMYK_SUPPORT
static int
checkInkNamesString(TIFF* tif, int slen, const char* s)
{
@ -110,7 +109,6 @@ bad:
td->td_samplesperpixel-i);
return (0);
}
#endif
static int
_TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
@ -395,19 +393,17 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
break;
/* End Pixar Tags */
#if SUBIFD_SUPPORT
case TIFFTAG_SUBIFD:
if ((tif->tif_flags & TIFF_INSUBIFD) == 0) {
td->td_nsubifd = (uint16) va_arg(ap, int);
_TIFFsetLongArray(&td->td_subifd, va_arg(ap, uint32*),
(long) td->td_nsubifd);
} else {
TIFFError(tif->tif_name, "Sorry, cannot nest SubIFDs");
TIFFError(module, "%s: Sorry, cannot nest SubIFDs",
tif->tif_name);
status = 0;
}
break;
#endif
#ifdef YCBCR_SUPPORT
case TIFFTAG_YCBCRCOEFFICIENTS:
_TIFFsetFloatArray(&td->td_ycbcrcoeffs, va_arg(ap, float*), 3);
break;
@ -418,8 +414,6 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
td->td_ycbcrsubsampling[0] = (uint16) va_arg(ap, int);
td->td_ycbcrsubsampling[1] = (uint16) va_arg(ap, int);
break;
#endif
#ifdef COLORIMETRY_SUPPORT
case TIFFTAG_WHITEPOINT:
_TIFFsetFloatArray(&td->td_whitepoint, va_arg(ap, float*), 2);
break;
@ -436,8 +430,6 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
/* XXX should check for null range */
_TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6);
break;
#endif
#ifdef CMYK_SUPPORT
case TIFFTAG_INKSET:
td->td_inkset = (uint16) va_arg(ap, int);
break;
@ -462,33 +454,22 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
case TIFFTAG_TARGETPRINTER:
_TIFFsetString(&td->td_targetprinter, va_arg(ap, char*));
break;
#endif
#ifdef ICC_SUPPORT
case TIFFTAG_ICCPROFILE:
td->td_profileLength = (uint32) va_arg(ap, uint32);
_TIFFsetByteArray(&td->td_profileData, va_arg(ap, void*),
td->td_profileLength);
break;
#endif
#ifdef PHOTOSHOP_SUPPORT
case TIFFTAG_PHOTOSHOP:
td->td_photoshopLength = (uint32) va_arg(ap, uint32);
_TIFFsetByteArray (&td->td_photoshopData, va_arg(ap, void*),
td->td_photoshopLength);
break;
#endif
#ifdef IPTC_SUPPORT
case TIFFTAG_RICHTIFFIPTC:
td->td_richtiffiptcLength = (uint32) va_arg(ap, uint32);
#ifdef PHOTOSHOP_SUPPORT
_TIFFsetLongArray ((uint32**)&td->td_richtiffiptcData, va_arg(ap, uint32*),
_TIFFsetLongArray ((uint32**)&td->td_richtiffiptcData,
va_arg(ap, uint32*),
td->td_richtiffiptcLength);
#else
_TIFFsetByteArray (&td->td_photoshopData, va_arg(ap, void*),
td->td_photoshopLength);
#endif
break;
#endif
case TIFFTAG_XMLPACKET:
td->td_xmlpacketLength = (uint32) va_arg(ap, uint32);
_TIFFsetByteArray(&td->td_xmlpacketData, va_arg(ap, void*),
@ -512,7 +493,7 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
*/
if( fip == NULL || fip->field_bit != FIELD_CUSTOM )
{
TIFFError("TIFFSetField",
TIFFError(module,
"%s: Invalid %stag \"%s\" (not supported by codec)",
tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
_TIFFFieldWithTag(tif, tag)->field_name);
@ -587,8 +568,7 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
else
{
/* not supporting "pass by value" types yet */
printf( "TIFFVSetField ... pass by value not imp.\n" );
TIFFWarning(module, " ... pass by value not implemented.");
tv->value = _TIFFmalloc(tv_size * tv->count);
if ( !tv->value ) {
@ -850,13 +830,10 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
case TIFFTAG_STONITS:
*va_arg(ap, double*) = td->td_stonits;
break;
#if SUBIFD_SUPPORT
case TIFFTAG_SUBIFD:
*va_arg(ap, uint16*) = td->td_nsubifd;
*va_arg(ap, uint32**) = td->td_subifd;
break;
#endif
#ifdef YCBCR_SUPPORT
case TIFFTAG_YCBCRCOEFFICIENTS:
*va_arg(ap, float**) = td->td_ycbcrcoeffs;
break;
@ -867,8 +844,6 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
*va_arg(ap, uint16*) = td->td_ycbcrsubsampling[0];
*va_arg(ap, uint16*) = td->td_ycbcrsubsampling[1];
break;
#endif
#ifdef COLORIMETRY_SUPPORT
case TIFFTAG_WHITEPOINT:
*va_arg(ap, float**) = td->td_whitepoint;
break;
@ -885,8 +860,6 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
case TIFFTAG_REFERENCEBLACKWHITE:
*va_arg(ap, float**) = td->td_refblackwhite;
break;
#endif
#ifdef CMYK_SUPPORT
case TIFFTAG_INKSET:
*va_arg(ap, uint16*) = td->td_inkset;
break;
@ -903,25 +876,18 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
case TIFFTAG_TARGETPRINTER:
*va_arg(ap, char**) = td->td_targetprinter;
break;
#endif
#ifdef ICC_SUPPORT
case TIFFTAG_ICCPROFILE:
*va_arg(ap, uint32*) = td->td_profileLength;
*va_arg(ap, void**) = td->td_profileData;
break;
#endif
#ifdef PHOTOSHOP_SUPPORT
case TIFFTAG_PHOTOSHOP:
*va_arg(ap, uint32*) = td->td_photoshopLength;
*va_arg(ap, void**) = td->td_photoshopData;
break;
#endif
#ifdef IPTC_SUPPORT
case TIFFTAG_RICHTIFFIPTC:
*va_arg(ap, uint32*) = td->td_richtiffiptcLength;
*va_arg(ap, void**) = td->td_richtiffiptcData;
break;
#endif
case TIFFTAG_XMLPACKET:
*va_arg(ap, uint32*) = td->td_xmlpacketLength;
*va_arg(ap, void**) = td->td_xmlpacketData;
@ -1067,33 +1033,19 @@ TIFFFreeDirectory(TIFF* tif)
CleanupField(td_copyright);
CleanupField(td_pagename);
CleanupField(td_sampleinfo);
#if SUBIFD_SUPPORT
CleanupField(td_subifd);
#endif
#ifdef YCBCR_SUPPORT
CleanupField(td_ycbcrcoeffs);
#endif
#ifdef CMYK_SUPPORT
CleanupField(td_inknames);
CleanupField(td_targetprinter);
#endif
#ifdef COLORIMETRY_SUPPORT
CleanupField(td_whitepoint);
CleanupField(td_primarychromas);
CleanupField(td_refblackwhite);
CleanupField(td_transferfunction[0]);
CleanupField(td_transferfunction[1]);
CleanupField(td_transferfunction[2]);
#endif
#ifdef ICC_SUPPORT
CleanupField(td_profileData);
#endif
#ifdef PHOTOSHOP_SUPPORT
CleanupField(td_photoshopData);
#endif
#ifdef IPTC_SUPPORT
CleanupField(td_richtiffiptcData);
#endif
CleanupField(td_xmlpacketData);
CleanupField(td_stripoffset);
CleanupField(td_stripbytecount);
@ -1169,15 +1121,11 @@ TIFFDefaultDirectory(TIFF* tif)
td->td_resolutionunit = RESUNIT_INCH;
td->td_sampleformat = SAMPLEFORMAT_UINT;
td->td_imagedepth = 1;
#ifdef YCBCR_SUPPORT
td->td_ycbcrsubsampling[0] = 2;
td->td_ycbcrsubsampling[1] = 2;
td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;
#endif
#ifdef CMYK_SUPPORT
td->td_inkset = INKSET_CMYK;
td->td_ninks = 4;
#endif
tif->tif_postdecode = _TIFFNoPostDecode;
tif->tif_tagmethods.vsetfield = _TIFFVSetField;
tif->tif_tagmethods.vgetfield = _TIFFVGetField;

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/Attic/tiffconf.h,v 1.7 2002-07-31 20:55:12 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/Attic/tiffconf.h,v 1.8 2003-12-26 10:20:03 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@ -33,7 +33,7 @@
* #defines on the command line, this file can be edited to
* configure the library. Otherwise, one can override portability
* and configuration-related definitions from a Makefile or command
* line by defining FEATURE_SUPPORT and COMPRESSION_SUPPORT (see below).
* line by defining COMPRESSION_SUPPORT (see below).
*/
/*
@ -68,25 +68,6 @@
# define USE_64BIT_API 0
#endif
#ifndef FEATURE_SUPPORT
/*
* Feature support definitions:
*
* COLORIMETRY_SUPPORT enable support for 6.0 colorimetry tags
* YCBCR_SUPPORT enable support for 6.0 YCbCr tags
* CMYK_SUPPORT enable support for 6.0 CMYK tags
* ICC_SUPPORT enable support for ICC profile tag
* PHOTOSHOP_SUPPORT enable support for PHOTOSHOP resource tag
* IPTC_SUPPORT enable support for RichTIFF IPTC tag
*/
#define COLORIMETRY_SUPPORT
#define YCBCR_SUPPORT
#define CMYK_SUPPORT
#define ICC_SUPPORT
#define PHOTOSHOP_SUPPORT
#define IPTC_SUPPORT
#endif /* FEATURE_SUPPORT */
#ifndef COMPRESSION_SUPPORT
/*
* Compression support defines:
@ -157,4 +138,16 @@
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
#endif
/*
* Feature support definitions.
* XXX: These macros are obsoleted. Don't use them in your apps!
* Macros stays here for backward compatibility and should be always defined.
*/
#define COLORIMETRY_SUPPORT
#define YCBCR_SUPPORT
#define CMYK_SUPPORT
#define ICC_SUPPORT
#define PHOTOSHOP_SUPPORT
#define IPTC_SUPPORT
#endif /* _TIFFCONF_ */