# 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:
Ykkrosh
2006-11-07 21:03:13 +00:00
parent 75f2f9fd5f
commit a265a441fd
18 changed files with 254 additions and 64 deletions
+6 -4
View File
@@ -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;
}