[winpr,crt] add InitializeConstWCharFromUtf8
This commit is contained in:
parent
30494d0c93
commit
6f723e9f4d
@ -390,6 +390,16 @@ extern "C"
|
||||
*/
|
||||
WINPR_API WCHAR* ConvertMszUtf8NToWCharAlloc(const char* str, size_t len, size_t* pSize);
|
||||
|
||||
/** \brief Helper function to initialize const WCHAR pointer from a Utf8 string
|
||||
*
|
||||
* \param str The Utf8 string to use for initialization
|
||||
* \param buffer The WCHAR buffer used to store the converted data
|
||||
* \param len The size of the buffer in number of WCHAR
|
||||
*
|
||||
* \return The WCHAR string (a pointer to buffer)
|
||||
*/
|
||||
WINPR_API const WCHAR* InitializeConstWCharFromUtf8(const char* str, WCHAR* buffer, size_t len);
|
||||
|
||||
#if defined(WITH_WINPR_DEPRECATED)
|
||||
WINPR_API WINPR_DEPRECATED_VAR("Use ConvertUtf8ToWChar functions instead",
|
||||
int ConvertToUnicode(UINT CodePage, DWORD dwFlags,
|
||||
|
@ -833,3 +833,11 @@ char* strndup(const char* src, size_t n)
|
||||
return dst;
|
||||
}
|
||||
#endif
|
||||
|
||||
const WCHAR* InitializeConstWCharFromUtf8(const char* str, WCHAR* buffer, size_t len)
|
||||
{
|
||||
WINPR_ASSERT(str);
|
||||
WINPR_ASSERT(buffer || (len == 0));
|
||||
ConvertUtf8ToWChar(str, buffer, len);
|
||||
return buffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user