This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 9944 for ps


Ignore:
Timestamp:
07/31/11 11:42:57 (13 years ago)
Author:
Jan Wassenberg
Message:

pool - safely handle zero-sized allocations (fixes #909)
snd_mgr - remove no longer needed hacks for native OpenAL implementations
test_wdbg_sym.h - belated commit of warning fix

Location:
ps/trunk/source/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/lib/allocators/pool.h

    r9475 r9944  
    296296    pointer allocate(size_type n)
    297297    {
     298        // safely handle zero-sized allocations (happens with GCC STL - see ticket #909).
     299        if(n == 0)
     300            n = 1;
    298301        return p.AllocateMemory<value_type> (n);
    299302    }
  • ps/trunk/source/lib/res/sound/snd_mgr.cpp

    r9877 r9944  
    5555#include "ogg.h"
    5656
    57 // HACK: OpenAL loads and unloads certain DLLs several times on Windows.
    58 // that looks unnecessary and wastes 100..400 ms on startup.
    59 // we hold a reference to prevent the actual unload. everything works ATM;
    60 // hopefully, OpenAL doesn't rely on them actually being unloaded.
    61 #if OS_WIN
    62 # define WIN_LOADLIBRARY_HACK 0
    63 #else
    64 # define WIN_LOADLIBRARY_HACK 0
    65 #endif
    6657
    6758static const size_t maxBufferSize = 64*KiB;
     
    223214    Status ret = INFO::OK;
    224215
    225 #if WIN_LOADLIBRARY_HACK
    226     HMODULE dlls[3];
    227     dlls[0] = LoadLibrary("wrap_oal.dll");
    228     dlls[1] = LoadLibrary("setupapi.dll");
    229     dlls[2] = LoadLibrary("wdmaud.drv");
    230 #endif
    231 
    232     // for reasons unknown, the NV native OpenAL implementation
    233     // causes an "invalid handle" exception internally when loaded
    234     // (it's not caused by the DLL load hack above). everything works and
    235     // we can continue normally; we just need to catch it to prevent the
    236     // unhandled exception filter from reporting it.
    237 #if OS_WIN
    238     __try
    239     {
    240         alc_dev = alcOpenDevice((alcString)alc_dev_name);
    241     }
    242     // if invalid handle, handle it; otherwise, continue handler search.
    243     __except(GetExceptionCode() == EXCEPTION_INVALID_HANDLE)
    244     {
    245         // ignore
    246     }
    247 #else
    248216    alc_dev = alcOpenDevice((alcString)alc_dev_name);
    249 #endif
    250 
    251217    if(alc_dev)
    252218    {
     
    277243    swprintf_s(buf, ARRAY_SIZE(buf), L"SND| alc_init: success, using %hs\n", dev_name);
    278244    ah_log(buf);
    279 
    280 #if WIN_LOADLIBRARY_HACK
    281     // release DLL references, so BoundsChecker doesn't complain at exit.
    282     for(int i = 0; i < ARRAY_SIZE(dlls); i++)
    283         if(dlls[i] != INVALID_HANDLE_VALUE)
    284             FreeLibrary(dlls[i]);
    285 #endif
    286245
    287246    return ret;
  • ps/trunk/source/lib/sysdep/os/win/tests/test_wdbg_sym.h

    r9875 r9944  
    5151
    5252#pragma optimize("", off)
     53#pragma warning(disable:4748)   // /GS can not protect [..] from local buffer overrun because optimizations are disabled
    5354
    5455// (these must be outside of TestWdbgSym so that we can simply
Note: See TracChangeset for help on using the changeset viewer.