From f3be3597079be7cd7adbb8392c32e408cadd3da2 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 25 Jun 2012 00:42:27 +0300 Subject: [PATCH] file: Only include unistd.h if it exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is included for the open/read/write/close functions. On MSVC, where this header does not exist, the same functions are provided by io.h, which is already included. On windows, these functions are provided by io.h. Make sure io.h is included if it exists, regardless of the setmode function. Signed-off-by: Martin Storsjö Conflicts: configure Signed-off-by: Michael Niedermayer --- configure | 2 ++ libavformat/file.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 36746854a5..3d5bb71800 100755 --- a/configure +++ b/configure @@ -1302,6 +1302,7 @@ HAVE_LIST=" ibm_asm inet_aton inline_asm + io_h isatty isinf isnan @@ -3503,6 +3504,7 @@ check_func_headers glob.h glob check_header dlfcn.h check_header dxva.h check_header dxva2api.h -D_WIN32_WINNT=0x0600 +check_header io.h check_header libcrystalhd/libcrystalhd_if.h check_header malloc.h check_header poll.h diff --git a/libavformat/file.c b/libavformat/file.c index c54ec2882f..4e8129e9ae 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -22,10 +22,12 @@ #include "libavutil/avstring.h" #include "avformat.h" #include -#if HAVE_SETMODE +#if HAVE_IO_H #include #endif +#if HAVE_UNISTD_H #include +#endif #include #include #include "os_support.h"