diff options
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/CMakeLists.txt | 6 | ||||
-rw-r--r-- | source/blender/imbuf/SConscript | 1 | ||||
-rw-r--r-- | source/blender/imbuf/intern/bmp.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineonlib.c | 5 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/dpxlib.c | 7 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logImageLib.c | 3 | ||||
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 8 | ||||
-rw-r--r-- | source/blender/imbuf/intern/iris.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/jp2.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/jpeg.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/png.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/radiance_hdr.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/readimage.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/targa.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/thumbs.c | 7 | ||||
-rw-r--r-- | source/blender/imbuf/intern/thumbs_blend.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/util.c | 2 |
17 files changed, 41 insertions, 26 deletions
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 649b7cb1c11..aa4454562b4 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -180,4 +180,10 @@ if(WITH_IMAGE_HDR) add_definitions(-DWITH_HDR) endif() +if(WIN32) + list(APPEND INC + ../../../intern/utfconv + ) +endif() + blender_add_lib(bf_imbuf "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript index ca56003845f..b2b526ca17d 100644 --- a/source/blender/imbuf/SConscript +++ b/source/blender/imbuf/SConscript @@ -17,6 +17,7 @@ defs = [] if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] + incs += ' ../../../intern/utfconv' if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 1b6184c8b58..1e13f5d913b 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -216,7 +216,7 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y; data = (uchar *) ibuf->rect; - ofile = fopen(name,"wb"); + ofile = BLI_fopen(name,"wb"); if (!ofile) return 0; putShortLSB(19778,ofile); /* "BM" */ diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index 810ed7b26a4..a10d8c67051 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -38,6 +38,7 @@ #include <string.h> /* memset */ #include "BLI_utildefines.h" +#include "BLI_fileops.h" #include "cin_debug_stuff.h" #include "logmemfile.h" @@ -523,7 +524,7 @@ cineonOpen(const char* filename) { cineon->memcursor = 0; cineon->membuffersize = 0; - cineon->file = fopen(filename, "rb"); + cineon->file = BLI_fopen(filename, "rb"); if (cineon->file == 0) { if (verbose) d_printf("Failed to open file \"%s\".\n", filename); cineonClose(cineon); @@ -727,7 +728,7 @@ cineonCreate(const char* filename, int width, int height, int depth) { cineon->lineBuffer = 0; cineon->pixelBuffer = 0; - cineon->file = fopen(filename, "wb"); + cineon->file = BLI_fopen(filename, "wb"); if (cineon->file == 0) { if (verbose) d_printf("Couldn't open file %s\n", filename); cineonClose(cineon); diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c index a63a2ea1dab..01177b01178 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.c +++ b/source/blender/imbuf/intern/cineon/dpxlib.c @@ -38,6 +38,7 @@ #include <string.h> /* memset */ #include "cin_debug_stuff.h" #include "logmemfile.h" +#include "BLI_fileops.h" static void fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) { @@ -401,7 +402,7 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) { if (mode == LFREALFILE) { filename = bytestuff; - dpx->file = fopen(filename, "rb"); + dpx->file = BLI_fopen(filename, "rb"); if (dpx->file == 0) { if (verbose) d_printf("Failed to open file \"%s\".\n", filename); dpxClose(dpx); @@ -589,7 +590,7 @@ dpxCreate(const char* filename, int width, int height, int depth) { dpx->lineBuffer = 0; dpx->pixelBuffer = 0; - dpx->file = fopen(filename, "wb"); + dpx->file = BLI_fopen(filename, "wb"); if (dpx->file == 0) { if (verbose) d_printf("Couldn't open file %s\n", filename); dpxClose(dpx); @@ -687,7 +688,7 @@ dpxDump(const char* filename) { DpxMainHeader header; FILE* file; - file = fopen(filename, "rb"); + file = BLI_fopen(filename, "rb"); if (file == 0) { d_printf("Failed to open file \"%s\".\n", filename); return; diff --git a/source/blender/imbuf/intern/cineon/logImageLib.c b/source/blender/imbuf/intern/cineon/logImageLib.c index 123d0b42979..dc50d93bf18 100644 --- a/source/blender/imbuf/intern/cineon/logImageLib.c +++ b/source/blender/imbuf/intern/cineon/logImageLib.c @@ -36,6 +36,7 @@ #include <netinet/in.h> /* htonl() */ #endif #include <string.h> /* memset */ +#include "BLI_fileops.h" #define MIN_GAMMA 0.01 #define MAX_GAMMA 99.9 @@ -154,7 +155,7 @@ logImageDump(const char* filename) U32 magic; - FILE* foo = fopen(filename, "rb"); + FILE* foo = BLI_fopen(filename, "rb"); if (foo == 0) { return; } diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index cf354371ddc..dcbce6d028c 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -81,7 +81,7 @@ anim_index_builder * IMB_index_builder_create(const char * name) BLI_make_existing_file(rv->temp_name); - rv->fp = fopen(rv->temp_name, "wb"); + rv->fp = BLI_fopen(rv->temp_name, "wb"); if (!rv->fp) { fprintf(stderr, "Couldn't open index target: %s! " @@ -140,7 +140,7 @@ void IMB_index_builder_finish(anim_index_builder * fp, int rollback) unlink(fp->temp_name); } else { unlink(fp->name); - rename(fp->temp_name, fp->name); + BLI_rename(fp->temp_name, fp->name); } MEM_freeN(fp); @@ -150,7 +150,7 @@ struct anim_index * IMB_indexer_open(const char * name) { char header[13]; struct anim_index * idx; - FILE * fp = fopen(name, "rb"); + FILE * fp = BLI_fopen(name, "rb"); int i; if (!fp) { @@ -690,7 +690,7 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx * ctx, get_proxy_filename(ctx->anim, ctx->proxy_size, fname, FALSE); unlink(fname); - rename(fname_tmp, fname); + BLI_rename(fname_tmp, fname); } MEM_freeN(ctx); diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 83351b5e0e4..38fc6f92c83 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -674,7 +674,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons int rlebuflen, goodwrite; goodwrite = 1; - outf = fopen(name, "wb"); + outf = BLI_fopen(name, "wb"); if(!outf) return 0; tablen = ysize*zsize*sizeof(int); diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index c2bdb44be10..87450170c66 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -731,7 +731,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) codestream_length = cio_tell(cio); /* write the buffer to disk */ - f = fopen(name, "wb"); + f = BLI_fopen(name, "wb"); if (!f) { fprintf(stderr, "failed to open %s for writing\n", name); diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 2aab497649a..75a5f274413 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -608,7 +608,7 @@ static int save_stdjpeg(const char *name, struct ImBuf *ibuf) struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo; struct my_error_mgr jerr; - if ((outfile = fopen(name, "wb")) == NULL) return 0; + if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0; jpeg_default_quality = 75; cinfo->err = jpeg_std_error(&jerr.pub); @@ -642,7 +642,7 @@ static int save_vidjpeg(const char *name, struct ImBuf *ibuf) struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo; struct my_error_mgr jerr; - if ((outfile = fopen(name, "wb")) == NULL) return 0; + if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0; jpeg_default_quality = 90; cinfo->err = jpeg_std_error(&jerr.pub); @@ -712,7 +712,7 @@ static int save_maxjpeg(const char *name, struct ImBuf *ibuf) struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo; struct my_error_mgr jerr; - if ((outfile = fopen(name, "wb")) == NULL) return 0; + if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0; jpeg_default_quality = 100; cinfo->err = jpeg_std_error(&jerr.pub); diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 84f3e18591d..78c7c672e22 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -195,7 +195,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) Flush); } else { - fp = fopen(name, "wb"); + fp = BLI_fopen(name, "wb"); if (!fp) { png_destroy_write_struct(&png_ptr, &info_ptr); MEM_freeN(pixels); diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 9265da8d8dc..42e4db54f3f 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -332,7 +332,7 @@ static void writeHeader(FILE *file, int width, int height) int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags) { - FILE* file = fopen(name, "wb"); + FILE* file = BLI_fopen(name, "wb"); float *fp= NULL; int y, width=ibuf->x, height=ibuf->y; unsigned char *cp= NULL; diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index c2f73efa63f..2ee389a42f6 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -126,7 +126,7 @@ ImBuf *IMB_loadiffname(const char *filepath, int flags) imb_cache_filename(filepath_tx, filepath, flags); - file = open(filepath_tx, O_BINARY|O_RDONLY); + file = BLI_open(filepath_tx, O_BINARY|O_RDONLY, 0); if(file < 0) return NULL; ibuf= IMB_loadifffile(file, flags, filepath_tx); @@ -152,7 +152,7 @@ ImBuf *IMB_testiffname(const char *filepath, int flags) imb_cache_filename(filepath_tx, filepath, flags); - file = open(filepath_tx,O_BINARY|O_RDONLY); + file = BLI_open(filepath_tx,O_BINARY|O_RDONLY,0); if(file < 0) return NULL; ibuf=IMB_loadifffile(file, flags|IB_test|IB_multilayer, filepath_tx); @@ -195,7 +195,7 @@ void imb_loadtile(ImBuf *ibuf, int tx, int ty, unsigned int *rect) { int file; - file = open(ibuf->cachename, O_BINARY|O_RDONLY); + file = BLI_open(ibuf->cachename, O_BINARY|O_RDONLY, 0); if(file < 0) return; imb_loadtilefile(ibuf, file, tx, ty, rect); diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index b5552a174a9..1801c1a8ef9 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -268,7 +268,7 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags) if (ibuf->planes==32) { buf[17] |= 0x08; } - fildes = fopen(name,"wb"); + fildes = BLI_fopen(name,"wb"); if (!fildes) return 0; if (fwrite(buf, 1, 18,fildes) != 18) { diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index fdc9e50bcd8..be716870dad 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -61,6 +61,7 @@ #include <process.h> /* getpid */ #include <direct.h> /* chdir */ #include "BLI_winstuff.h" +#include "utfconv.h" #else #include <unistd.h> #endif @@ -70,8 +71,12 @@ static int get_thumb_dir( char* dir , ThumbSize size) { #ifdef WIN32 + wchar_t dir_16 [MAX_PATH]; /* yes, applications shouldn't store data there, but so does GIMP :)*/ - SHGetSpecialFolderPath(0, dir, CSIDL_PROFILE, 0); + SHGetSpecialFolderPathW(0, dir_16, CSIDL_PROFILE, 0); + conv_utf_16_to_8(dir_16,dir,FILE_MAX); + + #else const char* home = getenv("HOME"); if (!home) return 0; diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index 1068eccc6e0..fd0be89df0d 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -30,6 +30,7 @@ #include "zlib.h" #include "BLI_utildefines.h" +#include "BLI_fileops.h" #include "BKE_utildefines.h" #include "BKE_global.h" @@ -123,9 +124,8 @@ static ImBuf *loadblend_thumb(gzFile gzfile) ImBuf *IMB_loadblend_thumb(const char *path) { gzFile gzfile; - /* not necessarily a gzip */ - gzfile = gzopen(path, "rb"); + gzfile = BLI_gzopen(path, "rb"); if (NULL == gzfile ) { return NULL; diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index b7eba1002c5..fdcc0641628 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -159,7 +159,7 @@ static int IMB_ispic_name(const char *name) if(((st.st_mode) & S_IFMT) != S_IFREG) return FALSE; - if((fp = open(name,O_BINARY|O_RDONLY)) < 0) + if((fp = BLI_open(name,O_BINARY|O_RDONLY, 0)) < 0) return FALSE; if(read(fp, buf, 32) != 32) { |