1993.09.10 23:17 "TIFF lib for Atari", by Alex Kiernan
Here are my diffs for getting the TIFF library compiling under Lattice C for TOS; there are two new files tif_atari.c and Makefile.lcc. The other things are one bug fix (tif_dir.c) and one feature enhancement for broken TIFF files (tif_dirread.c).
I've included the diffs I had to do to get the tools working as well; I don't know how much you're hacking on these at the moment.
diff --exclude=*.o --exclude=*.lib --exclude g3states.h --new-file --recursive --context --ignore-all-space libtiff/Makefile.lcc tiff/libtiff/Makefile.lcc
*** libtiff/Makefile.lcc
--- tiff/libtiff/Makefile.lcc Thu Sep 9 11:02:40 1993
***************
*** 0 ****
--- 1,129 ----
+ # $Header$
+ #
+ # Tag Image File Format Library
+ #
+ # Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
+ # Copyright (c) 1991, 1992 Silicon Graphics, Inc.
+ #
+ # Permission to use, copy, modify, distribute, and sell this software and
+ # its documentation for any purpose is hereby granted without fee, provided
+ # that (i) the above copyright notices and this permission notice appear in
+ # all copies of the software and related documentation, and (ii) the names of
+ # Sam Leffler and Silicon Graphics may not be used in any advertising or
+ # publicity relating to the software without the specific, prior written
+ # permission of Stanford and Silicon Graphics.
+ #
+ # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ #
+ # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ # OF THIS SOFTWARE.
+ #
+ DESTDIR=.
+ #
+ INSTALL= install
+ NULL=
+
+ IPATH= -I.
+ CONF_LIBRARY=\
+ ${NULL}
+ COPTS= -Oloop -cwagshf -d1 -b0 -v -DNDEBUG -rr -j135i
+ CFLAGS= ${COPTS} ${IPATH} ${CONF_LIBRARY}
+ #
+ INCS= tiff.h tiffio.h
+ SRCS= tif_fax3.c \
+ tif_fax4.c \
+ tif_aux.c \
+ tif_atari.c \
+ tif_ccittrle.c \
+ tif_close.c \
+ tif_compress.c \
+ tif_dir.c \
+ tif_dirinfo.c \
+ tif_dirread.c \
+ tif_dirwrite.c \
+ tif_dumpmode.c \
+ tif_error.c \
+ tif_getimage.c \
+ tif_jpeg.c \
+ tif_flush.c \
+ tif_lzw.c \
+ tif_next.c \
+ tif_open.c \
+ tif_packbits.c \
+ tif_print.c \
+ tif_read.c \
+ tif_swab.c \
+ tif_strip.c \
+ tif_thunder.c \
+ tif_tile.c \
+ tif_version.c \
+ tif_warning.c \
+ tif_write.c \
+ ${NULL}
+ OBJS= tif_fax3.o \
+ tif_fax4.o \
+ tif_aux.o \
+ tif_atari.o \
+ tif_ccittrle.o \
+ tif_close.o \
+ tif_compress.o \
+ tif_dir.o \
+ tif_dirinfo.o \
+ tif_dirread.o \
+ tif_dirwrite.o \
+ tif_dumpmode.o \
+ tif_error.o \
+ tif_getimage.o \
+ tif_jpeg.o \
+ tif_flush.o \
+ tif_lzw.o \
+ tif_next.o \
+ tif_open.o \
+ tif_packbits.o \
+ tif_print.o \
+ tif_read.o \
+ tif_swab.o \
+ tif_strip.o \
+ tif_thunder.o \
+ tif_tile.o \
+ tif_version.o \
+ tif_warning.o \
+ tif_write.o \
+ ${NULL}
+ ALL= tiffrnb.lib
+
+ all: ${ALL}
+
+ ${ALL}: ${OBJS}
+ ${AR} ${ARFLAGS} $@ r $<
+
+ ${OBJS}: tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
+ tif_fax3.o: tif_fax3.c g3states.h t4.h tif_fax3.h
+
+ g3states.h: mkg3states.c t4.h
+ ${CC} -o mkg3states.ttp ${CFLAGS} mkg3states.c
+ ./mkg3states -c > g3states.h
+
+ install: all installh
+ -for i in ${ALL}; do \
+ ${INSTALL} -c -m 644 $$i ${DESTDIR}/lib/$$i; \
+ done
+
+ installh: ${INCS}
+ -for i in ${INCS}; do \
+ h=`basename $$i`; \
+ cmp -s $$i ${DESTDIR}/include/$$h || \
+ ${INSTALL} -c -m 444 $$i ${DESTDIR}/include/$$h; \
+ done
+
+ clean:
+ rm -f ${ALL} ${OBJS} mkg3states.ttp mkg3states.o g3states.h
+
+ tags: ${SRCS}
+ ${CTAGS} ${SRCS}
diff --exclude=*.o --exclude=*.lib --exclude g3states.h --new-file --recursive --context --ignore-all-space libtiff/tif_atari.c tiff/libtiff/tif_atari.c
*** libtiff/tif_atari.c
--- tiff/libtiff/tif_atari.c Thu Sep 2 15:32:00 1993
***************
*** 0 ****
--- 1,211 ----
+ #ifndef lint
+ static char rcsid[] = "$Header$";
+ #endif
+
+ /*
+ * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
+ * Copyright (c) 1991, 1992 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+ /*
+ * TIFF Library ATARI-specific Routines.
+ */
+ #include "tiffiop.h"
+ #if defined(__TURBOC__)
+ #include <tos.h>
+ #include <stdio.h>
+ #else
+ #include <osbind.h>
+ #include <fcntl.h>
+ #endif
+
+ #ifndef O_ACCMODE
+ #define O_ACCMODE 3
+ #endif
+
+ #include <errno.h>
+
+ #define AEFILNF -33
+
+ static tsize_t
+ _tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
+ {
+ long r;
+
+ r = Fread((int) fd, size, buf);
+ if (r < 0) {
+ errno = (int)-r;
+ r = -1;
+ }
+ return r;
+ }
+
+ static tsize_t
+ _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
+ {
+ long r;
+
+ r = Fwrite((int) fd, size, buf);
+ if (r < 0) {
+ errno = (int)-r;
+ r = -1;
+ }
+ return r;
+ }
+
+ static toff_t
+ _tiffSeekProc(thandle_t fd, off_t off, int whence)
+ {
+ char buf[256];
+ long current_off, expected_off, new_off;
+
+ if (whence == SEEK_END || off <= 0)
+ return Fseek(off, (int) fd, whence);
+
+ current_off = Fseek(0, (int) fd, SEEK_CUR); /* find out where we are */
+
+ if (whence == SEEK_SET)
+ expected_off = off;
+ else
+ expected_off = off + current_off;
+
+ new_off = Fseek(off, (int) fd, whence);
+ if (new_off == expected_off)
+ return new_off;
+
+ /* otherwise extend file -- zero filling the hole */
+ if (new_off < 0) /* error? */
+ new_off = Fseek(0, (int) fd, SEEK_END); /* go to eof */
+
+ memset(buf, 0, sizeof(buf));
+ while (expected_off > new_off) {
+ off = expected_off - new_off;
+ if (off > sizeof(buf))
+ off = sizeof(buf);
+ if ((current_off = Fwrite((int) fd, off, buf)) != off)
+ return (current_off > 0) ? new_off + current_off : new_off;
+ new_off += off;
+ }
+ return new_off;
+ }
+
+ static int
+ _tiffCloseProc(thandle_t fd)
+ {
+ long r;
+
+ r = Fclose((int) fd);
+ if (r < 0) {
+ errno = (int)-r;
+ r = -1;
+ }
+ return (int)r;
+ }
+
+ static toff_t
+ _tiffSizeProc(thandle_t fd)
+ {
+ long pos, eof;
+
+ pos = Fseek(0, (int) fd, SEEK_CUR);
+ eof = Fseek(0, (int) fd, SEEK_END);
+ Fseek(pos, (int) fd, SEEK_SET);
+ return eof;
+ }
+
+ static int
+ _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
+ {
+ return (0);
+ }
+
+ static void
+ _tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
+ {
+ }
+
+ /*
+ * Open a TIFF file descriptor for read/writing.
+ */
+ TIFF*
+ TIFFFdOpen(int fd, const char* name, const char* mode)
+ {
+ TIFF* tif;
+
+ tif = TIFFClientOpen(name, mode,
+ (thandle_t) fd,
+ _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
+ _tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
+ if (tif)
+ tif->tif_fd = fd;
+ return (tif);
+ }
+
+ /*
+ * Open a TIFF file for read/writing.
+ */
+ TIFF*
+ TIFFOpen(const char* name, const char* mode)
+ {
+ static const char module[] = "TIFFOpen";
+ int m;
+ long fd;
+
+ m = _TIFFgetMode(mode, module);
+ if (m == -1)
+ return ((TIFF*)0);
+ if (m & O_TRUNC) {
+ fd = Fcreate(name, 0);
+ }
+ else {
+ fd = Fopen(name, m & O_ACCMODE);
+ if (fd == AEFILNF && m & O_CREAT)
+ fd = Fcreate(name, 0);
+ }
+ if (fd < 0)
+ errno = (int)fd;
+ if (fd < 0) {
+ TIFFError(module, "%s: Cannot open", name);
+ return ((TIFF*)0);
+ }
+ return (TIFFFdOpen(fd, name, mode));
+ }
+
+ #include <stdlib.h>
+
+ void*
+ _TIFFmalloc(size_t s)
+ {
+ return (malloc(s));
+ }
+
+ void
+ _TIFFfree(void* p)
+ {
+ free(p);
+ }
+
+ void*
+ _TIFFrealloc(void* p, size_t s)
+ {
+ return (realloc(p, s));
+ }
diff --exclude=*.o --exclude=*.lib --exclude g3states.h --new-file --recursive --context --ignore-all-space libtiff/tif_dir.c tiff/libtiff/tif_dir.c
*** libtiff/tif_dir.c Fri Sep 10 17:13:20 1993
--- tiff/libtiff/tif_dir.c Thu Sep 2 14:59:16 1993
***************
*** 380,386 ****
break;
case TIFFTAG_TILEDEPTH:
v32 = va_arg(ap, uint32);
! if (v == 0)
goto badvalue32;
td->td_tiledepth = v32;
break;
--- 380,386 ----
break;
case TIFFTAG_TILEDEPTH:
v32 = va_arg(ap, uint32);
! if (v32 == 0)
goto badvalue32;
td->td_tiledepth = v32;
break;
diff --exclude=*.o --exclude=*.lib --exclude g3states.h --new-file --recursive --context --ignore-all-space libtiff/tif_dirread.c tiff/libtiff/tif_dirread.c
*** libtiff/tif_dirread.c Fri Sep 10 17:13:22 1993
--- tiff/libtiff/tif_dirread.c Fri Sep 3 09:44:32 1993
***************
*** 440,448 ****
/*
* Some manufacturers violate the spec by not giving
* the size of the strips. In this case, assume there
! * is one uncompressed strip of data.
! */
! if (td->td_nstrips > 1) {
MissingRequired(tif, "StripByteCounts");
goto bad;
}
--- 440,453 ----
/*
* Some manufacturers violate the spec by not giving
* the size of the strips. In this case, assume there
! * is one uncompressed strip of data for the contiguous
! * configuration, or one strip per plane for separate
! * planes.
! */
! if ((td->td_planarconfig == PLANARCONFIG_CONTIG &&
! td->td_nstrips > 1) ||
! (td->td_planarconfig == PLANARCONFIG_SEPARATE &&
! td->td_nstrips != td->td_samplesperpixel)) {
MissingRequired(tif, "StripByteCounts");
goto bad;
}
***************
*** 511,519 ****
{
register TIFFDirEntry *dp;
register TIFFDirectory *td = &tif->tif_dir;
td->td_stripbytecount = (uint32*)
! CheckMalloc(tif, sizeof (uint32), "for \"StripByteCounts\" array");
if (td->td_compression != COMPRESSION_NONE) {
uint32 space = sizeof (TIFFHeader)
+ sizeof (uint16)
--- 516,525 ----
{
register TIFFDirEntry *dp;
register TIFFDirectory *td = &tif->tif_dir;
+ u_long i;
td->td_stripbytecount = (uint32*)
! CheckMalloc(tif, td->td_samplesperpixel * sizeof (uint32), "for \"StripByteCounts\" array");
if (td->td_compression != COMPRESSION_NONE) {
uint32 space = sizeof (TIFFHeader)
+ sizeof (uint16)
***************
*** 528,534 ****
if (cc > sizeof (uint32))
space += cc;
}
! td->td_stripbytecount[0] = filesize - space;
/*
* This gross hack handles the case were the offset to
* the strip is past the place where we think the strip
--- 534,542 ----
if (cc > sizeof (uint32))
space += cc;
}
! space = (filesize - space) / td->td_samplesperpixel;
! for (i = 0; i < td->td_samplesperpixel; i++) {
! td->td_stripbytecount[i] = space;
/*
* This gross hack handles the case were the offset to
* the strip is past the place where we think the strip
***************
*** 536,548 ****
* it's safe to assume that we've overestimated the amount
* of data in the strip and trim this number back accordingly.
*/
! if (td->td_stripoffset[0] + td->td_stripbytecount[0] > filesize)
! td->td_stripbytecount[0] =
! filesize - td->td_stripoffset[0];
} else {
uint32 rowbytes = howmany(td->td_bitspersample *
td->td_samplesperpixel * td->td_imagewidth, 8);
! td->td_stripbytecount[0] = td->td_imagelength * rowbytes;
}
TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
--- 544,559 ----
* it's safe to assume that we've overestimated the amount
* of data in the strip and trim this number back accordingly.
*/
! if (td->td_stripoffset[i] + td->td_stripbytecount[i] > filesize)
! td->td_stripbytecount[i] =
! filesize - td->td_stripoffset[i];
! }
} else {
uint32 rowbytes = howmany(td->td_bitspersample *
td->td_samplesperpixel * td->td_imagewidth, 8);
! for (i = 0; i < td->td_samplesperpixel; i++)
! td->td_stripbytecount[i] =
! td->td_imagelength * rowbytes / td->td_samplesperpixel;
}
TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
diff --exclude=*.o --new-file --recursive --context --ignore-all-space tools/Makefile.lcc tiff/tools/Makefile.lcc
*** tools/Makefile.lcc
--- tiff/tools/Makefile.lcc Fri Sep 10 17:11:18 1993
***************
*** 0 ****
--- 1,129 ----
+ # $Header$
+ #
+ # TIFF Library Tools
+ #
+ # Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
+ # Copyright (c) 1991, 1992 Silicon Graphics, Inc.
+ #
+ # Permission to use, copy, modify, distribute, and sell this software and
+ # its documentation for any purpose is hereby granted without fee, provided
+ # that (i) the above copyright notices and this permission notice appear in
+ # all copies of the software and related documentation, and (ii) the names of
+ # Sam Leffler and Silicon Graphics may not be used in any advertising or
+ # publicity relating to the software without the specific, prior written
+ # permission of Stanford and Silicon Graphics.
+ #
+ # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ #
+ # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ # OF THIS SOFTWARE.
+ #
+ NULL=
+ IPATH= -I..\libtiff
+ #
+ # If you don't want the public domain getopt code, then
+ # simply null this out and you'll get whatever is in your
+ # libc (or similar).
+ #
+ GETOPT= getopt.o
+ #
+ # Library-wide configuration defines:
+ # Note that if you change the library-wide configuration, you'll
+ # need to manual force a full rebuild.
+ #
+ CONF_LIBRARY=\
+ ${NULL}
+ COPTS= -Oloop -cwagshf -d1 -b0 -v -DNDEBUG -rr -j135i
+ CFLAGS= ${COPTS} ${IPATH} -DBINMODE='"b"'
+ #
+ LIBTIFF=..\libtiff\tiffrnb.lib
+ LIBS= -l${LIBTIFF} -lm
+ MACHALL=ras2tiff.ttp
+ OBJS= \
+ fax2tiff.o \
+ gif2tiff.o \
+ pal2rgb.o \
+ ppm2tiff.o \
+ rgb2ycbcr.o \
+ tiff2bw.o \
+ tiff2ps.o \
+ tiffcmp.o \
+ tiffcp.o \
+ tiffdither.o \
+ tiffdump.o \
+ tiffinfo.o \
+ tiffmedian.o \
+ tiffsplit.o \
+ ras2tiff.o \
+ ${GETOPT} \
+ ${NULL}
+ ALL=\
+ fax2tiff.ttp \
+ gif2tiff.ttp \
+ pal2rgb.ttp \
+ ppm2tiff.ttp \
+ rgb2ycbcr.ttp \
+ tiff2bw.ttp \
+ tiff2ps.ttp \
+ tiffcmp.ttp \
+ tiffcp.ttp \
+ tiffdither.ttp \
+ tiffdump.ttp \
+ tiffinfo.ttp \
+ tiffmedian.ttp \
+ tiffsplit.ttp \
+ ${MACHALL} \
+ ${NULL}
+
+ all: ${ALL}
+
+ tiffinfo.ttp: tiffinfo.c ${GETOPT} ${LIBTIFF}
+ ${CC} -o tiffinfo.ttp ${CFLAGS} tiffinfo.c ${GETOPT} ${LIBS}
+ tiffcmp.ttp: tiffcmp.c ${GETOPT} ${LIBTIFF}
+ ${CC} -o tiffcmp.ttp ${CFLAGS} tiffcmp.c ${GETOPT} ${LIBS}
+ tiffcp.ttp: tiffcp.c ${LIBTIFF}
+ ${CC} -o tiffcp.ttp ${CFLAGS} tiffcp.c ${LIBS}
+ tiffdump.ttp: tiffdump.c
+ ${CC} -o tiffdump.ttp ${CFLAGS} tiffdump.c -lm
+ tiffmedian.ttp: tiffmedian.c ${LIBTIFF}
+ ${CC} -o tiffmedian.ttp ${CFLAGS} tiffmedian.c ${LIBS}
+ tiffsplit.ttp: tiffsplit.c ${LIBTIFF}
+ ${CC} -o tiffsplit.ttp ${CFLAGS} tiffsplit.c ${LIBS}
+ tiff2ps.ttp: tiff2ps.c ${LIBTIFF}
+ ${CC} -o tiff2ps.ttp ${CFLAGS} tiff2ps.c ${LIBS}
+ # junky stuff...
+ # convert RGB image to B&W
+ tiff2bw.ttp: tiff2bw.c ${GETOPT} ${LIBTIFF}
+ ${CC} -o tiff2bw.ttp ${CFLAGS} tiff2bw.c ${GETOPT} ${LIBS}
+ # convert B&W image to bilevel w/ FS dithering
+ tiffdither.ttp: tiffdither.c ${LIBTIFF}
+ ${CC} -o tiffdither.ttp ${CFLAGS} tiffdither.c ${LIBS}
+ # Group 3 FAX file converter
+ fax2tiff.ttp: fax2tiff.c ${GETOPT} ${LIBTIFF}
+ ${CC} -o fax2tiff.ttp ${CFLAGS} ${CONF_LIBRARY} fax2tiff.c ${GETOPT} ${LIBS}
+ # convert Palette image to RGB
+ pal2rgb.ttp: pal2rgb.c ${LIBTIFF}
+ ${CC} -o pal2rgb.ttp ${CFLAGS} pal2rgb.c ${LIBS}
+ # convert RGB image to YCbCr
+ rgb2ycbcr.ttp: rgb2ycbcr.c ${GETOPT} ${LIBTIFF}
+ ${CC} -o rgb2ycbcr.ttp ${CFLAGS} rgb2ycbcr.c ${GETOPT} ${LIBS}
+ # GIF converter
+ gif2tiff.ttp: gif2tiff.c ${LIBTIFF}
+ ${CC} -o gif2tiff.ttp ${CFLAGS} gif2tiff.c ${LIBS}
+ # PBM converter
+ ppm2tiff.ttp: ppm2tiff.c ${LIBTIFF}
+ ${CC} -o ppm2tiff.ttp ${CFLAGS} ppm2tiff.c ${LIBS}
+ # Sun rasterfile converter
+ ras2tiff.ttp: ras2tiff.c ${LIBTIFF}
+ ${CC} -o ras2tiff.ttp ${CFLAGS} ras2tiff.c ${LIBS}
+
+ install: all
+
+ clean:
+ rm -f ${ALL} ${OBJS} ycbcr.ttp
diff --exclude=*.o --new-file --recursive --context --ignore-all-space tools/fax2tiff.c tiff/tools/fax2tiff.c
*** tools/fax2tiff.c Fri Sep 10 17:13:32 1993
--- tiff/tools/fax2tiff.c Fri Sep 10 14:59:16 1993
***************
*** 33,38 ****
--- 33,43 ----
#include <stdlib.h> /* should have atof & getopt */
#include "tiffiop.h"
+ #ifndef BINMODE
+ /* defined to "b" for thos machines which need it */
+ #define BINMODE
+ #endif
+
TIFF faxTIFF;
#define XSIZE 1728
u_char rowbuf[howmany(XSIZE,8)];
***************
*** 171,177 ****
/* NB: this must be done after directory info is setup */
TIFFSetField(&faxTIFF, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX3);
for (pn = 0; optind < argc; pn++, optind++) {
! in = fopen(argv[optind], "r");
if (in == NULL) {
fprintf(stderr,
"%s: %s: Can not open\n", argv[0], argv[optind]);
--- 176,182 ----
/* NB: this must be done after directory info is setup */
TIFFSetField(&faxTIFF, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX3);
for (pn = 0; optind < argc; pn++, optind++) {
! in = fopen(argv[optind], "r" BINMODE);
if (in == NULL) {
fprintf(stderr,
"%s: %s: Can not open\n", argv[0], argv[optind]);
diff --exclude=*.o --new-file --recursive --context --ignore-all-space tools/getopt.c tiff/tools/getopt.c
*** tools/getopt.c Fri Sep 10 17:13:32 1993
--- tiff/tools/getopt.c Fri Sep 10 15:27:56 1993
***************
*** 50,59 ****
#define EMSG ""
int
! getopt(nargc, nargv, ostr)
! int nargc;
! char **nargv;
! char *ostr;
{
static char *place = EMSG; /* option letter processing */
register char *oli; /* option letter list index */
--- 50,56 ----
#define EMSG ""
int
! getopt(int nargc, char **nargv, char *ostr)
{
static char *place = EMSG; /* option letter processing */
register char *oli; /* option letter list index */
diff --exclude=*.o --new-file --recursive --context --ignore-all-space tools/gif2tiff.c tiff/tools/gif2tiff.c
*** tools/gif2tiff.c Fri Sep 10 17:13:32 1993
--- tiff/tools/gif2tiff.c Fri Sep 10 14:59:16 1993
***************
*** 18,23 ****
--- 18,28 ----
#include "tiffio.h"
+ #ifndef BINMODE
+ /* defined to "b" for thos machines which need it */
+ #define BINMODE
+ #endif
+
#define GIFGAMMA (1.5) /* smaller makes output img brighter */
#define IMAX ((1<<16)-1) /* max intensity value */
#define EXTRAFUDGE 128 /* some people write BAD .gif files */
***************
*** 82,88 ****
}
filename = argv[1];
imagename = argv[2];
! if ((infile = fopen(filename,"r")) == NULL) {
perror(filename);
exit(1);
}
--- 87,93 ----
}
filename = argv[1];
imagename = argv[2];
! if ((infile = fopen(filename,"r" BINMODE)) == NULL) {
perror(filename);
exit(1);
}
diff --exclude=*.o --new-file --recursive --context --ignore-all-space tools/ppm2tiff.c tiff/tools/ppm2tiff.c
*** tools/ppm2tiff.c Fri Sep 10 17:13:34 1993
--- tiff/tools/ppm2tiff.c Fri Sep 10 14:59:16 1993
***************
*** 32,37 ****
--- 32,42 ----
#include "tiffio.h"
+ #ifndef BINMODE
+ /* defined to "b" for thos machines which need it */
+ #define BINMODE
+ #endif
+
#define howmany(x, y) (((x)+((y)-1))/(y))
#define streq(a,b) (strcmp(a,b) == 0)
***************
*** 98,104 ****
if (argc > 1) {
infile = argv[0];
argv++;
! in = fopen(infile, "r");
if (in == NULL) {
fprintf(stderr, "%s: Can not open.\n", infile);
exit(-1);
--- 103,109 ----
if (argc > 1) {
infile = argv[0];
argv++;
! in = fopen(infile, "r" BINMODE);
if (in == NULL) {
fprintf(stderr, "%s: Can not open.\n", infile);
exit(-1);
diff --exclude=*.o --new-file --recursive --context --ignore-all-space tools/ras2tiff.c tiff/tools/ras2tiff.c
*** tools/ras2tiff.c Fri Sep 10 17:13:34 1993
--- tiff/tools/ras2tiff.c Fri Sep 10 14:59:18 1993
***************
*** 32,37 ****
--- 32,42 ----
#include "rasterfile.h"
#include "tiffio.h"
+ #ifndef BINMODE
+ /* defined to "b" for thos machines which need it */
+ #define BINMODE
+ #endif
+
#define howmany(x, y) (((x)+((y)-1))/(y))
#define streq(a,b) (strcmp(a,b) == 0)
***************
*** 74,80 ****
}
usage();
}
! in = fopen(argv[0], "r");
if (in == NULL) {
fprintf(stderr, "%s: Can not open.\n", argv[0]);
exit(-1);
--- 79,85 ----
}
usage();
}
! in = fopen(argv[0], "r" BINMODE);
if (in == NULL) {
fprintf(stderr, "%s: Can not open.\n", argv[0]);
exit(-1);
diff --exclude=*.o --new-file --recursive --context --ignore-all-space tools/tiffdump.c tiff/tools/tiffdump.c
*** tools/tiffdump.c Fri Sep 10 17:13:38 1993
--- tiff/tools/tiffdump.c Fri Sep 10 15:35:40 1993
***************
*** 39,45 ****
#endif
#if defined(MSDOS)
#include <malloc.h>
! #else
#define O_BINARY 0
#endif
--- 39,47 ----
#endif
#if defined(MSDOS)
#include <malloc.h>
! #endif
!
! #ifndef O_BINARY
#define O_BINARY 0
#endif
***************
*** 661,667 ****
w = (dir->tdir_type < NWIDTHS ? datawidth[dir->tdir_type] : 0);
cc = dir->tdir_count * w;
! if (lseek(fd, (off_t) dir->tdir_offset, 0) == dir->tdir_offset &&
read(fd, cp, cc) == cc) {
if (swabflag) {
switch (dir->tdir_type) {
--- 663,669 ----
w = (dir->tdir_type < NWIDTHS ? datawidth[dir->tdir_type] : 0);
cc = dir->tdir_count * w;
! if (lseek(fd, dir->tdir_offset, 0) == dir->tdir_offset &&
read(fd, cp, cc) == cc) {
if (swabflag) {
switch (dir->tdir_type) {
--
Alex Kiernan.
alex@falcon.demon.co.uk