1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-20 10:13:17 +00:00

1. Removed usage of wcstomb_s(), which doesn't support UTF8

2. Added WideToUTF8_stupid() helper for API calls that give you byte count instead of character count of a non-null terminated UTF16 string
3. Fixed a few more places to support UTF8
This commit is contained in:
Bryan Roe
2020-04-30 16:20:37 -07:00
parent cf91d6c709
commit 10f1f53912
5 changed files with 52 additions and 17 deletions

View File

@@ -171,12 +171,17 @@ static inline void ignore_result(uintptr_t result) { (void)result; }
#endif
#ifdef WIN32
char *ILibWideToUTF8(WCHAR* wstr, int len);
char *ILibWideToUTF8Ex(WCHAR* wstr, int wstrCharacterLen, char *buffer, int bufferLen);
#define ILibWideToUTF8(wstr, wstrCharacterLen) ILibWideToUTF8Ex(wstr, wstrCharacterLen, NULL, 0)
char *ILibWideToUTF8_stupidEx(WCHAR* wstr, int wstrBYTESIZE, char *buffer, int bufferLen);
#define ILibWideToUTF8_stupid(wstr, wstrBYTESIZE) ILibWideToUTF8_stupidEx(wstr, wstrBYTESIZE, NULL, 0)
WCHAR* ILibUTF8ToWideEx(char* str, int len, WCHAR* buffer, int bufferCharacterSize);
#define ILibUTF8ToWide(utf8string, len) ILibUTF8ToWideEx(utf8string, len, NULL, 0)
#else
#define ILibWideToUTF8(wstr, len) (wstr)
#define ILibWideToUTF8Ex(wstr, len, buffer, sz) (wstr)
#define ILibUTF8toWide(str, len) (str)
#define ILibUTF8ToWideEx(str, len, buffer, ccsz) (str)
#endif