MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / ToUTF32Native

Function ToUTF32Native

xmpsdk/src/UnicodeConversions.cpp:342–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340// =================================================================================================
341
342extern void ToUTF32Native ( const UTF8Unit * utf8In, size_t utf8Len, std::string * utf32Str )
343{
344 enum { kBufferSize = 4*1024 };
345 UTF32Unit u32Buffer[kBufferSize]; // 16K bytes
346 size_t readCount, writeCount;
347
348 utf32Str->erase();
349 utf32Str->reserve ( 4*utf8Len ); // As good a guess as any.
350
351 while ( utf8Len > 0 ) {
352 UTF8_to_UTF32Nat ( utf8In, utf8Len, u32Buffer, kBufferSize, &readCount, &writeCount );
353 if ( writeCount == 0 ) UC_Throw ( "Incomplete Unicode at end of string", kXMPErr_BadXML );
354 utf32Str->append ( (const char *)u32Buffer, writeCount*4 );
355 utf8In += readCount;
356 utf8Len -= readCount;
357 }
358
359} // ToUTF32Native
360
361// =================================================================================================
362

Callers

nothing calls this directly

Calls 3

UTF8_to_UTF32NatFunction · 0.85
reserveMethod · 0.80
eraseMethod · 0.45

Tested by

no test coverage detected