bug 498845 - libbz2 can't use fdopen on windows ce r=bsmedberg

This commit is contained in:
=Hiroyuki Ikezoe 2009-07-08 11:49:47 -04:00
parent 0b95a139ae
commit 0c49011caf

View File

@ -1371,7 +1371,23 @@ const char * BZ_API(BZ2_bzlibVersion)(void)
#ifndef BZ_NO_STDIO
/*---------------------------------------------------*/
#if (defined(_WIN32) || defined(OS2) || defined(MSDOS)) && !defined(WINCE)
#ifdef WINCE
#ifndef setmode
#define setmode _setmode
#endif
#ifndef O_BINARY
#define O_BINARY _O_BINARY
#endif
static
FILE * fdopen(int fd, const char *mode)
{
wchar_t wMode[10];
MultiByteToWideChar(CP_ACP, 0, mode, -1, wMode, 10);
return _wfdopen((void*)fd, wMode);
}
#endif
#if (defined(_WIN32) || defined(OS2) || defined(MSDOS))
# include <fcntl.h>
# include <io.h>
# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY)