From f19d41198c6ce76eb05d72df022fee67d0945c8e Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Mon, 8 Jan 2024 14:42:03 +0100 Subject: [PATCH] Core: Fixed problem with Win32 GetTimeFormat name clash --- uppsrc/Core/TimeDate.cpp | 10 ++++++++++ uppsrc/Core/TimeDate.h | 10 ++++++++++ uppsrc/GLDraw/Text.cpp | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/uppsrc/Core/TimeDate.cpp b/uppsrc/Core/TimeDate.cpp index 7c5a7e2d4..82667d00e 100644 --- a/uppsrc/Core/TimeDate.cpp +++ b/uppsrc/Core/TimeDate.cpp @@ -78,6 +78,16 @@ void SetDateFormat(const char *fmt) strncpy(s_date_format_main, fmt, 63); } +#ifdef PLATFORM_WIN32 // resolve nameclash with win32 API + #ifdef GetDateFormatA + #undef GetDateFormatA + #endif + + #ifdef GetDateFormatW + #undef GetDateFormatW + #endif +#endif + String GetDateFormat() { return *s_date_format_thread ? s_date_format_thread : s_date_format_main; diff --git a/uppsrc/Core/TimeDate.h b/uppsrc/Core/TimeDate.h index f147e1cb1..989bedced 100644 --- a/uppsrc/Core/TimeDate.h +++ b/uppsrc/Core/TimeDate.h @@ -80,6 +80,16 @@ void SetDateFormat(const char *fmt); void SetDateScan(const char *scan); void SetDateFilter(const char *seps); +#ifdef PLATFORM_WIN32 // resolve nameclash with win32 API + #ifdef GetDateFormatA + #undef GetDateFormatA + #endif + + #ifdef GetDateFormatW + #undef GetDateFormatW + #endif +#endif + String GetDateFormat(); const char *StrToDate(const char *fmt, Date& d, const char *s, Date def = Null); diff --git a/uppsrc/GLDraw/Text.cpp b/uppsrc/GLDraw/Text.cpp index b90a6cfbe..3cc4b8e3e 100644 --- a/uppsrc/GLDraw/Text.cpp +++ b/uppsrc/GLDraw/Text.cpp @@ -27,7 +27,7 @@ struct sGlyphTextureMaker : LRUCache::Maker { Color color; virtual String Key() const { - StringBuffer h; + String h; RawCat(h, chr); RawCat(h, font); RawCat(h, angle);