AppleWin/source/linux/windows/winnls.cpp
Andrea Odetti ffddc18fe6 Dummy implementation of MultiByteToWideChar & WideCharToMultiByte.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
2020-10-06 20:57:18 +01:00

26 lines
928 B
C++

#include "linux/windows/winnls.h"
#include <cstdlib>
#include <cstring>
// massive hack until I understand how it works!
INT WINAPI MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, INT cbMultiByte, LPWSTR lpWideCharStr, INT cchWideChar)
{
// int res = mbstowcs(lpWideCharStr, lpMultiByteStr, strlen(lpMultiByteStr));
if (lpWideCharStr)
{
strcpy(reinterpret_cast<char *>(lpWideCharStr), lpMultiByteStr);
}
return strlen(lpMultiByteStr) + 1; // add NULL char at end
}
INT WINAPI WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, INT cchWideChar, LPSTR lpMultiByteStr, INT cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar)
{
if (lpMultiByteStr)
{
strcpy(lpMultiByteStr, reinterpret_cast<const char *>(lpWideCharStr));
}
// size_t res = wcstombs(lpMultiByteStr, lpWideCharStr, cbMultiByte);
return strlen((const char *)lpWideCharStr) + 1;
}