[Live-devel] [RFC] Guard against _setmode() on WinCE

Pierre Ynard linkfanel at yahoo.fr
Wed Nov 11 21:14:24 PST 2009


This allows live555 to compile with the mingw32ce toolchain of the CeGCC
project, that doesn't define _setmode(). However am I not sure that
this is the right thing to do, since I found documentation saying that
_setmode() should be available on WinCE.


diff -urp live.orig/liveMedia/InputFile.cpp live/liveMedia/InputFile.cpp
--- live.orig/liveMedia/InputFile.cpp	2009-09-28 17:16:16.000000000 +0200
+++ live/liveMedia/InputFile.cpp	2009-11-11 01:06:45.000000000 +0100
@@ -35,7 +35,7 @@ FILE* OpenInputFile(UsageEnvironment& en
   // Check for a special case file name: "stdin"
   if (strcmp(fileName, "stdin") == 0) {
     fid = stdin;
-#if defined(__WIN32__) || defined(_WIN32)
+#if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE)
     _setmode(_fileno(stdin), _O_BINARY); // convert to binary mode
 #endif
   } else {
diff -urp live.orig/liveMedia/OutputFile.cpp live/liveMedia/OutputFile.cpp
--- live.orig/liveMedia/OutputFile.cpp	2009-09-28 17:16:16.000000000 +0200
+++ live/liveMedia/OutputFile.cpp	2009-11-11 01:07:50.000000000 +0100
@@ -35,12 +35,12 @@ FILE* OpenOutputFile(UsageEnvironment& e
   // Check for special case 'file names': "stdout" and "stderr"
   if (strcmp(fileName, "stdout") == 0) {
     fid = stdout;
-#if defined(__WIN32__) || defined(_WIN32)
+#if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE)
     _setmode(_fileno(stdout), _O_BINARY);       // convert to binary mode
 #endif
   } else if (strcmp(fileName, "stderr") == 0) {
     fid = stderr;
-#if defined(__WIN32__) || defined(_WIN32)
+#if (defined(__WIN32__) || defined(_WIN32)) && !defined(_WIN32_WCE)
     _setmode(_fileno(stderr), _O_BINARY);       // convert to binary mode
 #endif
   } else {


Ross, I am sorry for upsetting you by taking one full day to bring up
this issue on this mailing-list. I guess that I am just careful with
what I send you.

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the live-devel mailing list