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

Method fromString

src/common/isc_file.cpp:1725–1752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1723 {}
1724
1725 bool fromString(UINT codePage, const AbstractString& str)
1726 {
1727 if (str.isEmpty())
1728 {
1729 m_len16 = 0;
1730 return true;
1731 }
1732
1733 int bufSize = m_utf16.getCapacity();
1734 WCHAR* utf16Buffer = m_utf16.getBuffer(bufSize);
1735 m_len16 = MultiByteToWideChar(codePage, 0, str.c_str(), str.length(), utf16Buffer, bufSize);
1736
1737 if (m_len16 == 0)
1738 {
1739 DWORD err = GetLastError();
1740 if (err != ERROR_INSUFFICIENT_BUFFER)
1741 return false;
1742
1743 bufSize = MultiByteToWideChar(codePage, 0, str.c_str(), str.length(), NULL, 0);
1744 if (bufSize == 0)
1745 return false;
1746
1747 utf16Buffer = m_utf16.getBuffer(bufSize);
1748 m_len16 = MultiByteToWideChar(codePage, 0, str.c_str(), str.length(), utf16Buffer, bufSize);
1749 }
1750
1751 return (m_len16 != 0);
1752 }
1753
1754 bool toString(UINT codePage, AbstractString& str)
1755 {

Callers 2

ISC_systemToUtf8Function · 0.45
ISC_utf8ToSystemFunction · 0.45

Calls 5

isEmptyMethod · 0.45
getCapacityMethod · 0.45
getBufferMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected