From 9234f29e673632d15f6a19cf5eda675cde392e44 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 15 Sep 2010 06:43:36 +0000 Subject: bugfix [#23405] PNG Images bigger then 2gig wont load with blender. all image formats should be able to load files bigger then 2gig (when its supported) --- source/blender/imbuf/intern/IMB_filetype.h | 28 ++++++++++++++-------------- source/blender/imbuf/intern/allocimbuf.c | 2 ++ source/blender/imbuf/intern/bmp.c | 2 +- source/blender/imbuf/intern/filetype.c | 1 + source/blender/imbuf/intern/iris.c | 2 +- source/blender/imbuf/intern/jp2.c | 2 +- source/blender/imbuf/intern/jpeg.c | 6 +++--- source/blender/imbuf/intern/module.c | 1 + source/blender/imbuf/intern/png.c | 4 ++-- source/blender/imbuf/intern/radiance_hdr.c | 2 +- source/blender/imbuf/intern/readimage.c | 6 +++--- source/blender/imbuf/intern/targa.c | 6 +++--- source/blender/imbuf/intern/tiff.c | 6 +++--- 13 files changed, 36 insertions(+), 32 deletions(-) (limited to 'source/blender/imbuf/intern') diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index 9fd4108bee9..8529c72c7ae 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -37,9 +37,9 @@ typedef struct ImFileType { int (*is_a)(unsigned char *buf); int (*ftype)(struct ImFileType *type, struct ImBuf *ibuf); - struct ImBuf *(*load)(unsigned char *mem, int size, int flags); + struct ImBuf *(*load)(unsigned char *mem, size_t size, int flags); int (*save)(struct ImBuf *ibuf, char *name, int flags); - void (*load_tile)(struct ImBuf *ibuf, unsigned char *mem, int size, int tx, int ty, unsigned int *rect); + void (*load_tile)(struct ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect); int flag; int filetype; @@ -60,59 +60,59 @@ void imb_tile_cache_tile_free(struct ImBuf *ibuf, int tx, int ty); /* png */ int imb_is_a_png(unsigned char *buf); -struct ImBuf *imb_loadpng(unsigned char *mem, int size, int flags); +struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags); int imb_savepng(struct ImBuf *ibuf, char *name, int flags); /* targa */ int imb_is_a_targa(unsigned char *buf); -struct ImBuf *imb_loadtarga(unsigned char *mem, int size, int flags); +struct ImBuf *imb_loadtarga(unsigned char *mem, size_t size, int flags); int imb_savetarga(struct ImBuf * ibuf, char *name, int flags); /* iris */ int imb_is_a_iris(unsigned char *mem); -struct ImBuf *imb_loadiris(unsigned char *mem, int size, int flags); +struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags); int imb_saveiris(struct ImBuf * ibuf, char *name, int flags); /* jp2 */ int imb_is_a_jp2(unsigned char *buf); -struct ImBuf *imb_jp2_decode(unsigned char *mem, int size, int flags); +struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags); int imb_savejp2(struct ImBuf *ibuf, char *name, int flags); /* jpeg */ int imb_is_a_jpeg(unsigned char *mem); int imb_savejpeg(struct ImBuf * ibuf, char * name, int flags); struct ImBuf * imb_ibJpegImageFromFilename (const char * filename, int flags); -struct ImBuf * imb_load_jpeg (unsigned char * buffer, int size, int flags); +struct ImBuf * imb_load_jpeg (unsigned char * buffer, size_t size, int flags); /* bmp */ int imb_is_a_bmp(unsigned char *buf); -struct ImBuf *imb_bmp_decode(unsigned char *mem, int size, int flags); +struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags); int imb_savebmp(struct ImBuf *ibuf, char *name, int flags); /* cocoa */ -struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, int size, int flags); +struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, size_t size, int flags); short imb_cocoaSaveImage(struct ImBuf *ibuf, char *name, int flags); /* cineon */ int imb_savecineon(struct ImBuf *buf, char *myfil, int flags); -struct ImBuf *imb_loadcineon(unsigned char *mem, int size, int flags); +struct ImBuf *imb_loadcineon(unsigned char *mem, size_t size, int flags); int imb_is_cineon(unsigned char *buf); /* dpx */ int imb_save_dpx(struct ImBuf *buf, char *myfile, int flags); -struct ImBuf *imb_loaddpx(unsigned char *mem, int size, int flags); +struct ImBuf *imb_loaddpx(unsigned char *mem, size_t size, int flags); int imb_is_dpx(unsigned char *buf); /* hdr */ int imb_is_a_hdr(unsigned char *buf); -struct ImBuf *imb_loadhdr(unsigned char *mem, int size, int flags); +struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags); int imb_savehdr(struct ImBuf * ibuf, char *name, int flags); /* tiff */ void imb_inittiff(void); int imb_is_a_tiff(unsigned char *buf); -struct ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags); -void imb_loadtiletiff(struct ImBuf *ibuf, unsigned char *mem, int size, +struct ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags); +void imb_loadtiletiff(struct ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect); int imb_savetiff(struct ImBuf *ibuf, char *name, int flags); void *libtiff_findsymbol(char *name); diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 3f440c0bf6f..02fc98f2d63 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -32,6 +32,8 @@ /* It's become a bit messy... Basically, only the IMB_ prefixed files * should remain. */ +#include + #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index bdcf60090c3..450b09c923b 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -101,7 +101,7 @@ int imb_is_a_bmp(unsigned char *buf) { return checkbmp(buf); } -struct ImBuf *imb_bmp_decode(unsigned char *mem, int size, int flags) +struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) { struct ImBuf *ibuf = 0; BMPINFOHEADER bmi; diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c index db2eef759dc..fb5d2f2e4d7 100644 --- a/source/blender/imbuf/intern/filetype.c +++ b/source/blender/imbuf/intern/filetype.c @@ -22,6 +22,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" #include "IMB_filetype.h" diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index c676c401ccd..883de823745 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -244,7 +244,7 @@ int imb_is_a_iris(unsigned char *mem) * */ -struct ImBuf *imb_loadiris(unsigned char *mem, int size, int flags) +struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) { unsigned int *base, *lptr = NULL; float *fbase, *fptr = NULL; diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 558eaedf8b2..a70c154014a 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -90,7 +90,7 @@ void info_callback(const char *msg, void *client_data) { -struct ImBuf *imb_jp2_decode(unsigned char *mem, int size, int flags) +struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) { struct ImBuf *ibuf = 0; int use_float = 0; /* for precision higher then 8 use float */ diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 2bae7228220..855c0bf3433 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -58,7 +58,7 @@ static void init_source(j_decompress_ptr cinfo); static boolean fill_input_buffer(j_decompress_ptr cinfo); static void skip_input_data(j_decompress_ptr cinfo, long num_bytes); static void term_source(j_decompress_ptr cinfo); -static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, int size); +static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t size); static boolean handle_app1 (j_decompress_ptr cinfo); static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int flags); @@ -167,7 +167,7 @@ static void term_source(j_decompress_ptr cinfo) { } -static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, int size) +static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t size) { my_src_ptr src; @@ -459,7 +459,7 @@ ImBuf * imb_ibJpegImageFromFilename (const char * filename, int flags) return(ibuf); } -ImBuf * imb_load_jpeg (unsigned char * buffer, int size, int flags) +ImBuf * imb_load_jpeg (unsigned char * buffer, size_t size, int flags) { struct jpeg_decompress_struct _cinfo, *cinfo = &_cinfo; struct my_error_mgr jerr; diff --git a/source/blender/imbuf/intern/module.c b/source/blender/imbuf/intern/module.c index 5438066d164..f291c0de776 100644 --- a/source/blender/imbuf/intern/module.c +++ b/source/blender/imbuf/intern/module.c @@ -22,6 +22,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include #include "IMB_imbuf.h" #include "IMB_filetype.h" diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 6344b227174..6b21f20b3fb 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -286,7 +286,7 @@ int imb_savepng(struct ImBuf *ibuf, char *name, int flags) return(1); } -struct ImBuf *imb_loadpng(unsigned char *mem, int size, int flags) +struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) { struct ImBuf *ibuf = 0; png_structp png_ptr; @@ -317,7 +317,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, int size, int flags) return 0; } - ps.size = size; + ps.size = size; /* XXX, 4gig limit! */ ps.data = mem; ps.seek = 0; diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index c5122ebe46c..4064246c866 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -173,7 +173,7 @@ int imb_is_a_hdr(unsigned char *buf) return 0; } -struct ImBuf *imb_loadhdr(unsigned char *mem, int size, int flags) +struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags) { struct ImBuf* ibuf; RGBE* sline; diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 3f4e177c78b..a56007f15f0 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -46,7 +46,7 @@ #include "IMB_imbuf.h" #include "IMB_filetype.h" -ImBuf *IMB_ibImageFromMemory(unsigned char *mem, int size, int flags) +ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags) { ImBuf *ibuf; ImFileType *type; @@ -79,7 +79,7 @@ ImBuf *IMB_loadifffile(int file, int flags) { ImBuf *ibuf; unsigned char *mem; - int size; + size_t size; if(file == -1) return 0; @@ -166,7 +166,7 @@ static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int { ImFileType *type; unsigned char *mem; - int size; + size_t size; if(file == -1) return; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index b5434b85b5a..ada1f448bfc 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -359,7 +359,7 @@ static void complete_partial_load(struct ImBuf *ibuf, unsigned int *rect) } } -static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, int mem_size, int psize) +static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size, int psize) { unsigned char *mem_end = mem+mem_size; int count, col, size; @@ -470,7 +470,7 @@ partial_load: complete_partial_load(ibuf, rect); } -static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, int mem_size, int psize) +static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, int psize) { unsigned char *mem_end = mem+mem_size; int col,size; @@ -527,7 +527,7 @@ partial_load: } -struct ImBuf *imb_loadtarga(unsigned char *mem, int mem_size, int flags) +struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags) { TARGA tga; struct ImBuf * ibuf; diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 6b94583f17d..5b77c6c7c36 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -262,7 +262,7 @@ static toff_t imb_tiff_SizeProc(thandle_t handle) return (toff_t)(mfile->size); } -static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, unsigned char *mem, int size) +static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, unsigned char *mem, size_t size) { /* open the TIFF client layer interface to the in-memory file */ memFile->mem = mem; @@ -464,7 +464,7 @@ void imb_inittiff(void) * * @return: A newly allocated ImBuf structure if successful, otherwise NULL. */ -ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags) +ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags) { TIFF *image = NULL; ImBuf *ibuf = NULL, *hbuf; @@ -573,7 +573,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags) return ibuf; } -void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, int size, int tx, int ty, unsigned int *rect) +void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect) { TIFF *image = NULL; uint32 width, height; -- cgit v1.2.3