diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-09 07:16:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-09 07:16:38 +0200 |
commit | 0dc17da30825c9bda5afef646ef3494fecce646a (patch) | |
tree | 791efd68a827963ba87ac86f0d257e852d073bd8 /libavformat | |
parent | 18be3fac1d04e02bace8fe6e6375b6d14f411514 (diff) | |
parent | dfc6b5c81491abf7effb97b23af17ccf7adcd132 (diff) | |
download | ffmpeg-0dc17da30825c9bda5afef646ef3494fecce646a.tar.gz |
Merge commit 'dfc6b5c81491abf7effb97b23af17ccf7adcd132'
* commit 'dfc6b5c81491abf7effb97b23af17ccf7adcd132':
file: Move win32 utf8->wchar open wrapper to libavutil
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/os_support.c | 40 | ||||
-rw-r--r-- | libavformat/os_support.h | 5 |
2 files changed, 0 insertions, 45 deletions
diff --git a/libavformat/os_support.c b/libavformat/os_support.c index dc88834bf3..3218956df5 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -27,46 +27,6 @@ #include "avformat.h" #include "os_support.h" -#if defined(_WIN32) && !defined(__MINGW32CE__) -#undef open -#undef lseek -#undef stat -#undef fstat -#include <fcntl.h> -#include <io.h> -#include <windows.h> -#include <share.h> -#include <errno.h> - -int ff_win32_open(const char *filename_utf8, int oflag, int pmode) -{ - int fd; - int num_chars; - wchar_t *filename_w; - - /* convert UTF-8 to wide chars */ - num_chars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename_utf8, -1, NULL, 0); - if (num_chars <= 0) - goto fallback; - filename_w = av_mallocz(sizeof(wchar_t) * num_chars); - if (!filename_w) { - errno = ENOMEM; - return -1; - } - MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, filename_w, num_chars); - - fd = _wsopen(filename_w, oflag, SH_DENYNO, pmode); - av_freep(&filename_w); - - if (fd != -1 || (oflag & O_CREAT)) - return fd; - -fallback: - /* filename may be be in CP_ACP */ - return _sopen(filename_utf8, oflag, SH_DENYNO, pmode); -} -#endif - #if CONFIG_NETWORK #include <fcntl.h> #if !HAVE_POLL_H diff --git a/libavformat/os_support.h b/libavformat/os_support.h index e5f31e05a4..b0f02c11f1 100644 --- a/libavformat/os_support.h +++ b/libavformat/os_support.h @@ -86,11 +86,6 @@ static inline int is_dos_path(const char *path) #endif #endif -#if defined(_WIN32) && !defined(__MINGW32CE__) -int ff_win32_open(const char *filename, int oflag, int pmode); -#define open ff_win32_open -#endif - #if CONFIG_NETWORK #if !HAVE_SOCKLEN_T typedef int socklen_t; |