X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/9d88c94317aeac5dd26c1dbe8c2112dbe855d2b5..73c04bcfe1096173b00431f0cdc742894b15eef0:/icuSources/extra/uconv/uconv.cpp diff --git a/icuSources/extra/uconv/uconv.cpp b/icuSources/extra/uconv/uconv.cpp index 633bbca3..a743daf0 100644 --- a/icuSources/extra/uconv/uconv.cpp +++ b/icuSources/extra/uconv/uconv.cpp @@ -1,6 +1,6 @@ /***************************************************************************** * -* Copyright (C) 1999-2004, International Business Machines +* Copyright (C) 1999-2006, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************/ @@ -8,7 +8,7 @@ /* * uconv(1): an iconv(1)-like converter using ICU. * - * Original code by Jonas Utterström + * Original code by Jonas Utterström * contributed in 1999. * * Conversion to the C conversion API and many improvements by @@ -38,10 +38,22 @@ #include "unicode/uwmsg.h" -#if (defined(WIN32) || defined(U_CYGWIN)) && !defined(__STRICT_ANSI__) +#if (defined(U_WINDOWS) || defined(U_CYGWIN)) && !defined(__STRICT_ANSI__) #include #include +#if defined(U_WINDOWS) #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 @@ -779,7 +791,7 @@ ConvertFile::convertFile(const char *pname, buf + rd, useOffsets ? fromoffsets : NULL, flush, &err); ulen = (int32_t)(unibufp - unibuf); - u.releaseBuffer(ulen); + u.releaseBuffer(U_SUCCESS(err) ? ulen : 0); // fromSawEndOfBytes indicates that ucnv_toUnicode() is done // converting all of the input bytes. @@ -1143,7 +1155,7 @@ main(int argc, char **argv) // Get and prettify pname. pname = uprv_strrchr(*argv, U_FILE_SEP_CHAR); -#ifdef WIN32 +#ifdef U_WINDOWS if (!pname) { pname = uprv_strrchr(*argv, '/'); }