[CRT]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 15 Sep 2011 17:11:53 +0000 (17:11 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 15 Sep 2011 17:11:53 +0000 (17:11 +0000)
- 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

53 files changed:
reactos/include/reactos/wine/exception.h
reactos/lib/sdk/crt/conio/cputs.c
reactos/lib/sdk/crt/crt.cmake
reactos/lib/sdk/crt/except/cpp.c
reactos/lib/sdk/crt/except/cppexcept.c
reactos/lib/sdk/crt/float/amd64/getsetfpcw.S [new file with mode: 0644]
reactos/lib/sdk/crt/float/i386/cntrlfp.c
reactos/lib/sdk/crt/float/i386/statfp.c
reactos/lib/sdk/crt/include/internal/time.h
reactos/lib/sdk/crt/math/cos.c
reactos/lib/sdk/crt/math/sin.c
reactos/lib/sdk/crt/mbstring/mbsstr.c
reactos/lib/sdk/crt/misc/assert.c
reactos/lib/sdk/crt/misc/environ.c
reactos/lib/sdk/crt/misc/getargs.c
reactos/lib/sdk/crt/misc/i10output.c
reactos/lib/sdk/crt/printf/_sxprintf.c
reactos/lib/sdk/crt/printf/streamout.c
reactos/lib/sdk/crt/process/process.c
reactos/lib/sdk/crt/search/bsearch.c
reactos/lib/sdk/crt/stdio/_flsbuf.c
reactos/lib/sdk/crt/stdio/file.c
reactos/lib/sdk/crt/stdio/findgen.c
reactos/lib/sdk/crt/stdio/stat.c
reactos/lib/sdk/crt/stdio/stat64.c
reactos/lib/sdk/crt/stdlib/atexit.c
reactos/lib/sdk/crt/stdlib/fullpath.c
reactos/lib/sdk/crt/stdlib/getenv.c
reactos/lib/sdk/crt/stdlib/makepath.c
reactos/lib/sdk/crt/stdlib/makepath_s.c
reactos/lib/sdk/crt/stdlib/qsort.c
reactos/lib/sdk/crt/stdlib/wmakpath.c
reactos/lib/sdk/crt/stdlib/wmakpath_s.c
reactos/lib/sdk/crt/string/itow.c
reactos/lib/sdk/crt/string/mbstowcs_nt.c
reactos/lib/sdk/crt/string/scanf.h
reactos/lib/sdk/crt/string/strtol.c
reactos/lib/sdk/crt/string/strtoul.c
reactos/lib/sdk/crt/string/strtoull.c
reactos/lib/sdk/crt/string/wcs.c
reactos/lib/sdk/crt/string/wcstol.c
reactos/lib/sdk/crt/string/wcstombs_nt.c
reactos/lib/sdk/crt/string/wcstoul.c
reactos/lib/sdk/crt/string/wtol.c
reactos/lib/sdk/crt/time/clock.c
reactos/lib/sdk/crt/time/ftime.c
reactos/lib/sdk/crt/time/futime.c
reactos/lib/sdk/crt/time/gmtime.c
reactos/lib/sdk/crt/time/mktime.c
reactos/lib/sdk/crt/time/time.c
reactos/lib/sdk/crt/time/timezone.c
reactos/lib/sdk/crt/wine/heap.c
reactos/lib/sdk/crt/wine/undname.c

index c2f23fb..611316b 100644 (file)
@@ -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
index 4a781e5..0def1b0 100644 (file)
@@ -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;
index 4f5a05b..508addb 100644 (file)
@@ -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
index 92d33b5..189d0c5 100644 (file)
@@ -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] == ' ')
index 99f6a3c..5b0c5e6 100644 (file)
@@ -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 */
-static inline void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr )
+__forceinline void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr )
 {
-#ifdef _MSC_VER
-#pragma message ("continue_after_catch is unimplemented for MSC")
+    __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 )
+{
     __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 (file)
index 0000000..cbf23ca
--- /dev/null
@@ -0,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
index b999151..18745ea 100644 (file)
 
 #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;
index ef78817..e7ba533 100644 (file)
@@ -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;
index 852bdab..2bcddb4 100644 (file)
 #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);
 
index 1e7d8c4..6fcae76 100644 (file)
@@ -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 <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
index da69573..013f91e 100644 (file)
@@ -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 <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
index 318de31..5eaee4d 100644 (file)
@@ -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;
index 693e42d..4619a4f 100644 (file)
@@ -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 @@ 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: x<y */
@@ -40,7 +40,7 @@ void _assert(const char *exp, const char *file, unsigned line)
 
     /* 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 @@ void _assert(const char *exp, const char *file, unsigned line)
     _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);
 
index 3018d1c..6aa0e49 100644 (file)
@@ -40,7 +40,8 @@ int BlockEnvToEnvironA(void)
 {
    char *ptr, *environment_strings;
    char **envptr;
-   int count = 1, len;
+   int count = 1;
+   size_t len;
 
    TRACE("BlockEnvToEnvironA()\n");
 
@@ -91,7 +92,8 @@ int BlockEnvToEnvironW(void)
 {
    wchar_t *ptr, *environment_strings;
    wchar_t **envptr;
-   int count = 1, len;
+   int count = 1;
+   size_t len;
 
    TRACE("BlockEnvToEnvironW()\n");
 
index 18672e6..b6c1b5d 100644 (file)
@@ -71,7 +71,7 @@ int wexpand(wchar_t* name, int expand_wildcards)
    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 @@ int aexpand(char* name, int expand_wildcards)
    HANDLE hFile;
    BOOLEAN first = TRUE;
    char buffer[256];
-   int pos;
+   uintptr_t pos;
 
    if (expand_wildcards && (s = strpbrk(name, "*?")))
    {
@@ -181,7 +181,8 @@ int aexpand(char* name, int expand_wildcards)
  */
 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 __getmainargs(int* argc, char*** argv, char*** env, int expand_wildcards, i
 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 */
 
index b44d03a..e6668c9 100644 (file)
@@ -59,7 +59,7 @@ int CDECL MSVCRT_I10_OUTPUT(long double ld, int prec, int flag, struct _I10_OUTP
     }
 
     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 @@ int CDECL MSVCRT_I10_OUTPUT(long double ld, int prec, int flag, struct _I10_OUTP
         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';
index 0b6c196..44d35ec 100644 (file)
@@ -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
index 0f26f32..c1d8ff2 100644 (file)
@@ -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 */
index 53f7523..32c24f5 100644 (file)
@@ -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);
index 9958ab4..f160a9e 100644 (file)
@@ -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)
index 8eeeba1..2750932 100644 (file)
@@ -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
index add57d8..8ec842e 100644 (file)
@@ -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;
index 9d70c98..7a525fa 100644 (file)
@@ -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);
 
