From c727e8698020f69516cb62e001ac6f8254025fe1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 20 May 2010 06:59:25 +0200 Subject: input/file, output/{fifo,recorder}: add O_BINARY to open() flags Windows compatibility. --- src/open.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/open.h (limited to 'src/open.h') 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 + +/* 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 -- cgit v1.2.3