changeset 30808:ce19feeb5cbb

Define O_BINARY in stream/stream.h unless it is defined yet, and use it in other places. This removes platform specific checks and prevents repeated definitions of O_BINARY.
author komh
date Sat, 06 Mar 2010 07:24:41 +0000
parents 82dd2fbdb772
children d01c83dcb634
files stream/stream.h stream/stream_cddb.c stream/stream_file.c stream/stream_live555.c
diffstat 4 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream.h	Fri Mar 05 23:13:08 2010 +0000
+++ b/stream/stream.h	Sat Mar 06 07:24:41 2010 +0000
@@ -25,6 +25,11 @@
 #include <string.h>
 #include <inttypes.h>
 #include <sys/types.h>
+#include <fcntl.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
 
 #define STREAMTYPE_DUMMY -1    // for placeholders, when the actual reading is handled in the demuxer
 #define STREAMTYPE_FILE 0      // read from seekable file
--- a/stream/stream_cddb.c	Fri Mar 05 23:13:08 2010 +0000
+++ b/stream/stream_cddb.c	Sat Mar 06 07:24:41 2010 +0000
@@ -76,10 +76,6 @@
 #include "network.h"
 #include "libavutil/common.h"
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #define DEFAULT_FREEDB_SERVER "freedb.freedb.org"
 #define DEFAULT_CACHE_DIR     "/.cddb/"
 
--- a/stream/stream_file.c	Fri Mar 05 23:13:08 2010 +0000
+++ b/stream/stream_file.c	Sat Mar 06 07:24:41 2010 +0000
@@ -136,9 +136,7 @@
     filename++;
 #endif
 
-#if defined(__CYGWIN__)|| defined(__MINGW32__) || defined(__OS2__)
   m |= O_BINARY;
-#endif
 
   if(!strcmp(filename,"-")){
     if(mode == STREAM_READ) {
--- a/stream/stream_live555.c	Fri Mar 05 23:13:08 2010 +0000
+++ b/stream/stream_live555.c	Sat Mar 06 07:24:41 2010 +0000
@@ -79,11 +79,7 @@
 
   if(strncmp("sdp://",filename,6) == 0) {
     filename += 6;
-#if defined(__CYGWIN__) || defined(__MINGW32__)
     f = open(filename,O_RDONLY|O_BINARY);
-#else
-    f = open(filename,O_RDONLY);
-#endif
     if(f < 0) {
       mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename);
       return STREAM_ERROR;