From 2156ebaef5fda422236cc2ec53a1a79ba7a7fa7e Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 28 Apr 2019 03:49:37 +0800 Subject: [PATCH] Build fixes for VS2008 --- code/nel/include/nel/misc/common.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index d5d59b130..4a1cafc23 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -313,7 +313,17 @@ inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp( #define utf8ToTStr(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) #else #define tStrToUtf8(str) (std::string((LPCSTR)str)) -#define utf8ToTStr(str) (str.c_str()) +inline const char *nlutf8ToTStr(const char *str) { return str; } +inline const char *nlutf8ToTStr(const std::string &str) { return str.c_str(); } +#define utf8ToTStr(str) NLMISC::nlutf8ToTStr(str) +#endif + +#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */ +float nlroundf(float x) +{ + return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f); +} +#define roundf(x) NLMISC::nlroundf(x) #endif // wrapper for fopen to be able to open files with an UTF-8 filename