MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / createUTF8string

Function createUTF8string

Engine/source/core/strings/unicode.cpp:271–290  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

269
270//-----------------------------------------------------------------------------
271UTF8* createUTF8string( const UTF16* unistring)
272{
273 PROFILE_SCOPE(createUTF8string);
274
275 // allocate plenty of memory.
276 U32 nCodeunits, len = dStrlen(unistring) * 3 + 1;
277 FrameTemp<UTF8> buf(len);
278
279 // perform conversion
280 nCodeunits = convertUTF16toUTF8N( unistring, buf, len);
281
282 // add 1 for the NULL terminator the converter promises it included.
283 nCodeunits++;
284
285 // allocate the return buffer, copy over, and return it.
286 UTF8 *ret = new UTF8[nCodeunits];
287 dMemcpy(ret, buf, nCodeunits * sizeof(UTF8));
288
289 return ret;
290}
291
292//-----------------------------------------------------------------------------
293

Callers 5

createCopy8Method · 0.85
StringMethod · 0.85
setTextMethod · 0.85
getCurrentDirectoryMethod · 0.85
getExecutableInfoFunction · 0.85

Calls 3

convertUTF16toUTF8NFunction · 0.85
dStrlenFunction · 0.70
dMemcpyFunction · 0.50

Tested by

no test coverage detected