file: Only include unistd.h if it exists
authorRonald S. Bultje <rsbultje@gmail.com>
Sun, 24 Jun 2012 21:42:27 +0000 (00:42 +0300)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 7 Sep 2012 16:41:23 +0000 (18:41 +0200)
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ö <martin@martin.st>
Conflicts:

configure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
configure
libavformat/file.c

index 3674685..3d5bb71 100755 (executable)
--- 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
index c54ec28..4e8129e 100644 (file)
 #include "libavutil/avstring.h"
 #include "avformat.h"
 #include <fcntl.h>
-#if HAVE_SETMODE
+#if HAVE_IO_H
 #include <io.h>
 #endif
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <sys/stat.h>
 #include <stdlib.h>
 #include "os_support.h"