Commit b8433e0d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Support filenames outside the ANSI Code Page

parent 11566f0a
...@@ -445,17 +445,35 @@ static int open_file (access_t *p_access, const char *psz_name) ...@@ -445,17 +445,35 @@ static int open_file (access_t *p_access, const char *psz_name)
p_access->info.i_update |= INPUT_UPDATE_SIZE; p_access->info.i_update |= INPUT_UPDATE_SIZE;
fseek( p_sys->fd, 0, SEEK_SET ); fseek( p_sys->fd, 0, SEEK_SET );
#else #else
const char *psz_localname = ToLocale (path); int fd = -1;
if (psz_localname == NULL)
# if defined (WIN32)
if (GetVersion() < 0x80000000)
{ {
msg_Err (p_access, "incorrect file name %s", psz_name); /* for Windows NT and above */
free (path); wchar_t wpath[MAX_PATH + 1];
return -1; if (!MultiByteToWideChar (CP_UTF8, 0, path, -1, wpath, MAX_PATH))
{
msg_Err (p_access, "incorrect file name %s", psz_name);
return VLC_EGENERIC;
}
wpath[MAX_PATH] = L'\0';
fd = _wopen( wpath, O_NONBLOCK );
} }
else
# endif
{
const char *psz_localname = ToLocale (path);
if (psz_localname == NULL)
{
msg_Err (p_access, "incorrect file name %s", psz_name);
free (path);
return -1;
}
// FIXME: support non-ANSI filenames on Win32 fd = open (path, O_NONBLOCK /*| O_LARGEFILE*/);
int fd = open (path, O_NONBLOCK /*| O_LARGEFILE*/); LocaleFree (psz_localname);
LocaleFree (psz_localname); }
free (path); free (path);
if (fd == -1) if (fd == -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment