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

Win32: default to binary mode in vlc_open() (fix #5578)

...rather than merely vlc_fopen().
parent d6d9ee33
...@@ -52,10 +52,6 @@ FILE *vlc_fopen (const char *filename, const char *mode) ...@@ -52,10 +52,6 @@ FILE *vlc_fopen (const char *filename, const char *mode)
{ {
int rwflags = 0, oflags = 0; int rwflags = 0, oflags = 0;
#ifdef O_BINARY
/* Assume binary mode by default (i.e. no translation) */
oflags |= O_BINARY;
#endif
for (const char *ptr = mode; *ptr; ptr++) for (const char *ptr = mode; *ptr; ptr++)
{ {
switch (*ptr) switch (*ptr)
......
...@@ -78,6 +78,10 @@ int vlc_open (const char *filename, int flags, ...) ...@@ -78,6 +78,10 @@ int vlc_open (const char *filename, int flags, ...)
mode = va_arg (ap, unsigned int); mode = va_arg (ap, unsigned int);
va_end (ap); va_end (ap);
/* Defaults to binary mode */
if ((flags & O_TEXT) == 0)
flags |= O_BINARY;
#ifdef UNDER_CE #ifdef UNDER_CE
/*_open translates to wchar internally on WinCE*/ /*_open translates to wchar internally on WinCE*/
return _open (filename, flags, mode); return _open (filename, flags, mode);
......
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