diff --git a/source/lib/config.h b/source/lib/config.h index e360b1ca71..bd39e0f42a 100755 --- a/source/lib/config.h +++ b/source/lib/config.h @@ -1,3 +1,4 @@ + // // OS // diff --git a/source/lib/sysdep/sysdep.h b/source/lib/sysdep/sysdep.h index 336fa51a5c..ccbbe910bc 100755 --- a/source/lib/sysdep/sysdep.h +++ b/source/lib/sysdep/sysdep.h @@ -12,8 +12,11 @@ #include "unix/unix.h" #endif + +// vsnprintf2: handles positional parameters and %lld. +// already available on *nix, emulated on Win32. #ifdef _WIN32 -#include "lib/sysdep/win/printf.h" +extern int vsnprintf2(char* buffer, size_t count, const char* format, va_list argptr); #else #define vsnprintf2 vsnprintf #endif diff --git a/source/lib/sysdep/win/win.cpp b/source/lib/sysdep/win/win.cpp index 287f82fd8f..938dd6cc43 100755 --- a/source/lib/sysdep/win/win.cpp +++ b/source/lib/sysdep/win/win.cpp @@ -28,7 +28,6 @@ #include #include // pick_dir -extern HWND hWnd; void sle(int x) { @@ -120,7 +119,10 @@ int clipboard_set(const wchar_t* text) { int err = -1; - if(!OpenClipboard( hWnd )) + const HWND new_owner = 0; + // MSDN: passing 0 requests the current task be granted ownership; + // there's no need to pass our window handle. + if(!OpenClipboard(new_owner)) return err; EmptyClipboard(); @@ -365,6 +367,7 @@ static inline void pre_main_init() // (w)sdl will take care of it anyway. } +#ifdef HAVE_DEBUGALLOC // Enable heap corruption checking after every allocation. Has the same // effect as PARANOIA in pre_main_init, but lets you switch it on anywhere // so that you can skip checking the whole of the initialisation code. @@ -376,23 +379,10 @@ void memory_debug_extreme_turbo_plus() { _CrtSetDbgFlag( _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF ); } - -extern u64 rdtsc(); -extern u64 PREVTSC; -u64 PREVTSC; - +#endif int entry() { -#ifdef _MSC_VER -u64 TSC=rdtsc(); -debug_out( -"----------------------------------------\n"\ -"ENTRY\n"\ -"----------------------------------------\n"); -PREVTSC=TSC; -#endif - pre_libc_init(); return WinMainCRTStartup(); // calls _cinit, and then WinMain } diff --git a/source/main.cpp b/source/main.cpp index 7113a5f328..14d5f764d9 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -925,7 +925,7 @@ TIMER(InitRenderer) g_Renderer.SetViewport(vp); } -extern u64 PREVTSC; +u64 PREVTSC; static void Shutdown() {