From 2bad78f2160594071bbdb89374e3cef38d2bce4c Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 13 May 2011 17:16:08 +0000 Subject: [PATCH] * Reduce difference to the cmake branch, MSVC fixes. svn path=/trunk/; revision=51702 --- .../base/applications/cmdutils/doskey/doskey.c | 15 +++++++++------ reactos/base/applications/sndrec32/sndrec32.cpp | 2 +- reactos/boot/freeldr/freeldr/freeldr.c | 11 +++++++++++ reactos/dll/win32/glu32/libutil/mipmap.c | 2 +- reactos/dll/win32/riched20/txtsrv.c | 5 ++++- reactos/dll/win32/shell32/shelllink.c | 8 ++++++-- reactos/drivers/base/nmidebug/nmidebug.c | 7 +++++++ reactos/drivers/bus/acpi/osl.c | 16 ++++++++++------ reactos/drivers/usb/usbehci/pdo.c | 4 ++-- reactos/lib/drivers/oskittcp/oskittcp/defaults.c | 4 ++++ .../lib/drivers/oskittcp/oskittcp/interface.c | 3 ++- 11 files changed, 57 insertions(+), 20 deletions(-) diff --git a/reactos/base/applications/cmdutils/doskey/doskey.c b/reactos/base/applications/cmdutils/doskey/doskey.c index 14237f90f16..986a3aa652c 100644 --- a/reactos/base/applications/cmdutils/doskey/doskey.c +++ b/reactos/base/applications/cmdutils/doskey/doskey.c @@ -10,7 +10,7 @@ WCHAR szStringBuf[MAX_STRING]; LPWSTR pszExeName = L"cmd.exe"; /* Function pointers */ -typedef DWORD (WINAPI *GetConsoleCommandHistoryW_t) (LPWSTR sCommands, DWORD nBufferLength, LPWSTR sExeName); +typedef DWORD (WINAPI *GetConsoleCommandHistoryW_t) (LPWSTR sCommands, DWORD nBufferLength, LPWSTR sExeName); typedef DWORD (WINAPI *GetConsoleCommandHistoryLengthW_t) (LPWSTR sExeName); typedef BOOL (WINAPI *SetConsoleNumberOfCommandsW_t)(DWORD nNumber, LPWSTR sExeName); typedef VOID (WINAPI *ExpungeConsoleCommandHistoryW_t)(LPWSTR sExeName); @@ -142,7 +142,7 @@ static VOID ReadFromFile(LPWSTR param) return; } - while ( fgetws(line, MAX_PATH, fp) != NULL) + while ( fgetws(line, MAX_PATH, fp) != NULL) { /* Remove newline character */ WCHAR *end = &line[wcslen(line) - 1]; @@ -191,13 +191,16 @@ static LPWSTR RemoveQuotes(LPWSTR str) int wmain(VOID) { - setlocale(LC_ALL, ""); + WCHAR *pArgStart; + WCHAR *pArgEnd; + HMODULE hKernel32; + + setlocale(LC_ALL, ""); /* Get the full command line using GetCommandLine(). We can't just use argv, * because then a parameter like "gotoroot=cd \" wouldn't be passed completely. */ - WCHAR *pArgStart; - WCHAR *pArgEnd = GetCommandLine(); - HMODULE hKernel32 = LoadLibraryW(L"kernel32.dll"); + pArgEnd = GetCommandLine(); + hKernel32 = LoadLibraryW(L"kernel32.dll"); /* Get function pointers */ pGetConsoleCommandHistoryW = (GetConsoleCommandHistoryW_t)GetProcAddress( hKernel32, "GetConsoleCommandHistoryW"); diff --git a/reactos/base/applications/sndrec32/sndrec32.cpp b/reactos/base/applications/sndrec32/sndrec32.cpp index 3e0f4a720f7..830e232ce63 100644 --- a/reactos/base/applications/sndrec32/sndrec32.cpp +++ b/reactos/base/applications/sndrec32/sndrec32.cpp @@ -462,7 +462,7 @@ WndProc_wave( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) x = ( i * samples ) / WAVEBAR_CX; - line_h = ( abs(AUD_OUT->nsample( x )) * max_h ) / AUD_OUT->samplevalue_max(); + line_h = ( AUD_OUT->nsample( x ) * max_h ) / AUD_OUT->samplevalue_max(); if ( line_h ) diff --git a/reactos/boot/freeldr/freeldr/freeldr.c b/reactos/boot/freeldr/freeldr/freeldr.c index 57899168b2a..98af295c4c7 100644 --- a/reactos/boot/freeldr/freeldr/freeldr.c +++ b/reactos/boot/freeldr/freeldr/freeldr.c @@ -54,6 +54,17 @@ VOID BootMain(LPSTR CmdLine) RunLoader(); } +#ifdef _MSC_VER +long _ftol2(double f) +{ + return _ftol(f); +} +long _ftol2_sse(double f) +{ + return _ftol(f); +} +#endif + // We need to emulate these, because the original ones don't work in freeldr int __cdecl wctomb(char *mbchar, wchar_t wchar) { diff --git a/reactos/dll/win32/glu32/libutil/mipmap.c b/reactos/dll/win32/glu32/libutil/mipmap.c index b943c7b642b..e2a07bb9522 100644 --- a/reactos/dll/win32/glu32/libutil/mipmap.c +++ b/reactos/dll/win32/glu32/libutil/mipmap.c @@ -6577,7 +6577,7 @@ static void halve1DimagePackedPixel(int components, * Contributed by Gerk Huisma . */ -typedef WINAPI void (GLAPIENTRY *TexImage3Dproc)( GLenum target, GLint level, +typedef void (GLAPIENTRY *TexImage3Dproc)( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, diff --git a/reactos/dll/win32/riched20/txtsrv.c b/reactos/dll/win32/riched20/txtsrv.c index 7ab2af45162..8db45e8e24d 100644 --- a/reactos/dll/win32/riched20/txtsrv.c +++ b/reactos/dll/win32/riched20/txtsrv.c @@ -88,7 +88,10 @@ HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter, ITextImpl->lpVtbl = &textservices_Vtbl; ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE); ITextImpl->editor->exStyleFlags = 0; - ITextImpl->editor->rcFormat = (RECT){0,0,0,0}; + ITextImpl->editor->rcFormat.left = 0; + ITextImpl->editor->rcFormat.top = 0; + ITextImpl->editor->rcFormat.right = 0; + ITextImpl->editor->rcFormat.bottom = 0; ME_HandleMessage(ITextImpl->editor, WM_CREATE, 0, 0, TRUE, &hres); if (pUnkOuter) diff --git a/reactos/dll/win32/shell32/shelllink.c b/reactos/dll/win32/shell32/shelllink.c index fb60fab4316..78c25c45ffc 100644 --- a/reactos/dll/win32/shell32/shelllink.c +++ b/reactos/dll/win32/shell32/shelllink.c @@ -187,9 +187,13 @@ static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWor /* strdup on the process heap */ static LPWSTR __inline HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str) { + INT len; + LPWSTR p; + assert(str); - INT len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); - LPWSTR p = HeapAlloc( heap, flags, len*sizeof (WCHAR) ); + + len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); + p = HeapAlloc( heap, flags, len*sizeof (WCHAR) ); if( !p ) return p; MultiByteToWideChar( CP_ACP, 0, str, -1, p, len ); diff --git a/reactos/drivers/base/nmidebug/nmidebug.c b/reactos/drivers/base/nmidebug/nmidebug.c index cfe87559eed..9b147850869 100644 --- a/reactos/drivers/base/nmidebug/nmidebug.c +++ b/reactos/drivers/base/nmidebug/nmidebug.c @@ -21,7 +21,14 @@ NmiClearFlag(VOID) { ((PCHAR)&KiBugCheckData[4])[0] -= (NmiBegin[3] | NmiBegin[7]); ((PCHAR)&KiBugCheckData[4])[3] |= 1; +#ifdef _MSC_VER + __asm + { + rcr KiBugCheckData[4], 8 + } +#else __asm__("rcrl %b[shift], %k[retval]" : [retval] "=rm" (KiBugCheckData[4]) : "[retval]" (KiBugCheckData[4]), [shift] "Nc" (8)); +#endif } BOOLEAN diff --git a/reactos/drivers/bus/acpi/osl.c b/reactos/drivers/bus/acpi/osl.c index a5df0c0d620..4eeb71f8f51 100644 --- a/reactos/drivers/bus/acpi/osl.c +++ b/reactos/drivers/bus/acpi/osl.c @@ -67,6 +67,8 @@ AcpiOsRemoveInterruptHandler ( ACPI_STATUS AcpiOsInitialize (void) { + UINT32 i; + DPRINT("AcpiOsInitialize called\n"); #ifndef NDEBUG @@ -75,8 +77,6 @@ AcpiOsInitialize (void) AcpiDbgLayer = 0xFFFFFFFF; #endif - UINT32 i; - for (i = 0; i < NUM_SEMAPHORES; i++) { AcpiGbl_Semaphores[i].OsHandle = NULL; @@ -209,10 +209,11 @@ void * AcpiOsAcquireObject ( ACPI_CACHE_T *Cache) { + void* ptr; PNPAGED_LOOKASIDE_LIST List = (PNPAGED_LOOKASIDE_LIST)Cache; + DPRINT("AcpiOsAcquireObject from %p\n", Cache); - void* ptr = - ExAllocateFromNPagedLookasideList(List); + ptr = ExAllocateFromNPagedLookasideList(List); ASSERT(ptr); RtlZeroMemory(ptr,List->L.Size); @@ -692,8 +693,10 @@ AcpiOsExecute ( UINT64 AcpiOsGetTimer (void) { - DPRINT("AcpiOsGetTimer\n"); LARGE_INTEGER Timer; + + DPRINT("AcpiOsGetTimer\n"); + KeQueryTickCount(&Timer); return Timer.QuadPart; @@ -758,9 +761,10 @@ ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer ( void) { - DPRINT("AcpiOsGetRootPointer\n"); ACPI_PHYSICAL_ADDRESS pa = 0; + DPRINT("AcpiOsGetRootPointer\n"); + AcpiFindRootPointer(&pa); return pa; } diff --git a/reactos/drivers/usb/usbehci/pdo.c b/reactos/drivers/usb/usbehci/pdo.c index 0181628c952..38829fcf9f5 100644 --- a/reactos/drivers/usb/usbehci/pdo.c +++ b/reactos/drivers/usb/usbehci/pdo.c @@ -368,6 +368,8 @@ PdoDispatchPnp( PIO_STACK_LOCATION Stack; ULONG_PTR Information = Irp->IoStatus.Information; NTSTATUS Status = Irp->IoStatus.Status; + PDEVICE_CAPABILITIES DeviceCapabilities; + ULONG i; Stack = IoGetCurrentIrpStackLocation(Irp); MinorFunction = Stack->MinorFunction; @@ -513,8 +515,6 @@ PdoDispatchPnp( case IRP_MN_QUERY_CAPABILITIES: { DPRINT("Ehci: PDO Query Capabilities\n"); - PDEVICE_CAPABILITIES DeviceCapabilities; - ULONG i; DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities; diff --git a/reactos/lib/drivers/oskittcp/oskittcp/defaults.c b/reactos/lib/drivers/oskittcp/oskittcp/defaults.c index 08a5fd61f41..bfc27f9ad95 100644 --- a/reactos/lib/drivers/oskittcp/oskittcp/defaults.c +++ b/reactos/lib/drivers/oskittcp/oskittcp/defaults.c @@ -194,7 +194,11 @@ int bcmp(const void *b1, const void *b2, size_t len) return RtlCompareMemory(b1, b2, len); } +#ifndef _MSC_VER + int memcmp(const void *b1, const void *b2, size_t len) { return RtlCompareMemory(b1, b2, len); } + +#endif diff --git a/reactos/lib/drivers/oskittcp/oskittcp/interface.c b/reactos/lib/drivers/oskittcp/oskittcp/interface.c index bda5937ffdd..9205757f8c8 100644 --- a/reactos/lib/drivers/oskittcp/oskittcp/interface.c +++ b/reactos/lib/drivers/oskittcp/oskittcp/interface.c @@ -129,9 +129,10 @@ int OskitTCPSocket( void *context, int proto ) { struct socket *so; + int error ; OSKLock(); - int error = socreate(domain, &so, type, proto); + error = socreate(domain, &so, type, proto); if( !error ) { so->so_connection = context; InitializeSocketFlags(so);