mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 20:31:58 +00:00
Linux/GCC Compat(tm)
This was SVN commit r1284.
This commit is contained in:
@@ -327,6 +327,17 @@ CStrW ScriptingHost::ValueToUCString( const jsval value )
|
||||
return CStrW(std::wstring(strptr, strptr+length));
|
||||
}
|
||||
|
||||
utf16string ScriptingHost::ValueToUTF16( const jsval value )
|
||||
{
|
||||
JSString* string = JS_ValueToString(m_Context, value);
|
||||
if (string == NULL)
|
||||
throw PSERROR_Scripting_ConversionFailed();
|
||||
|
||||
jschar *strptr=JS_GetStringChars(string);
|
||||
size_t length=JS_GetStringLength(string);
|
||||
return utf16string(strptr, strptr+length);
|
||||
}
|
||||
|
||||
jsval ScriptingHost::UCStringToValue(const utf16string &str)
|
||||
{
|
||||
return STRING_TO_JSVAL(JS_NewUCStringCopyZ(m_Context, str.c_str()));
|
||||
|
||||
Reference in New Issue
Block a user