-/* $Id$ */
/*
* Copyright (c) 1994-1997 Sam Leffler
# include <unistd.h>
#endif
+#ifdef NEED_LIBPORT
+# include "libport.h"
+#endif
+
#include "tiffio.h"
#ifndef HAVE_GETOPT
if (out == NULL)
return 2;
in = TIFFOpen(argv[optind], "r");
+ if( in == NULL )
+ return 2;
thumbnail = (uint8*) _TIFFmalloc(tnw * tnh);
if (!thumbnail) {
CopyField(tag, longv);
}
break;
+ case TIFF_LONG8:
+ { uint64 longv8;
+ CopyField(tag, longv8);
+ }
+ break;
+ case TIFF_SLONG8:
+ { int64 longv8;
+ CopyField(tag, longv8);
+ }
+ break;
case TIFF_RATIONAL:
if (count == 1) {
float floatv;
CopyField(tag, doubleav);
}
break;
- default:
+ case TIFF_IFD8:
+ { toff_t ifd8;
+ CopyField(tag, ifd8);
+ }
+ break; default:
TIFFError(TIFFFileName(in),
"Data type %d is not supported, tag %d skipped.",
tag, type);
{ TIFFTAG_DATETIME, 1, TIFF_ASCII },
{ TIFFTAG_ARTIST, 1, TIFF_ASCII },
{ TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
- { TIFFTAG_WHITEPOINT, 1, TIFF_RATIONAL },
+ { TIFFTAG_WHITEPOINT, 2, TIFF_RATIONAL },
{ TIFFTAG_PRIMARYCHROMATICITIES, (uint16) -1,TIFF_RATIONAL },
{ TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
{ TIFFTAG_BADFAXLINES, 1, TIFF_LONG },
if (buf) {
tstrip_t s, ns = TIFFNumberOfStrips(in);
- tsize_t *bytecounts;
+ uint64 *bytecounts;
TIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &bytecounts);
for (s = 0; s < ns; s++) {
- if (bytecounts[s] > bufsize) {
- buf = (unsigned char *)_TIFFrealloc(buf, bytecounts[s]);
+ if (bytecounts[s] > (uint64) bufsize) {
+ buf = (unsigned char *)_TIFFrealloc(buf, (tmsize_t)bytecounts[s]);
if (!buf)
goto bad;
- bufsize = bytecounts[s];
+ bufsize = (tmsize_t)bytecounts[s];
}
- if (TIFFReadRawStrip(in, s, buf, bytecounts[s]) < 0 ||
- TIFFWriteRawStrip(out, s, buf, bytecounts[s]) < 0) {
+ if (TIFFReadRawStrip(in, s, buf, (tmsize_t)bytecounts[s]) < 0 ||
+ TIFFWriteRawStrip(out, s, buf, (tmsize_t)bytecounts[s]) < 0) {
_TIFFfree(buf);
return 0;
}
if (buf) {
ttile_t t, nt = TIFFNumberOfTiles(in);
- tsize_t *bytecounts;
+ uint64 *bytecounts;
TIFFGetField(in, TIFFTAG_TILEBYTECOUNTS, &bytecounts);
for (t = 0; t < nt; t++) {
- if (bytecounts[t] > bufsize) {
- buf = (unsigned char *)_TIFFrealloc(buf, bytecounts[t]);
+ if (bytecounts[t] > (uint64) bufsize) {
+ buf = (unsigned char *)_TIFFrealloc(buf, (tmsize_t)bytecounts[t]);
if (!buf)
goto bad;
- bufsize = bytecounts[t];
+ bufsize = (tmsize_t)bytecounts[t];
}
- if (TIFFReadRawTile(in, t, buf, bytecounts[t]) < 0 ||
- TIFFWriteRawTile(out, t, buf, bytecounts[t]) < 0) {
+ if (TIFFReadRawTile(in, t, buf, (tmsize_t)bytecounts[t]) < 0 ||
+ TIFFWriteRawTile(out, t, buf, (tmsize_t)bytecounts[t]) < 0) {
_TIFFfree(buf);
return 0;
}
uint16 bps, spp;
tsize_t rowsize, rastersize;
tstrip_t s, ns = TIFFNumberOfStrips(in);
- uint32 diroff[1];
+ toff_t diroff[1];
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &sw);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &sh);
cpTag(in, out, TIFFTAG_IMAGEDESCRIPTION, (uint16) -1, TIFF_ASCII);
cpTag(in, out, TIFFTAG_DATETIME, (uint16) -1, TIFF_ASCII);
cpTag(in, out, TIFFTAG_HOSTCOMPUTER, (uint16) -1, TIFF_ASCII);
- diroff[0] = 0;
+ diroff[0] = 0UL;
TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff);
return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 &&
TIFFWriteDirectory(out) != -1);
}
/* vim: set ts=8 sts=8 sw=8 noet: */
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 8
+ * fill-column: 78
+ * End:
+ */