mirror of
https://github.com/gbdev/rgbds.git
synced 2026-03-25 06:13:03 +00:00
Fix some truncation warnings
Amusingly, reported by MSVC only
This commit is contained in:
@@ -51,7 +51,7 @@ char const *printChar(int c);
|
||||
struct Uppercase {
|
||||
// FNV-1a hash of an uppercased string
|
||||
constexpr size_t operator()(std::string const &str) const {
|
||||
return std::accumulate(RANGE(str), 0x811C9DC5, [](size_t hash, char c) {
|
||||
return std::accumulate(RANGE(str), size_t(0x811C9DC5), [](size_t hash, char c) {
|
||||
return (hash ^ toUpper(c)) * 16777619;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,5 +76,5 @@ std::pair<WarningState, std::optional<uint32_t>> getInitialWarningState(std::str
|
||||
}
|
||||
}
|
||||
|
||||
return {state, param > UINT32_MAX ? UINT32_MAX : param};
|
||||
return {state, param > UINT32_MAX ? UINT32_MAX : uint32_t(param)};
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ static void warnExtraColors(
|
||||
// Parses the initial part of a string_view, advancing the "read index" as it does
|
||||
template<typename UintT> // Should be uint*_t
|
||||
static std::optional<UintT> parseDec(std::string const &str, size_t &n) {
|
||||
uintmax_t value = 0;
|
||||
UintT value = 0;
|
||||
auto result = std::from_chars(str.data() + n, str.data() + str.length(), value);
|
||||
if (static_cast<bool>(result.ec)) {
|
||||
return std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user