diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-07 22:09:40 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-07 22:09:40 (GMT) |
commit | b306d7594ff0ed5ba666dbb26491a269abfbc9d7 (patch) | |
tree | 6c0e7fbba4a7d70e4087d69705922a387115053c /Python | |
parent | e7c8083bf1cfaef8a00b171ec2c170fad92974b7 (diff) | |
download | cpython-b306d7594ff0ed5ba666dbb26491a269abfbc9d7.zip cpython-b306d7594ff0ed5ba666dbb26491a269abfbc9d7.tar.gz cpython-b306d7594ff0ed5ba666dbb26491a269abfbc9d7.tar.bz2 |
Fix fileutils for Windows
* Don't define _Py_wstat() on Windows, Windows has its own _wstat() function
with a different API (the stat buffer has another type)
* Include windows.h
Diffstat (limited to 'Python')
-rw-r--r-- | Python/fileutils.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index 0e87860..5d01867 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -1,4 +1,7 @@ #include "Python.h" +#ifdef MS_WINDOWS +# include <windows.h> +#endif #ifdef HAVE_STAT @@ -183,10 +186,6 @@ _Py_wchar2char(const wchar_t *text) return result; } -#if defined(MS_WINDOWS) || defined(HAVE_STAT) -int -_Py_wstat(const wchar_t* path, struct stat *buf) -{ /* In principle, this should use HAVE__WSTAT, and _wstat should be detected by autoconf. However, no current POSIX system provides that function, so testing for @@ -194,9 +193,10 @@ _Py_wstat(const wchar_t* path, struct stat *buf) Not sure whether the MS_WINDOWS guards are necessary: perhaps for cygwin/mingw builds? */ -#ifdef MS_WINDOWS - return _wstat(path, buf); -#else +#if defined(HAVE_STAT) && !defined(MS_WINDOWS) +int +_Py_wstat(const wchar_t* path, struct stat *buf) +{ int err; char *fname; fname = _Py_wchar2char(path); @@ -207,7 +207,6 @@ _Py_wstat(const wchar_t* path, struct stat *buf) err = stat(fname, buf); PyMem_Free(fname); return err; -#endif } #endif |