Add a couple of visibility specifiers that were missing
[ardour.git] / libs / pbd / file_manager.cc
index e02bcc2b0d902f02c48a9289bf26c9da112130df..2cfa63ae39c19aa387b12e79fbbfb550fcad7a61 100644 (file)
@@ -24,6 +24,9 @@
 #include <cassert>
 #include <cstdio>
 
+#include <glib.h>
+#include <glib/gstdio.h>
+
 #ifdef __APPLE__
 #include <mach/mach_time.h>
 #endif
@@ -225,8 +228,19 @@ bool
 FdFileDescriptor::open ()
 {
        /* we must have a lock on the FileManager's mutex */
-       
-       _fd = ::open (_path.c_str(), _writeable ? (O_RDWR | O_CREAT) : O_RDONLY, _mode);
+
+       /* files must be opened with O_BINARY flag on windows
+        * or it treats the file as a text stream and puts in
+        * line endings in etc
+        */
+#ifdef WIN32
+#define WRITE_FLAGS O_RDWR | O_CREAT | O_BINARY
+#define READ_FLAGS O_RDONLY | O_BINARY
+#else
+#define WRITE_FLAGS O_RDWR | O_CREAT
+#define READ_FLAGS O_RDONLY
+#endif
+       _fd = ::g_open (_path.c_str(), _writeable ? WRITE_FLAGS : READ_FLAGS, _mode);
        return (_fd == -1);
 }