Author: hyperion Date: Wed Nov 26 08:28:19 2008 New Revision: 37659
URL: http://svn.reactos.org/svn/reactos?rev=37659&view=rev Log: Merging fixes from Visual C++ branch
modified include/psdk/rpcndr.h Mask argument before casting in NdrFcShort
modified include/psdk/winternl.h Visual C++-compatible placement of function attribute
modified include/reactos/wine/port.h Visual C++ has interlocked intrinsics, too
modified lib/3rdparty/adns/adns_win32/adns_unix_calls.c modified lib/3rdparty/adns/src/setup.c alloca -> _alloca
modified lib/3rdparty/libwine/debug.c Fix a benign range check warning
modified lib/3rdparty/libwine/debug_ros.c Properly decorate malloc replacement
modified lib/3rdparty/libwine/string.c The actual function is called _stricmp
modified lib/3rdparty/mingw/wcrt1.c Visual C++ support
Modified: trunk/reactos/include/psdk/rpcndr.h trunk/reactos/include/psdk/winternl.h trunk/reactos/include/reactos/wine/port.h trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c trunk/reactos/lib/3rdparty/adns/src/setup.c trunk/reactos/lib/3rdparty/libwine/debug.c trunk/reactos/lib/3rdparty/libwine/debug_ros.c trunk/reactos/lib/3rdparty/libwine/string.c trunk/reactos/lib/3rdparty/mingw/wcrt1.c
Modified: trunk/reactos/include/psdk/rpcndr.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/rpcndr.h?rev=3... ============================================================================== --- trunk/reactos/include/psdk/rpcndr.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/rpcndr.h [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -111,7 +111,7 @@ #define midl_user_free MIDL_user_free #define midl_user_allocate MIDL_user_allocate
-#define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8) +#define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0xff00) >> 8) #define NdrFcLong(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \ (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24)
Modified: trunk/reactos/include/psdk/winternl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winternl.h?rev... ============================================================================== --- trunk/reactos/include/psdk/winternl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winternl.h [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -1987,7 +1987,7 @@ BOOL WINAPI RtlEqualSid(PSID,PSID); BOOLEAN WINAPI RtlEqualString(const STRING*,const STRING*,BOOLEAN); BOOLEAN WINAPI RtlEqualUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN); -void WINAPI RtlExitUserThread(ULONG) DECLSPEC_NORETURN; +DECLSPEC_NORETURN void WINAPI RtlExitUserThread(ULONG); NTSTATUS WINAPI RtlExpandEnvironmentStrings_U(PWSTR, const UNICODE_STRING*, UNICODE_STRING*, ULONG*); LONGLONG WINAPI RtlExtendedMagicDivide(LONGLONG,LONGLONG,INT); LONGLONG WINAPI RtlExtendedIntegerMultiply(LONGLONG,INT);
Modified: trunk/reactos/include/reactos/wine/port.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/port.h... ============================================================================== --- trunk/reactos/include/reactos/wine/port.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/wine/port.h [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -326,7 +326,7 @@
/* Interlocked functions */
-#if defined(__i386__) && defined(__GNUC__) && !defined(WINE_PORT_NO_INTERLOCKED) +#if defined(_MSC_VER) || (defined(__i386__) && defined(__GNUC__) && !defined(WINE_PORT_NO_INTERLOCKED))
#define interlocked_cmpxchg InterlockedCompareExchange #define interlocked_cmpxchg_ptr InterlockedCompareExchangePtr
Modified: trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/adns/adns_win3... ============================================================================== --- trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -39,7 +39,7 @@ for(; i < iovCount; i++) total_len += iov[i].iov_len;
- p = buf = (char *)alloca(total_len); + p = buf = (char *)_alloca(total_len);
for(; i < iovCount; i++) { @@ -79,28 +79,28 @@
int gettimeofday(struct timeval *tv, struct timezone *tz) { - static __int64 Adjustment; + static __int64 Adjustment; __int64 now = 0; - - if (!Adjustment) - { + + if (!Adjustment) + { SYSTEMTIME st = {1970,1,0,1,0,0,0}; SystemTimeToFileTime(&st, (LPFILETIME)&Adjustment); - } - - if (tz) - { + } + + if (tz) + { errno = EINVAL; - return -1; - } - + return -1; + } + GetSystemTimeAsFileTime((LPFILETIME)&now); now -= Adjustment; - + tv->tv_sec = (long)(now / 10000000); tv->tv_usec = (long)((now % 10000000) / 10);
- return 0; + return 0; }
/* Memory allocated in the DLL must be freed in the dll, so
Modified: trunk/reactos/lib/3rdparty/adns/src/setup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/adns/src/setup... ============================================================================== --- trunk/reactos/lib/3rdparty/adns/src/setup.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/adns/src/setup.c [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -573,7 +573,7 @@ char PathBuf[MAX_PATH]; struct in_addr addr; #define ADNS_PFIXED_INFO_BLEN (2048) - PFIXED_INFO network_info = (PFIXED_INFO)alloca(ADNS_PFIXED_INFO_BLEN); + PFIXED_INFO network_info = (PFIXED_INFO)_alloca(ADNS_PFIXED_INFO_BLEN); ULONG network_info_blen = ADNS_PFIXED_INFO_BLEN; DWORD network_info_result; PIP_ADDR_STRING pip;
Modified: trunk/reactos/lib/3rdparty/libwine/debug.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libwine/debug.... ============================================================================== --- trunk/reactos/lib/3rdparty/libwine/debug.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/libwine/debug.c [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -188,7 +188,7 @@ char *wine_debug; DWORD dwLength; /* GetEnvironmentVariableA will change LastError! */ - DWORD LastError = GetLastError(); + DWORD LastError = GetLastError();
if (nb_debug_options != -1) return; /* already initialized */ nb_debug_options = 0; @@ -278,7 +278,7 @@ /* default implementation of wine_dbgstr_an */ static const char *default_dbgstr_an( const char *str, int n ) { - static const char hex[16] = "0123456789abcdef"; + static const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; char *dst, *res; size_t size;
Modified: trunk/reactos/lib/3rdparty/libwine/debug_ros.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libwine/debug_... ============================================================================== --- trunk/reactos/lib/3rdparty/libwine/debug_ros.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/libwine/debug_ros.c [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -8,6 +8,7 @@
#include "debug.c"
+__MINGW_ATTRIB_MALLOC void *malloc(size_t size) { return LocalAlloc(0, size); @@ -24,6 +25,7 @@ return LocalReAlloc(ptr, size, LMEM_MOVEABLE); }
+__MINGW_ATTRIB_MALLOC char *_strdup(const char *str) { char *newstr = malloc(strlen(str) + 1);
Modified: trunk/reactos/lib/3rdparty/libwine/string.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/libwine/string... ============================================================================== --- trunk/reactos/lib/3rdparty/libwine/string.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/libwine/string.c [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -4,11 +4,11 @@
#ifndef HAVE_STRCASECMP
-#ifdef strcasecmp -# undef strcasecmp +#ifdef _stricmp +# undef _stricmp #endif
-int strcasecmp( const char *str1, const char *str2 ) +int _stricmp( const char *str1, const char *str2 ) { const unsigned char *ustr1 = (const unsigned char *)str1; const unsigned char *ustr2 = (const unsigned char *)str2;
Modified: trunk/reactos/lib/3rdparty/mingw/wcrt1.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/wcrt1.c?... ============================================================================== --- trunk/reactos/lib/3rdparty/mingw/wcrt1.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/mingw/wcrt1.c [iso-8859-1] Wed Nov 26 08:28:19 2008 @@ -42,7 +42,7 @@ #define __UNKNOWN_APP 0 #define __CONSOLE_APP 1 #define __GUI_APP 2 -__MINGW_IMPORT void __set_app_type(int); +_CRTIMP void __set_app_type(int); #endif /* __MSVCRT__ */
/* Global _fmode for this .exe, not the one in msvcrt.dll, @@ -181,7 +181,7 @@ /* * The function mainCRTStartup is the entry point for all console programs. */ -static void __attribute__((noreturn)) +static void __declspec(noreturn) __mingw_wCRTStartup (void) { int nRet; @@ -218,6 +218,7 @@ _pei386_runtime_relocator (); #endif
+#if defined(__GNUC__) #if defined(__i386__) /* Align the stack to 16 bytes for the sake of SSE ops in main or in functions inlined into main. */ @@ -231,6 +232,17 @@ #else #error Unsupported architecture #endif +#endif + +#if defined(_MSC_VER) +#if defined(_M_IX86) + /* Align the stack to 16 bytes for the sake of SSE ops in main + or in functions inlined into main. */ + __asm and esp, 0FFFFFFF0h +#else +#error Unsupported architecture +#endif +#endif
/* * Call the main function. If the user does not supply one