[MPlayer-cvslog] r30829 - in trunk: configure stream/stream_file.c

komh subversion at mplayerhq.hu
Thu Mar 4 15:46:44 CET 2010


Author: komh
Date: Thu Mar  4 15:46:44 2010
New Revision: 30829

Log:
Define HAVE_SETMODE conditionally, and use it in stream/stream_file.c instead
of platform specific predefined macros.

Modified:
   trunk/configure
   trunk/stream/stream_file.c

Modified: trunk/configure
==============================================================================
--- trunk/configure	Thu Mar  4 13:55:30 2010	(r30828)
+++ trunk/configure	Thu Mar  4 15:46:44 2010	(r30829)
@@ -4050,6 +4050,17 @@ fi
 echores "$_setenv"
 
 
+echocheck "setmode()"
+_setmode=no
+def_setmode='#define HAVE_SETMODE 0'
+cat > $TMPC << EOF
+#include <io.h>
+int main(void) { setmode(0, 0); return 0; }
+EOF
+cc_check && _setmode=yes && def_setmode='#define HAVE_SETMODE 1'
+echores "$_setmode"
+
+
 if sunos; then
 echocheck "sysi86()"
 cat > $TMPC << EOF
@@ -8870,6 +8881,7 @@ $def_nanosleep
 $def_posix_select
 $def_select
 $def_setenv
+$def_setmode
 $def_shm
 $def_strsep
 $def_swab
@@ -9225,7 +9237,6 @@ $def_yasm
 #define HAVE_LDBRX 0
 #define HAVE_POLL_H 1
 #define HAVE_PPC4XX 0
-#define HAVE_SETMODE 0
 #define HAVE_SYS_SELECT_H 0
 #define HAVE_VFP_ARGS 1
 #define HAVE_VIRTUALALLOC 0

Modified: trunk/stream/stream_file.c
==============================================================================
--- trunk/stream/stream_file.c	Thu Mar  4 13:55:30 2010	(r30828)
+++ trunk/stream/stream_file.c	Thu Mar  4 15:46:44 2010	(r30829)
@@ -145,14 +145,14 @@ static int open_f(stream_t *stream,int m
       // read from stdin
       mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ReadSTDIN);
       f=0; // 0=stdin
-#if defined(__MINGW32__) || defined(__OS2__)
-	  setmode(fileno(stdin),O_BINARY);
+#if HAVE_SETMODE
+      setmode(fileno(stdin),O_BINARY);
 #endif
     } else {
       mp_msg(MSGT_OPEN,MSGL_INFO,"Writing to stdout\n");
       f=1;
-#if defined(__MINGW32__) || defined(__OS2__)
-	  setmode(fileno(stdout),O_BINARY);
+#if HAVE_SETMODE
+      setmode(fileno(stdout),O_BINARY);
 #endif
     }
   } else {


More information about the MPlayer-cvslog mailing list