Changeset 125
- Timestamp:
- 02/08/06 20:02:37 (3 years ago)
- Files:
-
- fastphoto/trunk/configure.ac (modified) (1 diff)
- fastphoto/trunk/src/Makefile.am (modified) (1 diff)
- fastphoto/trunk/src/cache.c (modified) (1 diff)
- fastphoto/trunk/src/cgi.c (modified) (2 diffs)
- fastphoto/trunk/src/main.c (modified) (2 diffs)
- fastphoto/trunk/src/send.c (added)
- fastphoto/trunk/src/send.h (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fastphoto/trunk/configure.ac
r112 r125 32 32 # Checks for library functions. 33 33 AC_FUNC_REALLOC 34 AC_CHECK_FUNCS([ memmove random])34 AC_CHECK_FUNCS([sendfile]) 35 35 36 36 # Check for valgrind fastphoto/trunk/src/Makefile.am
r107 r125 6 6 bin_PROGRAMS = fastphoto 7 7 8 noinst_HEADERS = alloc_snprintf.h cache.h cgi.h resize.h 8 noinst_HEADERS = alloc_snprintf.h cache.h cgi.h resize.h send.h 9 9 10 fastphoto_SOURCES = main.c alloc_snprintf.c cache.c cgi.c resize.c 10 fastphoto_SOURCES = main.c alloc_snprintf.c cache.c cgi.c resize.c send.c 11 11 fastphoto_LDADD = $(EPEG_LIBS) fastphoto/trunk/src/cache.c
r124 r125 109 109 110 110 int 111 memory_send (fastphoto_t * params)112 {113 fwrite (params->data, 1, params->data_size, stdout);114 }115 116 int117 111 cache_init (fastphoto_t * params, char * path_info) 118 112 { fastphoto/trunk/src/cgi.c
r124 r125 1 #include "config.h" 2 1 3 #include <stdio.h> 2 4 #include <stdlib.h> … … 108 110 content_type_jpeg () 109 111 { 110 return puts (CONTENT_TYPE_JPEG); 112 puts (CONTENT_TYPE_JPEG); 113 fflush (stdout); 114 return 0; 111 115 } 112 113 int114 cgi_send (fastphoto_t * params)115 {116 unsigned char buf[BUFSIZE];117 FILE * fd;118 size_t n;119 120 if (params->outfile) {121 fd = fopen (params->outfile, "rb");122 while ((n = fread (buf, 1, BUFSIZE, fd)) > 0) {123 fwrite (buf, 1, n, stdout);124 }125 fclose (fd);126 } else {127 fprintf (stderr, "fastphoto: Sending from memory ...\n");128 fwrite (params->data, 1, params->data_size, stdout);129 }130 131 return 1;132 }133 fastphoto/trunk/src/main.c
r121 r125 11 11 #include "cgi.h" 12 12 #include "resize.h" 13 #include "send.h" 13 14 14 15 static void … … 171 172 if (!err) { 172 173 if (cgi) { 173 cgi_send (¶ms);174 send (¶ms); 174 175 } else if (!params.outfile) { 175 memory_send(¶ms);176 send_memory (¶ms); 176 177 } 177 178 }
