From 1c422390e76aee787feb62df939436ccdf5cbdd8 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 1 May 2019 10:17:01 +0800 Subject: [PATCH] Cleaning up unicode conversion --- code/nel/include/nel/net/service.h | 10 ++++++++++ code/nel/src/3d/driver/direct3d/driver_direct3d.cpp | 2 +- code/ryzom/client/src/login_xdelta.cpp | 2 +- code/ryzom/client/src/permanent_ban.cpp | 6 +++--- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/code/nel/include/nel/net/service.h b/code/nel/include/nel/net/service.h index bdabb48a1..8b79bdc55 100644 --- a/code/nel/include/nel/net/service.h +++ b/code/nel/include/nel/net/service.h @@ -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 diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 7a4618683..43d33d081 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -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: diff --git a/code/ryzom/client/src/login_xdelta.cpp b/code/ryzom/client/src/login_xdelta.cpp index c70304dc2..8cb8beaa1 100644 --- a/code/ryzom/client/src/login_xdelta.cpp +++ b/code/ryzom/client/src/login_xdelta.cpp @@ -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 diff --git a/code/ryzom/client/src/permanent_ban.cpp b/code/ryzom/client/src/permanent_ban.cpp index dab097c79..5c9cbbb1f 100644 --- a/code/ryzom/client/src/permanent_ban.cpp +++ b/code/ryzom/client/src/permanent_ban.cpp @@ -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) {