tumble_tiff.c

changeset 152
e69798068425
parent 151
83a99cc69861
child 168
ad0b9a8990ac
     1.1 diff -r 83a99cc69861 -r e69798068425 tumble_tiff.c
     1.2 --- a/tumble_tiff.c	Thu Mar 20 14:55:28 2003 +0000
     1.3 +++ b/tumble_tiff.c	Thu Mar 20 15:22:23 2003 +0000
     1.4 @@ -1,7 +1,7 @@
     1.5  /*
     1.6   * tumble: build a PDF file from image files
     1.7   *
     1.8 - * $Id: tumble_tiff.c,v 1.4 2003/03/20 06:55:28 eric Exp $
     1.9 + * $Id: tumble_tiff.c,v 1.5 2003/03/20 07:22:23 eric Exp $
    1.10   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.11   *
    1.12   * This program is free software; you can redistribute it and/or modify
    1.13 @@ -28,6 +28,12 @@
    1.14  #include <strings.h>  /* strcasecmp() is a BSDism */
    1.15  
    1.16  #include <tiffio.h>
    1.17 +/*
    1.18 + * On the x86, libtiff defaults to bit-endian bit order for no good reason.
    1.19 + * In theory, the '-L' (and maybe '-H') should give us little-endian bit
    1.20 + * order, but it doesn't seem to work.  Thus we reverse the bits ourselves
    1.21 + * after we read in the file.
    1.22 + */
    1.23  #define TIFF_REVERSE_BITS
    1.24  
    1.25  
    1.26 @@ -69,7 +75,8 @@
    1.27  
    1.28    rewind (f);
    1.29  
    1.30 -  if ((buf [0] != 0x49) || (buf [1] != 0x49))
    1.31 +  if (! (((buf [0] == 0x49) && (buf [1] == 0x49)) ||
    1.32 +	 ((buf [0] == 0x4d) && (buf [1] == 0x4d))))
    1.33      return (0);
    1.34  
    1.35    tiff_in = TIFFFdOpen (fileno (f), name, "r");