From 3d43a6752bf1417f6f212a5e6d2eadf77e783285 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Mon, 24 Oct 2005 07:01:52 +0000 Subject: [PATCH] ICU-4707 Better warning fix for Windows & Cygwin for setmode, fileno and O_BINARY X-SVN-Rev: 18707 --- icu4c/source/extra/uconv/uconv.cpp | 12 +++++++++++- icu4c/source/tools/genrb/derb.c | 13 ++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/icu4c/source/extra/uconv/uconv.cpp b/icu4c/source/extra/uconv/uconv.cpp index 581c744cfc..660cb24e37 100644 --- a/icu4c/source/extra/uconv/uconv.cpp +++ b/icu4c/source/extra/uconv/uconv.cpp @@ -38,10 +38,20 @@ #include "unicode/uwmsg.h" -#if (defined(U_WINDOWS) || defined(U_CYGWIN)) && !defined(__STRICT_ANSI__) +#if defined(U_WINDOWS) || defined(U_CYGWIN) #include #include #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 #ifdef UCONVMSG_LINK diff --git a/icu4c/source/tools/genrb/derb.c b/icu4c/source/tools/genrb/derb.c index 4bf033d886..a695f4182e 100644 --- a/icu4c/source/tools/genrb/derb.c +++ b/icu4c/source/tools/genrb/derb.c @@ -33,6 +33,17 @@ #if defined(U_WINDOWS) || defined(U_CYGWIN) #include #include +#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 #define DERB_VERSION "1.0" @@ -285,7 +296,7 @@ main(int argc, char* argv[]) { if (tostdout) { out = stdout; #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); return 4; }