From 3e2fddbe1981bad10efa7d9628652d5111144946 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 15 Sep 2011 17:11:53 +0000 Subject: [PATCH] [CRT] - Implement MSVC versions of call_copy_ctor, call_dtor, continue_after_catch, __CxxFrameHandler - Fix amd64 versions of _control87 and _statusfp - Fix MSVC and amd64 warnings svn path=/trunk/; revision=53713 --- reactos/include/reactos/wine/exception.h | 9 +++ reactos/lib/sdk/crt/conio/cputs.c | 2 +- reactos/lib/sdk/crt/crt.cmake | 1 + reactos/lib/sdk/crt/except/cpp.c | 4 +- reactos/lib/sdk/crt/except/cppexcept.c | 68 ++++++++++++++++--- reactos/lib/sdk/crt/float/amd64/getsetfpcw.S | 24 +++++++ reactos/lib/sdk/crt/float/i386/cntrlfp.c | 21 +++--- reactos/lib/sdk/crt/float/i386/statfp.c | 9 +-- reactos/lib/sdk/crt/include/internal/time.h | 6 +- reactos/lib/sdk/crt/math/cos.c | 4 +- reactos/lib/sdk/crt/math/sin.c | 4 +- reactos/lib/sdk/crt/mbstring/mbsstr.c | 2 +- reactos/lib/sdk/crt/misc/assert.c | 10 +-- reactos/lib/sdk/crt/misc/environ.c | 6 +- reactos/lib/sdk/crt/misc/getargs.c | 10 +-- reactos/lib/sdk/crt/misc/i10output.c | 4 +- reactos/lib/sdk/crt/printf/_sxprintf.c | 2 +- reactos/lib/sdk/crt/printf/streamout.c | 13 ++-- reactos/lib/sdk/crt/process/process.c | 25 +++---- reactos/lib/sdk/crt/search/bsearch.c | 3 +- reactos/lib/sdk/crt/stdio/_flsbuf.c | 2 +- reactos/lib/sdk/crt/stdio/file.c | 28 ++++---- reactos/lib/sdk/crt/stdio/findgen.c | 12 ++-- reactos/lib/sdk/crt/stdio/stat.c | 8 +-- reactos/lib/sdk/crt/stdio/stat64.c | 6 +- reactos/lib/sdk/crt/stdlib/atexit.c | 2 +- reactos/lib/sdk/crt/stdlib/fullpath.c | 2 +- reactos/lib/sdk/crt/stdlib/getenv.c | 4 +- reactos/lib/sdk/crt/stdlib/makepath.c | 4 +- reactos/lib/sdk/crt/stdlib/makepath_s.c | 12 ++-- reactos/lib/sdk/crt/stdlib/qsort.c | 4 +- reactos/lib/sdk/crt/stdlib/wmakpath.c | 4 +- reactos/lib/sdk/crt/stdlib/wmakpath_s.c | 12 ++-- reactos/lib/sdk/crt/string/itow.c | 8 +-- reactos/lib/sdk/crt/string/mbstowcs_nt.c | 6 +- reactos/lib/sdk/crt/string/scanf.h | 6 +- reactos/lib/sdk/crt/string/strtol.c | 4 +- reactos/lib/sdk/crt/string/strtoul.c | 2 +- reactos/lib/sdk/crt/string/strtoull.c | 2 +- reactos/lib/sdk/crt/string/wcs.c | 4 +- reactos/lib/sdk/crt/string/wcstol.c | 4 +- reactos/lib/sdk/crt/string/wcstombs_nt.c | 4 +- reactos/lib/sdk/crt/string/wcstoul.c | 2 +- reactos/lib/sdk/crt/string/wtol.c | 2 +- reactos/lib/sdk/crt/time/clock.c | 2 +- reactos/lib/sdk/crt/time/ftime.c | 10 +-- reactos/lib/sdk/crt/time/futime.c | 11 +-- reactos/lib/sdk/crt/time/gmtime.c | 12 ++-- reactos/lib/sdk/crt/time/mktime.c | 20 +++--- reactos/lib/sdk/crt/time/time.c | 2 +- reactos/lib/sdk/crt/time/timezone.c | 14 ++-- reactos/lib/sdk/crt/wine/heap.c | 8 +-- reactos/lib/sdk/crt/wine/undname.c | 70 ++++++++++---------- 53 files changed, 309 insertions(+), 211 deletions(-) create mode 100644 reactos/lib/sdk/crt/float/amd64/getsetfpcw.S diff --git a/reactos/include/reactos/wine/exception.h b/reactos/include/reactos/wine/exception.h index c2f23fb9d2b..611316b50e0 100644 --- a/reactos/include/reactos/wine/exception.h +++ b/reactos/include/reactos/wine/exception.h @@ -74,6 +74,11 @@ typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD #define siglongjmp(buf,val) longjmp(buf,val) #endif +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4733) +#endif + static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame ) { #ifdef __i386__ @@ -101,6 +106,10 @@ static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTR #endif } +#ifdef _MSC_VER +#pragma warning(pop) +#endif + extern void __wine_enter_vm86( CONTEXT *context ); #ifdef __cplusplus diff --git a/reactos/lib/sdk/crt/conio/cputs.c b/reactos/lib/sdk/crt/conio/cputs.c index 4a781e5e3c7..0def1b00d53 100644 --- a/reactos/lib/sdk/crt/conio/cputs.c +++ b/reactos/lib/sdk/crt/conio/cputs.c @@ -26,7 +26,7 @@ int _cputs(const char *_str) UNLOCK_CONSOLE; return retval; #else - int len = strlen(_str); + int len = (int)strlen(_str); DWORD written = 0; if (!WriteFile( fdesc[stdout->_file].hFile ,_str,len,&written,NULL)) return -1; diff --git a/reactos/lib/sdk/crt/crt.cmake b/reactos/lib/sdk/crt/crt.cmake index 4f5a05b2850..508addb9ad3 100644 --- a/reactos/lib/sdk/crt/crt.cmake +++ b/reactos/lib/sdk/crt/crt.cmake @@ -379,6 +379,7 @@ elseif(ARCH MATCHES amd64) except/amd64/seh.s except/amd64/ehandler.c float/amd64/clearfp.S + float/amd64/getsetfpcw.S float/i386/cntrlfp.c float/amd64/fpreset.S float/amd64/logb.S diff --git a/reactos/lib/sdk/crt/except/cpp.c b/reactos/lib/sdk/crt/except/cpp.c index 92d33b5b0c4..189d0c52dd2 100644 --- a/reactos/lib/sdk/crt/except/cpp.c +++ b/reactos/lib/sdk/crt/except/cpp.c @@ -132,7 +132,7 @@ static void WINAPI EXCEPTION_ctor(exception *_this, const char** name) _this->vtable = &MSVCRT_exception_vtable; if (*name) { - unsigned int name_len = strlen(*name) + 1; + size_t name_len = strlen(*name) + 1; _this->name = MSVCRT_malloc(name_len); memcpy(_this->name, *name, name_len); _this->do_free = TRUE; @@ -608,7 +608,7 @@ const char * __stdcall MSVCRT_type_info_name(type_info * _this) if (name) { - unsigned int len = strlen(name); + size_t len = strlen(name); /* It seems _unDName may leave blanks at the end of the demangled name */ while (len && name[--len] == ' ') diff --git a/reactos/lib/sdk/crt/except/cppexcept.c b/reactos/lib/sdk/crt/except/cppexcept.c index 99f6a3cfbde..5b0c5e66b28 100644 --- a/reactos/lib/sdk/crt/except/cppexcept.c +++ b/reactos/lib/sdk/crt/except/cppexcept.c @@ -81,7 +81,25 @@ static inline void call_copy_ctor( void *func, void *this, void *src, int has_vb { TRACE( "calling copy ctor %p object %p src %p\n", func, this, src ); #ifdef _MSC_VER -#pragma message ("call_copy_ctor is unimplemented for MSC") + if (has_vbase) + { + __asm + { + mov ecx, this + push 1 + push src + call func + } + } + else + { + __asm + { + mov ecx, this + push src + call func + } + } #else if (has_vbase) /* in that case copy ctor takes an extra bool indicating whether to copy the base class */ @@ -97,23 +115,42 @@ static inline void call_copy_ctor( void *func, void *this, void *src, int has_vb static inline void call_dtor( void *func, void *object ) { #ifdef _MSC_VER -#pragma message ("call_dtor is unimplemented for MSC") + __asm + { + mov ecx, object + call func + } #else __asm__ __volatile__("call *%0" : : "r" (func), "c" (object) : "eax", "edx", "memory" ); #endif } +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4731) +/* continue execution to the specified address after exception is caught */ +__forceinline void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr ) +{ + __asm + { + mov eax, addr + mov edx, frame + mov esp, [edx-4] + lea ebp, [edx+12] + jmp eax + } + for (;;) ; /* unreached */ +} +#pragma warning(pop) +#else /* continue execution to the specified address after exception is caught */ static inline void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr ) { -#ifdef _MSC_VER -#pragma message ("continue_after_catch is unimplemented for MSC") -#else __asm__ __volatile__("movl -4(%0),%%esp; leal 12(%0),%%ebp; jmp *%1" : : "r" (frame), "a" (addr) ); -#endif for (;;) ; /* unreached */ } +#endif static inline void dump_type( const cxx_type_info *type ) { @@ -235,7 +272,7 @@ static void cxx_local_unwind( cxx_exception_frame* frame, const cxx_function_des while (trylevel != last_level) { - if (trylevel < 0 || trylevel >= descr->unwind_count) + if (trylevel < 0 || (unsigned)trylevel >= descr->unwind_count) { ERR( "invalid trylevel %d\n", trylevel ); MSVCRT_terminate(); @@ -448,11 +485,22 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame extern DWORD CDECL __CxxFrameHandler( PEXCEPTION_RECORD rec, EXCEPTION_REGISTRATION_RECORD* frame, PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch ); #ifdef _MSC_VER -#pragma message ("__CxxFrameHandler is unimplemented for MSC") -DWORD CDECL __CxxFrameHandler( PEXCEPTION_RECORD rec, EXCEPTION_REGISTRATION_RECORD* frame, +DWORD _declspec(naked) __CxxFrameHandler( PEXCEPTION_RECORD rec, EXCEPTION_REGISTRATION_RECORD* frame, PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch ) { - return 0; + __asm + { + push 0 + push 0 + push eax + push [esp + 28] + push [esp + 28] + push [esp + 28] + push [esp + 28] + call cxx_frame_handler + add esp, 28 + ret + } } #else __ASM_GLOBAL_FUNC( __CxxFrameHandler, diff --git a/reactos/lib/sdk/crt/float/amd64/getsetfpcw.S b/reactos/lib/sdk/crt/float/amd64/getsetfpcw.S new file mode 100644 index 00000000000..cbf23ca76c8 --- /dev/null +++ b/reactos/lib/sdk/crt/float/amd64/getsetfpcw.S @@ -0,0 +1,24 @@ + +#include + +.code64 + +PUBLIC __getfpcw87 +FUNC __getfpcw87 + sub rsp, 8 + .ENDPROLOG + stmxcsr [rsp] + mov rax, [rsp] + add rsp, 8 + ret +ENDFUNC __getfpcw87 + +PUBLIC __setfpcw87 +FUNC __setfpcw87 + mov qword ptr [rsp + 8], rcx + .ENDPROLOG + ldmxcsr [rsp + 8] + ret +ENDFUNC __setfpcw87 + +END diff --git a/reactos/lib/sdk/crt/float/i386/cntrlfp.c b/reactos/lib/sdk/crt/float/i386/cntrlfp.c index b999151c2a3..18745eaaf6f 100644 --- a/reactos/lib/sdk/crt/float/i386/cntrlfp.c +++ b/reactos/lib/sdk/crt/float/i386/cntrlfp.c @@ -23,6 +23,11 @@ #define X87_CW_IC (1<<12) /* infinity control flag */ +#ifdef _M_AMD64 +unsigned int __getfpcw87(void); +void __setfpcw87(unsigned int); +#endif + /* * @implemented */ @@ -43,12 +48,12 @@ unsigned int CDECL _control87(unsigned int newval, unsigned int mask) TRACE("(%08x, %08x): Called\n", newval, mask); /* Get fp control word */ -#if defined(__GNUC__) +#ifdef _M_AMD64 + fpword = __getfpcw87(); +#elif defined(__GNUC__) __asm__ __volatile__( "fstcw %0" : "=m" (fpword) : ); -#elif defined(_M_IX86) - __asm fstcw [fpword]; #else - #pragma message("FIXME: _control87 is halfplemented") + __asm fstcw [fpword]; #endif TRACE("Control word before : %08x\n", fpword); @@ -98,12 +103,12 @@ unsigned int CDECL _control87(unsigned int newval, unsigned int mask) TRACE("Control word after : %08x\n", fpword); /* Put fp control word */ -#if defined(__GNUC__) +#ifdef _M_AMD64 + __setfpcw87(fpword); +#elif defined(__GNUC__) __asm__ __volatile__( "fldcw %0" : : "m" (fpword) ); -#elif defined(_M_IX86) - __asm fldcw [fpword]; #else - #pragma message("FIXME: _control87 is halfplemented") + __asm fldcw [fpword]; #endif return flags; diff --git a/reactos/lib/sdk/crt/float/i386/statfp.c b/reactos/lib/sdk/crt/float/i386/statfp.c index ef788178a1f..e7ba53389d1 100644 --- a/reactos/lib/sdk/crt/float/i386/statfp.c +++ b/reactos/lib/sdk/crt/float/i386/statfp.c @@ -26,12 +26,13 @@ unsigned int CDECL _statusfp(void) { unsigned int retVal = 0; unsigned int fpword; -#if defined(__GNUC__) + +#ifdef _M_AMD64 + fpword = _mm_getcsr(); +#elif defined(__GNUC__) __asm__ __volatile__( "fstsw %0" : "=m" (fpword) : ); -#elif defined(_M_IX86) +#else // _MSC_VER __asm fstsw [fpword]; -#else - #pragma message("FIXME: _statusfp is halfplemented") #endif if (fpword & 0x1) retVal |= _SW_INVALID; if (fpword & 0x2) retVal |= _SW_DENORMAL; diff --git a/reactos/lib/sdk/crt/include/internal/time.h b/reactos/lib/sdk/crt/include/internal/time.h index 852bdabec4f..2bcddb4314e 100644 --- a/reactos/lib/sdk/crt/include/internal/time.h +++ b/reactos/lib/sdk/crt/include/internal/time.h @@ -10,17 +10,17 @@ #define LEAPDAY 59 static __inline -time_t +__time64_t FileTimeToUnixTime(const FILETIME *FileTime, USHORT *millitm) { ULARGE_INTEGER ULargeInt; - time_t time; + __time64_t time; ULargeInt.LowPart = FileTime->dwLowDateTime; ULargeInt.HighPart = FileTime->dwHighDateTime; ULargeInt.QuadPart -= DIFFTIME; - time = (time_t)(ULargeInt.QuadPart / 10000000); + time = ULargeInt.QuadPart / 10000000; if (millitm) *millitm = (USHORT)((ULargeInt.QuadPart % 10000000) / 10000); diff --git a/reactos/lib/sdk/crt/math/cos.c b/reactos/lib/sdk/crt/math/cos.c index 1e7d8c4206c..6fcae769449 100644 --- a/reactos/lib/sdk/crt/math/cos.c +++ b/reactos/lib/sdk/crt/math/cos.c @@ -19,7 +19,7 @@ cos(double x) double x2, result; /* Calculate the quadrant */ - quadrant = x * (2./M_PI); + quadrant = (int)(x * (2./M_PI)); /* Get offset inside quadrant */ x = x - quadrant * (M_PI/2.); @@ -33,7 +33,7 @@ cos(double x) /* Calculate the negative of the square of x */ x2 = - (x * x); - /* This is an unrolled taylor series using iterations + /* This is an unrolled taylor series using iterations * Example with 4 iterations: * result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! * To save multiplications and to keep the precision high, it's performed diff --git a/reactos/lib/sdk/crt/math/sin.c b/reactos/lib/sdk/crt/math/sin.c index da69573edb8..013f91e83aa 100644 --- a/reactos/lib/sdk/crt/math/sin.c +++ b/reactos/lib/sdk/crt/math/sin.c @@ -19,7 +19,7 @@ sin(double x) double x2, result; /* Calculate the quadrant */ - quadrant = x * (2./M_PI); + quadrant = (int)(x * (2./M_PI)); /* Get offset inside quadrant */ x = x - quadrant * (M_PI/2.); @@ -33,7 +33,7 @@ sin(double x) /* Calculate the negative of the square of x */ x2 = - (x * x); - /* This is an unrolled taylor series using iterations + /* This is an unrolled taylor series using iterations * Example with 4 iterations: * result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! * To save multiplications and to keep the precision high, it's performed diff --git a/reactos/lib/sdk/crt/mbstring/mbsstr.c b/reactos/lib/sdk/crt/mbstring/mbsstr.c index 318de319c70..5eaee4d4e98 100644 --- a/reactos/lib/sdk/crt/mbstring/mbsstr.c +++ b/reactos/lib/sdk/crt/mbstring/mbsstr.c @@ -6,7 +6,7 @@ */ unsigned char *_mbsstr(const unsigned char *src1,const unsigned char *src2) { - int len; + size_t len; if (src2 ==NULL || *src2 == 0) return (unsigned char *)src1; diff --git a/reactos/lib/sdk/crt/misc/assert.c b/reactos/lib/sdk/crt/misc/assert.c index 693e42d1056..4619a4fa889 100644 --- a/reactos/lib/sdk/crt/misc/assert.c +++ b/reactos/lib/sdk/crt/misc/assert.c @@ -5,7 +5,7 @@ #include #include -static const char formatstr[] = +static const char formatstr[] = "Assertion failed!\n\n" "Program: %s\n" "File: %s\n" @@ -23,7 +23,7 @@ void _assert(const char *exp, const char *file, unsigned line) HMODULE hmodUser32; char achProgram[40]; char *pszBuffer; - int len; + size_t len; int iResult; /* Assertion failed at foo.c line 45: xpos++; for(p = buf+prec+1; p>buf+1 && *p=='0'; p--); - data->len = p-buf; + data->len = (BYTE)(p - buf); memcpy(data->str, buf+1, data->len); data->str[data->len] = '\0'; diff --git a/reactos/lib/sdk/crt/printf/_sxprintf.c b/reactos/lib/sdk/crt/printf/_sxprintf.c index 0b6c19658fa..44d35ecafff 100644 --- a/reactos/lib/sdk/crt/printf/_sxprintf.c +++ b/reactos/lib/sdk/crt/printf/_sxprintf.c @@ -47,7 +47,7 @@ _sxprintf( stream._ptr = stream._base; stream._charbuf = 0; #if USE_COUNT - stream._cnt = count * sizeof(TCHAR); + stream._cnt = (int)(count * sizeof(TCHAR)); #else stream._cnt = INT_MAX; #endif diff --git a/reactos/lib/sdk/crt/printf/streamout.c b/reactos/lib/sdk/crt/printf/streamout.c index 0f26f32ee6b..c1d8ff29095 100644 --- a/reactos/lib/sdk/crt/printf/streamout.c +++ b/reactos/lib/sdk/crt/printf/streamout.c @@ -67,7 +67,7 @@ enum (flags & FLAG_LONGDOUBLE) ? va_arg(argptr, long double) : \ va_arg(argptr, double) -#define get_exp(f) floor(f == 0 ? 0 : (f >= 0 ? log10(f) : log10(-f))) +#define get_exp(f) (int)floor(f == 0 ? 0 : (f >= 0 ? log10(f) : log10(-f))) #define round(x) floor((x) + 0.5) #ifndef _USER32_WSPRINTF @@ -244,7 +244,7 @@ streamout_char(FILE *stream, int chr) static int -streamout_astring(FILE *stream, const char *string, int count) +streamout_astring(FILE *stream, const char *string, size_t count) { TCHAR chr; int written = 0; @@ -267,7 +267,7 @@ streamout_astring(FILE *stream, const char *string, int count) static int -streamout_wstring(FILE *stream, const wchar_t *string, int count) +streamout_wstring(FILE *stream, const wchar_t *string, size_t count) { wchar_t chr; int written = 0; @@ -317,7 +317,8 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) TCHAR chr, *string; STRING *nt_string; const TCHAR *digits, *prefix; - int base, len, prefixlen, fieldwidth, precision, padding; + int base, fieldwidth, precision, padding; + size_t prefixlen, len; int written = 1, written_all = 0; unsigned int flags; unsigned __int64 val64; @@ -510,7 +511,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) len = wcslen((wchar_t*)string); else len = strlen((char*)string); - if (precision >= 0 && len > precision) len = precision; + if (precision >= 0 && len > (unsigned)precision) len = precision; precision = 0; break; @@ -611,7 +612,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) /* Calculate padding */ prefixlen = prefix ? _tcslen(prefix) : 0; if (precision < 0) precision = 0; - padding = fieldwidth - len - prefixlen - precision; + padding = (int)(fieldwidth - len - prefixlen - precision); if (padding < 0) padding = 0; /* Optional left space padding */ diff --git a/reactos/lib/sdk/crt/process/process.c b/reactos/lib/sdk/crt/process/process.c index 53f752310fc..32c24f591a8 100644 --- a/reactos/lib/sdk/crt/process/process.c +++ b/reactos/lib/sdk/crt/process/process.c @@ -117,7 +117,8 @@ const _TCHAR* find_execT(const _TCHAR* path, _TCHAR* rpath) static _TCHAR* argvtosT(const _TCHAR* const* argv, _TCHAR delim) { - int i, len; + int i; + size_t len; _TCHAR *ptr, *str; if (argv == NULL) @@ -149,7 +150,7 @@ valisttosT(const _TCHAR* arg0, va_list alist, _TCHAR delim) { va_list alist2 = alist; _TCHAR *ptr, *str; - int len; + size_t len; if (arg0 == NULL) return NULL; @@ -327,7 +328,7 @@ intptr_t _tspawnl(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ...) { va_list argp; _TCHAR* args; - int ret = -1; + intptr_t ret = -1; TRACE(MK_STR(_tspawnl)"('%"sT"')\n", cmdname); @@ -348,7 +349,7 @@ intptr_t _tspawnl(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ...) intptr_t _tspawnv(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv) { _TCHAR* args; - int ret = -1; + intptr_t ret = -1; TRACE(MK_STR(_tspawnv)"('%"sT"')\n", cmdname); @@ -371,7 +372,7 @@ intptr_t _tspawnle(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ... /*, _TCHAR* args; _TCHAR* envs; _TCHAR const * const* ptr; - int ret = -1; + intptr_t ret = -1; TRACE(MK_STR(_tspawnle)"('%"sT"')\n", cmdname); @@ -404,7 +405,7 @@ intptr_t _tspawnve(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv, c { _TCHAR *args; _TCHAR *envs; - int ret = -1; + intptr_t ret = -1; TRACE(MK_STR(_tspawnve)"('%"sT"')\n", cmdname); @@ -442,7 +443,7 @@ intptr_t _tspawnlp(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, N { va_list argp; _TCHAR* args; - int ret = -1; + intptr_t ret = -1; _TCHAR pathname[FILENAME_MAX]; TRACE(MK_STR(_tspawnlp)"('%"sT"')\n", cmdname); @@ -467,7 +468,7 @@ intptr_t _tspawnlpe(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, _TCHAR* args; _TCHAR* envs; _TCHAR const* const * ptr; - int ret = -1; + intptr_t ret = -1; _TCHAR pathname[FILENAME_MAX]; TRACE(MK_STR(_tspawnlpe)"('%"sT"')\n", cmdname); @@ -512,7 +513,7 @@ intptr_t _texecl(const _TCHAR* cmdname, const _TCHAR* arg0, ...) { _TCHAR* args; va_list argp; - int ret = -1; + intptr_t ret = -1; TRACE(MK_STR(_texecl)"('%"sT"')\n", cmdname); @@ -545,7 +546,7 @@ intptr_t _texecle(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* _TCHAR* args; _TCHAR* envs; _TCHAR const* const* ptr; - int ret = -1; + intptr_t ret = -1; TRACE(MK_STR(_texecle)"('%"sT"')\n", cmdname); @@ -586,7 +587,7 @@ intptr_t _texeclp(const _TCHAR* cmdname, const _TCHAR* arg0, ...) { _TCHAR* args; va_list argp; - int ret = -1; + intptr_t ret = -1; _TCHAR pathname[FILENAME_MAX]; TRACE(MK_STR(_texeclp)"('%"sT"')\n", cmdname); @@ -620,7 +621,7 @@ intptr_t _texeclpe(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char _TCHAR* args; _TCHAR* envs; _TCHAR const* const* ptr; - int ret = -1; + intptr_t ret = -1; _TCHAR pathname[FILENAME_MAX]; TRACE(MK_STR(_texeclpe)"('%"sT"')\n", cmdname); diff --git a/reactos/lib/sdk/crt/search/bsearch.c b/reactos/lib/sdk/crt/search/bsearch.c index 9958ab4c65d..f160a9e685c 100644 --- a/reactos/lib/sdk/crt/search/bsearch.c +++ b/reactos/lib/sdk/crt/search/bsearch.c @@ -9,7 +9,8 @@ bsearch(const void *key, const void *base0, size_t nelem, size_t size, int (__cdecl *cmp)(const void *ck, const void *ce)) { char *base = (char *)base0; - int lim, cmpval; + size_t lim; + int cmpval; void *p; for (lim = nelem; lim != 0; lim >>= 1) diff --git a/reactos/lib/sdk/crt/stdio/_flsbuf.c b/reactos/lib/sdk/crt/stdio/_flsbuf.c index 8eeeba1125a..2750932073b 100644 --- a/reactos/lib/sdk/crt/stdio/_flsbuf.c +++ b/reactos/lib/sdk/crt/stdio/_flsbuf.c @@ -56,7 +56,7 @@ _flsbuf(int ch, FILE *stream) if (stream->_base && !(stream->_flag & _IONBF)) { /* We can, check if there is something to write */ - count = stream->_ptr - stream->_base; + count = (int)(stream->_ptr - stream->_base); if (count > 0) written = _write(stream->_file, stream->_base, count); else diff --git a/reactos/lib/sdk/crt/stdio/file.c b/reactos/lib/sdk/crt/stdio/file.c index add57d8d02d..8ec842eb7b0 100644 --- a/reactos/lib/sdk/crt/stdio/file.c +++ b/reactos/lib/sdk/crt/stdio/file.c @@ -267,7 +267,7 @@ unsigned create_io_inherit_block(WORD *size, BYTE **block) char* wxflag_ptr; HANDLE* handle_ptr; - *size = sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * fdend; + *size = (WORD)(sizeof(unsigned) + (sizeof(char) + sizeof(HANDLE)) * fdend); *block = calloc(*size, 1); if (!*block) { @@ -302,7 +302,7 @@ unsigned create_io_inherit_block(WORD *size, BYTE **block) void msvcrt_init_io(void) { STARTUPINFOA si; - int i; + unsigned int i; InitializeCriticalSection(&FILE_cs); FILE_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": FILE_cs"); @@ -397,7 +397,7 @@ void msvcrt_init_io(void) static int flush_buffer(FILE* file) { if(file->_bufsiz) { - int cnt=file->_ptr-file->_base; + int cnt = (int)(file->_ptr - file->_base); if(cnt>0 && _write(file->_file, file->_base, cnt) != cnt) { file->_flag |= _IOERR; return EOF; @@ -839,7 +839,7 @@ __int64 CDECL _lseeki64(int fd, __int64 offset, int whence) */ LONG CDECL _lseek(int fd, LONG offset, int whence) { - return _lseeki64(fd, offset, whence); + return (LONG)_lseeki64(fd, offset, whence); } /********************************************************************* @@ -1056,7 +1056,7 @@ FILE* CDECL _fdopen(int fd, const char *mode) */ FILE* CDECL _wfdopen(int fd, const wchar_t *mode) { - unsigned mlen = strlenW(mode); + unsigned mlen = (unsigned)strlenW(mode); char *modea = calloc(mlen + 1, 1); FILE* file = NULL; int open_flags, stream_flags; @@ -1409,7 +1409,7 @@ int CDECL _sopen( const char *path, int oflags, int shflags, ... ) */ int CDECL _wsopen( const wchar_t* path, int oflags, int shflags, ... ) { - const unsigned int len = strlenW(path); + const unsigned int len = (unsigned)strlenW(path); char *patha = calloc(len + 1,1); va_list ap; int pmode; @@ -1453,7 +1453,7 @@ int CDECL _open( const char *path, int flags, ... ) */ int CDECL _wopen(const wchar_t *path,int flags,...) { - const unsigned int len = strlenW(path); + const unsigned int len = (unsigned)strlenW(path); char *patha = calloc(len + 1,1); va_list ap; int pmode; @@ -1793,7 +1793,7 @@ int CDECL _write(int fd, const void* buf, unsigned int count) *_errno() = ENOSPC; if(nr_lf) free(p); - return s - buf_start; + return (int)(s - buf_start); } else { @@ -2071,7 +2071,7 @@ wchar_t * CDECL fgetws(wchar_t *s, int size, FILE* file) */ size_t CDECL fwrite(const void *ptr, size_t size, size_t nmemb, FILE* file) { - size_t wrcnt=size * nmemb; + int wrcnt=(int)(size * nmemb); int written = 0; if (size == 0) return 0; @@ -2184,7 +2184,7 @@ FILE * CDECL _fsopen(const char *path, const char *mode, int share) */ FILE * CDECL _wfsopen(const wchar_t *path, const wchar_t *mode, int share) { - const unsigned int plen = strlenW(path), mlen = strlenW(mode); + const unsigned int plen = (unsigned)strlenW(path), mlen = (unsigned)strlenW(mode); char *patha = calloc(plen + 1, 1); char *modea = calloc(mlen + 1, 1); @@ -2256,7 +2256,7 @@ int CDECL _fputchar(int c) * fread (MSVCRT.@) */ size_t CDECL fread(void *ptr, size_t size, size_t nmemb, FILE* file) -{ size_t rcnt=size * nmemb; +{ int rcnt=(int)(size * nmemb); size_t read=0; int pread=0; @@ -2431,7 +2431,7 @@ LONG CDECL ftell(FILE* file) if(pos == -1) return -1; if(file->_bufsiz) { if( file->_flag & _IOWRT ) { - off = file->_ptr - file->_base; + off = (int)(file->_ptr - file->_base); } else { off = -file->_cnt; if (fdesc[file->_file].wxflag & WX_TEXT) { @@ -2457,7 +2457,7 @@ int CDECL fgetpos(FILE* file, fpos_t *pos) if(*pos == -1) return -1; if(file->_bufsiz) { if( file->_flag & _IOWRT ) { - off = file->_ptr - file->_base; + off = (int)(file->_ptr - file->_base); } else { off = -file->_cnt; if (fdesc[file->_file].wxflag & WX_TEXT) { @@ -2664,7 +2664,7 @@ int CDECL setvbuf(FILE* file, char *buf, int mode, size_t size) file->_flag &= ~_IONBF; file->_base = file->_ptr = buf; if(buf) { - file->_bufsiz = size; + file->_bufsiz = (int)size; } } else { file->_flag |= _IONBF; diff --git a/reactos/lib/sdk/crt/stdio/findgen.c b/reactos/lib/sdk/crt/stdio/findgen.c index 9d70c98d4d3..7a525fa08c3 100644 --- a/reactos/lib/sdk/crt/stdio/findgen.c +++ b/reactos/lib/sdk/crt/stdio/findgen.c @@ -14,9 +14,9 @@ intptr_t _tfindfirst(const _TCHAR* _name, struct _tfinddata_t* result) } result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->time_create = (time_t)FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = (time_t)FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = (time_t)FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); result->size = (((__int64)FindFileData.nFileSizeHigh)<<32) + FindFileData.nFileSizeLow; _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); @@ -36,9 +36,9 @@ int _tfindnext(intptr_t handle, struct _tfinddata_t* result) } result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->time_create = (time_t)FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = (time_t)FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = (time_t)FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); result->size = (((__int64)FindFileData.nFileSizeHigh)<<32) + FindFileData.nFileSizeLow; _tcsncpy(result->name,FindFileData.cFileName, MAX_PATH); diff --git a/reactos/lib/sdk/crt/stdio/stat.c b/reactos/lib/sdk/crt/stdio/stat.c index ac73b2fd63f..39df882ed34 100644 --- a/reactos/lib/sdk/crt/stdio/stat.c +++ b/reactos/lib/sdk/crt/stdio/stat.c @@ -9,10 +9,10 @@ buf->st_uid = (buf64)->st_uid; \ buf->st_gid = (buf64)->st_gid; \ buf->st_rdev = (buf64)->st_rdev; \ - buf->st_size = (buf64)->st_size; \ - buf->st_atime = (buf64)->st_atime; \ - buf->st_mtime = (buf64)->st_mtime; \ - buf->st_ctime = (buf64)->st_ctime; \ + buf->st_size = (_off_t)(buf64)->st_size; \ + buf->st_atime = (time_t)(buf64)->st_atime; \ + buf->st_mtime = (time_t)(buf64)->st_mtime; \ + buf->st_ctime = (time_t)(buf64)->st_ctime; \ int CDECL _tstat(const _TCHAR* path, struct _stat * buf) { diff --git a/reactos/lib/sdk/crt/stdio/stat64.c b/reactos/lib/sdk/crt/stdio/stat64.c index 4df2e767cbc..7005f3aef63 100644 --- a/reactos/lib/sdk/crt/stdio/stat64.c +++ b/reactos/lib/sdk/crt/stdio/stat64.c @@ -2,7 +2,7 @@ #include #include -HANDLE fdtoh(int fd); +HANDLE fdtoh(int fd); #define ALL_S_IREAD (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) #define ALL_S_IWRITE (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) @@ -27,7 +27,7 @@ int CDECL _tstat64(const _TCHAR *path, struct __stat64 *buf) DWORD dw; WIN32_FILE_ATTRIBUTE_DATA hfi; unsigned short mode = ALL_S_IREAD; - int plen; + size_t plen; TRACE(":file (%s) buf(%p)\n",path,buf); @@ -136,7 +136,7 @@ int CDECL _fstat64(int fd, struct __stat64* buf) buf->st_atime = dw; RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); buf->st_mtime = buf->st_ctime = dw; - buf->st_nlink = hfi.nNumberOfLinks; + buf->st_nlink = (short)hfi.nNumberOfLinks; } TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, buf->st_mode); diff --git a/reactos/lib/sdk/crt/stdlib/atexit.c b/reactos/lib/sdk/crt/stdlib/atexit.c index 0b6a952854b..975264972a4 100644 --- a/reactos/lib/sdk/crt/stdlib/atexit.c +++ b/reactos/lib/sdk/crt/stdlib/atexit.c @@ -23,7 +23,7 @@ void _atexit_cleanup(void) _onexit_t __dllonexit(_onexit_t func, _onexit_t **start, _onexit_t **end) { _onexit_t *tmp; - int len; + size_t len; if (!start || !*start || !end || !*end) return NULL; diff --git a/reactos/lib/sdk/crt/stdlib/fullpath.c b/reactos/lib/sdk/crt/stdlib/fullpath.c index 740ae1d57e5..6f434d267c5 100644 --- a/reactos/lib/sdk/crt/stdlib/fullpath.c +++ b/reactos/lib/sdk/crt/stdlib/fullpath.c @@ -25,7 +25,7 @@ _TCHAR* _tfullpath(_TCHAR* absPath, const _TCHAR* relPath, size_t maxLength) absPath = malloc(maxLength); } - copied = GetFullPathName(relPath,maxLength,absPath,&lpFilePart); + copied = GetFullPathName(relPath,(DWORD)maxLength,absPath,&lpFilePart); if (copied == 0 || copied > maxLength) return NULL; diff --git a/reactos/lib/sdk/crt/stdlib/getenv.c b/reactos/lib/sdk/crt/stdlib/getenv.c index 0f5fb4396cb..4136d430e66 100644 --- a/reactos/lib/sdk/crt/stdlib/getenv.c +++ b/reactos/lib/sdk/crt/stdlib/getenv.c @@ -17,7 +17,7 @@ char *getenv(const char *name) { char **environ; - unsigned int length = strlen(name); + size_t length = strlen(name); for (environ = *__p__environ(); *environ; environ++) { @@ -35,7 +35,7 @@ char *getenv(const char *name) wchar_t *_wgetenv(const wchar_t *name) { wchar_t **environ; - unsigned int length = wcslen(name); + size_t length = wcslen(name); for (environ = *__p__wenviron(); *environ; environ++) { diff --git a/reactos/lib/sdk/crt/stdlib/makepath.c b/reactos/lib/sdk/crt/stdlib/makepath.c index 441cd679511..c048fb80c42 100644 --- a/reactos/lib/sdk/crt/stdlib/makepath.c +++ b/reactos/lib/sdk/crt/stdlib/makepath.c @@ -34,7 +34,7 @@ void _makepath(char* path, const char* drive, const char* dir, const char* fname } if (dir && dir[0]) { - unsigned int len = strlen(dir); + size_t len = strlen(dir); memmove(p, dir, len); p += len; if (p[-1] != '/' && p[-1] != '\\') @@ -42,7 +42,7 @@ void _makepath(char* path, const char* drive, const char* dir, const char* fname } if (fname && fname[0]) { - unsigned int len = strlen(fname); + size_t len = strlen(fname); memmove(p, fname, len); p += len; } diff --git a/reactos/lib/sdk/crt/stdlib/makepath_s.c b/reactos/lib/sdk/crt/stdlib/makepath_s.c index b96f1f6c178..f5b673dc54b 100644 --- a/reactos/lib/sdk/crt/stdlib/makepath_s.c +++ b/reactos/lib/sdk/crt/stdlib/makepath_s.c @@ -44,9 +44,9 @@ int CDECL _makepath_s(char *path, size_t size, const char *drive, if (directory && directory[0]) { - unsigned int len = strlen(directory); + size_t len = strlen(directory); unsigned int needs_separator = directory[len - 1] != '/' && directory[len - 1] != '\\'; - unsigned int copylen = min(size - 1, len); + size_t copylen = min(size - 1, len); if (size < 2) goto range; @@ -71,8 +71,8 @@ int CDECL _makepath_s(char *path, size_t size, const char *drive, if (filename && filename[0]) { - unsigned int len = strlen(filename); - unsigned int copylen = min(size - 1, len); + size_t len = strlen(filename); + size_t copylen = min(size - 1, len); if (size < 2) goto range; @@ -88,9 +88,9 @@ int CDECL _makepath_s(char *path, size_t size, const char *drive, if (extension && extension[0]) { - unsigned int len = strlen(extension); + size_t len = strlen(extension); unsigned int needs_period = extension[0] != '.'; - unsigned int copylen; + size_t copylen; if (size < 2) goto range; diff --git a/reactos/lib/sdk/crt/stdlib/qsort.c b/reactos/lib/sdk/crt/stdlib/qsort.c index 76353795432..1e1dc8c712d 100644 --- a/reactos/lib/sdk/crt/stdlib/qsort.c +++ b/reactos/lib/sdk/crt/stdlib/qsort.c @@ -53,9 +53,9 @@ static void qst(size_t size, int (__cdecl *compar)(const void*, const void*), char *base, char *max) { char c, *i, *j, *jj; - int ii; + size_t ii; char *mid, *tmp; - int lo, hi; + size_t lo, hi; size_t thresh; size_t mthresh; diff --git a/reactos/lib/sdk/crt/stdlib/wmakpath.c b/reactos/lib/sdk/crt/stdlib/wmakpath.c index 5c131f347d4..16ad4e3f844 100644 --- a/reactos/lib/sdk/crt/stdlib/wmakpath.c +++ b/reactos/lib/sdk/crt/stdlib/wmakpath.c @@ -32,7 +32,7 @@ void _wmakepath(wchar_t* path, const wchar_t* drive, const wchar_t* dir, const w } if (dir && dir[0]) { - unsigned int len = strlenW(dir); + size_t len = strlenW(dir); memmove(p, dir, len * sizeof(wchar_t)); p += len; if (p[-1] != '/' && p[-1] != '\\') @@ -40,7 +40,7 @@ void _wmakepath(wchar_t* path, const wchar_t* drive, const wchar_t* dir, const w } if (fname && fname[0]) { - unsigned int len = strlenW(fname); + size_t len = strlenW(fname); memmove(p, fname, len * sizeof(wchar_t)); p += len; } diff --git a/reactos/lib/sdk/crt/stdlib/wmakpath_s.c b/reactos/lib/sdk/crt/stdlib/wmakpath_s.c index 581a0e2a22c..f227bcbd17b 100644 --- a/reactos/lib/sdk/crt/stdlib/wmakpath_s.c +++ b/reactos/lib/sdk/crt/stdlib/wmakpath_s.c @@ -44,9 +44,9 @@ int CDECL _wmakepath_s(wchar_t *path, size_t size, const wchar_t *drive, if (directory && directory[0]) { - unsigned int len = strlenW(directory); + size_t len = strlenW(directory); unsigned int needs_separator = directory[len - 1] != '/' && directory[len - 1] != '\\'; - unsigned int copylen = min(size - 1, len); + size_t copylen = min(size - 1, len); if (size < 2) goto range; @@ -71,8 +71,8 @@ int CDECL _wmakepath_s(wchar_t *path, size_t size, const wchar_t *drive, if (filename && filename[0]) { - unsigned int len = strlenW(filename); - unsigned int copylen = min(size - 1, len); + size_t len = strlenW(filename); + size_t copylen = min(size - 1, len); if (size < 2) goto range; @@ -88,9 +88,9 @@ int CDECL _wmakepath_s(wchar_t *path, size_t size, const wchar_t *drive, if (extension && extension[0]) { - unsigned int len = strlenW(extension); + size_t len = strlenW(extension); unsigned int needs_period = extension[0] != '.'; - unsigned int copylen; + size_t copylen; if (size < 2) goto range; diff --git a/reactos/lib/sdk/crt/string/itow.c b/reactos/lib/sdk/crt/string/itow.c index 7f6bd42f388..4ce450a1983 100644 --- a/reactos/lib/sdk/crt/string/itow.c +++ b/reactos/lib/sdk/crt/string/itow.c @@ -34,7 +34,7 @@ _i64tow(__int64 value, wchar_t *string, int radix) *pos = '\0'; do { - digit = val % radix; + digit = (WCHAR)(val % radix); val = val / radix; if (digit < 10) { *--pos = '0' + digit; @@ -68,7 +68,7 @@ _ui64tow(unsigned __int64 value, wchar_t *string, int radix) *pos = '\0'; do { - digit = value % radix; + digit = (WCHAR)(value % radix); value = value / radix; if (digit < 10) { *--pos = '0' + digit; @@ -120,7 +120,7 @@ _ltow(long value, wchar_t *string, int radix) *pos = '\0'; do { - digit = val % radix; + digit = (WCHAR)(val % radix); val = val / radix; if (digit < 10) { *--pos = '0' + digit; @@ -155,7 +155,7 @@ _ultow(unsigned long value, wchar_t *string, int radix) *pos = '\0'; do { - digit = value % radix; + digit = (WCHAR)(value % radix); value = value / radix; if (digit < 10) { *--pos = '0' + digit; diff --git a/reactos/lib/sdk/crt/string/mbstowcs_nt.c b/reactos/lib/sdk/crt/string/mbstowcs_nt.c index 7058558f4e2..dc970349486 100644 --- a/reactos/lib/sdk/crt/string/mbstowcs_nt.c +++ b/reactos/lib/sdk/crt/string/mbstowcs_nt.c @@ -32,7 +32,7 @@ int mbtowc (wchar_t *wchar, const char *mbchar, size_t count) *wchar = wc; - return mbs - mbarr; + return (int)(mbs - mbarr); } /* @@ -44,7 +44,7 @@ size_t mbstowcs (wchar_t *wcstr, const char *mbstr, size_t count) ULONG Size; ULONG Length; - Length = strlen (mbstr); + Length = (ULONG)strlen (mbstr); if (wcstr == NULL) { @@ -56,7 +56,7 @@ size_t mbstowcs (wchar_t *wcstr, const char *mbstr, size_t count) } Status = RtlMultiByteToUnicodeN (wcstr, - count * sizeof(WCHAR), + (ULONG)count * sizeof(WCHAR), &Size, mbstr, Length); diff --git a/reactos/lib/sdk/crt/string/scanf.h b/reactos/lib/sdk/crt/string/scanf.h index 4be9d8d4343..3edf0ea01c2 100644 --- a/reactos/lib/sdk/crt/string/scanf.h +++ b/reactos/lib/sdk/crt/string/scanf.h @@ -170,7 +170,7 @@ _FUNCTION_ { base = 0; number: { /* read an integer */ - ULONGLONG cur = 0; + __int64 cur = 0; int negative = 0; int seendigit=0; /* skip initial whitespace */ @@ -224,7 +224,7 @@ _FUNCTION_ { if (!seendigit) break; /* not a valid number */ st = 1; if (!suppress) { -#define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur +#define _SET_NUMBER_(type) *va_arg(ap, type*) = (type)(negative ? -cur : cur) if (I64_prefix) _SET_NUMBER_(LONGLONG); else if (l_prefix) _SET_NUMBER_(LONG); else if (h_prefix) _SET_NUMBER_(short int); @@ -296,7 +296,7 @@ _FUNCTION_ { if (width>0) width--; } /* update 'cur' with this exponent. */ - expcnt = negexp ? .1 : 10; + expcnt = negexp ? 0.1f : 10.0f; while (exponent!=0) { if (exponent&1) cur*=expcnt; diff --git a/reactos/lib/sdk/crt/string/strtol.c b/reactos/lib/sdk/crt/string/strtol.c index 6dc42745771..cbaf86a3ab6 100644 --- a/reactos/lib/sdk/crt/string/strtol.c +++ b/reactos/lib/sdk/crt/string/strtol.c @@ -54,7 +54,7 @@ strtol(const char *nptr, char **endptr, int base) * Set any if any `digits' consumed; make it negative to indicate * overflow. */ - cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; + cutoff = neg ? ((unsigned long)LONG_MAX+1) : LONG_MAX; cutlim = cutoff % (unsigned long)base; cutoff /= (unsigned long)base; for (acc = 0, any = 0;; c = *s++) @@ -84,7 +84,7 @@ strtol(const char *nptr, char **endptr, int base) #endif } else if (neg) - acc = -acc; + acc = 0-acc; if (endptr != 0) *endptr = any ? (char *)((size_t)(s - 1)) : (char *)((size_t)nptr); return acc; diff --git a/reactos/lib/sdk/crt/string/strtoul.c b/reactos/lib/sdk/crt/string/strtoul.c index bbfa8fffe6e..32f18d9884b 100644 --- a/reactos/lib/sdk/crt/string/strtoul.c +++ b/reactos/lib/sdk/crt/string/strtoul.c @@ -68,7 +68,7 @@ strtoul(const char *nptr, char **endptr, int base) #endif } else if (neg) - acc = -acc; + acc = 0-acc; if (endptr != 0) *endptr = any ? (char *)((size_t)(s - 1)) : (char *)((size_t)nptr); return acc; diff --git a/reactos/lib/sdk/crt/string/strtoull.c b/reactos/lib/sdk/crt/string/strtoull.c index 3a2553afbbb..2badee8e8fb 100644 --- a/reactos/lib/sdk/crt/string/strtoull.c +++ b/reactos/lib/sdk/crt/string/strtoull.c @@ -59,7 +59,7 @@ strtoull(const char *nptr, char **endptr, int base) #endif } else if (neg) - acc = -acc; + acc = 0-acc; if (endptr != 0) *endptr = any ? (char *)((size_t)(s - 1)) : (char *)((size_t)nptr); return acc; diff --git a/reactos/lib/sdk/crt/string/wcs.c b/reactos/lib/sdk/crt/string/wcs.c index dcef8c4cca5..8b3e6851bc1 100644 --- a/reactos/lib/sdk/crt/string/wcs.c +++ b/reactos/lib/sdk/crt/string/wcs.c @@ -60,7 +60,7 @@ wchar_t* CDECL _wcsdup( const wchar_t* str ) wchar_t* ret = NULL; if (str) { - int size = (strlenW(str) + 1) * sizeof(wchar_t); + size_t size = (strlenW(str) + 1) * sizeof(wchar_t); ret = malloc( size ); if (ret) memcpy( ret, str, size ); } @@ -386,7 +386,7 @@ size_t CDECL wcstombs(char *mbstr, const wchar_t *wcstr, size_t count) */ INT CDECL wcscpy_s( wchar_t* wcDest, size_t numElement, const wchar_t *wcSrc) { - INT size = 0; + size_t size = 0; if(!wcDest || !numElement) return EINVAL; diff --git a/reactos/lib/sdk/crt/string/wcstol.c b/reactos/lib/sdk/crt/string/wcstol.c index ab87e4016d7..04f1e90b0eb 100644 --- a/reactos/lib/sdk/crt/string/wcstol.c +++ b/reactos/lib/sdk/crt/string/wcstol.c @@ -63,7 +63,7 @@ wcstol(const wchar_t *nptr, wchar_t **endptr, int base) * Set any if any `digits' consumed; make it negative to indicate * overflow. */ - cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; + cutoff = neg ? ((unsigned long)LONG_MAX+1) : LONG_MAX; cutlim = cutoff % (unsigned long)base; cutoff /= (unsigned long)base; for (acc = 0, any = 0;; c = *s++) @@ -90,7 +90,7 @@ wcstol(const wchar_t *nptr, wchar_t **endptr, int base) acc = neg ? LONG_MIN : LONG_MAX; } else if (neg) - acc = -acc; + acc = 0-acc; if (endptr != 0) *endptr = any ? (wchar_t *)((size_t)(s - 1)) : (wchar_t *)((size_t)nptr); return acc; diff --git a/reactos/lib/sdk/crt/string/wcstombs_nt.c b/reactos/lib/sdk/crt/string/wcstombs_nt.c index d927b7e9681..721caab2a32 100644 --- a/reactos/lib/sdk/crt/string/wcstombs_nt.c +++ b/reactos/lib/sdk/crt/string/wcstombs_nt.c @@ -34,7 +34,7 @@ size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count) ULONG Size; ULONG Length; - Length = wcslen (wcstr); + Length = (ULONG)wcslen (wcstr); if (mbstr == NULL) { @@ -46,7 +46,7 @@ size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count) } Status = RtlUnicodeToMultiByteN (mbstr, - count, + (ULONG)count, &Size, (wchar_t*)((size_t)wcstr), Length * sizeof(WCHAR)); diff --git a/reactos/lib/sdk/crt/string/wcstoul.c b/reactos/lib/sdk/crt/string/wcstoul.c index 9e50a2646bc..4775585eb5f 100644 --- a/reactos/lib/sdk/crt/string/wcstoul.c +++ b/reactos/lib/sdk/crt/string/wcstoul.c @@ -65,7 +65,7 @@ wcstoul(const wchar_t *nptr, wchar_t **endptr, int base) acc = ULONG_MAX; } else if (neg) - acc = -acc; + acc = 0-acc; if (endptr != 0) *endptr = any ? (wchar_t *)((size_t)(s - 1)) : (wchar_t *)((size_t)nptr); return acc; diff --git a/reactos/lib/sdk/crt/string/wtol.c b/reactos/lib/sdk/crt/string/wtol.c index a57015e9f7b..8250c53d4e2 100644 --- a/reactos/lib/sdk/crt/string/wtol.c +++ b/reactos/lib/sdk/crt/string/wtol.c @@ -32,7 +32,7 @@ _wtol(const wchar_t *str) str++; } /* while */ - return bMinus ? -RunningTotal : RunningTotal; + return bMinus ? 0-RunningTotal : RunningTotal; } diff --git a/reactos/lib/sdk/crt/time/clock.c b/reactos/lib/sdk/crt/time/clock.c index e601341363e..b843cce5afd 100644 --- a/reactos/lib/sdk/crt/time/clock.c +++ b/reactos/lib/sdk/crt/time/clock.c @@ -26,5 +26,5 @@ clock(void) GetSystemTimeAsFileTime((FILETIME*)&Time); Time.QuadPart -= g_StartupTime.QuadPart; - return FileTimeToUnixTime((FILETIME*)&Time, NULL); + return (clock_t)FileTimeToUnixTime((FILETIME*)&Time, NULL); }; diff --git a/reactos/lib/sdk/crt/time/ftime.c b/reactos/lib/sdk/crt/time/ftime.c index 5b62f170cd9..c9743669699 100644 --- a/reactos/lib/sdk/crt/time/ftime.c +++ b/reactos/lib/sdk/crt/time/ftime.c @@ -13,7 +13,7 @@ /****************************************************************************** * \name _ftime_s * \brief Get the current time. - * \param [out] ptimeb Pointer to a structure of type struct _timeb that + * \param [out] ptimeb Pointer to a structure of type struct _timeb that * recieves the current time. * \sa http://msdn.microsoft.com/en-us/library/95e68951.aspx */ @@ -39,10 +39,10 @@ _ftime_s(struct _timeb *ptimeb) ret = GetTimeZoneInformation(&TimeZoneInformation); ptimeb->dstflag = (ret == TIME_ZONE_ID_DAYLIGHT) ? 1 : 0; - ptimeb->timezone = TimeZoneInformation.Bias; + ptimeb->timezone = (short)TimeZoneInformation.Bias; GetSystemTimeAsFileTime(&SystemTime); - ptimeb->time = FileTimeToUnixTime(&SystemTime, &ptimeb->millitm); + ptimeb->time = (time_t)FileTimeToUnixTime(&SystemTime, &ptimeb->millitm); return 0; } @@ -50,9 +50,9 @@ _ftime_s(struct _timeb *ptimeb) /****************************************************************************** * \name _ftime * \brief Get the current time. - * \param [out] ptimeb Pointer to a structure of type struct _timeb that + * \param [out] ptimeb Pointer to a structure of type struct _timeb that * recieves the current time. - * \note This function is for compatability and simply calls the secure + * \note This function is for compatability and simply calls the secure * version _ftime_s(). * \sa http://msdn.microsoft.com/en-us/library/z54t9z5f.aspx */ diff --git a/reactos/lib/sdk/crt/time/futime.c b/reactos/lib/sdk/crt/time/futime.c index 82d76857fa7..36193054ca8 100644 --- a/reactos/lib/sdk/crt/time/futime.c +++ b/reactos/lib/sdk/crt/time/futime.c @@ -44,7 +44,7 @@ HANDLE fdtoh(int fd); /****************************************************************************** * \name _futime - * \brief Set a files modification time. + * \brief Set a file's modification time. * \param [out] ptimeb Pointer to a structure of type struct _timeb that * recieves the current time. * \sa http://msdn.microsoft.com/en-us/library/95e68951.aspx @@ -65,19 +65,22 @@ _futime(int fd, struct _utimbuf *filetime) { time_t currTime; _time(&currTime); - RtlSecondsSince1970ToTime(currTime, (LARGE_INTEGER *)&at); + RtlSecondsSince1970ToTime((ULONG)currTime, + (LARGE_INTEGER *)&at); wt = at; } else { - RtlSecondsSince1970ToTime(filetime->actime, (LARGE_INTEGER *)&at); + RtlSecondsSince1970ToTime((ULONG)filetime->actime, + (LARGE_INTEGER *)&at); if (filetime->actime == filetime->modtime) { wt = at; } else { - RtlSecondsSince1970ToTime(filetime->modtime, (LARGE_INTEGER *)&wt); + RtlSecondsSince1970ToTime((ULONG)filetime->modtime, + (LARGE_INTEGER *)&wt); } } diff --git a/reactos/lib/sdk/crt/time/gmtime.c b/reactos/lib/sdk/crt/time/gmtime.c index f0ed6d88dd1..d5b4b94e2b8 100644 --- a/reactos/lib/sdk/crt/time/gmtime.c +++ b/reactos/lib/sdk/crt/time/gmtime.c @@ -23,7 +23,7 @@ _gmtime_worker(struct tm *ptm, __time64_t time, int do_dst) } /* Divide into date and time */ - days = time / SECONDSPERDAY; + days = (unsigned int)(time / SECONDSPERDAY); secondinday = time % SECONDSPERDAY; /* Shift to days from 1.1.1601 */ @@ -61,11 +61,11 @@ _gmtime_worker(struct tm *ptm, __time64_t time, int do_dst) ptm->tm_isdst = 0; if (do_dst) { - unsigned int yeartime = dayinyear * SECONDSPERDAY + secondinday ; + int yeartime = dayinyear * SECONDSPERDAY + secondinday ; if (yeartime >= dst_begin && yeartime <= dst_end) // FIXME! DST in winter { time -= _dstbias; - days = time / SECONDSPERDAY + DIFFDAYS; + days = (unsigned int)(time / SECONDSPERDAY + DIFFDAYS); dayinyear = days - daystoyear; ptm->tm_isdst = 1; } @@ -97,7 +97,7 @@ _gmtime_worker(struct tm *ptm, __time64_t time, int do_dst) /****************************************************************************** * \name _gmtime64 - * \brief + * \brief * \param ptime Pointer to a variable of type __time64_t containing the time. */ struct tm * @@ -123,7 +123,7 @@ _gmtime64(const __time64_t * ptime) /****************************************************************************** * \name _gmtime32 - * \brief + * \brief * \param ptime Pointer to a variable of type __time32_t containing the time. */ struct tm * @@ -135,7 +135,7 @@ _gmtime32(const __time32_t * ptime) /****************************************************************************** * \name gmtime - * \brief + * \brief * \param ptime Pointer to a variable of type time_t containing the time. */ struct tm * diff --git a/reactos/lib/sdk/crt/time/mktime.c b/reactos/lib/sdk/crt/time/mktime.c index f7217c4cff6..f1730c9b799 100644 --- a/reactos/lib/sdk/crt/time/mktime.c +++ b/reactos/lib/sdk/crt/time/mktime.c @@ -106,36 +106,36 @@ mktime_worker(struct tm * ptm, int utc) int tm_isdst; */ -/** +/** * \name _mkgmtime - * + * */ time_t _mkgmtime(struct tm *ptm) { - time_t time = mktime_worker(ptm, 1); - return (time > MAX_32BIT_TIME) ? -1 : time; + __time64_t time = mktime_worker(ptm, 1); + return (time_t)((time > MAX_32BIT_TIME) ? -1 : time); } time_t mktime(struct tm *ptm) { - time_t time = mktime_worker(ptm, 0); - return (time > MAX_32BIT_TIME) ? -1 : time; + __time64_t time = mktime_worker(ptm, 0); + return (time_t)((time > MAX_32BIT_TIME) ? -1 : time); } __time32_t _mkgmtime32(struct tm *ptm) { - time_t time = mktime_worker(ptm, 1); - return (time > MAX_32BIT_TIME) ? -1 : time; + __time64_t time = mktime_worker(ptm, 1); + return (__time32_t)((time > MAX_32BIT_TIME) ? -1 : time); } __time32_t _mktime32(struct tm *ptm) { - time_t time = mktime_worker(ptm, 0); - return (time > MAX_32BIT_TIME) ? -1 : time; + __time64_t time = mktime_worker(ptm, 0); + return (__time32_t)((time > MAX_32BIT_TIME) ? -1 : time); } __time64_t diff --git a/reactos/lib/sdk/crt/time/time.c b/reactos/lib/sdk/crt/time/time.c index ff3e51b9e9d..f2da1838d8a 100644 --- a/reactos/lib/sdk/crt/time/time.c +++ b/reactos/lib/sdk/crt/time/time.c @@ -15,7 +15,7 @@ time_t _time(time_t* ptime) time_t time = 0; GetSystemTimeAsFileTime(&SystemTime); - time = FileTimeToUnixTime(&SystemTime, NULL); + time = (time_t)FileTimeToUnixTime(&SystemTime, NULL); if (ptime) { diff --git a/reactos/lib/sdk/crt/time/timezone.c b/reactos/lib/sdk/crt/time/timezone.c index 468d0a89ffd..831d7c612f8 100644 --- a/reactos/lib/sdk/crt/time/timezone.c +++ b/reactos/lib/sdk/crt/time/timezone.c @@ -65,7 +65,7 @@ long _dstbias = 0; * \name __p__dstbias * \brief Returns a pointer to the _dstbias variable; */ -long * +long * __p__dstbias(void) { return &_dstbias; @@ -103,7 +103,7 @@ _tzset(void) if (str && str[0] != 0) { long hour = 0, min = 0, sec = 0; - int len = strnlen(str, 16); + size_t len = strnlen(str, 16); int sign = 1; dst_begin = 0; @@ -143,7 +143,7 @@ _tzset(void) /* Copy DST name */ strncpy(tz_dst_name, str, 3); - + // FIXME: set dst_begin etc /* We are finished */ @@ -151,7 +151,7 @@ _tzset(void) } _timezone = sign * (((hour * 60) + min) * 60 + sec); - + } else { @@ -163,7 +163,7 @@ _tzset(void) { return; } - + ret = WideCharToMultiByte(CP_ACP, 0, tzi.StandardName, @@ -196,13 +196,13 @@ _tzset(void) _tm.tm_hour = tzi.DaylightDate.wHour; _tm.tm_min = tzi.DaylightDate.wMinute; _tm.tm_sec = tzi.DaylightDate.wSecond; - dst_begin = _mkgmtime(&_tm); + dst_begin = (long)_mkgmtime(&_tm); _tm.tm_mon = tzi.StandardDate.wMonth - 1; _tm.tm_mday = tzi.StandardDate.wDay; _tm.tm_hour = tzi.StandardDate.wHour; _tm.tm_min = tzi.StandardDate.wMinute; _tm.tm_sec = tzi.StandardDate.wSecond; - dst_end = _mkgmtime(&_tm); + dst_end = (long)_mkgmtime(&_tm); } else { diff --git a/reactos/lib/sdk/crt/wine/heap.c b/reactos/lib/sdk/crt/wine/heap.c index 08973706c2b..a9301ed6e42 100644 --- a/reactos/lib/sdk/crt/wine/heap.c +++ b/reactos/lib/sdk/crt/wine/heap.c @@ -40,7 +40,7 @@ typedef void (*MSVCRT_new_handler_func)(size_t size); static MSVCRT_new_handler_func MSVCRT_new_handler; static int MSVCRT_new_mode; -/* FIXME - According to documentation it should be 8*1024, at runtime it returns 16 */ +/* FIXME - According to documentation it should be 8*1024, at runtime it returns 16 */ static unsigned int MSVCRT_amblksiz = 16; /* FIXME - According to documentation it should be 480 bytes, at runtime default is 0 */ static size_t MSVCRT_sbh_threshold = 0; @@ -148,7 +148,7 @@ int CDECL _callnewh(size_t size) */ void* CDECL _expand(void* mem, size_t size) { - return HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, mem, size); + return HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, mem, (DWORD)size); } /********************************************************************* @@ -187,7 +187,7 @@ int CDECL _heapwalk(_HEAPINFO* next) LOCK_HEAP; phe.lpData = next->_pentry; - phe.cbData = next->_size; + phe.cbData = (DWORD)next->_size; phe.wFlags = next->_useflag == _USEDENTRY ? PROCESS_HEAP_ENTRY_BUSY : 0; if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY && @@ -303,7 +303,7 @@ void* CDECL malloc(size_t size) void* CDECL realloc(void* ptr, size_t size) { if (!ptr) return malloc(size); - if (size) return HeapReAlloc(GetProcessHeap(), 0, ptr, size); + if (size) return HeapReAlloc(GetProcessHeap(), 0, ptr, (DWORD)size); free(ptr); return NULL; } diff --git a/reactos/lib/sdk/crt/wine/undname.c b/reactos/lib/sdk/crt/wine/undname.c index b7242540ea1..ca7b2d525c2 100644 --- a/reactos/lib/sdk/crt/wine/undname.c +++ b/reactos/lib/sdk/crt/wine/undname.c @@ -53,7 +53,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); #define UNDNAME_NO_COMPLEX_TYPE (0x8000) /* How data types modifiers are stored: - * M (in the following definitions) is defined for + * M (in the following definitions) is defined for * 'A', 'B', 'C' and 'D' as follows * {}: "" * {}: "const " @@ -67,7 +67,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); * in data fields: * same as for arguments and also the following * ?x {}x - * + * */ struct array @@ -127,7 +127,7 @@ static void* und_alloc(struct parsed_symbol* sym, unsigned int len) sym->avail_in_first = 0; ptr = (char*)sym->alloc_list + sizeof(void*); } - else + else { if (len > sym->avail_in_first) { @@ -201,14 +201,14 @@ static BOOL str_array_push(struct parsed_symbol* sym, const char* ptr, int len, a->alloc *= 2; a->elts = new; } - if (len == -1) len = strlen(ptr); + if (len == -1) len = (int)strlen(ptr); a->elts[a->num] = und_alloc(sym, len + 1); assert(a->elts[a->num]); memcpy(a->elts[a->num], ptr, len); - a->elts[a->num][len] = '\0'; + a->elts[a->num][len] = '\0'; if (++a->num >= a->max) a->max = a->num; { - int i; + unsigned int i; char c; for (i = a->max - 1; i >= 0; i--) @@ -234,18 +234,18 @@ static char* str_array_get_ref(struct array* cref, unsigned idx) assert(cref); if (cref->start + idx >= cref->max) { - WARN("Out of bounds: %p %d + %d >= %d\n", + WARN("Out of bounds: %p %d + %d >= %d\n", cref, cref->start, idx, cref->max); return NULL; } - TRACE("Returning %p[%d] => %s\n", + TRACE("Returning %p[%d] => %s\n", cref, idx, cref->elts[cref->start + idx]); return cref->elts[cref->start + idx]; } /****************************************************************** * str_printf - * Helper for printf type of command (only %s and %c are implemented) + * Helper for printf type of command (only %s and %c are implemented) * while dynamically allocating the buffer */ static char* str_printf(struct parsed_symbol* sym, const char* format, ...) @@ -263,7 +263,7 @@ static char* str_printf(struct parsed_symbol* sym, const char* format, ...) { switch (format[++i]) { - case 's': t = va_arg(args, char*); if (t) len += strlen(t); break; + case 's': t = va_arg(args, char*); if (t) len += (int)strlen(t); break; case 'c': (void)va_arg(args, int); len++; break; default: i--; /* fall thru */ case '%': len++; break; @@ -284,7 +284,7 @@ static char* str_printf(struct parsed_symbol* sym, const char* format, ...) t = va_arg(args, char*); if (t) { - sz = strlen(t); + sz = (int)strlen(t); memcpy(p, t, sz); p += sz; } @@ -358,7 +358,7 @@ static const char* get_number(struct parsed_symbol* sym) * Parses a list of function/method arguments, creates a string corresponding * to the arguments' list. */ -static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_term, +static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_term, char open_char, char close_char) { @@ -393,8 +393,8 @@ static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_t */ if (z_term && *sym->current++ != 'Z') return NULL; - if (arg_collect.num == 0 || - (arg_collect.num == 1 && !strcmp(arg_collect.elts[0], "void"))) + if (arg_collect.num == 0 || + (arg_collect.num == 1 && !strcmp(arg_collect.elts[0], "void"))) return str_printf(sym, "%cvoid%c", open_char, close_char); for (i = 1; i < arg_collect.num; i++) { @@ -403,12 +403,12 @@ static char* get_args(struct parsed_symbol* sym, struct array* pmt_ref, BOOL z_t last = args_str ? args_str : arg_collect.elts[0]; if (close_char == '>' && last[strlen(last) - 1] == '>') - args_str = str_printf(sym, "%c%s%s %c", + args_str = str_printf(sym, "%c%s%s %c", open_char, arg_collect.elts[0], args_str, close_char); else - args_str = str_printf(sym, "%c%s%s%c", + args_str = str_printf(sym, "%c%s%s%c", open_char, arg_collect.elts[0], args_str, close_char); - + return args_str; } @@ -516,7 +516,7 @@ static char* get_literal_string(struct parsed_symbol* sym) } } while (*++sym->current != '@'); sym->current++; - if (!str_array_push(sym, ptr, sym->current - 1 - ptr, &sym->names)) + if (!str_array_push(sym, ptr, (int)(sym->current - 1 - ptr), &sym->names)) return NULL; return str_array_get_ref(&sym->names, sym->names.num - sym->names.start - 1); @@ -582,7 +582,7 @@ static BOOL get_class(struct parsed_symbol* sym) name = str_array_get_ref(&sym->names, *sym->current++ - '0'); break; case '?': - if (*++sym->current == '$') + if (*++sym->current == '$') { sym->current++; if ((name = get_template_name(sym)) && @@ -613,15 +613,15 @@ static char* get_class_string(struct parsed_symbol* sym, int start) char* ret; struct array *a = &sym->stack; - for (len = 0, i = start; i < a->num; i++) + for (len = 0, i = start; i < (int)a->num; i++) { assert(a->elts[i]); - len += 2 + strlen(a->elts[i]); + len += 2 + (int)strlen(a->elts[i]); } if (!(ret = und_alloc(sym, len - 1))) return NULL; for (len = 0, i = a->num - 1; i >= start; i--) { - sz = strlen(a->elts[i]); + sz = (int)strlen(a->elts[i]); memcpy(ret + len, a->elts[i], sz); len += sz; if (i > start) @@ -702,7 +702,7 @@ static BOOL get_calling_convention(char ch, const char** call_conv, static const char* get_simple_type(char c) { const char* type_string; - + switch (c) { case 'C': type_string = "signed char"; break; @@ -731,7 +731,7 @@ static const char* get_simple_type(char c) static const char* get_extended_type(char c) { const char* type_string; - + switch (c) { case 'D': type_string = "__int8"; break; @@ -766,7 +766,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, assert(ct); ct->left = ct->right = NULL; - + switch (dt = *sym->current++) { case '_': @@ -791,7 +791,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, if (!(struct_name = get_class_name(sym))) goto done; - if (!(sym->flags & UNDNAME_NO_COMPLEX_TYPE)) + if (!(sym->flags & UNDNAME_NO_COMPLEX_TYPE)) { switch (dt) { @@ -839,7 +839,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, unsigned mark = sym->stack.num; if (!get_calling_convention(*sym->current++, - &call_conv, &exported, + &call_conv, &exported, sym->flags & ~UNDNAME_NO_ALLOCATION_LANGUAGE) || !demangle_datatype(sym, &sub_ct, pmt_ref, FALSE)) goto done; @@ -848,7 +848,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, if (!args) goto done; sym->stack.num = mark; - ct->left = str_printf(sym, "%s%s (%s*", + ct->left = str_printf(sym, "%s%s (%s*", sub_ct.left, sub_ct.right, call_conv); ct->right = str_printf(sym, ")%s", args); } @@ -944,7 +944,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, return FALSE; } done: - + return ct->left != NULL; } @@ -980,7 +980,7 @@ static BOOL handle_data(struct parsed_symbol* sym) case '0': access = "private: "; break; case '1': access = "protected: "; break; case '2': access = "public: "; break; - } + } } if (!(sym->flags & UNDNAME_NO_MEMBER_TYPE)) @@ -1028,8 +1028,8 @@ static BOOL handle_data(struct parsed_symbol* sym) if (sym->flags & UNDNAME_NAME_ONLY) ct.left = ct.right = modifier = NULL; sym->result = str_printf(sym, "%s%s%s%s%s%s%s%s", access, - member_type, ct.left, - modifier && ct.left ? " " : NULL, modifier, + member_type, ct.left, + modifier && ct.left ? " " : NULL, modifier, modifier || ct.left ? " " : NULL, name, ct.right); ret = TRUE; done: @@ -1163,10 +1163,10 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) * Yet!!! FIXME */ sym->result = str_printf(sym, "%s%s%s%s%s%s%s%s%s%s%s%s", - access, member_type, ct_ret.left, + access, member_type, ct_ret.left, (ct_ret.left && !ct_ret.right) ? " " : NULL, call_conv, call_conv ? " " : NULL, exported, - name, args_str, modifier, + name, args_str, modifier, modifier ? " " : NULL, ct_ret.right); ret = TRUE; done: @@ -1446,7 +1446,7 @@ char* CDECL __unDNameEx(char* buffer, const char* mangled, int buflen, TRACE("(%p,%s,%d,%p,%p,%p,%x)\n", buffer, mangled, buflen, memget, memfree, unknown, flags); - + /* The flags details is not documented by MS. However, it looks exactly * like the UNDNAME_ manifest constants from imagehlp.h and dbghelp.h * So, we copied those (on top of the file)