Use ToJSVal for JS_NewStringCopyZ to improve encapsulation and consistency and remove a snprintf call.

This was SVN commit r22536.
This commit is contained in:
elexis committed 2019-07-23 15:17:35 +00:00
1 parent cbcd1bbde0
commit 62f83eb673
2 files changed
+3 -7

No files matched your search

@@ -591,10 +591,7 @@ bool JSI_IGUIObject::toString(JSContext* cx, uint UNUSED(argc), JS::Value* vp)
if (!e)
return false;
char buffer[256];
snprintf(buffer, 256, "[GUIObject: %s]", e->GetName().c_str());
buffer[255] = 0;
rec.rval().setString(JS_NewStringCopyZ(cx, buffer));
ScriptInterface::ToJSVal(cx, rec.rval(), "[GUIObject: " + e->GetName() + "]");
return true;
}