[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46172] trunk/blender/source/blender: Fixes opening video files on Windows.
Alexander Kuznetsov
kuzsasha at gmail.com
Tue May 1 23:46:56 CEST 2012
Revision: 46172
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46172
Author: alexk
Date: 2012-05-01 21:46:55 +0000 (Tue, 01 May 2012)
Log Message:
-----------
Fixes opening video files on Windows. [#30752]
Thanks Lockal for finding faulty stat function which helped a lot.
Now there BLI_stat. I will replace all other stat later.
*** Please use BLI_xxxx() functions ***
for file operations
Reported by Leon Cheung, Lockal, Believil
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_fileops.h
trunk/blender/source/blender/blenlib/intern/storage.c
trunk/blender/source/blender/imbuf/intern/util.c
Modified: trunk/blender/source/blender/blenlib/BLI_fileops.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_fileops.h 2012-05-01 21:39:52 UTC (rev 46171)
+++ trunk/blender/source/blender/blenlib/BLI_fileops.h 2012-05-01 21:46:55 UTC (rev 46172)
@@ -55,6 +55,7 @@
int BLI_delete(const char *path, int dir, int recursive);
int BLI_move(const char *path, const char *to);
int BLI_create_symlink(const char *path, const char *to);
+int BLI_stat(const char *path, struct stat *buffer);
/* Directories */
Modified: trunk/blender/source/blender/blenlib/intern/storage.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/storage.c 2012-05-01 21:39:52 UTC (rev 46171)
+++ trunk/blender/source/blender/blenlib/intern/storage.c 2012-05-01 21:46:55 UTC (rev 46172)
@@ -493,6 +493,23 @@
return(st.st_mode);
}
+
+#ifdef WIN32
+int BLI_stat(const char *path, struct stat *buffer)
+{
+ int r;
+ UTF16_ENCODE(path);
+ r=_wstat(path_16,buffer);
+ UTF16_UN_ENCODE(path);
+ return r;
+}
+#else
+int BLI_stat(const char *path, struct stat *buffer)
+{
+ return stat(path, buffer);
+}
+#endif
+
/* would be better in fileops.c except that it needs stat.h so add here */
int BLI_is_dir(const char *file)
{
Modified: trunk/blender/source/blender/imbuf/intern/util.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/util.c 2012-05-01 21:39:52 UTC (rev 46171)
+++ trunk/blender/source/blender/imbuf/intern/util.c 2012-05-01 21:46:55 UTC (rev 46172)
@@ -40,6 +40,7 @@
#endif
#include "BLI_blenlib.h"
+#include "BLI_fileops.h"
#include "DNA_userdef_types.h"
#include "BKE_global.h"
@@ -342,14 +343,14 @@
/* stat test below fails on large files > 4GB */
if (isffmpeg(name)) return (ANIM_FFMPEG);
# endif
- if (stat(name, &st) == -1) return(0);
+ if (BLI_stat(name, &st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
if (isavi(name)) return (ANIM_AVI);
if (ismovie(name)) return (ANIM_MOVIE);
#else
- if (stat(name, &st) == -1) return(0);
+ if (BLI_stat(name, &st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
if (ismovie(name)) return (ANIM_MOVIE);
@@ -359,6 +360,8 @@
# ifdef WITH_FFMPEG
if (isffmpeg(name)) return (ANIM_FFMPEG);
# endif
+
+
if (isavi(name)) return (ANIM_AVI);
#endif
#ifdef WITH_REDCODE
More information about the Bf-blender-cvs
mailing list