Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Minecraft.Server/ServerProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include <cstdint>

namespace ServerRuntime
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand All @@ -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<int64_t>(parsed);
return true;
}

Expand Down Expand Up @@ -498,7 +498,7 @@ static std::string ReadNormalizedStringProperty(
static bool ReadNormalizedOptionalInt64Property(
std::unordered_map<std::string, std::string> *properties,
const char *key,
__int64 *outValue,
int64_t *outValue,
bool *shouldWrite)
{
std::string raw = TrimAscii((*properties)[key]);
Expand All @@ -515,7 +515,7 @@ static bool ReadNormalizedOptionalInt64Property(
return false;
}

__int64 parsed = 0;
int64_t parsed = 0;
if (!TryParseInt64(raw, &parsed))
{
(*properties)[key] = "";
Expand Down
Loading