MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / convertUtf16ToAscii

Method convertUtf16ToAscii

src/common/IntlUtil.cpp:251–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249
250
251string IntlUtil::convertUtf16ToAscii(const string& utf16, bool* error)
252{
253 fb_assert(utf16.length() % sizeof(USHORT) == 0);
254
255 string s;
256 const USHORT* end = (const USHORT*) (utf16.c_str() + utf16.length());
257
258 for (const USHORT* p = (const USHORT*) utf16.c_str(); p < end; ++p)
259 {
260 if (*p <= 0xFF)
261 s.append(1, (UCHAR) *p);
262 else
263 {
264 *error = true;
265 return "";
266 }
267 }
268
269 *error = false;
270
271 return s;
272}
273
274
275ULONG IntlUtil::cvtAsciiToUtf16(csconvert* obj, ULONG nSrc, const UCHAR* pSrc,

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.45
c_strMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected