input/file, output/{fifo,recorder}: add O_BINARY to open() flags

Windows compatibility.
This commit is contained in:
Max Kellermann
2010-05-20 06:59:25 +02:00
parent 57b4013306
commit c727e86980
4 changed files with 49 additions and 7 deletions

41
src/open.h Normal file
View File

@@ -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