tumble_tiff.c

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