Skip to content
Snippets Groups Projects
Commit 17ec0256 authored by Petri Hintukainen's avatar Petri Hintukainen
Browse files

Fix opening non-ASCII paths in Windows

parent a0a738eb
No related branches found
No related tags found
1 merge request!5Fix opening non-ASCII paths in Windows
Pipeline #88756 passed with stage
in 21 seconds
......@@ -63,6 +63,10 @@
# include <fcntl.h> /* O_BINARY */
#endif
#ifdef _WIN32
# include <windows.h>
#endif
#include "dvdcss/dvdcss.h"
#include "common.h"
......@@ -442,7 +446,22 @@ int dvdcss_close_device ( dvdcss_t dvdcss )
*****************************************************************************/
static int libc_open ( dvdcss_t dvdcss, const char *psz_device )
{
#ifdef _WIN32
int wlen;
dvdcss->i_fd = -1;
wlen = MultiByteToWideChar( CP_UTF8, 0, psz_device, -1, NULL, 0 );
if( wlen > 0 ) {
wchar_t *wpath = (wchar_t*)malloc( sizeof(wchar_t) * wlen );
if( wpath ) {
if( MultiByteToWideChar(CP_UTF8, 0, psz_device, -1, wpath, wlen ) ) {
dvdcss->i_fd = _wopen( wpath, O_BINARY );
}
free( wpath );
}
}
#else
dvdcss->i_fd = open( psz_device, O_BINARY );
#endif
if( dvdcss->i_fd == -1 )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment