diff --git a/source/lib/allocators/pool.h b/source/lib/allocators/pool.h index 8b66dfebc3..68aaffc1ec 100644 --- a/source/lib/allocators/pool.h +++ b/source/lib/allocators/pool.h @@ -295,6 +295,9 @@ public: pointer allocate(size_type n) { + // safely handle zero-sized allocations (happens with GCC STL - see ticket #909). + if(n == 0) + n = 1; return p.AllocateMemory (n); } diff --git a/source/lib/res/sound/snd_mgr.cpp b/source/lib/res/sound/snd_mgr.cpp index 4ab40df234..bfc7d0df2f 100644 --- a/source/lib/res/sound/snd_mgr.cpp +++ b/source/lib/res/sound/snd_mgr.cpp @@ -54,15 +54,6 @@ #include "ogg.h" -// HACK: OpenAL loads and unloads certain DLLs several times on Windows. -// that looks unnecessary and wastes 100..400 ms on startup. -// we hold a reference to prevent the actual unload. everything works ATM; -// hopefully, OpenAL doesn't rely on them actually being unloaded. -#if OS_WIN -# define WIN_LOADLIBRARY_HACK 0 -#else -# define WIN_LOADLIBRARY_HACK 0 -#endif static const size_t maxBufferSize = 64*KiB; @@ -222,32 +213,7 @@ static Status alc_init() { Status ret = INFO::OK; -#if WIN_LOADLIBRARY_HACK - HMODULE dlls[3]; - dlls[0] = LoadLibrary("wrap_oal.dll"); - dlls[1] = LoadLibrary("setupapi.dll"); - dlls[2] = LoadLibrary("wdmaud.drv"); -#endif - - // for reasons unknown, the NV native OpenAL implementation - // causes an "invalid handle" exception internally when loaded - // (it's not caused by the DLL load hack above). everything works and - // we can continue normally; we just need to catch it to prevent the - // unhandled exception filter from reporting it. -#if OS_WIN - __try - { - alc_dev = alcOpenDevice((alcString)alc_dev_name); - } - // if invalid handle, handle it; otherwise, continue handler search. - __except(GetExceptionCode() == EXCEPTION_INVALID_HANDLE) - { - // ignore - } -#else alc_dev = alcOpenDevice((alcString)alc_dev_name); -#endif - if(alc_dev) { alc_ctx = alcCreateContext(alc_dev, 0); // no attrlist needed @@ -277,13 +243,6 @@ static Status alc_init() swprintf_s(buf, ARRAY_SIZE(buf), L"SND| alc_init: success, using %hs\n", dev_name); ah_log(buf); -#if WIN_LOADLIBRARY_HACK - // release DLL references, so BoundsChecker doesn't complain at exit. - for(int i = 0; i < ARRAY_SIZE(dlls); i++) - if(dlls[i] != INVALID_HANDLE_VALUE) - FreeLibrary(dlls[i]); -#endif - return ret; } diff --git a/source/lib/sysdep/os/win/tests/test_wdbg_sym.h b/source/lib/sysdep/os/win/tests/test_wdbg_sym.h index 79fd43356f..e0d7383e07 100644 --- a/source/lib/sysdep/os/win/tests/test_wdbg_sym.h +++ b/source/lib/sysdep/os/win/tests/test_wdbg_sym.h @@ -50,6 +50,7 @@ static Status OnFrame(const _tagSTACKFRAME64* frame, uintptr_t UNUSED(cbData)) } #pragma optimize("", off) +#pragma warning(disable:4748) // /GS can not protect [..] from local buffer overrun because optimizations are disabled // (these must be outside of TestWdbgSym so that we can simply // search for the function's name as a substring within the ILT