From: Steven Edwards Date: Thu, 24 Nov 2005 06:07:04 +0000 (+0000) Subject: more msvc compile fixes by Brezenbak and I X-Git-Tag: backups/ros-branch-0_2_9@19949~413 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=59a50a6f8803de9afd184146d78884ab177d4e96 more msvc compile fixes by Brezenbak and I svn path=/trunk/; revision=19515 --- diff --git a/reactos/lib/crt/float/logb.c b/reactos/lib/crt/float/logb.c index 55e65f90b55..aaba1b4cf4f 100644 --- a/reactos/lib/crt/float/logb.c +++ b/reactos/lib/crt/float/logb.c @@ -22,13 +22,13 @@ double _logb (double __x) { - register double __value; + register double __val; #ifdef __GNUC__ register double __junk; __asm __volatile__ ("fxtract\n\t" - : "=t" (__junk), "=u" (__value) : "0" (__x)); + : "=t" (__junk), "=u" (__val) : "0" (__x)); #else #endif /*__GNUC__*/ - return __value; + return __val; } diff --git a/reactos/lib/crt/include/float.h b/reactos/lib/crt/include/float.h index 6226f4818be..ce575e24fb1 100644 --- a/reactos/lib/crt/include/float.h +++ b/reactos/lib/crt/include/float.h @@ -15,15 +15,16 @@ * here. * */ - -#include_next - +#ifdef __GNUC__ + #include_next +#endif #ifndef _MINGW_FLOAT_H_ #define _MINGW_FLOAT_H_ /* All the headers include this file. */ -#include <_mingw.h> - +#ifdef __GNUC__ + #include <_mingw.h> +#endif /* * Functions and definitions for controlling the FPU. */ @@ -90,12 +91,24 @@ #define _FPE_STACKUNDERFLOW 0x8b #define _FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */ +#define DBL_MAX_10_EXP 308 +#define S_IFIFO -1 +#define UINT64_MAX 0xffffffffffffffff + #ifndef RC_INVOKED #ifdef __cplusplus extern "C" { #endif +#ifndef _CRTIMP +#ifdef _DLL +#define _CRTIMP __declspec(dllimport) +#else +#define _CRTIMP +#endif /* _DLL */ +#endif + /* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask), * i.e. change the bits in unMask to have the values they have in unNew, * leaving other bits unchanged. */ diff --git a/reactos/lib/crt/include/internal/file.h b/reactos/lib/crt/include/internal/file.h index edd99a028ff..5b48bfa0c5e 100644 --- a/reactos/lib/crt/include/internal/file.h +++ b/reactos/lib/crt/include/internal/file.h @@ -16,6 +16,8 @@ #include #include #include +#include + #include #include diff --git a/reactos/lib/crt/include/internal/mbstring.h b/reactos/lib/crt/include/internal/mbstring.h index fc5f64e1a29..65d89d19c47 100644 --- a/reactos/lib/crt/include/internal/mbstring.h +++ b/reactos/lib/crt/include/internal/mbstring.h @@ -18,5 +18,20 @@ #endif #define _P2 (_P_|__2) +#if defined (_MSC_VER) + +#undef _ismbbkana +#undef _ismbbkpunct +#undef _ismbbalpha +#undef _ismbbalnum +#undef _ismbbgraph +#undef _ismbbkalnum +#undef _ismbblead +#undef _ismbbprint +#undef _ismbbpunct +#undef _ismbbtrail + +#endif + #endif diff --git a/reactos/lib/crt/io/access.c b/reactos/lib/crt/io/access.c index 4afb18b72c8..f07d109d65c 100644 --- a/reactos/lib/crt/io/access.c +++ b/reactos/lib/crt/io/access.c @@ -20,7 +20,7 @@ int _taccess( const _TCHAR *_path, int _amode ) { DWORD Attributes = GetFileAttributes(_path); - DPRINT(MK_STR(_taccess)"('%"_TS"', %x)\n", _path, _amode); + DPRINT(MK_STR(_taccess)"('%"sT"', %x)\n", _path, _amode); if (Attributes == (DWORD)-1) { _dosmaperr(GetLastError()); @@ -44,7 +44,7 @@ int _taccess( const _TCHAR *_path, int _amode ) int access_dirT(const _TCHAR *_path) { DWORD Attributes = GetFileAttributes(_path); - DPRINT(MK_STR(is_dirT)"('%"_TS"')\n", _path); + DPRINT(MK_STR(is_dirT)"('%"sT"')\n", _path); if (Attributes == (DWORD)-1) { _dosmaperr(GetLastError()); diff --git a/reactos/lib/crt/io/chmod.c b/reactos/lib/crt/io/chmod.c index 7bc92346cca..b72949df4b0 100644 --- a/reactos/lib/crt/io/chmod.c +++ b/reactos/lib/crt/io/chmod.c @@ -20,7 +20,7 @@ int _tchmod(const _TCHAR* filename, mode_t mode) DWORD FileAttributes = 0; BOOLEAN Set = FALSE; - DPRINT(#_tchmod"('%"sT"', %x)\n", filename, mode); + DPRINT(MK_STR(_tchmod)"('%"sT"', %x)\n", filename, mode); FileAttributes = GetFileAttributes(filename); if ( FileAttributes == (DWORD)-1 ) { diff --git a/reactos/lib/crt/io/tell.c b/reactos/lib/crt/io/tell.c index e12150c487b..9c12b5412f4 100644 --- a/reactos/lib/crt/io/tell.c +++ b/reactos/lib/crt/io/tell.c @@ -2,7 +2,7 @@ #include #include #include - +#include /* * @implemented diff --git a/reactos/lib/crt/io/wutime.c b/reactos/lib/crt/io/wutime.c index 2a5983d06dd..c4100fa13e9 100644 --- a/reactos/lib/crt/io/wutime.c +++ b/reactos/lib/crt/io/wutime.c @@ -1,10 +1,10 @@ +#include "precomp.h" #include #include #include #include #include - /* * @implemented */ @@ -23,3 +23,4 @@ int _wutime(const wchar_t* filename, struct _utimbuf* buf) return -1; return ret; } + diff --git a/reactos/lib/crt/precomp.h b/reactos/lib/crt/precomp.h index b13bd383336..fafc79a4a48 100644 --- a/reactos/lib/crt/precomp.h +++ b/reactos/lib/crt/precomp.h @@ -1,4 +1,7 @@ #define CRT_SECURE_NO_DEPRECATE +#define _INC_WTIME_INL +#define _INC_UTIME_INL +#define _INC_TIME_INL #define WIN32_NO_STATUS #include diff --git a/reactos/lib/crt/process/dll.c b/reactos/lib/crt/process/dll.c index 71910108d1a..5cab733eca0 100644 --- a/reactos/lib/crt/process/dll.c +++ b/reactos/lib/crt/process/dll.c @@ -9,7 +9,6 @@ */ #include "precomp.h" -#include /* * @implemented diff --git a/reactos/lib/crt/signal/signal.c b/reactos/lib/crt/signal/signal.c index 81a1c4ee180..15f8beddefa 100644 --- a/reactos/lib/crt/signal/signal.c +++ b/reactos/lib/crt/signal/signal.c @@ -8,7 +8,7 @@ void _default_handler(int signal); -//typedef void (*_p_sig_fn_t)(int); +typedef void (*__p_sig_fn_t)(int); typedef struct _sig_element diff --git a/reactos/lib/crt/stdio/fopen.c b/reactos/lib/crt/stdio/fopen.c index 5dd887dccbd..38328a8596f 100644 --- a/reactos/lib/crt/stdio/fopen.c +++ b/reactos/lib/crt/stdio/fopen.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include diff --git a/reactos/lib/crt/stdio/fputc.c b/reactos/lib/crt/stdio/fputc.c index 44953c8a991..022adf4552e 100644 --- a/reactos/lib/crt/stdio/fputc.c +++ b/reactos/lib/crt/stdio/fputc.c @@ -23,3 +23,4 @@ fputwc(wchar_t c, FILE *fp) return putwc(c,fp); } + diff --git a/reactos/lib/crt/stdio/freopen.c b/reactos/lib/crt/stdio/freopen.c index 9030e5dda39..5ab613a85a5 100644 --- a/reactos/lib/crt/stdio/freopen.c +++ b/reactos/lib/crt/stdio/freopen.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include diff --git a/reactos/lib/crt/stdio/fsopen.c b/reactos/lib/crt/stdio/fsopen.c index 6ad0dd98da3..241aafad694 100644 --- a/reactos/lib/crt/stdio/fsopen.c +++ b/reactos/lib/crt/stdio/fsopen.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/reactos/lib/crt/stdio/vfprintf.c b/reactos/lib/crt/stdio/vfprintf.c index 11d0f634fca..66135212310 100644 --- a/reactos/lib/crt/stdio/vfprintf.c +++ b/reactos/lib/crt/stdio/vfprintf.c @@ -450,6 +450,7 @@ static int string(FILE *f, const char* s, int len, int field_width, int precisio static int stringw(FILE *f, const wchar_t* sw, int len, int field_width, int precision, int flags) { int i, done = 0; + char * mb; if (sw == NULL) { sw = L""; @@ -476,10 +477,11 @@ static int stringw(FILE *f, const wchar_t* sw, int len, int field_width, int pre return -1; done++; } + mb = malloc(MB_CUR_MAX * sizeof(char)); + if(!mb) + return -1; for (i = 0; i < len; ++i) { -//#define MB_CUR_MAX 1 - char mb[MB_CUR_MAX]; int mbcount, j; mbcount = wctomb(mb, *sw++); if (mbcount <= 0) @@ -489,16 +491,23 @@ static int stringw(FILE *f, const wchar_t* sw, int len, int field_width, int pre for (j = 0; j < mbcount; j++) { if (putc(mb[j], f) == EOF) + { + free(mb); return -1; + } done++; } } while (len < field_width--) { if (putc(' ', f) == EOF) + { + free(mb); return -1; + } done++; } + free(mb); return done; } diff --git a/reactos/lib/crt/stdio/vfwprint.c b/reactos/lib/crt/stdio/vfwprint.c index a3a955b673f..fd844c43779 100644 --- a/reactos/lib/crt/stdio/vfwprint.c +++ b/reactos/lib/crt/stdio/vfwprint.c @@ -7,7 +7,7 @@ #include #include -#include +#include int _isnanl(double x); int _isinfl(double x); diff --git a/reactos/lib/crt/stdlib/senv.c b/reactos/lib/crt/stdlib/senv.c index e2d96747d69..11577578e83 100644 --- a/reactos/lib/crt/stdlib/senv.c +++ b/reactos/lib/crt/stdlib/senv.c @@ -17,7 +17,7 @@ void _tsearchenv(const _TCHAR* file,const _TCHAR* var,_TCHAR* path) _TCHAR* y; _TCHAR* FilePart; - DPRINT(#_tsearchenv"()\n"); + DPRINT(MK_STR(_tsearchenv)"()\n"); x = _tcschr(env,'='); if ( x != NULL ) { diff --git a/reactos/lib/crt/stdlib/strtoull.c b/reactos/lib/crt/stdlib/strtoull.c index eb51909f0d6..79724036d00 100644 --- a/reactos/lib/crt/stdlib/strtoull.c +++ b/reactos/lib/crt/stdlib/strtoull.c @@ -8,19 +8,23 @@ #include #include +#if defined (_MSC_VER) +#define UINT64_MAX 0xffffffffffffffff +#endif + /* * Convert a string to an unsigned long integer. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -uint64_t +UINT64 strtoull(const char *nptr, char **endptr, int base) { const char *s = nptr; - uint64_t acc; + UINT64 acc; int c; - uint64_t cutoff; + UINT64 cutoff; int neg = 0, any, cutlim; /* diff --git a/reactos/lib/crt/sys_stat/fstat.c b/reactos/lib/crt/sys_stat/fstat.c index 1e533127050..c38296cb69c 100644 --- a/reactos/lib/crt/sys_stat/fstat.c +++ b/reactos/lib/crt/sys_stat/fstat.c @@ -73,7 +73,7 @@ int _fstat(int fd, struct _stat* statbuf) else if (dwFileType == FILE_TYPE_PIPE) { statbuf->st_dev = fd; - statbuf->st_mode = S_IFIFO; + statbuf->st_mode = -1; //S_IFIFO; } else { diff --git a/reactos/lib/crt/time/difftime.c b/reactos/lib/crt/time/difftime.c index 6b4de57c930..8d5d37b8790 100644 --- a/reactos/lib/crt/time/difftime.c +++ b/reactos/lib/crt/time/difftime.c @@ -1,4 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ +#include "precomp.h" #include /*