aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/Configuration/Config.cpp1
-rw-r--r--src/common/Debugging/Windows/WheatyExceptionReport.h2
-rw-r--r--src/common/Logging/Log.cpp4
-rw-r--r--src/common/Platform/Windows/ServiceWin32.cpp2
-rw-r--r--src/common/PrecompiledHeaders/commonPCH.h23
-rw-r--r--src/common/Time/Timezone.cpp25
-rw-r--r--src/common/Utilities/StringConvert.h3
-rw-r--r--src/common/Utilities/StringFormat.h2
8 files changed, 26 insertions, 36 deletions
diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp
index a0672d56ff6..946ff676e6f 100644
--- a/src/common/Configuration/Config.cpp
+++ b/src/common/Configuration/Config.cpp
@@ -19,6 +19,7 @@
#include "Common.h"
#include "Log.h"
#include "StringConvert.h"
+#include "Util.h"
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/property_tree/ini_parser.hpp>
diff --git a/src/common/Debugging/Windows/WheatyExceptionReport.h b/src/common/Debugging/Windows/WheatyExceptionReport.h
index e24492bb5e2..27eb5753b27 100644
--- a/src/common/Debugging/Windows/WheatyExceptionReport.h
+++ b/src/common/Debugging/Windows/WheatyExceptionReport.h
@@ -5,7 +5,7 @@
#include "Define.h"
#include "Optional.h"
-#include <windows.h>
+#include <Windows.h>
#include <winnt.h>
#include <winternl.h>
#include <dbghelp.h>
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp
index b64aec29866..643f0c8483c 100644
--- a/src/common/Logging/Log.cpp
+++ b/src/common/Logging/Log.cpp
@@ -19,7 +19,6 @@
#include "AppenderConsole.h"
#include "AppenderFile.h"
#include "Config.h"
-#include "Duration.h"
#include "Errors.h"
#include "LogMessage.h"
#include "LogOperation.h"
@@ -263,8 +262,7 @@ Logger const* Log::GetLoggerByType(std::string_view type) const
std::string Log::GetTimestampStr()
{
- time_t tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
- return TimeToTimestampStr(tt);
+ return TimeToTimestampStr(time(nullptr));
}
bool Log::SetLogLevel(std::string const& name, int32 newLeveli, bool isLogger /* = true */)
diff --git a/src/common/Platform/Windows/ServiceWin32.cpp b/src/common/Platform/Windows/ServiceWin32.cpp
index 80914d2a415..f536d4b6e4a 100644
--- a/src/common/Platform/Windows/ServiceWin32.cpp
+++ b/src/common/Platform/Windows/ServiceWin32.cpp
@@ -20,7 +20,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include <windows.h>
+#include <Windows.h>
#include <winsvc.h>
namespace
diff --git a/src/common/PrecompiledHeaders/commonPCH.h b/src/common/PrecompiledHeaders/commonPCH.h
index dfd7e51f82f..ba41f2657bf 100644
--- a/src/common/PrecompiledHeaders/commonPCH.h
+++ b/src/common/PrecompiledHeaders/commonPCH.h
@@ -15,28 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "BoundingIntervalHierarchy.h"
#include "Common.h"
-#include "Config.h"
#include "Define.h"
+#include "Duration.h"
#include "Errors.h"
-#include "GitRevision.h"
#include "Log.h"
-#include "LogMessage.h"
-#include "MapTree.h"
-#include "ModelInstance.h"
-#include "StringConvert.h"
-#include "Util.h"
-#include "VMapDefinitions.h"
#include "WorldModel.h"
-#include <G3D/Ray.h>
+#include <boost/filesystem/directory.hpp>
#include <G3D/Vector4.h>
+#include <openssl/evp.h>
#include <algorithm>
-#include <cstring>
#include <memory>
-#include <mutex>
-#include <set>
-#include <sstream>
-#include <string>
-#include <unordered_map>
#include <vector>
+
+#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
+#include <Windows.h>
+#endif
diff --git a/src/common/Time/Timezone.cpp b/src/common/Time/Timezone.cpp
index 5cd80d03232..6c9e58e0c93 100644
--- a/src/common/Time/Timezone.cpp
+++ b/src/common/Time/Timezone.cpp
@@ -17,13 +17,19 @@
#include "Timezone.h"
#include "Hash.h"
-#include "Locales.h"
#include "MapUtils.h"
+#include "Tuples.h"
+#include <algorithm>
+#include <unordered_map>
+
+#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
#include "StringConvert.h"
+#else
+#include "Locales.h"
+#include "Util.h"
#include <boost/locale/date_time_facet.hpp>
-#include <chrono>
#include <memory>
-#include <unordered_map>
+#endif
namespace
{
@@ -163,20 +169,13 @@ std::string GetSystemZoneName()
std::string_view FindClosestClientSupportedTimezone(std::string_view currentTimezone, Minutes currentTimezoneOffset)
{
// try exact match
- auto itr = std::find_if(_clientSupportedTimezones.begin(), _clientSupportedTimezones.end(), [currentTimezone](ClientSupportedTimezone const& tz)
- {
- return tz.second == currentTimezone;
- });
+ auto itr = std::ranges::find(_clientSupportedTimezones, currentTimezone, Trinity::TupleElement<1>);
if (itr != _clientSupportedTimezones.end())
return itr->second;
// try closest offset
- itr = std::min_element(_clientSupportedTimezones.begin(), _clientSupportedTimezones.end(), [currentTimezoneOffset](ClientSupportedTimezone const& left, ClientSupportedTimezone const& right)
- {
- Minutes leftDiff = left.first - currentTimezoneOffset;
- Minutes rightDiff = right.first - currentTimezoneOffset;
- return std::abs(leftDiff.count()) < std::abs(rightDiff.count());
- });
+ itr = std::ranges::min_element(_clientSupportedTimezones, std::ranges::less(),
+ [currentTimezoneOffset](ClientSupportedTimezone const& ctz) { return std::chrono::abs(ctz.first - currentTimezoneOffset); });
return itr->second;
}
diff --git a/src/common/Utilities/StringConvert.h b/src/common/Utilities/StringConvert.h
index 0d11dbb6667..ebe33cee721 100644
--- a/src/common/Utilities/StringConvert.h
+++ b/src/common/Utilities/StringConvert.h
@@ -22,12 +22,13 @@
#include "Errors.h"
#include "Optional.h"
#include "Types.h"
-#include "Util.h"
#include <charconv>
#include <string>
#include <string_view>
#include <type_traits>
+TC_COMMON_API bool StringEqualI(std::string_view str1, std::string_view str2);
+
namespace Trinity::Impl::StringConvertImpl
{
template <typename T, typename = void> struct For
diff --git a/src/common/Utilities/StringFormat.h b/src/common/Utilities/StringFormat.h
index 2016eab0ba3..f7f2b7c300b 100644
--- a/src/common/Utilities/StringFormat.h
+++ b/src/common/Utilities/StringFormat.h
@@ -125,6 +125,6 @@ struct fmt::formatter<Optional<T>, Char> : formatter<T, Char>
// allow implicit enum to int conversions for formatting
template <typename E, std::enable_if_t<std::is_enum_v<E>, std::nullptr_t> = nullptr>
-auto format_as(E e) { return std::underlying_type_t<E>(e); }
+inline constexpr auto format_as(E e) { return static_cast<std::underlying_type_t<E>>(e); }
#endif