Changeset 135
- Timestamp:
- 02/15/06 20:15:38 (3 years ago)
- Files:
-
- fastphoto/trunk/src/Makefile.am (modified) (1 diff)
- fastphoto/trunk/src/cache.c (modified) (3 diffs)
- fastphoto/trunk/src/cache.h (modified) (1 diff)
- fastphoto/trunk/src/cgi.c (modified) (2 diffs)
- fastphoto/trunk/src/cgi.h (modified) (1 diff)
- fastphoto/trunk/src/main.c (modified) (2 diffs)
- fastphoto/trunk/src/resize.c (modified) (2 diffs)
- fastphoto/trunk/src/send.c (deleted)
- fastphoto/trunk/src/send.h (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fastphoto/trunk/src/Makefile.am
r131 r135 5 5 bin_PROGRAMS = fastphoto 6 6 7 noinst_HEADERS = alloc_snprintf.h cache.h cgi.h header.h resize.h send.h7 noinst_HEADERS = alloc_snprintf.h cache.h cgi.h header.h photo.h resize.h 8 8 9 fastphoto_SOURCES = main.c alloc_snprintf.c cache.c cgi.c header.c resize.c send.c9 fastphoto_SOURCES = main.c alloc_snprintf.c cache.c cgi.c header.c photo.c resize.c 10 10 fastphoto_LDADD = $(EPEG_LIBS) fastphoto/trunk/src/cache.c
r134 r135 8 8 9 9 #include "fastphoto.h" 10 #include "photo.h" 10 11 #include "alloc_snprintf.h" 11 12 … … 44 45 } 45 46 46 int47 file_check (photo_t * photo)48 {49 struct stat statbuf;50 51 if (stat (photo->name, &statbuf) == -1) {52 switch (errno) {53 case ENOENT:54 return 0;55 default:56 fprintf (stderr, "fastphoto: Error checking %s: %s\n", photo->name, strerror (errno));57 return -1;58 }59 }60 61 photo->mtime = statbuf.st_mtime;62 photo->size = statbuf.st_size;63 64 return 1;65 }66 67 47 static int 68 48 cache_check (fastphoto_t * params) … … 70 50 int ret; 71 51 72 if ((ret = file_check(¶ms->out)) != 1) {52 if ((ret = photo_stat (¶ms->out)) != 1) { 73 53 return ret; 74 54 } 75 55 76 if ((ret = file_check(¶ms->in)) != 1) {56 if ((ret = photo_stat (¶ms->in)) != 1) { 77 57 return ret; 78 58 } fastphoto/trunk/src/cache.h
r134 r135 7 7 int memory_send (fastphoto_t * params); 8 8 9 int file_check (photo_t * photo);10 11 12 9 #endif /* __CACHE_H__ */ fastphoto/trunk/src/cgi.c
r134 r135 7 7 #include "fastphoto.h" 8 8 #include "cache.h" 9 10 #define CONTENT_TYPE_JPEG "Content-Type: image/jpeg\n" 11 12 #define BUFSIZE 4096 9 #include "header.h" 10 #include "photo.h" 13 11 14 12 static void … … 106 104 return 1; 107 105 } 106 107 size_t 108 send_memory (fastphoto_t * params) 109 { 110 size_t n = fwrite (params->data, 1, params->data_size, stdout); 111 fflush (stdout); 112 return n; 113 } 114 115 int 116 cgi_send (fastphoto_t * params) 117 { 118 header_content_length (params->out.size); 119 header_end(); 120 121 if (params->out.name) { 122 photo_put (¶ms->out); 123 } else { 124 fprintf (stderr, "fastphoto: Sending from memory ...\n"); 125 send_memory (params); 126 } 127 128 return 1; 129 } fastphoto/trunk/src/cgi.h
r131 r135 7 7 int cgi_send (fastphoto_t * params); 8 8 9 size_t send_memory (fastphoto_t * params); 10 9 11 #endif /* __CGI_H__ */ fastphoto/trunk/src/main.c
r134 r135 12 12 #include "header.h" 13 13 #include "resize.h" 14 #include "send.h"15 14 16 15 static void … … 173 172 if (!err) { 174 173 if (cgi) { 175 send (¶ms);174 cgi_send (¶ms); 176 175 } else if (!params.out.name) { 177 176 send_memory (¶ms); fastphoto/trunk/src/resize.c
r134 r135 3 3 4 4 #include "fastphoto.h" 5 #include " cache.h" /* file_check() */5 #include "photo.h" 6 6 7 7 int … … 59 59 60 60 if (params->out.name) 61 file_check(¶ms->out);61 photo_stat (¶ms->out); 62 62 else 63 63 params->out.size = (off_t)params->data_size;
