MCPcopy Create free account
hub / github.com/ablab/spades / UTF8ToUTF16

Method UTF8ToUTF16

ext/src/cppformat/format.cc:428–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426#ifdef _WIN32
427
428fmt::internal::UTF8ToUTF16::UTF8ToUTF16(fmt::StringRef s) {
429 int length = MultiByteToWideChar(
430 CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, 0, 0);
431 static const char ERROR[] = "cannot convert string from UTF-8 to UTF-16";
432 if (length == 0)
433 FMT_THROW(WindowsError(GetLastError(), ERROR));
434 buffer_.resize(length);
435 length = MultiByteToWideChar(
436 CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, &buffer_[0], length);
437 if (length == 0)
438 FMT_THROW(WindowsError(GetLastError(), ERROR));
439}
440
441fmt::internal::UTF16ToUTF8::UTF16ToUTF8(fmt::WStringRef s) {
442 if (int error_code = convert(s)) {

Callers

nothing calls this directly

Calls 3

WindowsErrorClass · 0.85
c_strMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected