diff options
author | Martin Storsjö <martin@martin.st> | 2014-11-25 10:39:50 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2014-11-27 09:29:17 +0200 |
commit | 9326d64ed1baadd7af60df6bbcc59cf1fefede48 (patch) | |
tree | d9eb4e97348868fa1756f612d9ae3b3246dcb4bd /libavformat/os_support.h | |
parent | 234fb81e3145e9c9aec4ec16266676fab7dc21fa (diff) | |
download | ffmpeg-9326d64ed1baadd7af60df6bbcc59cf1fefede48.tar.gz |
Share the utf8 to wchar conversion routine between lavf and lavu
This doesn't add any dependency on library internals, since this
only is a static inline function that gets built into each of the
calling functions - this is only to reduce the code duplication.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/os_support.h')
-rw-r--r-- | libavformat/os_support.h | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/libavformat/os_support.h b/libavformat/os_support.h index 50846d0f41..4aa98bdc18 100644 --- a/libavformat/os_support.h +++ b/libavformat/os_support.h @@ -127,24 +127,7 @@ int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout); #elif defined(_WIN32) #include <stdio.h> #include <windows.h> -#include "libavutil/mem.h" - -static inline int utf8towchar(const char *filename_utf8, wchar_t **filename_w) -{ - int num_chars; - num_chars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename_utf8, -1, NULL, 0); - if (num_chars <= 0) { - *filename_w = NULL; - return 0; - } - *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); - return 0; -} +#include "libavutil/wchar_filename.h" #define DEF_FS_FUNCTION(name, wfunc, afunc) \ static inline int win32_##name(const char *filename_utf8) \ |