Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2012-05-14 19:50:35 +0400
committerSv. Lockal <lockalsash@gmail.com>2012-05-14 19:50:35 +0400
commit1a729d51d0babc2c68e8417a57cacd012816afbd (patch)
tree745401a18d12faaa4f1b65985551ec17a3c322aa
parent24fb2bad55f5fa741d3b5d1df27750a4b7d80eff (diff)
revert 46626, which crashes blender during startup with fileno
There is a better way to fix this by zlib upgrade, which has its own open function for windows paths
-rw-r--r--source/blender/blenlib/intern/fileops.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 958de59c4b3..e6d06484e74 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -211,30 +211,32 @@ FILE *BLI_fopen(const char *filename, const char *mode)
void *BLI_gzopen(const char *filename, const char *mode)
{
- FILE *file;
- gzFile gzfile = NULL;
- wchar_t short_name_16[256];
+ gzFile gzfile;
- if (!filename || !mode)
+ if (!filename || !mode) {
return 0;
+ }
+ else {
+ wchar_t short_name_16[256];
+ char short_name[256];
+ int i = 0;
- /* xxx Creates file before transcribing the path */
- if (mode[0] == 'w')
- fclose(ufopen(filename, "a"));
+ /* xxx Creates file before transcribing the path */
+ if (mode[0] == 'w')
+ fclose(ufopen(filename, "a"));
- UTF16_ENCODE(filename);
- UTF16_ENCODE(mode);
+ UTF16_ENCODE(filename);
- GetShortPathNameW(filename_16, short_name_16, 256);
+ GetShortPathNameW(filename_16, short_name_16, 256);
- if ((file = _wfopen(short_name_16, mode_16))) {
- if (!(gzfile = gzdopen(fileno(file), mode))) {
- fclose(file);
+ for (i = 0; i < 256; i++) {
+ short_name[i] = (char)short_name_16[i];
}
- }
- UTF16_UN_ENCODE(mode);
- UTF16_UN_ENCODE(filename);
+ gzfile = gzopen(short_name, mode);
+
+ UTF16_UN_ENCODE(filename);
+ }
return gzfile;
}