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

Function convertUTF16toUTF8N

Engine/source/core/strings/unicode.cpp:197–219  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

195
196//-----------------------------------------------------------------------------
197U32 convertUTF16toUTF8N( const UTF16 *unistring, UTF8 *outbuffer, U32 len)
198{
199 AssertFatal(len >= 1, "Buffer for unicode conversion must be large enough to hold at least the null terminator.");
200 PROFILE_START(convertUTF16toUTF8);
201 U32 walked, nCodeunits, codeunitLen;
202 UTF32 middleman;
203
204 nCodeunits=0;
205 while( *unistring != '\0' && nCodeunits + 3 < len )
206 {
207 walked = 1;
208 middleman = oneUTF16toUTF32(unistring,&walked);
209 codeunitLen = oneUTF32toUTF8(middleman, &outbuffer[nCodeunits]);
210 unistring += walked;
211 nCodeunits += codeunitLen;
212 }
213
214 nCodeunits = getMin(nCodeunits,len - 1);
215 outbuffer[nCodeunits] = '\0';
216
217 PROFILE_END();
218 return nCodeunits;
219}
220
221U32 convertUTF16toUTF8DoubleNULL( const UTF16 *unistring, UTF8 *outbuffer, U32 len)
222{

Callers 8

getCopy8Method · 0.85
updateBuffer8Method · 0.85
convertUTF16toUTF8Function · 0.85
createUTF8stringFunction · 0.85
recurseDumpPathFunction · 0.85
recurseDumpDirectoriesFunction · 0.85
osGetTemporaryDirectoryFunction · 0.85
EnumFamCallBackFunction · 0.85

Calls 2

oneUTF16toUTF32Function · 0.85
oneUTF32toUTF8Function · 0.85

Tested by

no test coverage detected