diff options
author | godspeed1989 <tongxinjichu@gmail.com> | 2013-05-03 22:38:48 +0800 |
---|---|---|
committer | godspeed1989 <tongxinjichu@gmail.com> | 2013-05-03 22:38:48 +0800 |
commit | e0ca0d4bcbd1195dc6f173c07bdfa61335306746 (patch) | |
tree | 7e1b6ec192ab90fee882b2633b3d5c167cd91678 | |
parent | 4d223e6127f03b9218e8c8febb8005c44d3224c4 (diff) | |
download | fbv-e0ca0d4bcbd1195dc6f173c07bdfa61335306746.tar.gz fbv-e0ca0d4bcbd1195dc6f173c07bdfa61335306746.zip |
fix compile error
-rw-r--r-- | bmp.c | 1 | ||||
-rw-r--r-- | jpeg.c | 26 | ||||
-rw-r--r-- | png.c | 15 |
3 files changed, 17 insertions, 25 deletions
@@ -1,7 +1,6 @@ #include "config.h" #ifdef FBV_SUPPORT_BMP - #include "fbv.h" #include <sys/types.h> #include <sys/stat.h> @@ -1,15 +1,15 @@ #include "config.h" #ifdef FBV_SUPPORT_JPEG +#include "fbv.h" #include <stdio.h> #include <string.h> +#include <jpeglib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <jpeglib.h> #include <setjmp.h> #include <unistd.h> -#include "fbv.h" struct r_jpeg_error_mgr { @@ -45,7 +45,7 @@ int fh_jpeg_load(char *filename, unsigned char *buffer, unsigned char ** alpha, struct jpeg_decompress_struct *ciptr; struct r_jpeg_error_mgr emgr; unsigned char *bp; - int px, py, c; + int px, c; FILE *fh; JSAMPLE *lb; @@ -53,27 +53,25 @@ int fh_jpeg_load(char *filename, unsigned char *buffer, unsigned char ** alpha, if(!(fh=fopen(filename,"rb"))) return(FH_ERROR_FILE); ciptr->err = jpeg_std_error(&emgr.pub); emgr.pub.error_exit = jpeg_cb_error_exit; - if(setjmp(emgr.envbuffer)==1) + if(setjmp(emgr.envbuffer)) { - // FATAL ERROR - Free the object and return... jpeg_destroy_decompress(ciptr); fclose(fh); return(FH_ERROR_FORMAT); } jpeg_create_decompress(ciptr); - jpeg_stdio_src(ciptr,fh); + jpeg_stdio_src(ciptr, fh); jpeg_read_header(ciptr, TRUE); ciptr->out_color_space = JCS_RGB; jpeg_start_decompress(ciptr); px = ciptr->output_width; - py = ciptr->output_height; c = ciptr->output_components; if(c==3) { - lb = (*ciptr->mem->alloc_small)((j_common_ptr) ciptr,JPOOL_PERMANENT,c*px); + lb = (*ciptr->mem->alloc_small)((j_common_ptr)ciptr, JPOOL_PERMANENT, c*px); bp = buffer; while (ciptr->output_scanline < ciptr->output_height) { @@ -93,30 +91,28 @@ int fh_jpeg_getsize(char *filename, int *x, int *y) struct jpeg_decompress_struct cinfo; struct jpeg_decompress_struct *ciptr; struct r_jpeg_error_mgr emgr; - int px, py, c; + int px, py; FILE *fh; - ciptr=&cinfo; + ciptr = &cinfo; if(!(fh=fopen(filename,"rb"))) return(FH_ERROR_FILE); ciptr->err = jpeg_std_error(&emgr.pub); emgr.pub.error_exit = jpeg_cb_error_exit; - if(setjmp(emgr.envbuffer)==1) + if(setjmp(emgr.envbuffer)) { - // FATAL ERROR - Free the object and return... jpeg_destroy_decompress(ciptr); fclose(fh); return(FH_ERROR_FORMAT); } jpeg_create_decompress(ciptr); - jpeg_stdio_src(ciptr,fh); - jpeg_read_header(ciptr,TRUE); + jpeg_stdio_src(ciptr, fh); + jpeg_read_header(ciptr, TRUE); ciptr->out_color_space = JCS_RGB; jpeg_start_decompress(ciptr); px = ciptr->output_width; py = ciptr->output_height; - c = ciptr->output_components; *x = px; *y = py; jpeg_destroy_decompress(ciptr); @@ -1,14 +1,14 @@ #include "config.h" #ifdef FBV_SUPPORT_PNG -#include <png.h> #include "fbv.h" +#include <stdlib.h> +#include <string.h> +#include <png.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> -#include <stdlib.h> -#include <string.h> #define PNG_BYTES_TO_CHECK 4 #ifndef min @@ -64,7 +64,7 @@ int fh_png_load(char *name,unsigned char *buffer, unsigned char ** alpha,int x,i png_init_io(png_ptr,fh); png_read_info(png_ptr, info_ptr); - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,&interlace_type, NULL, NULL); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL); if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_expand(png_ptr); if (bit_depth < 8) png_set_packing(png_ptr); if (color_type == PNG_COLOR_TYPE_GRAY || color_type== PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr); @@ -76,7 +76,7 @@ int fh_png_load(char *name,unsigned char *buffer, unsigned char ** alpha,int x,i if(bit_depth == 16) png_set_strip_16(png_ptr); number_passes = png_set_interlace_handling(png_ptr); - png_read_update_info(png_ptr,info_ptr); + png_read_update_info(png_ptr, info_ptr); if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA || color_type == PNG_COLOR_TYPE_RGB_ALPHA || trans) { @@ -92,14 +92,11 @@ int fh_png_load(char *name,unsigned char *buffer, unsigned char ** alpha,int x,i { fbptr = buffer; aptr = alpha_buffer; - for(i=0; i<height; i++) { int n; unsigned char *trp = rp; - png_read_rows(png_ptr, rptr, NULL, 1); - for(n = 0; n < width; n++, fbptr += 3, trp += 4) { memcpy(fbptr, trp, 3); @@ -159,7 +156,7 @@ int fh_png_getsize(char *name, int *x, int *y) png_init_io(png_ptr,fh); png_read_info(png_ptr, info_ptr); - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,&interlace_type, NULL, NULL); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL); png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); *x = width; *y = height; |