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

Function FromUTF32Native

xmpsdk/src/UnicodeConversions.cpp:432–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430// =================================================================================================
431
432extern void FromUTF32Native ( const UTF32Unit * utf32In, size_t utf32Len, std::string * utf8Str )
433{
434 enum { kBufferSize = 16*1024 };
435 UTF8Unit u8Buffer[kBufferSize];
436 size_t readCount, writeCount;
437
438 utf8Str->erase();
439 utf8Str->reserve ( 2*utf32Len ); // As good a guess as any.
440
441 while ( utf32Len > 0 ) {
442 UTF32Nat_to_UTF8 ( utf32In, utf32Len, u8Buffer, kBufferSize, &readCount, &writeCount );
443 if ( writeCount == 0 ) UC_Throw ( "Incomplete Unicode at end of string", kXMPErr_BadXML );
444 utf8Str->append ( (const char *)u8Buffer, writeCount );
445 utf32In += readCount;
446 utf32Len -= readCount;
447 }
448
449} // FromUTF32Native
450
451// =================================================================================================
452

Callers

nothing calls this directly

Calls 3

UTF32Nat_to_UTF8Function · 0.85
reserveMethod · 0.80
eraseMethod · 0.45

Tested by

no test coverage detected