[vlc-commits] Win32: default to binary mode in vlc_open() (fix #5578)

Rémi Denis-Courmont git at videolan.org
Thu Nov 24 21:18:52 CET 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 24 22:17:27 2011 +0200| [8179cfedcb3fbdcf6db6521ce49c82d16762c88f] | committer: Rémi Denis-Courmont

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

...rather than merely vlc_fopen().

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8179cfedcb3fbdcf6db6521ce49c82d16762c88f
---

 src/text/filesystem.c  |    4 ----
 src/win32/filesystem.c |    4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/text/filesystem.c b/src/text/filesystem.c
index 11f1c99..cfe0d13 100644
--- a/src/text/filesystem.c
+++ b/src/text/filesystem.c
@@ -52,10 +52,6 @@ FILE *vlc_fopen (const char *filename, const char *mode)
 {
     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++)
     {
         switch (*ptr)
diff --git a/src/win32/filesystem.c b/src/win32/filesystem.c
index f26c29c..36b52c9 100644
--- a/src/win32/filesystem.c
+++ b/src/win32/filesystem.c
@@ -78,6 +78,10 @@ int vlc_open (const char *filename, int flags, ...)
         mode = va_arg (ap, unsigned int);
     va_end (ap);
 
+    /* Defaults to binary mode */
+    if ((flags & O_TEXT) == 0)
+        flags |= O_BINARY;
+
 #ifdef UNDER_CE
     /*_open translates to wchar internally on WinCE*/
     return _open (filename, flags, mode);



More information about the vlc-commits mailing list