1.1 diff -r 17531d20e477 -r 83a99cc69861 tumble_jpeg.c 1.2 --- a/tumble_jpeg.c Thu Mar 20 08:32:16 2003 +0000 1.3 +++ b/tumble_jpeg.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_jpeg.c,v 1.3 2003/03/20 00:32:16 eric Exp $ 1.9 + * $Id: tumble_jpeg.c,v 1.4 2003/03/20 06:55:27 eric Exp $ 1.10 * Copyright 2003 Eric Smith <eric@brouhaha.com> 1.11 * 1.12 * This program is free software; you can redistribute it and/or modify 1.13 @@ -24,6 +24,7 @@ 1.14 #include <stdbool.h> 1.15 #include <stdint.h> 1.16 #include <stdio.h> 1.17 +#include <strings.h> /* strcasecmp() is a BSDism */ 1.18 #include <jpeglib.h> 1.19 1.20 1.21 @@ -40,13 +41,19 @@ 1.22 static struct jpeg_error_mgr jerr; 1.23 1.24 1.25 -bool close_jpeg_input_file (void) 1.26 +static bool match_jpeg_suffix (char *suffix) 1.27 +{ 1.28 + return ((strcasecmp (suffix, ".jpg") == 0) || 1.29 + (strcasecmp (suffix, ".jpeg") == 0)); 1.30 +} 1.31 + 1.32 +static bool close_jpeg_input_file (void) 1.33 { 1.34 return (1); 1.35 } 1.36 1.37 1.38 -bool open_jpeg_input_file (FILE *f, char *name) 1.39 +static bool open_jpeg_input_file (FILE *f, char *name) 1.40 { 1.41 uint8_t buf [2]; 1.42 size_t l; 1.43 @@ -75,15 +82,15 @@ 1.44 } 1.45 1.46 1.47 -bool last_jpeg_input_page (void) 1.48 +static bool last_jpeg_input_page (void) 1.49 { 1.50 return (1); 1.51 } 1.52 1.53 1.54 -bool get_jpeg_image_info (int image, 1.55 - input_attributes_t input_attributes, 1.56 - image_info_t *image_info) 1.57 +static bool get_jpeg_image_info (int image, 1.58 + input_attributes_t input_attributes, 1.59 + image_info_t *image_info) 1.60 { 1.61 double unit; 1.62 1.63 @@ -155,10 +162,10 @@ 1.64 } 1.65 1.66 1.67 -bool process_jpeg_image (int image, /* range 1 .. n */ 1.68 - input_attributes_t input_attributes, 1.69 - image_info_t *image_info, 1.70 - pdf_page_handle page) 1.71 +static bool process_jpeg_image (int image, /* range 1 .. n */ 1.72 + input_attributes_t input_attributes, 1.73 + image_info_t *image_info, 1.74 + pdf_page_handle page) 1.75 { 1.76 pdf_write_jpeg_image (page, 1.77 0, 0, /* x, y */ 1.78 @@ -175,6 +182,7 @@ 1.79 1.80 input_handler_t jpeg_handler = 1.81 { 1.82 + match_jpeg_suffix, 1.83 open_jpeg_input_file, 1.84 close_jpeg_input_file, 1.85 last_jpeg_input_page,