diff --git a/source/graphics/MapWriter.cpp b/source/graphics/MapWriter.cpp index 47991a80b2..eed07b4cdc 100644 --- a/source/graphics/MapWriter.cpp +++ b/source/graphics/MapWriter.cpp @@ -386,7 +386,7 @@ void CMapWriter::WriteXML(const VfsPath& filename, } } if (! XML_StoreVFS(g_VFS, filename)) - ENSURE(0); // failed to write map XML file + DEBUG_WARN_ERR(ERR::LOGIC); // failed to write map XML file } /* diff --git a/source/gui/scripting/JSInterface_IGUIObject.cpp b/source/gui/scripting/JSInterface_IGUIObject.cpp index 5d75124bf2..f78d616025 100644 --- a/source/gui/scripting/JSInterface_IGUIObject.cpp +++ b/source/gui/scripting/JSInterface_IGUIObject.cpp @@ -282,7 +282,7 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsid id, jsval* default: JS_ReportError(cx, "Setting '%s' uses an unimplemented type", propName.c_str()); - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return JS_FALSE; } diff --git a/source/lib/adts/cache_adt.h b/source/lib/adts/cache_adt.h index e08e75da0e..88145c77c3 100644 --- a/source/lib/adts/cache_adt.h +++ b/source/lib/adts/cache_adt.h @@ -581,7 +581,7 @@ public: return; } } - ENSURE(0); // entry not found in list + DEBUG_WARN_ERR(ERR::LOGIC); // entry not found in list } void remove_least_valuable(std::list& entry_list) diff --git a/source/lib/adts/ring_buf.h b/source/lib/adts/ring_buf.h index 4e91dbc8ce..57cda064ef 100644 --- a/source/lib/adts/ring_buf.h +++ b/source/lib/adts/ring_buf.h @@ -96,7 +96,7 @@ public: head = (head + 1) % n; } else - ENSURE(0); // underflow + DEBUG_WARN_ERR(ERR::LOGIC); // underflow } class iterator diff --git a/source/lib/allocators/allocator_checker.h b/source/lib/allocators/allocator_checker.h index 8c2e1971d1..539f615f76 100644 --- a/source/lib/allocators/allocator_checker.h +++ b/source/lib/allocators/allocator_checker.h @@ -44,7 +44,7 @@ public: { Allocs::iterator it = allocs.find(p); if(it == allocs.end()) - ENSURE(0); // freeing invalid pointer + DEBUG_WARN_ERR(ERR::LOGIC); // freeing invalid pointer else { // size must match what was passed to OnAllocate diff --git a/source/lib/allocators/pool.cpp b/source/lib/allocators/pool.cpp index 384db1b875..6f7a23c1c9 100644 --- a/source/lib/allocators/pool.cpp +++ b/source/lib/allocators/pool.cpp @@ -105,14 +105,14 @@ void pool_free(Pool* p, void* el) // check if requested_size matches that when allocating) if(p->el_size == 0) { - ENSURE(0); // cannot free variable-size items + DEBUG_WARN_ERR(ERR::LOGIC); // cannot free variable-size items return; } if(pool_contains(p, el)) mem_freelist_AddToFront(p->freelist, el); else - ENSURE(0); // invalid pointer (not in pool) + DEBUG_WARN_ERR(ERR::LOGIC); // invalid pointer (not in pool) } diff --git a/source/lib/bits.h b/source/lib/bits.h index f30e2d0a6e..71f060b213 100644 --- a/source/lib/bits.h +++ b/source/lib/bits.h @@ -241,7 +241,7 @@ inline T MaxPowerOfTwoDivisor(T value) return T(1) << log2; } - ENSURE(0); // unreachable (!= 0 => there is a set bit) + DEBUG_WARN_ERR(ERR::LOGIC); // unreachable (!= 0 => there is a set bit) return 0; } diff --git a/source/lib/code_annotation.h b/source/lib/code_annotation.h index 1dedb94d54..2006eaedfc 100644 --- a/source/lib/code_annotation.h +++ b/source/lib/code_annotation.h @@ -105,7 +105,7 @@ #else # define UNREACHABLE\ STMT(\ - ENSURE(0); /* hit supposedly unreachable code */\ + DEBUG_WARN_ERR(ERR::LOGIC); /* hit supposedly unreachable code */\ for(;;){};\ ) #endif diff --git a/source/lib/debug.cpp b/source/lib/debug.cpp index a985edf05e..344fbbf2f0 100644 --- a/source/lib/debug.cpp +++ b/source/lib/debug.cpp @@ -84,7 +84,7 @@ void debug_filter_add(const wchar_t* tag) // too many already? if(num_tags == MAX_TAGS) { - ENSURE(0); // increase MAX_TAGS + DEBUG_WARN_ERR(ERR::LOGIC); // increase MAX_TAGS return; } diff --git a/source/lib/file/file.cpp b/source/lib/file/file.cpp index 068d346862..abb2e2a897 100644 --- a/source/lib/file/file.cpp +++ b/source/lib/file/file.cpp @@ -47,7 +47,7 @@ Status FileOpen(const OsPath& pathname, int opcode, int& fd) oflag = O_WRONLY|O_CREAT|O_TRUNC; break; default: - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); break; } #if OS_WIN diff --git a/source/lib/file/vfs/vfs_lookup.cpp b/source/lib/file/vfs/vfs_lookup.cpp index 0bdf7dd7d9..fb7ba52f8a 100644 --- a/source/lib/file/vfs/vfs_lookup.cpp +++ b/source/lib/file/vfs/vfs_lookup.cpp @@ -63,7 +63,7 @@ static Status CreateDirectory(const OsPath& path) // unexpected failure debug_printf(L"wmkdir failed with errno=%d\n", errno); - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); WARN_RETURN(StatusFromErrno()); } diff --git a/source/lib/file/vfs/vfs_tree.cpp b/source/lib/file/vfs/vfs_tree.cpp index 4e1372c7e7..d487898007 100644 --- a/source/lib/file/vfs/vfs_tree.cpp +++ b/source/lib/file/vfs/vfs_tree.cpp @@ -127,7 +127,7 @@ VfsDirectory* VfsDirectory::GetSubdirectory(const VfsPath& name) void VfsDirectory::SetAssociatedDirectory(const PRealDirectory& realDirectory) { if(!cpu_CAS(&m_shouldPopulate, 0, 1)) - ENSURE(0); // caller didn't check ShouldPopulate + DEBUG_WARN_ERR(ERR::LOGIC); // caller didn't check ShouldPopulate m_realDirectory = realDirectory; } diff --git a/source/lib/input.cpp b/source/lib/input.cpp index e652682845..8bd8ab5e96 100644 --- a/source/lib/input.cpp +++ b/source/lib/input.cpp @@ -66,6 +66,6 @@ void in_dispatch_event(const SDL_Event_* ev) continue; // .. invalid return value else - ENSURE(0); // invalid handler return value + DEBUG_WARN_ERR(ERR::LOGIC); // invalid handler return value } } diff --git a/source/lib/lib.cpp b/source/lib/lib.cpp index 0d1988824c..e15548b54f 100644 --- a/source/lib/lib.cpp +++ b/source/lib/lib.cpp @@ -84,7 +84,7 @@ u8 u8_from_double(double in) { if(!(0.0 <= in && in < 1.0)) { - ENSURE(0); // clampf not in [0,1) + DEBUG_WARN_ERR(ERR::LOGIC); // clampf not in [0,1) return 255; } @@ -98,7 +98,7 @@ u16 u16_from_double(double in) { if(!(0.0 <= in && in < 1.0)) { - ENSURE(0); // clampf not in [0,1) + DEBUG_WARN_ERR(ERR::LOGIC); // clampf not in [0,1) return 65535; } diff --git a/source/lib/ogl.cpp b/source/lib/ogl.cpp index ff706a26b4..2aac7991f3 100644 --- a/source/lib/ogl.cpp +++ b/source/lib/ogl.cpp @@ -221,7 +221,7 @@ bool ogl_HaveVersion(const char* desired_version) int desired_major, desired_minor; if(sscanf_s(desired_version, "%d.%d", &desired_major, &desired_minor) != 2) { - ENSURE(0); // invalid version string + DEBUG_WARN_ERR(ERR::LOGIC); // invalid version string return false; } @@ -230,7 +230,7 @@ bool ogl_HaveVersion(const char* desired_version) int major, minor; if(!version || sscanf_s(version, "%d.%d", &major, &minor) != 2) { - ENSURE(0); // GL_VERSION invalid + DEBUG_WARN_ERR(ERR::LOGIC); // GL_VERSION invalid return false; } diff --git a/source/lib/res/graphics/cursor.cpp b/source/lib/res/graphics/cursor.cpp index 95d8cb1ed1..552d012dfc 100644 --- a/source/lib/res/graphics/cursor.cpp +++ b/source/lib/res/graphics/cursor.cpp @@ -180,7 +180,7 @@ static void Cursor_dtor(Cursor* c) break; default: - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); break; } } @@ -261,7 +261,7 @@ static Status Cursor_to_string(const Cursor* c, wchar_t* buf) break; default: - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); type = L"?"; break; } @@ -323,7 +323,7 @@ Status cursor_draw(const PIVFS& vfs, const wchar_t* name, int x, int y) break; default: - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); break; } diff --git a/source/lib/res/graphics/ogl_tex.cpp b/source/lib/res/graphics/ogl_tex.cpp index c6b18d11e2..fb5aeb16d3 100644 --- a/source/lib/res/graphics/ogl_tex.cpp +++ b/source/lib/res/graphics/ogl_tex.cpp @@ -129,7 +129,7 @@ static GLint choose_fmt(size_t bpp, size_t flags) case 5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; default: - ENSURE(0); // invalid DXT value + DEBUG_WARN_ERR(ERR::LOGIC); // invalid DXT value return 0; } } @@ -149,7 +149,7 @@ static GLint choose_fmt(size_t bpp, size_t flags) ENSURE(alpha); return bgr? GL_BGRA : GL_RGBA; default: - ENSURE(0); // invalid bpp + DEBUG_WARN_ERR(ERR::LOGIC); // invalid bpp return 0; } @@ -242,7 +242,7 @@ static GLint choose_int_fmt(GLenum fmt, int q_flags) wchar_t buf[100]; swprintf_s(buf, ARRAY_SIZE(buf), L"choose_int_fmt: fmt 0x%x isn't covered! please add it", fmt); DEBUG_DISPLAY_ERROR(buf); - ENSURE(0); // given fmt isn't covered! please add it. + DEBUG_WARN_ERR(ERR::LOGIC); // given fmt isn't covered! please add it. // fall back to a reasonable default return half_bpp? GL_RGB4 : GL_RGB8; } @@ -588,7 +588,7 @@ static void warn_if_uploaded(Handle ht, const OglTex* ot) return; // don't complain if(ot->flags & OT_IS_UPLOADED) - ENSURE(0); // ogl_tex_set_*: texture already uploaded and shouldn't be changed + DEBUG_WARN_ERR(ERR::LOGIC); // ogl_tex_set_*: texture already uploaded and shouldn't be changed #else // (prevent warnings; the alternative of wrapping all call sites in // #ifndef is worse) @@ -689,7 +689,7 @@ void ogl_tex_override(OglTexOverrides what, OglTexAllow allow) have_anistropy = enable; break; default: - ENSURE(0); // invalid + DEBUG_WARN_ERR(ERR::LOGIC); // invalid break; } } diff --git a/source/lib/res/graphics/unifont.cpp b/source/lib/res/graphics/unifont.cpp index 4d3ed6c95c..b19fb5c5b5 100644 --- a/source/lib/res/graphics/unifont.cpp +++ b/source/lib/res/graphics/unifont.cpp @@ -127,7 +127,7 @@ static Status UniFont_reload(UniFont* f, const PIVFS& vfs, const VfsPath& basena if (Codepoint < 0 || Codepoint > 0xFFFF) { - ENSURE(0); // Invalid codepoint + DEBUG_WARN_ERR(ERR::LOGIC); // Invalid codepoint continue; } @@ -367,7 +367,7 @@ Status unifont_stringsize(const Handle h, const wchar_t* text, int& width, int& if (it == f->glyphs->end()) // Missing the missing glyph symbol - give up { - ENSURE(0); // Missing the missing glyph in a unifont! + DEBUG_WARN_ERR(ERR::LOGIC); // Missing the missing glyph in a unifont! return INFO::OK; } diff --git a/source/lib/res/h_mgr.cpp b/source/lib/res/h_mgr.cpp index 8afeab7266..7e76e55c38 100644 --- a/source/lib/res/h_mgr.cpp +++ b/source/lib/res/h_mgr.cpp @@ -675,7 +675,7 @@ void* h_user_data(const Handle h, const H_Type type) if(!hd->refs) { // note: resetting the tag is not enough (user might pass in its value) - ENSURE(0); // no references to resource (it's cached, but someone is accessing it directly) + DEBUG_WARN_ERR(ERR::LOGIC); // no references to resource (it's cached, but someone is accessing it directly) return 0; } @@ -691,7 +691,7 @@ VfsPath h_filename(const Handle h) HDATA* hd = h_data_tag(h); if(!hd) { - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return VfsPath(); } return hd->pathname; @@ -779,7 +779,7 @@ void h_add_ref(Handle h) HDATA* hd = h_data_tag(h); if(!hd) { - ENSURE(0); // invalid handle + DEBUG_WARN_ERR(ERR::LOGIC); // invalid handle return; } @@ -824,7 +824,7 @@ static void Shutdown() // each HDATA entry has already been allocated. if(!hd) { - ENSURE(0); // h_data_from_idx failed - why?! + DEBUG_WARN_ERR(ERR::LOGIC); // h_data_from_idx failed - why?! continue; } diff --git a/source/lib/res/sound/snd_mgr.cpp b/source/lib/res/sound/snd_mgr.cpp index 9046f28c17..24f0397a6e 100644 --- a/source/lib/res/sound/snd_mgr.cpp +++ b/source/lib/res/sound/snd_mgr.cpp @@ -111,7 +111,7 @@ static void al_ReportError(ALenum err, const char* caller, int line) ENSURE(al_initialized); debug_printf(L"OpenAL error: %hs; called from %hs (line %d)\n", alGetString(err), caller, line); - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); } /** @@ -561,7 +561,7 @@ static void al_src_free(ALuint al_src) ENSURE(cpu_CAS(&al_srcs_allocationStates[i], kInUse, kAvailable)); } else - ENSURE(0); // al_src wasn't in al_srcs + DEBUG_WARN_ERR(ERR::LOGIC); // al_src wasn't in al_srcs } @@ -1471,7 +1471,7 @@ static void list_remove(VSrc* vs) } } - ENSURE(0); // VSrc not found + DEBUG_WARN_ERR(ERR::LOGIC); // VSrc not found } diff --git a/source/lib/sysdep/arch/x86_x64/cache.cpp b/source/lib/sysdep/arch/x86_x64/cache.cpp index 73d9ea8e7d..2106f9d65a 100644 --- a/source/lib/sysdep/arch/x86_x64/cache.cpp +++ b/source/lib/sysdep/arch/x86_x64/cache.cpp @@ -332,7 +332,7 @@ struct Characteristics // POD case U: return x86_x64_Cache::kUnified; default: - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return x86_x64_Cache::kNull; } } diff --git a/source/lib/sysdep/arch/x86_x64/topology.cpp b/source/lib/sysdep/arch/x86_x64/topology.cpp index 543e41ce3b..e4ff495215 100644 --- a/source/lib/sysdep/arch/x86_x64/topology.cpp +++ b/source/lib/sysdep/arch/x86_x64/topology.cpp @@ -181,7 +181,7 @@ size_t ProcessorFromApicId(size_t apicId) const u8* pos = std::find(apicIds, end, apicId); if(pos == end) { - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return 0; } return pos - apicIds; // index @@ -299,7 +299,7 @@ static Status InitCpuTopology() } } - ENSURE(0); // didn't find a feasible topology + DEBUG_WARN_ERR(ERR::LOGIC); // didn't find a feasible topology } return INFO::OK; diff --git a/source/lib/sysdep/os/win/mahaf.cpp b/source/lib/sysdep/os/win/mahaf.cpp index d56e6232d4..91ff8d0d8f 100644 --- a/source/lib/sysdep/os/win/mahaf.cpp +++ b/source/lib/sysdep/os/win/mahaf.cpp @@ -295,7 +295,7 @@ static void StartDriver(const OsPath& driverPathname) { // starting failed. don't raise a warning because this // always happens on least-permission user accounts. - //ENSURE(0); + //DEBUG_WARN_ERR(ERR::LOGIC); } } } diff --git a/source/lib/sysdep/os/win/wdbg_sym.cpp b/source/lib/sysdep/os/win/wdbg_sym.cpp index e2f853c2cd..74b0f4f9ae 100644 --- a/source/lib/sysdep/os/win/wdbg_sym.cpp +++ b/source/lib/sysdep/os/win/wdbg_sym.cpp @@ -534,7 +534,7 @@ static void out(const wchar_t* fmt, ...) // make sure out_chars_left remains nonnegative if((size_t)len > out_chars_left) { - ENSURE(0); // apparently wrote more than out_chars_left + DEBUG_WARN_ERR(ERR::LOGIC); // apparently wrote more than out_chars_left len = (int)out_chars_left; } out_chars_left -= len; @@ -1034,7 +1034,7 @@ static Status dump_sym_base_type(DWORD type_id, const u8* p, DumpState state) else if(size == sizeof(double)) out(L"%g (0x%016I64X)", data, data); else - ENSURE(0); // invalid float size + DEBUG_WARN_ERR(ERR::LOGIC); // invalid float size break; // boolean @@ -1072,7 +1072,7 @@ display_as_hex: else if(size == 8) fmt = L"%I64d (0x%016I64X)"; else - ENSURE(0); // invalid size for integers + DEBUG_WARN_ERR(ERR::LOGIC); // invalid size for integers out(fmt, data, data); break; @@ -1100,11 +1100,11 @@ display_as_hex: fmt = L""; } else - ENSURE(0); // non-pointer btVoid or btNoType + DEBUG_WARN_ERR(ERR::LOGIC); // non-pointer btVoid or btNoType break; default: - ENSURE(0); // unknown type + DEBUG_WARN_ERR(ERR::LOGIC); // unknown type break; // unsupported complex types diff --git a/source/lib/sysdep/os/win/wfirmware.cpp b/source/lib/sysdep/os/win/wfirmware.cpp index b95a6b0036..e9e7a41de7 100644 --- a/source/lib/sysdep/os/win/wfirmware.cpp +++ b/source/lib/sysdep/os/win/wfirmware.cpp @@ -34,7 +34,7 @@ Table GetTable(Provider provider, TableId tableId) const size_t tableSize = pGetSystemFirmwareTable(provider, tableId, 0, 0); if(tableSize == 0) { - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return Table(); } diff --git a/source/lib/sysdep/os/win/whrt/counter.cpp b/source/lib/sysdep/os/win/whrt/counter.cpp index 619b90ed4d..eda7fb7152 100644 --- a/source/lib/sysdep/os/win/whrt/counter.cpp +++ b/source/lib/sysdep/os/win/whrt/counter.cpp @@ -94,7 +94,7 @@ ICounter* CreateCounter(size_t id) // size until after the alloc / placement new. if(!cpu_CAS(&isCounterAllocated, 0, 1)) - ENSURE(0); // static counter memory is already in use! + DEBUG_WARN_ERR(ERR::LOGIC); // static counter memory is already in use! static const size_t memSize = 200; static u8 mem[memSize]; diff --git a/source/lib/sysdep/os/win/wnuma.cpp b/source/lib/sysdep/os/win/wnuma.cpp index 7a532e1453..b9414f7c29 100644 --- a/source/lib/sysdep/os/win/wnuma.cpp +++ b/source/lib/sysdep/os/win/wnuma.cpp @@ -96,7 +96,7 @@ static void FillProcessorsNode() if(node) processorsNode[processor] = node-nodes; else - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); } } @@ -240,7 +240,7 @@ static void PopulateProcessorMaskFromApicId(u32 apicId, uintptr_t& processorMask } } - ENSURE(0); // APIC ID not found + DEBUG_WARN_ERR(ERR::LOGIC); // APIC ID not found } struct ProximityDomain diff --git a/source/lib/sysdep/os/win/wposix/waio.cpp b/source/lib/sysdep/os/win/wposix/waio.cpp index 26e352f5db..740fdf7402 100644 --- a/source/lib/sysdep/os/win/wposix/waio.cpp +++ b/source/lib/sysdep/os/win/wposix/waio.cpp @@ -567,7 +567,7 @@ int aio_suspend(const struct aiocb* const cbs[], int n, const struct timespec* t const Status ret = PollCompletionPort(hIOCP, milliseconds, bytesTransferred, key, ovl); if(ret != INFO::OK && ret != ERR::AGAIN) // failed { - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return -1; } diff --git a/source/lib/sysdep/os/win/wposix/wmman.cpp b/source/lib/sysdep/os/win/wposix/wmman.cpp index 63dcca5dde..dd709fc6b0 100644 --- a/source/lib/sysdep/os/win/wposix/wmman.cpp +++ b/source/lib/sysdep/os/win/wposix/wmman.cpp @@ -203,7 +203,7 @@ void* mmap(void* start, size_t len, int prot, int flags, int fd, off_t ofs) { if(len == 0) // POSIX says this must cause mmap to fail { - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); errno = EINVAL; return MAP_FAILED; } diff --git a/source/lib/sysdep/os/win/wposix/wpthread.cpp b/source/lib/sysdep/os/win/wposix/wpthread.cpp index 521efac4a1..2ce7c5a981 100644 --- a/source/lib/sysdep/os/win/wposix/wpthread.cpp +++ b/source/lib/sysdep/os/win/wposix/wpthread.cpp @@ -259,7 +259,7 @@ static CRITICAL_SECTION* CRITICAL_SECTION_from_pthread_mutex_t(pthread_mutex_t* { if(!m) { - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return 0; } return (CRITICAL_SECTION*)*m; diff --git a/source/lib/sysdep/os/win/wprintf.cpp b/source/lib/sysdep/os/win/wprintf.cpp index 847794065c..dce843c9e1 100644 --- a/source/lib/sysdep/os/win/wprintf.cpp +++ b/source/lib/sysdep/os/win/wprintf.cpp @@ -319,7 +319,7 @@ int sys_vswprintf(TCHAR* buffer, size_t count, const TCHAR* format, va_list argp if (chr == _T('I')) { - ENSURE(0); // MSVC-style \"%I64\" is not allowed! + DEBUG_WARN_ERR(ERR::LOGIC); // MSVC-style \"%I64\" is not allowed! } if (is_lengthmod(chr)) @@ -468,7 +468,7 @@ finished_reading: { if (varsizes[i] <= 0) { - ENSURE(0); // Invalid variable type somewhere - make sure all variable things are positional and defined + DEBUG_WARN_ERR(ERR::LOGIC); // Invalid variable type somewhere - make sure all variable things are positional and defined return -1; } @@ -491,7 +491,7 @@ finished_reading: FormatVariable* s = static_cast(chunk); if (s->position <= 0) { - ENSURE(0); // Invalid use of positional elements - make sure all variable things are positional and defined + DEBUG_WARN_ERR(ERR::LOGIC); // Invalid use of positional elements - make sure all variable things are positional and defined return -1; } newstack += std::string( stackitems[s->position-1].first, stackitems[s->position-1].second ); diff --git a/source/lib/sysdep/os/win/wprofiler.cpp b/source/lib/sysdep/os/win/wprofiler.cpp index e873bb4220..d5af0a9563 100644 --- a/source/lib/sysdep/os/win/wprofiler.cpp +++ b/source/lib/sysdep/os/win/wprofiler.cpp @@ -75,7 +75,7 @@ static uintptr_t get_target_pc() ret = SuspendThread(hThread); if(ret == (DWORD)-1) { - ENSURE(0); // get_target_pc: SuspendThread failed + DEBUG_WARN_ERR(ERR::LOGIC); // get_target_pc: SuspendThread failed return 0; } // note: we don't need to call more than once: this increments a DWORD @@ -136,7 +136,7 @@ static void* prof_thread_func(void* UNUSED(data)) break; // actual error: warn if(errno != ETIMEDOUT) - ENSURE(0); // wpcu prof_thread_func: sem_timedwait failed + DEBUG_WARN_ERR(ERR::LOGIC); // wpcu prof_thread_func: sem_timedwait failed uintptr_t pc = get_target_pc(); UNUSED2(pc); diff --git a/source/lib/sysdep/os/win/wsdl.cpp b/source/lib/sysdep/os/win/wsdl.cpp index 13c82d0da8..318d7bf5d0 100644 --- a/source/lib/sysdep/os/win/wsdl.cpp +++ b/source/lib/sysdep/os/win/wsdl.cpp @@ -239,7 +239,7 @@ static HWND wnd_CreateWindow(int w, int h) ATOM class_atom = RegisterClassW(&wc); if(!class_atom) { - ENSURE(0); // RegisterClassW failed + DEBUG_WARN_ERR(ERR::LOGIC); // RegisterClassW failed return 0; } @@ -609,7 +609,7 @@ static inline SDLKey SDLKeyFromVK(int vk) { if(!(0 <= vk && vk < 256)) { - ENSURE(0); // invalid vk + DEBUG_WARN_ERR(ERR::LOGIC); // invalid vk return SDLK_UNKNOWN; } return g_SDLKeyForVK[vk]; diff --git a/source/lib/sysdep/os/win/wversion.cpp b/source/lib/sysdep/os/win/wversion.cpp index faa7299137..747680a0af 100644 --- a/source/lib/sysdep/os/win/wversion.cpp +++ b/source/lib/sysdep/os/win/wversion.cpp @@ -94,7 +94,7 @@ static Status wversion_Init() RegCloseKey(hKey); } else - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return INFO::OK; } diff --git a/source/lib/tex/tex_codec.cpp b/source/lib/tex/tex_codec.cpp index c7e0a1e14e..38f09e67af 100644 --- a/source/lib/tex/tex_codec.cpp +++ b/source/lib/tex/tex_codec.cpp @@ -119,7 +119,7 @@ Status tex_codec_transform(Tex* t, size_t transforms) else if(err != INFO::TEX_CODEC_CANNOT_HANDLE) { ret = err; - ENSURE(0); // codec indicates error + DEBUG_WARN_ERR(ERR::LOGIC); // codec indicates error } } diff --git a/source/ps/Filesystem.cpp b/source/ps/Filesystem.cpp index 197b7fa462..f622cbf8b2 100644 --- a/source/ps/Filesystem.cpp +++ b/source/ps/Filesystem.cpp @@ -109,7 +109,7 @@ PSRETURN CVFSFile::Load(const PIVFS& vfs, const VfsPath& filename) // Load should never be called more than once, so complain if (m_Buffer) { - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); return PSRETURN_CVFSFile_AlreadyLoaded; } diff --git a/source/ps/XML/XMLWriter.cpp b/source/ps/XML/XMLWriter.cpp index efe9aaee54..2111aa017c 100644 --- a/source/ps/XML/XMLWriter.cpp +++ b/source/ps/XML/XMLWriter.cpp @@ -190,7 +190,7 @@ void XMLWriter_File::ElementEnd(const char* name, int type) m_Data += ">"; break; default: - ENSURE(0); + DEBUG_WARN_ERR(ERR::LOGIC); } }