part2: misc source/lib fixes/improvements

move all except user-specified config choices out of config.h and into
appropriate headers
CPU_IA32 -> ARCH_IA32
wsdl: disable use of ddraw (will soon be replaced by WMI)

use shared_ptr without namespace qualifier (it's in tr1)
debug_warn -> debug_assert(0)
LIB_API to allow building as DLL
smart pointers: reduce use of .get()
cache_adt: use map instead of hash_map (avoids needing a hashCompare
class). also remove spurious warning
code_annotation.h: better cassert implementation
move FPS measuring portion of timer.cpp into frequency_filter
move include of memory headers into mmgr.h (to avoid errors, we must
ensure they are included if mmgr is used)
posix_filesystem.h: move definition of mkdir to wfilesystem
stl: disable iterator checks in release mode
wmi: fix COM init bug, use smart pointers
wutil: add code to get DLL module handle (if compiled as such), add
WinScopedLock
timer: fix handling of raw ticks

This was SVN commit r5517.
This commit is contained in:
janwas
2007-12-20 20:09:19 +00:00
parent 03543147b7
commit 2e5d9452aa
68 changed files with 836 additions and 881 deletions
+8 -13
View File
@@ -70,7 +70,7 @@ void debug_wprintf_mem(const wchar_t* fmt, ...)
va_end(args);
if(len < 0)
{
debug_warn("vswprintf failed");
debug_assert(0); // vswprintf failed
return;
}
debug_log_pos += len+2;
@@ -112,7 +112,7 @@ void debug_filter_add(const char* tag)
// too many already?
if(num_tags == MAX_TAGS)
{
debug_warn("increase MAX_TAGS");
debug_assert(0); // increase MAX_TAGS
return;
}
@@ -204,14 +204,11 @@ void debug_wprintf(const wchar_t* fmt, ...)
const size_t MAX_BYTES = MAX_CHARS*2;
char mbs_buf[MAX_BYTES]; mbs_buf[MAX_BYTES-1] = '\0';
size_t bytes_written = wcstombs(mbs_buf, wcs_buf, MAX_BYTES);
// .. error
if(bytes_written == (size_t)-1)
debug_warn("invalid wcs character encountered");
// .. exact fit, make sure it's 0-terminated
debug_assert(bytes_written != (size_t)-1); // else: invalid wcs character encountered
debug_assert(bytes_written <= MAX_BYTES); // else: overflow (should be impossible)
// exact fit, ensure it's 0-terminated
if(bytes_written == MAX_BYTES)
mbs_buf[MAX_BYTES-1] = '\0';
// .. paranoia: overflow is impossible
debug_assert(bytes_written <= MAX_BYTES);
if(debug_filter_allows(mbs_buf))
debug_puts(mbs_buf);
@@ -396,8 +393,7 @@ static void symbol_string_add_to_cache(const char* string, void* symbol)
{
// note: must be zeroed to set each Symbol to "invalid"
symbols = (Symbol*)calloc(MAX_SYMBOLS, sizeof(Symbol));
if(!symbols)
debug_warn("failed to allocate symbols");
debug_assert(symbols);
}
// hash table is completely full (guard against infinite loop below).
@@ -680,7 +676,7 @@ void debug_skip_next_err(LibError err)
if(cpu_CAS(&expected_err_valid, 0, 1))
expected_err = err;
else
debug_warn("internal error: concurrent attempt to skip assert/error");
debug_assert(0); // internal error: concurrent attempt to skip assert/error
}
@@ -691,8 +687,7 @@ static bool should_skip_this_error(LibError err)
// (use cpu_CAS to ensure only one error is skipped)
if(cpu_CAS(&expected_err_valid, 1, 0))
{
if(!was_expected_err)
debug_warn("anticipated error was not raised");
debug_assert(was_expected_err);
return was_expected_err;
}