MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / convertUTF16toUTF8DoubleNULL

Function convertUTF16toUTF8DoubleNULL

Engine/source/core/strings/unicode.cpp:221–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221U32 convertUTF16toUTF8DoubleNULL( const UTF16 *unistring, UTF8 *outbuffer, U32 len)
222{
223 AssertFatal(len >= 1, "Buffer for unicode conversion must be large enough to hold at least the null terminator.");
224 PROFILE_START(convertUTF16toUTF8DoubleNULL);
225 U32 walked, nCodeunits, codeunitLen;
226 UTF32 middleman;
227
228 nCodeunits=0;
229 while( ! (*unistring == '\0' && *(unistring + 1) == '\0') && nCodeunits + 3 < len )
230 {
231 walked = 1;
232 middleman = oneUTF16toUTF32(unistring,&walked);
233 codeunitLen = oneUTF32toUTF8(middleman, &outbuffer[nCodeunits]);
234 unistring += walked;
235 nCodeunits += codeunitLen;
236 }
237
238 nCodeunits = getMin(nCodeunits,len - 1);
239 outbuffer[nCodeunits] = NULL;
240 outbuffer[nCodeunits+1] = NULL;
241
242 PROFILE_END();
243 return nCodeunits;
244}
245
246//-----------------------------------------------------------------------------
247// Functions that convert buffers of unicode code points

Callers

nothing calls this directly

Calls 2

oneUTF16toUTF32Function · 0.85
oneUTF32toUTF8Function · 0.85

Tested by

no test coverage detected