Cleaning up unicode conversion

This commit is contained in:
kaetemi 2019-05-01 10:17:01 +08:00
parent 44124e5853
commit 1c422390e7
4 changed files with 15 additions and 5 deletions

View file

@ -54,7 +54,17 @@ struct HINSTANCE__;
typedef struct HINSTANCE__ *HINSTANCE;
typedef char CHAR;
typedef wchar_t WCHAR;
typedef CHAR *LPSTR;
typedef WCHAR *LPWSTR;
#if defined(UNICODE) || defined(_UNICODE)
typedef LPWSTR LPTSTR;
#else
typedef LPSTR LPTSTR;
#endif
#endif
namespace NLNET

View file

@ -1810,7 +1810,7 @@ emptyProc CDriverD3D::getWindowProc()
IDriver::TMessageBoxId CDriverD3D::systemMessageBox (const char* message, const char* title, TMessageBoxType type, TMessageBoxIcon icon)
{
switch (::MessageBoxW (_HWnd, utf8ToWide(message), utf8ToWide(title), ((type==retryCancelType)?MB_RETRYCANCEL:
switch (::MessageBoxW(_HWnd, nlUtf8ToWide(message), nlUtf8ToWide(title), ((type == retryCancelType) ? MB_RETRYCANCEL :
(type==yesNoCancelType)?MB_YESNOCANCEL:
(type==okCancelType)?MB_OKCANCEL:
(type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE:

View file

@ -95,7 +95,7 @@ bool CXDPFileReader::init(const std::string &sFilename, sint32 nLowerBound, sint
{
// First open the file with a normal function
#ifdef NL_OS_WINDOWS
int fd = _wopen(utf8ToWide(sFilename), _O_BINARY | _O_RDONLY);
int fd = _wopen(nlUtf8ToWide(sFilename), _O_BINARY | _O_RDONLY);
#else
int fd = open(sFilename.c_str(), O_RDONLY);
#endif

View file

@ -87,9 +87,9 @@ static void setPermanentBanFileMarker(const std::string &path, bool on)
{
// simply touch a file
COFile f(path);
#ifdef NL_OS_WINDOWS
SetFileAttributesW(utf8ToWide(path), FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM);
#endif
#ifdef NL_OS_WINDOWS
SetFileAttributesW(nlUtf8ToWide(path), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
#endif
}
catch(const EStream &e)
{