changeset 12921:1e42749917c8

mingw stdin fixes
author faust3
date Sat, 31 Jul 2004 11:08:47 +0000
parents fa02d0766f46
children bd2cb631965f
files libmpdemux/stream_file.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/stream_file.c	Fri Jul 30 20:19:23 2004 +0000
+++ b/libmpdemux/stream_file.c	Sat Jul 31 11:08:47 2004 +0000
@@ -96,9 +96,15 @@
       // read from stdin
       mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ReadSTDIN);
       f=0; // 0=stdin
+#ifdef __MINGW32__
+	  setmode(fileno(stdin),O_BINARY);
+#endif
     } else {
       mp_msg(MSGT_OPEN,MSGL_INFO,"Writing to stdout\n");
       f=1;
+#ifdef __MINGW32__
+	  setmode(fileno(stdout),O_BINARY);
+#endif
     }
   } else {
     f=open(p->filename,m);
@@ -110,7 +116,11 @@
   }
 
   len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
+#ifdef __MINGW32__
+  if(f==0 || len == -1) {
+#else
   if(len == -1) {
+#endif
     stream->seek = seek_forward;
     stream->type = STREAMTYPE_STREAM; // Must be move to STREAMTYPE_FILE
     stream->flags |= STREAM_SEEK_FW;