Index: intern/utfconv/utfconv.c =================================================================== --- intern/utfconv/utfconv.c (revision 45380) +++ intern/utfconv/utfconv.c (working copy) @@ -25,7 +25,7 @@ #include "utfconv.h" -size_t count_utf_8_from_16(wchar_t * string16) +size_t count_utf_8_from_16(const wchar_t * string16) { int i; size_t count = 0; @@ -50,7 +50,7 @@ } -size_t count_utf_16_from_8(char * string8) +size_t count_utf_16_from_8(const char * string8) { size_t count = 0; char u; @@ -88,7 +88,7 @@ -int conv_utf_16_to_8(wchar_t * in16, char * out8, size_t size8) +int conv_utf_16_to_8(const wchar_t * in16, char * out8, size_t size8) { char * out8end = out8+size8; wchar_t u = 0; @@ -139,7 +139,7 @@ } -int conv_utf_8_to_16(char * in8, wchar_t * out16, size_t size16) +int conv_utf_8_to_16(const char * in8, wchar_t * out16, size_t size16) { char u; char type = 0; @@ -186,7 +186,7 @@ return err; } -int is_ascii(char * in8) +int is_ascii(const char * in8) { for(in8; *in8; in8++) if(0x80 & *in8) return 0; @@ -210,7 +210,7 @@ -char * alloc_utf_8_from_16(wchar_t * in16, size_t add) +char * alloc_utf_8_from_16(const wchar_t * in16, size_t add) { size_t bsize = count_utf_8_from_16(in16); char * out8 = NULL; @@ -220,7 +220,7 @@ return out8; } -wchar_t * alloc_utf16_from_8(char * in8, size_t add) +wchar_t * alloc_utf16_from_8(const char * in8, size_t add) { size_t bsize = count_utf_16_from_8(in8); wchar_t * out16 = NULL; Index: intern/utfconv/utfconv.h =================================================================== --- intern/utfconv/utfconv.h (revision 45380) +++ intern/utfconv/utfconv.h (working copy) @@ -38,14 +38,14 @@ * @param string-16 pointer to working utf-16 string * @return How many bytes must be allocated includeng NULL. */ -size_t count_utf_8_from_16(wchar_t * string16); +size_t count_utf_8_from_16(const wchar_t * string16); /** * Counts how many wchar_t (two byte) is requered for for future utf-16 string using utf-8 * @param string-8 pointer to working utf-8 string * @return How many bytes must be allocated includeng NULL. */ -size_t count_utf_16_from_8(char * string8); +size_t count_utf_16_from_8(const char * string8); /** * conv_utf_*** errors @@ -62,7 +62,7 @@ * @params size8 the allocated size in bytes of out8 * @return Returns any errors occured during conversion. See the block above, */ -int conv_utf_16_to_8(wchar_t * in16, char * out8, size_t size8); +int conv_utf_16_to_8(const wchar_t * in16, char * out8, size_t size8); /** * Converts utf-8 string to allocated utf-16 string @@ -71,7 +71,7 @@ * @params size16 the allocated size in wchar_t (two byte) of out16 * @return Returns any errors occured during conversion. See the block above, */ -int conv_utf_8_to_16(char * in8, wchar_t * out16, size_t size16); +int conv_utf_8_to_16(const char * in8, wchar_t * out16, size_t size16); /** @@ -80,7 +80,7 @@ * @params add any additional size which will be allocated for new utf-8 string in bytes * @return New allocated and converted utf-8 string or NULL if in16 is 0. */ -char * alloc_utf_8_from_16(wchar_t * in16, size_t add); +char * alloc_utf_8_from_16(const wchar_t * in16, size_t add); /** * Allocates and converts the utf-16 string from utf-8 @@ -88,7 +88,7 @@ * @params add any additional size which will be allocated for new utf-16 string in wchar_t (two bytes) * @return New allocated and converted utf-16 string or NULL if in8 is 0. */ -wchar_t * alloc_utf16_from_8(char * in8, size_t add); +wchar_t * alloc_utf16_from_8(const char * in8, size_t add); /* Easy allocation and conversion of new utf-16 string. New string has _16 suffix. Must be deallocated with UTF16_UN_ENCODE in right order*/ #define UTF16_ENCODE(in8str) if(1){\ Index: source/blender/avi/intern/avi.c =================================================================== --- source/blender/avi/intern/avi.c (revision 45380) +++ source/blender/avi/intern/avi.c (working copy) @@ -741,6 +741,7 @@ int i; int64_t header_pos1, header_pos2; int64_t stream_pos1, stream_pos2; + int64_t junk_pos; movie->type = AVI_MOVIE_WRITE; movie->fp = fopen (name, "wb"); @@ -899,9 +900,11 @@ fseek (movie->fp, stream_pos2, SEEK_SET); } - if (ftell(movie->fp) < 2024 - 8) { + junk_pos = ftell(movie->fp); + + if (junk_pos < 2024 - 8) { chunk.fcc = FCC("JUNK"); - chunk.size = 2024-8-ftell(movie->fp); + chunk.size = 2024 - 8 - (int)junk_pos; awrite (movie, &chunk, 1, sizeof(AviChunk), movie->fp, AVI_CHUNK); Index: source/blender/blenlib/intern/fileops.c =================================================================== --- source/blender/blenlib/intern/fileops.c (revision 45380) +++ source/blender/blenlib/intern/fileops.c (working copy) @@ -204,6 +204,42 @@ static char str[MAXPATHLEN+12]; +/* zlibs gzopen does not handle Unicode filenames on Windows correctly, so this + function uses WIN32 functions to open the file and then creates a gzfile + handle by using the WIN32 file handles. */ +/* http://stackoverflow.com/questions/9717068/using-zlib-with-unicode-file-paths-on-windows */ +static gzFile gzopen_w(const wchar_t* fileName, const wchar_t* mode) +{ + FILE* file= NULL; + gzFile gzfile= NULL; + char* cmode= NULL; // mode converted to char* + + int n = -1; + + file = _wfopen(fileName, mode); + + if (file) { + n = wcstombs(NULL, mode, 0); + } + + if (n != -1) { + cmode = (char*)malloc(n + 1); + } + + if (cmode) { + wcstombs(cmode, mode, n + 1); + gzfile = gzdopen(fileno(file), cmode); + } + + free(cmode); + + if (file && !gzfile) { + fclose(file); + } + + return gzfile; +} + FILE *BLI_fopen(const char *filename, const char *mode) { return ufopen(filename, mode); @@ -212,28 +248,20 @@ gzFile BLI_gzopen(const char *filename, const char *mode) { gzFile gzfile; - int fi; - if (!filename || !mode) {return 0;} - else - - { - - wchar_t short_name_16 [256]; - char short_name [256]; - int i=0; + if (!filename || !mode) { + gzfile= NULL; + } + else { UTF16_ENCODE(filename); + UTF16_ENCODE(mode); - GetShortPathNameW(filename_16,short_name_16,256); + gzfile= gzopen_w(filename_16, mode_16); - for (i=0;i<256;i++) {short_name[i]=short_name_16[i];}; - - - gzfile = gzopen(short_name,mode); - + UTF16_UN_ENCODE(mode); UTF16_UN_ENCODE(filename); + } - } return gzfile; } Index: source/blender/blenlib/intern/path_util.c =================================================================== --- source/blender/blenlib/intern/path_util.c (revision 45380) +++ source/blender/blenlib/intern/path_util.c (working copy) @@ -831,7 +831,6 @@ return getenv("HOME"); #else /* Windows */ - const char * ret; static char documentfolder[MAXPATHLEN]; HRESULT hResult; Index: source/blender/blenlib/intern/winstuff.c =================================================================== --- source/blender/blenlib/intern/winstuff.c (revision 45380) +++ source/blender/blenlib/intern/winstuff.c (working copy) @@ -217,8 +217,6 @@ struct dirent *readdir(DIR *dp) { - char * FileName; - size_t size; if (dp->direntry.d_name) { MEM_freeN(dp->direntry.d_name); dp->direntry.d_name= NULL; Index: source/blender/blenloader/intern/readfile.c =================================================================== --- source/blender/blenloader/intern/readfile.c (revision 45380) +++ source/blender/blenloader/intern/readfile.c (working copy) @@ -5706,8 +5706,8 @@ RegionView3D *rv3d; rv3d= ar->regiondata= MEM_callocN(sizeof(RegionView3D), "region v3d patch"); - rv3d->persp= v3d->persp; - rv3d->view= v3d->view; + rv3d->persp= (char)v3d->persp; + rv3d->view= (char)v3d->view; rv3d->dist= v3d->dist; copy_v3_v3(rv3d->ofs, v3d->ofs); copy_qt_qt(rv3d->viewquat, v3d->viewquat); Index: source/gameengine/Converter/BL_BlenderDataConversion.cpp =================================================================== --- source/gameengine/Converter/BL_BlenderDataConversion.cpp (revision 45380) +++ source/gameengine/Converter/BL_BlenderDataConversion.cpp (working copy) @@ -2363,8 +2363,8 @@ frame_type = RAS_FrameSettings::e_frame_scale; } - aspect_width = blenderscene->r.xsch*blenderscene->r.xasp; - aspect_height = blenderscene->r.ysch*blenderscene->r.yasp; + aspect_width = (int)(blenderscene->r.xsch * blenderscene->r.xasp); + aspect_height = (int)(blenderscene->r.ysch * blenderscene->r.yasp); } RAS_FrameSettings frame_settings( Index: source/gameengine/Converter/KX_ConvertProperties.cpp =================================================================== --- source/gameengine/Converter/KX_ConvertProperties.cpp (revision 45380) +++ source/gameengine/Converter/KX_ConvertProperties.cpp (working copy) @@ -201,7 +201,7 @@ } case GPROP_FLOAT: { - float floatprop = atof(str); + float floatprop = (float)atof(str); propval = new CFloatValue(floatprop); tprop->SetValue(propval); break; @@ -214,7 +214,7 @@ } case GPROP_TIME: { - float floatprop = atof(str); + float floatprop = (float)atof(str); CValue* timeval = new CFloatValue(floatprop); // set a subproperty called 'timer' so that