From 7bcfedf84a724da0c0a1c784cd542d43c094907c Mon Sep 17 00:00:00 2001 From: Syed Maroof Hussain Date: Thu, 16 Apr 2026 16:16:33 -0400 Subject: [PATCH] replaced msvc __int64 to int64_t, updated Int64ToString and TryParseInt64 to use int64_t instead --- Minecraft.Server/ServerProperties.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Minecraft.Server/ServerProperties.cpp b/Minecraft.Server/ServerProperties.cpp index ddc75a4a5..dc6355891 100644 --- a/Minecraft.Server/ServerProperties.cpp +++ b/Minecraft.Server/ServerProperties.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace ServerRuntime { @@ -95,11 +96,9 @@ static std::string IntToString(int value) return std::string(buffer); } -static std::string Int64ToString(__int64 value) +static std::string Int64ToString(int64_t value) { - char buffer[64] = {}; - _i64toa_s(value, buffer, sizeof(buffer), 10); - return std::string(buffer); + return std::to_string(value); } static int ClampInt(int value, int minValue, int maxValue) @@ -160,7 +159,7 @@ static bool TryParseInt(const std::string &value, int *outValue) return true; } -static bool TryParseInt64(const std::string &value, __int64 *outValue) +static bool TryParseInt64(const std::string &value, int64_t *outValue) { if (outValue == NULL) { @@ -174,13 +173,14 @@ static bool TryParseInt64(const std::string &value, __int64 *outValue) } char *end = NULL; - __int64 parsed = _strtoi64(trimmed.c_str(), &end, 10); + long long parsed = strtoll(trimmed.c_str(), &end, 10); + if (end == trimmed.c_str() || *end != 0) { return false; } - *outValue = parsed; + *outValue = static_cast(parsed); return true; } @@ -498,7 +498,7 @@ static std::string ReadNormalizedStringProperty( static bool ReadNormalizedOptionalInt64Property( std::unordered_map *properties, const char *key, - __int64 *outValue, + int64_t *outValue, bool *shouldWrite) { std::string raw = TrimAscii((*properties)[key]); @@ -515,7 +515,7 @@ static bool ReadNormalizedOptionalInt64Property( return false; } - __int64 parsed = 0; + int64_t parsed = 0; if (!TryParseInt64(raw, &parsed)) { (*properties)[key] = "";