Author: tkreuzer Date: Thu Sep 15 17:11:53 2011 New Revision: 53713
URL: http://svn.reactos.org/svn/reactos?rev=53713&view=rev Log: [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
Added: trunk/reactos/lib/sdk/crt/float/amd64/getsetfpcw.S (with props) Modified: trunk/reactos/include/reactos/wine/exception.h trunk/reactos/lib/sdk/crt/conio/cputs.c trunk/reactos/lib/sdk/crt/crt.cmake trunk/reactos/lib/sdk/crt/except/cpp.c trunk/reactos/lib/sdk/crt/except/cppexcept.c trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c trunk/reactos/lib/sdk/crt/float/i386/statfp.c trunk/reactos/lib/sdk/crt/include/internal/time.h trunk/reactos/lib/sdk/crt/math/cos.c trunk/reactos/lib/sdk/crt/math/sin.c trunk/reactos/lib/sdk/crt/mbstring/mbsstr.c trunk/reactos/lib/sdk/crt/misc/assert.c trunk/reactos/lib/sdk/crt/misc/environ.c trunk/reactos/lib/sdk/crt/misc/getargs.c trunk/reactos/lib/sdk/crt/misc/i10output.c trunk/reactos/lib/sdk/crt/printf/_sxprintf.c trunk/reactos/lib/sdk/crt/printf/streamout.c trunk/reactos/lib/sdk/crt/process/process.c trunk/reactos/lib/sdk/crt/search/bsearch.c trunk/reactos/lib/sdk/crt/stdio/_flsbuf.c trunk/reactos/lib/sdk/crt/stdio/file.c trunk/reactos/lib/sdk/crt/stdio/findgen.c trunk/reactos/lib/sdk/crt/stdio/stat.c trunk/reactos/lib/sdk/crt/stdio/stat64.c trunk/reactos/lib/sdk/crt/stdlib/atexit.c trunk/reactos/lib/sdk/crt/stdlib/fullpath.c trunk/reactos/lib/sdk/crt/stdlib/getenv.c trunk/reactos/lib/sdk/crt/stdlib/makepath.c trunk/reactos/lib/sdk/crt/stdlib/makepath_s.c trunk/reactos/lib/sdk/crt/stdlib/qsort.c trunk/reactos/lib/sdk/crt/stdlib/wmakpath.c trunk/reactos/lib/sdk/crt/stdlib/wmakpath_s.c trunk/reactos/lib/sdk/crt/string/itow.c trunk/reactos/lib/sdk/crt/string/mbstowcs_nt.c trunk/reactos/lib/sdk/crt/string/scanf.h trunk/reactos/lib/sdk/crt/string/strtol.c trunk/reactos/lib/sdk/crt/string/strtoul.c trunk/reactos/lib/sdk/crt/string/strtoull.c trunk/reactos/lib/sdk/crt/string/wcs.c trunk/reactos/lib/sdk/crt/string/wcstol.c trunk/reactos/lib/sdk/crt/string/wcstombs_nt.c trunk/reactos/lib/sdk/crt/string/wcstoul.c trunk/reactos/lib/sdk/crt/string/wtol.c trunk/reactos/lib/sdk/crt/time/clock.c trunk/reactos/lib/sdk/crt/time/ftime.c trunk/reactos/lib/sdk/crt/time/futime.c trunk/reactos/lib/sdk/crt/time/gmtime.c trunk/reactos/lib/sdk/crt/time/mktime.c trunk/reactos/lib/sdk/crt/time/time.c trunk/reactos/lib/sdk/crt/time/timezone.c trunk/reactos/lib/sdk/crt/wine/heap.c trunk/reactos/lib/sdk/crt/wine/undname.c
Modified: trunk/reactos/include/reactos/wine/exception.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/except... ============================================================================== --- trunk/reactos/include/reactos/wine/exception.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/wine/exception.h [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -74,6 +74,11 @@ #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 @@ #endif }
+#ifdef _MSC_VER +#pragma warning(pop) +#endif + extern void __wine_enter_vm86( CONTEXT *context );
#ifdef __cplusplus
Modified: trunk/reactos/lib/sdk/crt/conio/cputs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/conio/cputs.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/conio/cputs.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/conio/cputs.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -26,7 +26,7 @@ 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;
Modified: trunk/reactos/lib/sdk/crt/crt.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.cmake?rev=5... ============================================================================== --- trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -379,6 +379,7 @@ 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
Modified: trunk/reactos/lib/sdk/crt/except/cpp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/cpp.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/except/cpp.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/except/cpp.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -132,7 +132,7 @@ _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 @@
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] == ' ')
Modified: trunk/reactos/lib/sdk/crt/except/cppexcept.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/cppexcep... ============================================================================== --- trunk/reactos/lib/sdk/crt/except/cppexcept.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/except/cppexcept.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -81,7 +81,25 @@ { 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_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 @@
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 @@ 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,
Added: trunk/reactos/lib/sdk/crt/float/amd64/getsetfpcw.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/amd64/get... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/amd64/getsetfpcw.S (added) +++ trunk/reactos/lib/sdk/crt/float/amd64/getsetfpcw.S [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -1,0 +1,24 @@ + +#include <asm.inc> + +.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
Propchange: trunk/reactos/lib/sdk/crt/float/amd64/getsetfpcw.S ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/i386/cntr... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/float/i386/cntrlfp.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -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 @@ 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) +#else __asm fstcw [fpword]; -#else - #pragma message("FIXME: _control87 is halfplemented") #endif
TRACE("Control word before : %08x\n", fpword); @@ -98,12 +103,12 @@ 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) +#else __asm fldcw [fpword]; -#else - #pragma message("FIXME: _control87 is halfplemented") #endif
return flags;
Modified: trunk/reactos/lib/sdk/crt/float/i386/statfp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/float/i386/stat... ============================================================================== --- trunk/reactos/lib/sdk/crt/float/i386/statfp.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/float/i386/statfp.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -26,12 +26,13 @@ { 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;
Modified: trunk/reactos/lib/sdk/crt/include/internal/time.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/include/interna... ============================================================================== --- trunk/reactos/lib/sdk/crt/include/internal/time.h [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/include/internal/time.h [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -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);
Modified: trunk/reactos/lib/sdk/crt/math/cos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/cos.c?rev=... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/cos.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/math/cos.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -19,7 +19,7 @@ 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 @@ /* Calculate the negative of the square of x */ x2 = - (x * x);
- /* This is an unrolled taylor series using <PRECISION> iterations + /* This is an unrolled taylor series using <PRECISION> 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
Modified: trunk/reactos/lib/sdk/crt/math/sin.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/sin.c?rev=... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/sin.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/math/sin.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -19,7 +19,7 @@ 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 @@ /* Calculate the negative of the square of x */ x2 = - (x * x);
- /* This is an unrolled taylor series using <PRECISION> iterations + /* This is an unrolled taylor series using <PRECISION> 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
Modified: trunk/reactos/lib/sdk/crt/mbstring/mbsstr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/mbstring/mbsstr... ============================================================================== --- trunk/reactos/lib/sdk/crt/mbstring/mbsstr.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/mbstring/mbsstr.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -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;
Modified: trunk/reactos/lib/sdk/crt/misc/assert.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/misc/assert.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/misc/assert.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/misc/assert.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -5,7 +5,7 @@ #include <stdlib.h> #include <signal.h>
-static const char formatstr[] = +static const char formatstr[] = "Assertion failed!\n\n" "Program: %s\n" "File: %s\n" @@ -23,7 +23,7 @@ HMODULE hmodUser32; char achProgram[40]; char *pszBuffer; - int len; + size_t len; int iResult;
/* Assertion failed at foo.c line 45: x<y */ @@ -40,7 +40,7 @@
/* Get the file name of the module */ len = GetModuleFileNameA(NULL, achProgram, 40); - + /* Calculate full length of the message */ len += sizeof(formatstr) + len + strlen(exp) + strlen(file);
@@ -51,8 +51,8 @@ _snprintf(pszBuffer, len, formatstr, achProgram, file, line, exp);
/* Display a message box */ - iResult = pMessageBoxA(NULL, - pszBuffer, + iResult = pMessageBoxA(NULL, + pszBuffer, "ReactOS C Runtime Library", MB_ABORTRETRYIGNORE | MB_ICONERROR);
Modified: trunk/reactos/lib/sdk/crt/misc/environ.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/misc/environ.c?... ============================================================================== --- trunk/reactos/lib/sdk/crt/misc/environ.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/misc/environ.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -40,7 +40,8 @@ { char *ptr, *environment_strings; char **envptr; - int count = 1, len; + int count = 1; + size_t len;
TRACE("BlockEnvToEnvironA()\n");
@@ -91,7 +92,8 @@ { wchar_t *ptr, *environment_strings; wchar_t **envptr; - int count = 1, len; + int count = 1; + size_t len;
TRACE("BlockEnvToEnvironW()\n");
Modified: trunk/reactos/lib/sdk/crt/misc/getargs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/misc/getargs.c?... ============================================================================== --- trunk/reactos/lib/sdk/crt/misc/getargs.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/misc/getargs.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -71,7 +71,7 @@ HANDLE hFile; BOOLEAN first = TRUE; wchar_t buffer[256]; - int pos; + uintptr_t pos;
if (expand_wildcards && (s = wcspbrk(name, L"*?"))) { @@ -136,7 +136,7 @@ HANDLE hFile; BOOLEAN first = TRUE; char buffer[256]; - int pos; + uintptr_t pos;
if (expand_wildcards && (s = strpbrk(name, "*?"))) { @@ -181,7 +181,8 @@ */ void __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, int* new_mode) { - int i, afterlastspace, ignorespace, len, doexpand; + int i, afterlastspace, ignorespace, doexpand; + size_t len;
/* missing threading init */
@@ -262,7 +263,8 @@ void __wgetmainargs(int* argc, wchar_t*** wargv, wchar_t*** wenv, int expand_wildcards, int* new_mode) { - int i, afterlastspace, ignorespace, len, doexpand; + int i, afterlastspace, ignorespace, doexpand; + size_t len;
/* missing threading init */
Modified: trunk/reactos/lib/sdk/crt/misc/i10output.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/misc/i10output.... ============================================================================== --- trunk/reactos/lib/sdk/crt/misc/i10output.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/misc/i10output.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -59,7 +59,7 @@ }
if(flag&1) { - int exp = 1+floor(log10(d)); + int exp = (int)(1+floor(log10(d)));
prec += exp; if(exp < 0) @@ -83,7 +83,7 @@ data->pos++;
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';
Modified: trunk/reactos/lib/sdk/crt/printf/_sxprintf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/_sxprint... ============================================================================== --- trunk/reactos/lib/sdk/crt/printf/_sxprintf.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/printf/_sxprintf.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -47,7 +47,7 @@ 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
Modified: trunk/reactos/lib/sdk/crt/printf/streamout.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/streamou... ============================================================================== --- trunk/reactos/lib/sdk/crt/printf/streamout.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/printf/streamout.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -67,7 +67,7 @@ (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 @@
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 @@
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 @@ 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 @@ 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 @@ /* 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 */
Modified: trunk/reactos/lib/sdk/crt/process/process.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/process/process... ============================================================================== --- trunk/reactos/lib/sdk/crt/process/process.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/process/process.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -117,7 +117,8 @@ 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 @@ { va_list alist2 = alist; _TCHAR *ptr, *str; - int len; + size_t len;
if (arg0 == NULL) return NULL; @@ -327,7 +328,7 @@ { 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 _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 @@ _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 @@ { _TCHAR *args; _TCHAR *envs; - int ret = -1; + intptr_t ret = -1;
TRACE(MK_STR(_tspawnve)"('%"sT"')\n", cmdname);
@@ -442,7 +443,7 @@ { 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 @@ _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 @@ { _TCHAR* args; va_list argp; - int ret = -1; + intptr_t ret = -1;
TRACE(MK_STR(_texecl)"('%"sT"')\n", cmdname);
@@ -545,7 +546,7 @@ _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 @@ { _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 @@ _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);
Modified: trunk/reactos/lib/sdk/crt/search/bsearch.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/search/bsearch.... ============================================================================== --- trunk/reactos/lib/sdk/crt/search/bsearch.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/search/bsearch.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -9,7 +9,8 @@ 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)
Modified: trunk/reactos/lib/sdk/crt/stdio/_flsbuf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/_flsbuf.c... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdio/_flsbuf.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdio/_flsbuf.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -56,7 +56,7 @@ 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
Modified: trunk/reactos/lib/sdk/crt/stdio/file.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/file.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -267,7 +267,7 @@ 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 @@ 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 @@ 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 @@ */ 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 _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 _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 _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 @@ *_errno() = ENOSPC; if(nr_lf) free(p); - return s - buf_start; + return (int)(s - buf_start); } else { @@ -2071,7 +2071,7 @@ */ 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 _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 @@ * 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 @@ 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 @@ 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 @@ file->_flag &= ~_IONBF; file->_base = file->_ptr = buf; if(buf) { - file->_bufsiz = size; + file->_bufsiz = (int)size; } } else { file->_flag |= _IONBF;
Modified: trunk/reactos/lib/sdk/crt/stdio/findgen.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/findgen.c... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdio/findgen.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdio/findgen.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -14,9 +14,9 @@ }
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 @@ }
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);
Modified: trunk/reactos/lib/sdk/crt/stdio/stat.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/stat.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdio/stat.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdio/stat.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -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) {
Modified: trunk/reactos/lib/sdk/crt/stdio/stat64.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/stat64.c?... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdio/stat64.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdio/stat64.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -2,7 +2,7 @@ #include <tchar.h> #include <direct.h>
-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 @@ 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 @@ 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);
Modified: trunk/reactos/lib/sdk/crt/stdlib/atexit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/atexit.c... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/atexit.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/atexit.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -23,7 +23,7 @@ _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;
Modified: trunk/reactos/lib/sdk/crt/stdlib/fullpath.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/fullpath... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/fullpath.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/fullpath.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -25,7 +25,7 @@ absPath = malloc(maxLength); }
- copied = GetFullPathName(relPath,maxLength,absPath,&lpFilePart); + copied = GetFullPathName(relPath,(DWORD)maxLength,absPath,&lpFilePart); if (copied == 0 || copied > maxLength) return NULL;
Modified: trunk/reactos/lib/sdk/crt/stdlib/getenv.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/getenv.c... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/getenv.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/getenv.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -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 @@ 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++) {
Modified: trunk/reactos/lib/sdk/crt/stdlib/makepath.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/makepath... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/makepath.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/makepath.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -34,7 +34,7 @@ } 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 @@ } if (fname && fname[0]) { - unsigned int len = strlen(fname); + size_t len = strlen(fname); memmove(p, fname, len); p += len; }
Modified: trunk/reactos/lib/sdk/crt/stdlib/makepath_s.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/makepath... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/makepath_s.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/makepath_s.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -44,9 +44,9 @@
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 @@
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 @@
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;
Modified: trunk/reactos/lib/sdk/crt/stdlib/qsort.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/qsort.c?... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/qsort.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/qsort.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -53,9 +53,9 @@ 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;
Modified: trunk/reactos/lib/sdk/crt/stdlib/wmakpath.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/wmakpath... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/wmakpath.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/wmakpath.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -32,7 +32,7 @@ } 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 @@ } if (fname && fname[0]) { - unsigned int len = strlenW(fname); + size_t len = strlenW(fname); memmove(p, fname, len * sizeof(wchar_t)); p += len; }
Modified: trunk/reactos/lib/sdk/crt/stdlib/wmakpath_s.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/wmakpath... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/wmakpath_s.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/wmakpath_s.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -44,9 +44,9 @@
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 @@
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 @@
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;
Modified: trunk/reactos/lib/sdk/crt/string/itow.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/itow.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/itow.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/itow.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -34,7 +34,7 @@ *pos = '\0';
do { - digit = val % radix; + digit = (WCHAR)(val % radix); val = val / radix; if (digit < 10) { *--pos = '0' + digit; @@ -68,7 +68,7 @@ *pos = '\0';
do { - digit = value % radix; + digit = (WCHAR)(value % radix); value = value / radix; if (digit < 10) { *--pos = '0' + digit; @@ -120,7 +120,7 @@ *pos = '\0';
do { - digit = val % radix; + digit = (WCHAR)(val % radix); val = val / radix; if (digit < 10) { *--pos = '0' + digit; @@ -155,7 +155,7 @@ *pos = '\0';
do { - digit = value % radix; + digit = (WCHAR)(value % radix); value = value / radix; if (digit < 10) { *--pos = '0' + digit;
Modified: trunk/reactos/lib/sdk/crt/string/mbstowcs_nt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/mbstowcs... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/mbstowcs_nt.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/mbstowcs_nt.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -32,7 +32,7 @@
*wchar = wc;
- return mbs - mbarr; + return (int)(mbs - mbarr); }
/* @@ -44,7 +44,7 @@ ULONG Size; ULONG Length;
- Length = strlen (mbstr); + Length = (ULONG)strlen (mbstr);
if (wcstr == NULL) { @@ -56,7 +56,7 @@ }
Status = RtlMultiByteToUnicodeN (wcstr, - count * sizeof(WCHAR), + (ULONG)count * sizeof(WCHAR), &Size, mbstr, Length);
Modified: trunk/reactos/lib/sdk/crt/string/scanf.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/scanf.h?... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/scanf.h [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/scanf.h [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -170,7 +170,7 @@ 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 @@ 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 @@ 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;
Modified: trunk/reactos/lib/sdk/crt/string/strtol.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/strtol.c... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/strtol.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/strtol.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -54,7 +54,7 @@ * 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 @@ #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;
Modified: trunk/reactos/lib/sdk/crt/string/strtoul.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/strtoul.... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/strtoul.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/strtoul.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -68,7 +68,7 @@ #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;
Modified: trunk/reactos/lib/sdk/crt/string/strtoull.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/strtoull... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/strtoull.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/strtoull.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -59,7 +59,7 @@ #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;
Modified: trunk/reactos/lib/sdk/crt/string/wcs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wcs.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/wcs.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/wcs.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -60,7 +60,7 @@ 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 @@ */ 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;
Modified: trunk/reactos/lib/sdk/crt/string/wcstol.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wcstol.c... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/wcstol.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/wcstol.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -63,7 +63,7 @@ * 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 @@ 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;
Modified: trunk/reactos/lib/sdk/crt/string/wcstombs_nt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wcstombs... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/wcstombs_nt.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/wcstombs_nt.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -34,7 +34,7 @@ ULONG Size; ULONG Length;
- Length = wcslen (wcstr); + Length = (ULONG)wcslen (wcstr);
if (mbstr == NULL) { @@ -46,7 +46,7 @@ }
Status = RtlUnicodeToMultiByteN (mbstr, - count, + (ULONG)count, &Size, (wchar_t*)((size_t)wcstr), Length * sizeof(WCHAR));
Modified: trunk/reactos/lib/sdk/crt/string/wcstoul.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wcstoul.... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/wcstoul.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/wcstoul.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -65,7 +65,7 @@ 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;
Modified: trunk/reactos/lib/sdk/crt/string/wtol.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wtol.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/string/wtol.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/wtol.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -32,7 +32,7 @@ str++; } /* while */
- return bMinus ? -RunningTotal : RunningTotal; + return bMinus ? 0-RunningTotal : RunningTotal; }
Modified: trunk/reactos/lib/sdk/crt/time/clock.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/clock.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/clock.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/clock.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -26,5 +26,5 @@
GetSystemTimeAsFileTime((FILETIME*)&Time); Time.QuadPart -= g_StartupTime.QuadPart; - return FileTimeToUnixTime((FILETIME*)&Time, NULL); + return (clock_t)FileTimeToUnixTime((FILETIME*)&Time, NULL); };
Modified: trunk/reactos/lib/sdk/crt/time/ftime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/ftime.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/ftime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/ftime.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -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 @@
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 @@ /****************************************************************************** * \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 */
Modified: trunk/reactos/lib/sdk/crt/time/futime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/futime.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/futime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/futime.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -44,7 +44,7 @@
/****************************************************************************** * \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 @@ { 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); } }
Modified: trunk/reactos/lib/sdk/crt/time/gmtime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/gmtime.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/gmtime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/gmtime.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -23,7 +23,7 @@ }
/* 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 @@ 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 @@
/****************************************************************************** * \name _gmtime64 - * \brief + * \brief * \param ptime Pointer to a variable of type __time64_t containing the time. */ struct tm * @@ -123,7 +123,7 @@
/****************************************************************************** * \name _gmtime32 - * \brief + * \brief * \param ptime Pointer to a variable of type __time32_t containing the time. */ struct tm * @@ -135,7 +135,7 @@
/****************************************************************************** * \name gmtime - * \brief + * \brief * \param ptime Pointer to a variable of type time_t containing the time. */ struct tm *
Modified: trunk/reactos/lib/sdk/crt/time/mktime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/mktime.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/mktime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/mktime.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -106,36 +106,36 @@ 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
Modified: trunk/reactos/lib/sdk/crt/time/time.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/time.c?rev... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/time.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/time.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -15,7 +15,7 @@ time_t time = 0;
GetSystemTimeAsFileTime(&SystemTime); - time = FileTimeToUnixTime(&SystemTime, NULL); + time = (time_t)FileTimeToUnixTime(&SystemTime, NULL);
if (ptime) {
Modified: trunk/reactos/lib/sdk/crt/time/timezone.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/timezone.c... ============================================================================== --- trunk/reactos/lib/sdk/crt/time/timezone.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/timezone.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -65,7 +65,7 @@ * \name __p__dstbias * \brief Returns a pointer to the _dstbias variable; */ -long * +long * __p__dstbias(void) { return &_dstbias; @@ -103,7 +103,7 @@ 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 @@
/* Copy DST name */ strncpy(tz_dst_name, str, 3); - + // FIXME: set dst_begin etc
/* We are finished */ @@ -151,7 +151,7 @@ }
_timezone = sign * (((hour * 60) + min) * 60 + sec); - + } else { @@ -163,7 +163,7 @@ { return; } - + ret = WideCharToMultiByte(CP_ACP, 0, tzi.StandardName, @@ -196,13 +196,13 @@ _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 {
Modified: trunk/reactos/lib/sdk/crt/wine/heap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/wine/heap.c?rev... ============================================================================== --- trunk/reactos/lib/sdk/crt/wine/heap.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/wine/heap.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -40,7 +40,7 @@ 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 @@ */ 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 @@
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 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; }
Modified: trunk/reactos/lib/sdk/crt/wine/undname.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/wine/undname.c?... ============================================================================== --- trunk/reactos/lib/sdk/crt/wine/undname.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/wine/undname.c [iso-8859-1] Thu Sep 15 17:11:53 2011 @@ -53,7 +53,7 @@ #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 * {<A>}: "" * {<B>}: "const " @@ -67,7 +67,7 @@ * in data fields: * same as for arguments and also the following * ?<M>x {<M>}x - * + * */
struct array @@ -127,7 +127,7 @@ sym->avail_in_first = 0; ptr = (char*)sym->alloc_list + sizeof(void*); } - else + else { if (len > sym->avail_in_first) { @@ -201,14 +201,14 @@ 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 @@ 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 @@ { 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 @@ t = va_arg(args, char*); if (t) { - sz = strlen(t); + sz = (int)strlen(t); memcpy(p, t, sz); p += sz; } @@ -358,7 +358,7 @@ * 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 @@ */ 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 @@
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 @@ } } 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 @@ 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 @@ 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 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_extended_type(char c) { const char* type_string; - + switch (c) { case 'D': type_string = "__int8"; break; @@ -766,7 +766,7 @@
assert(ct); ct->left = ct->right = NULL; - + switch (dt = *sym->current++) { case '_': @@ -791,7 +791,7 @@
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 @@ 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 @@ 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 @@ return FALSE; } done: - + return ct->left != NULL; }
@@ -980,7 +980,7 @@ 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 @@ 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 @@ * 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 @@
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)