index ac73b2f..39df882 100644 (file)
@@ -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)
 {
index 4df2e76..7005f3a 100644 (file)
@@ -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 @@ 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);
index 0b6a952..9752649 100644 (file)
@@ -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;
index 740ae1d..6f434d2 100644 (file)
@@ -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;
 
index 0f5fb43..4136d43 100644 (file)
@@ -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++)
    {
index 441cd67..c048fb8 100644 (file)
@@ -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;
     }
index b96f1f6..f5b673d 100644 (file)
@@ -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;
index 7635379..1e1dc8c 100644 (file)
@@ -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;
 
index 5c131f3..16ad4e3 100644 (file)
@@ -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;
     }
index 581a0e2..f227bcb 100644 (file)
@@ -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;
index 7f6bd42..4ce450a 100644 (file)
@@ -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;
index 7058558..dc97034 100644 (file)
@@ -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);
index 4be9d8d..3edf0ea 100644 (file)
@@ -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;
index 6dc4274..cbaf86a 100644 (file)
@@ -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;
index bbfa8ff..32f18d9 100644 (file)
@@ -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;
index 3a2553a..2badee8 100644 (file)
@@ -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;
index dcef8c4..8b3e685 100644 (file)
@@ -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;
index ab87e40..04f1e90 100644 (file)
@@ -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;
index d927b7e..721caab 100644 (file)
@@ -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));
index 9e50a26..4775585 100644 (file)
@@ -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;
index a57015e..8250c53 100644 (file)
@@ -32,7 +32,7 @@ _wtol(const wchar_t *str)
         str++;
     } /* while */
 
-    return bMinus ? -RunningTotal : RunningTotal;
+    return bMinus ? 0-RunningTotal : RunningTotal;
 }
 
 
index e601341..b843cce 100644 (file)
@@ -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);
 };
index 5b62f17..c974366 100644 (file)
@@ -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
  */
index 82d7685..3619305 100644 (file)
@@ -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);
         }
     }
 
index f0ed6d8..d5b4b94 100644 (file)
@@ -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 *
index f7217c4..f1730c9 100644 (file)
@@ -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
index ff3e51b..f2da183 100644 (file)
@@ -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)
     {
index 468d0a8..831d7c6 100644 (file)
@@ -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
         {
index 0897370..a9301ed 100644 (file)
@@ -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;
 }
index b724254..ca7b2d5 100644 (file)
@@ -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
  *      {<A>}:  ""
  *      {<B>}:  "const "
@@ -67,7 +67,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
  *      in data fields:
  *              same as for arguments and also the following
  *              ?<M>x   {<M>}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)