tumble_tiff.c

changeset 151
83a99cc69861
parent 148
d4a6e303703a
child 152
e69798068425
     1.1 diff -r 17531d20e477 -r 83a99cc69861 tumble_tiff.c
     1.2 --- a/tumble_tiff.c	Thu Mar 20 08:32:16 2003 +0000
     1.3 +++ b/tumble_tiff.c	Thu Mar 20 14:55:28 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.3 2003/03/20 00:20:52 eric Exp $
     1.9 + * $Id: tumble_tiff.c,v 1.4 2003/03/20 06:55:28 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 @@ -25,7 +25,7 @@
    1.14  #include <stdint.h>
    1.15  #include <stdio.h>
    1.16  #include <stdlib.h>
    1.17 -#include <string.h>
    1.18 +#include <strings.h>  /* strcasecmp() is a BSDism */
    1.19  
    1.20  #include <tiffio.h>
    1.21  #define TIFF_REVERSE_BITS
    1.22 @@ -44,14 +44,21 @@
    1.23  #define SWAP(type,a,b) do { type temp; temp = a; a = b; b = temp; } while (0)
    1.24  
    1.25  
    1.26 -bool close_tiff_input_file (void)
    1.27 +static bool match_tiff_suffix (char *suffix)
    1.28 +{
    1.29 +  return ((strcasecmp (suffix, ".tif") == 0) ||
    1.30 +	  (strcasecmp (suffix, ".tiff") == 0));
    1.31 +}
    1.32 +
    1.33 +
    1.34 +static bool close_tiff_input_file (void)
    1.35  {
    1.36    TIFFClose (tiff_in);
    1.37    return (1);
    1.38  }
    1.39  
    1.40  
    1.41 -bool open_tiff_input_file (FILE *f, char *name)
    1.42 +static bool open_tiff_input_file (FILE *f, char *name)
    1.43  {
    1.44    uint8_t buf [2];
    1.45    size_t l;
    1.46 @@ -75,15 +82,15 @@
    1.47  }
    1.48  
    1.49  
    1.50 -bool last_tiff_input_page (void)
    1.51 +static bool last_tiff_input_page (void)
    1.52  {
    1.53    return (TIFFLastDirectory (tiff_in));
    1.54  }
    1.55  
    1.56  
    1.57 -bool get_tiff_image_info (int image,
    1.58 -			  input_attributes_t input_attributes,
    1.59 -			  image_info_t *image_info)
    1.60 +static bool get_tiff_image_info (int image,
    1.61 +				 input_attributes_t input_attributes,
    1.62 +				 image_info_t *image_info)
    1.63  {
    1.64    uint32_t image_height, image_width;
    1.65    uint16_t samples_per_pixel;
    1.66 @@ -250,10 +257,10 @@
    1.67  }
    1.68  
    1.69  
    1.70 -bool process_tiff_image (int image,  /* range 1 .. n */
    1.71 -			 input_attributes_t input_attributes,
    1.72 -			 image_info_t *image_info,
    1.73 -			 pdf_page_handle page)
    1.74 +static bool process_tiff_image (int image,  /* range 1 .. n */
    1.75 +				input_attributes_t input_attributes,
    1.76 +				image_info_t *image_info,
    1.77 +				pdf_page_handle page)
    1.78  {
    1.79    bool result = 0;
    1.80    Rect rect;
    1.81 @@ -333,6 +340,7 @@
    1.82  
    1.83  input_handler_t tiff_handler =
    1.84    {
    1.85 +    match_tiff_suffix,
    1.86      open_tiff_input_file,
    1.87      close_tiff_input_file,
    1.88      last_tiff_input_page,