From 5a093689570d27df5ecd7394284a670fc32234b5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 19 Nov 2010 02:14:18 +0000 Subject: use 'const char *' for imbuf and file ops. --- source/blender/imbuf/IMB_imbuf.h | 8 ++++---- source/blender/imbuf/intern/IMB_filetype.h | 24 +++++++++++----------- source/blender/imbuf/intern/anim_movie.c | 2 +- source/blender/imbuf/intern/bmp.c | 2 +- source/blender/imbuf/intern/cineon/cineon_dpx.c | 6 +++--- source/blender/imbuf/intern/dds/dds_api.cpp | 2 +- source/blender/imbuf/intern/dds/dds_api.h | 2 +- source/blender/imbuf/intern/iris.c | 4 ++-- source/blender/imbuf/intern/jp2.c | 2 +- source/blender/imbuf/intern/jpeg.c | 10 ++++----- .../blender/imbuf/intern/openexr/openexr_api.cpp | 6 +++--- source/blender/imbuf/intern/openexr/openexr_api.h | 2 +- source/blender/imbuf/intern/png.c | 2 +- source/blender/imbuf/intern/radiance_hdr.c | 2 +- source/blender/imbuf/intern/targa.c | 2 +- source/blender/imbuf/intern/tiff.c | 2 +- source/blender/imbuf/intern/util.c | 14 ++++++------- source/blender/imbuf/intern/writeimage.c | 2 +- 18 files changed, 47 insertions(+), 47 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 4fcb1ffab81..eff42e48dad 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -206,7 +206,7 @@ void IMB_close_anim(struct anim *anim); * @attention Defined in anim.c */ -int ismovie(char *name); +int ismovie(const char *name); void IMB_anim_set_preseek(struct anim *anim, int preseek); int IMB_anim_get_preseek(struct anim *anim); @@ -296,19 +296,19 @@ short IMB_png_encode(struct ImBuf *ibuf, int file, int flags); * * @attention Defined in util.c */ -int IMB_ispic(char *name); +int IMB_ispic(const char *name); /** * * @attention Defined in util.c */ -int IMB_isanim(char *name); +int IMB_isanim(const char *name); /** * * @attention Defined in util.c */ -int imb_get_anim_type(char *name); +int imb_get_anim_type(const char *name); /** * diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index 8529c72c7ae..f82f93c83a1 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -38,7 +38,7 @@ typedef struct ImFileType { int (*is_a)(unsigned char *buf); int (*ftype)(struct ImFileType *type, struct ImBuf *ibuf); struct ImBuf *(*load)(unsigned char *mem, size_t size, int flags); - int (*save)(struct ImBuf *ibuf, char *name, int flags); + int (*save)(struct ImBuf *ibuf, const char *name, int flags); void (*load_tile)(struct ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect); int flag; @@ -61,52 +61,52 @@ 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, size_t size, int flags); -int imb_savepng(struct ImBuf *ibuf, char *name, int flags); +int imb_savepng(struct ImBuf *ibuf, const char *name, int flags); /* targa */ int imb_is_a_targa(unsigned char *buf); struct ImBuf *imb_loadtarga(unsigned char *mem, size_t size, int flags); -int imb_savetarga(struct ImBuf * ibuf, char *name, int flags); +int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags); /* iris */ int imb_is_a_iris(unsigned char *mem); struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags); -int imb_saveiris(struct ImBuf * ibuf, char *name, int flags); +int imb_saveiris(struct ImBuf * ibuf, const char *name, int flags); /* jp2 */ int imb_is_a_jp2(unsigned char *buf); struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags); -int imb_savejp2(struct ImBuf *ibuf, char *name, int flags); +int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags); /* jpeg */ int imb_is_a_jpeg(unsigned char *mem); -int imb_savejpeg(struct ImBuf * ibuf, char * name, int flags); +int imb_savejpeg(struct ImBuf *ibuf, const char *name, int flags); struct ImBuf * imb_ibJpegImageFromFilename (const char * filename, 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, size_t size, int flags); -int imb_savebmp(struct ImBuf *ibuf, char *name, int flags); +int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags); /* cocoa */ struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, size_t size, int flags); -short imb_cocoaSaveImage(struct ImBuf *ibuf, char *name, int flags); +short imb_cocoaSaveImage(struct ImBuf *ibuf, const char *name, int flags); /* cineon */ -int imb_savecineon(struct ImBuf *buf, char *myfil, int flags); +int imb_savecineon(struct ImBuf *buf, const char *name, 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); +int imb_save_dpx(struct ImBuf *buf, const char *name, 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, size_t size, int flags); -int imb_savehdr(struct ImBuf * ibuf, char *name, int flags); +int imb_savehdr(struct ImBuf * ibuf, const char *name, int flags); /* tiff */ void imb_inittiff(void); @@ -114,7 +114,7 @@ int imb_is_a_tiff(unsigned char *buf); 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); +int imb_savetiff(struct ImBuf *ibuf, const char *name, int flags); void *libtiff_findsymbol(char *name); #endif /* IMB_FILETYPE_H */ diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 421ef08dc25..1bf8eb899db 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -215,7 +215,7 @@ int ismovie(char *name) { #else -int ismovie(char *UNUSED(name)) { +int ismovie(const char *UNUSED(name)) { return 0; } diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 10dc23b1ad2..8aae41b653c 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -195,7 +195,7 @@ static int putShortLSB(unsigned short us,FILE *ofile) { } /* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */ -int imb_savebmp(struct ImBuf *ibuf, char *name, int flags) { +int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) { BMPINFOHEADER infoheader; int bytesize, extrabytes, x, y, t, ptr; diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 7a5a3fb011b..816d2d27b78 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -116,7 +116,7 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int return ibuf; } -static int imb_save_dpx_cineon(ImBuf *buf, char *filename, int use_cineon, int flags) +static int imb_save_dpx_cineon(ImBuf *buf, const char *filename, int use_cineon, int flags) { LogImageByteConversionParameters conversion; int width, height, depth; @@ -182,7 +182,7 @@ static int imb_save_dpx_cineon(ImBuf *buf, char *filename, int use_cineon, int f return 1; } -short imb_savecineon(struct ImBuf *buf, char *myfile, int flags) +short imb_savecineon(struct ImBuf *buf, const char *myfile, int flags) { return imb_save_dpx_cineon(buf, myfile, 1, flags); } @@ -200,7 +200,7 @@ ImBuf *imb_loadcineon(unsigned char *mem, int size, int flags) return NULL; } -short imb_save_dpx(struct ImBuf *buf, char *myfile, int flags) +short imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags) { return imb_save_dpx_cineon(buf, myfile, 0, flags); } diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 08f60589977..94ff8fd5d78 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -37,7 +37,7 @@ extern "C" { #include "IMB_allocimbuf.h" -int imb_save_dds(struct ImBuf * ibuf, char *name, int flags) +int imb_save_dds(struct ImBuf * ibuf, const char *name, int flags) { return(0); /* todo: finish this function */ diff --git a/source/blender/imbuf/intern/dds/dds_api.h b/source/blender/imbuf/intern/dds/dds_api.h index 384570ceb72..6aea3058863 100644 --- a/source/blender/imbuf/intern/dds/dds_api.h +++ b/source/blender/imbuf/intern/dds/dds_api.h @@ -29,7 +29,7 @@ extern "C" { #endif -int imb_save_dds(struct ImBuf *ibuf, char *name, int flags); +int imb_save_dds(struct ImBuf *ibuf, const char *name, int flags); int imb_is_a_dds(unsigned char *mem); /* use only first 32 bytes of mem */ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags); diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 71ba9b06cad..4e74132cdc7 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -662,7 +662,7 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z) * Added: zbuf write */ -static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, char *name, int *zptr) +static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, const char *name, int *zptr) { FILE *outf; IMAGE *image; @@ -816,7 +816,7 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn return optr - (unsigned char *)rlebuf; } -int imb_saveiris(struct ImBuf * ibuf, char *name, int flags) +int imb_saveiris(struct ImBuf * ibuf, const char *name, int flags) { short zsize; int ret; diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 0403d0044f5..3f0443e5a88 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -661,7 +661,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) { /* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */ -int imb_savejp2(struct ImBuf *ibuf, char *name, int flags) { +int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) { int quality = ibuf->ftype & 0xff; diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index e7737e68fce..c685a54cbe9 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -622,7 +622,7 @@ static int init_jpeg(FILE * outfile, struct jpeg_compress_struct * cinfo, struct } -static int save_stdjpeg(char * name, struct ImBuf * ibuf) +static int save_stdjpeg(const char *name, struct ImBuf *ibuf) { FILE * outfile; struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo; @@ -656,7 +656,7 @@ static int save_stdjpeg(char * name, struct ImBuf * ibuf) } -static int save_vidjpeg(char * name, struct ImBuf * ibuf) +static int save_vidjpeg(const char *name, struct ImBuf *ibuf) { FILE * outfile; struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo; @@ -695,7 +695,7 @@ static int save_vidjpeg(char * name, struct ImBuf * ibuf) return 1; } -static int save_jstjpeg(char * name, struct ImBuf * ibuf) +static int save_jstjpeg(const char *name, struct ImBuf *ibuf) { char fieldname[1024]; struct ImBuf * tbuf; @@ -726,7 +726,7 @@ static int save_jstjpeg(char * name, struct ImBuf * ibuf) return returnval; } -static int save_maxjpeg(char * name, struct ImBuf * ibuf) +static int save_maxjpeg(const char *name, struct ImBuf *ibuf) { FILE * outfile; struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo; @@ -765,7 +765,7 @@ static int save_maxjpeg(char * name, struct ImBuf * ibuf) return 1; } -int imb_savejpeg(struct ImBuf * ibuf, char * name, int flags) +int imb_savejpeg(struct ImBuf *ibuf, const char *name, int flags) { ibuf->flags = flags; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 2be935a9565..964e57f6cfe 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -187,7 +187,7 @@ static void openexr_header_metadata(Header *header, struct ImBuf *ibuf) header->insert(info->key, StringAttribute(info->value)); } -static int imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags) +static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags) { int channels = ibuf->channels; int width = ibuf->x; @@ -314,7 +314,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags) return (1); } -static int imb_save_openexr_float(struct ImBuf *ibuf, char *name, int flags) +static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flags) { int channels = ibuf->channels; int width = ibuf->x; @@ -372,7 +372,7 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, char *name, int flags) } -int imb_save_openexr(struct ImBuf *ibuf, char *name, int flags) +int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags) { if (flags & IB_mem) { diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h index c7e4c7d2f57..8ca6dcd36e9 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.h +++ b/source/blender/imbuf/intern/openexr/openexr_api.h @@ -46,7 +46,7 @@ extern "C" { int imb_is_a_openexr (unsigned char *mem); -int imb_save_openexr (struct ImBuf *ibuf, char *name, int flags); +int imb_save_openexr (struct ImBuf *ibuf, const char *name, int flags); struct ImBuf *imb_load_openexr (unsigned char *mem, size_t size, int flags); diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index b29a4ae0627..0acefac45b5 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -94,7 +94,7 @@ static void ReadData( png_structp png_ptr, png_bytep data, png_size_t length) longjmp(png_jmpbuf(png_ptr), 1); } -int imb_savepng(struct ImBuf *ibuf, char *name, int flags) +int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) { png_structp png_ptr; png_infop info_ptr; diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index b356f56ab74..9dbb4512e1f 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -333,7 +333,7 @@ static void writeHeader(FILE *file, int width, int height) fputc(10, file); } -int imb_savehdr(struct ImBuf *ibuf, char *name, int flags) +int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags) { FILE* file = fopen(name, "wb"); float *fp= NULL; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index bc88f2bed0d..a748cc1ab1d 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -233,7 +233,7 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file) } -int imb_savetarga(struct ImBuf * ibuf, char *name, int flags) +int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags) { char buf[20]= {0}; FILE *fildes; diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index eb5d1f2c039..c086a55a70a 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -642,7 +642,7 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int * @return: 1 if the function is successful, 0 on failure. */ -int imb_savetiff(ImBuf *ibuf, char *name, int flags) +int imb_savetiff(ImBuf *ibuf, const char *name, int flags) { TIFF *image = NULL; uint16 samplesperpixel, bitspersample; diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index cd447e5e43a..0365b712f24 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -142,7 +142,7 @@ const char *imb_ext_audio[] = { ".eac3", NULL}; -static int IMB_ispic_name(char *name) +static int IMB_ispic_name(const char *name) { ImFileType *type; struct stat st; @@ -176,7 +176,7 @@ static int IMB_ispic_name(char *name) return FALSE; } -int IMB_ispic(char *filename) +int IMB_ispic(const char *filename) { if(U.uiflag & USER_FILTERFILEEXTS) { if( (BLI_testextensie_array(filename, imb_ext_image)) || @@ -195,12 +195,12 @@ int IMB_ispic(char *filename) -static int isavi (char *name) { +static int isavi (const char *name) { return AVI_is_avi (name); } #ifdef WITH_QUICKTIME -static int isqtime (char *name) { +static int isqtime (const char *name) { return anim_is_quicktime (name); } #endif @@ -248,7 +248,7 @@ static AVCodecContext* get_codec_from_stream(AVStream* stream) #endif -static int isffmpeg (char *filename) { +static int isffmpeg (const char *filename) { AVFormatContext *pFormatCtx; unsigned int i; int videoStream; @@ -331,7 +331,7 @@ static int isredcode(char * filename) #endif -int imb_get_anim_type(char * name) { +int imb_get_anim_type(const char * name) { int type; struct stat st; @@ -372,7 +372,7 @@ int imb_get_anim_type(char * name) { return(0); } -int IMB_isanim(char *filename) { +int IMB_isanim(const char *filename) { int type; if(U.uiflag & USER_FILTERFILEEXTS) { diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c index 98a7399c000..9c2855b0544 100644 --- a/source/blender/imbuf/intern/writeimage.c +++ b/source/blender/imbuf/intern/writeimage.c @@ -51,7 +51,7 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags) IMB_rect_from_float(ibuf); } /* TODO. have const char for image write funcs */ - return type->save(ibuf, (char *)name, flags); + return type->save(ibuf, name, flags); } } -- cgit v1.2.3