aboutsummaryrefslogtreecommitdiffstats
path: root/src/open.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-05-20 06:59:25 +0200
committerMax Kellermann <max@duempel.org>2010-05-20 09:13:39 +0200
commitc727e8698020f69516cb62e001ac6f8254025fe1 (patch)
tree925ec857d42dc44b743a31de36691b64e59914b0 /src/open.h
parent57b4013306c18a1c510d00845a9915bea0bcf525 (diff)
downloadmpd-c727e8698020f69516cb62e001ac6f8254025fe1.tar.gz
mpd-c727e8698020f69516cb62e001ac6f8254025fe1.tar.xz
mpd-c727e8698020f69516cb62e001ac6f8254025fe1.zip
input/file, output/{fifo,recorder}: add O_BINARY to open() flags
Windows compatibility.
Diffstat (limited to 'src/open.h')
-rw-r--r--src/open.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/open.h b/src/open.h
new file mode 100644
index 000000000..e39c64a97
--- /dev/null
+++ b/src/open.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2003-2010 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/** \file
+ *
+ * Portability macros for opening files.
+ */
+
+#ifndef MPD_OPEN_H
+#define MPD_OPEN_H
+
+#include <fcntl.h>
+
+/* On Windows, files are opened in "text" mode by default, and the C
+ library will mangle data being read/written; this must be switched
+ off by specifying the proprietary "O_BINARY" flag. That sucks! */
+#ifndef O_BINARY
+#ifdef _O_BINARY
+#define O_BINARY _O_BINARY
+#else
+#define O_BINARY 0
+#endif
+#endif
+
+#endif