diff options
author | Max Kellermann <max@musicpd.org> | 2020-10-08 20:25:54 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-10-08 20:26:39 +0200 |
commit | d64729065e845ed5341ead94623f4a25e3ab1f33 (patch) | |
tree | 74d8346ff10dd3a5014413d280cafa93dae59495 | |
parent | ab318200dbc6f594e3c6169c7ee8d8249d75dbe4 (diff) |
config/Parser: use std::size_t
-rw-r--r-- | src/config/Parser.cxx | 20 | ||||
-rw-r--r-- | src/config/Parser.hxx | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/config/Parser.cxx b/src/config/Parser.cxx index 89c3458c1..9bfb735c2 100644 --- a/src/config/Parser.cxx +++ b/src/config/Parser.cxx @@ -70,28 +70,28 @@ ParsePositive(const char *s) return (unsigned)value; } -template<size_t OPERAND> -static size_t -Multiply(size_t value) +template<std::size_t OPERAND> +static std::size_t +Multiply(std::size_t value) { - static constexpr size_t MAX_VALUE = SIZE_MAX / OPERAND; + static constexpr std::size_t MAX_VALUE = SIZE_MAX / OPERAND; if (value > MAX_VALUE) throw std::runtime_error("Value too large"); return value * OPERAND; } -size_t -ParseSize(const char *s, size_t default_factor) +std::size_t +ParseSize(const char *s, std::size_t default_factor) { char *endptr; - size_t value = strtoul(s, &endptr, 10); + std::size_t value = strtoul(s, &endptr, 10); if (endptr == s) throw std::runtime_error("Failed to parse integer"); - static constexpr size_t KILO = 1024; - static constexpr size_t MEGA = 1024 * KILO; - static constexpr size_t GIGA = 1024 * MEGA; + static constexpr std::size_t KILO = 1024; + static constexpr std::size_t MEGA = 1024 * KILO; + static constexpr std::size_t GIGA = 1024 * MEGA; s = StripLeft(endptr); diff --git a/src/config/Parser.hxx b/src/config/Parser.hxx index b448709cd..71feec4ca 100644 --- a/src/config/Parser.hxx +++ b/src/config/Parser.hxx @@ -51,7 +51,7 @@ ParsePositive(const char *s); * * Throws on error. */ -size_t -ParseSize(const char *s, size_t default_factor=1); +std::size_t +ParseSize(const char *s, std::size_t default_factor=1); #endif |