ICU-4707 Better warning fix for Windows & Cygwin for setmode, fileno and O_BINARY

X-SVN-Rev: 18707
This commit is contained in:
George Rhoten 2005-10-24 07:01:52 +00:00
parent 58881c2ea7
commit 3d43a6752b
2 changed files with 23 additions and 2 deletions

View File

@ -38,10 +38,20 @@
#include "unicode/uwmsg.h" #include "unicode/uwmsg.h"
#if (defined(U_WINDOWS) || defined(U_CYGWIN)) && !defined(__STRICT_ANSI__) #if defined(U_WINDOWS) || defined(U_CYGWIN)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#define USE_FILENO_BINARY_MODE 1 #define USE_FILENO_BINARY_MODE 1
/* Windows likes to rename Unix-like functions */
#ifndef fileno
#define fileno _fileno
#endif
#ifndef setmode
#define setmode _setmode
#endif
#ifndef O_BINARY
#define O_BINARY _O_BINARY
#endif
#endif #endif
#ifdef UCONVMSG_LINK #ifdef UCONVMSG_LINK

View File

@ -33,6 +33,17 @@
#if defined(U_WINDOWS) || defined(U_CYGWIN) #if defined(U_WINDOWS) || defined(U_CYGWIN)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#define USE_FILENO_BINARY_MODE 1
/* Windows likes to rename Unix-like functions */
#ifndef fileno
#define fileno _fileno
#endif
#ifndef setmode
#define setmode _setmode
#endif
#ifndef O_BINARY
#define O_BINARY _O_BINARY
#endif
#endif #endif
#define DERB_VERSION "1.0" #define DERB_VERSION "1.0"
@ -285,7 +296,7 @@ main(int argc, char* argv[]) {
if (tostdout) { if (tostdout) {
out = stdout; out = stdout;
#if defined(U_WINDOWS) || defined(U_CYGWIN) #if defined(U_WINDOWS) || defined(U_CYGWIN)
if (_setmode(_fileno(out), _O_BINARY) == -1) { if (setmode(fileno(out), O_BINARY) == -1) {
fprintf(stderr, "%s: couldn't set standard output to binary mode\n", pname); fprintf(stderr, "%s: couldn't set standard output to binary mode\n", pname);
return 4; return 4;
} }