mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-10-13 15:34:37 +00:00
# Fixed string handling for Windows/Linux compatibility.
* vsnprintf2: Made compatible between GCC and MSVC - it now always null-terminates the buffer, and returns -1 on overflow. Fixes #158. Added tests. * MeshManager: Use shared_ptr.expired() instead of checking for bad_weak_ptr exception. * Xeromyces: Added tests for GetXMBPath, because it does unusual things in sscanf which MSVC's /analyze complains about. * ConfigDB, ScriptGlue: Replaced some asserts with return-on-failure, to avoid invalid array accesses when continuing after the assert (as complained about by /analyze). * CStr: Removed "using namespace std". Added tests for handling of invalid UTF-8. This was SVN commit r4625.
This commit is contained in:
@@ -625,11 +625,12 @@ JSBool startXTimer(JSContext* cx, JSObject*, uint argc, jsval* argv, jsval* rval
|
||||
|
||||
JSU_REQUIRE_PARAMS(1);
|
||||
uint slot = ToPrimitive<uint>(argv[0]);
|
||||
debug_assert(slot < MAX_XTIMERS);
|
||||
if (slot >= MAX_XTIMERS)
|
||||
return JS_FALSE;
|
||||
|
||||
debug_assert(xstart_times[slot] == 0);
|
||||
xstart_times[slot] = xtimer_impl.get_timestamp();
|
||||
return( JS_TRUE );
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -637,13 +638,14 @@ JSBool stopXTimer(JSContext* cx, JSObject*, uint argc, jsval* argv, jsval* rval)
|
||||
{
|
||||
JSU_REQUIRE_PARAMS(1);
|
||||
uint slot = ToPrimitive<uint>(argv[0]);
|
||||
debug_assert(slot < MAX_XTIMERS);
|
||||
if (slot >= MAX_XTIMERS)
|
||||
return JS_FALSE;
|
||||
|
||||
debug_assert(xstart_times[slot] != 0);
|
||||
XTimerImpl::unit dt = xtimer_impl.get_timestamp() - xstart_times[slot] - xoverhead;
|
||||
xstart_times[slot] = 0;
|
||||
timer_bill_client(&xclients[slot], dt);
|
||||
return( JS_TRUE );
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user