From d64729065e845ed5341ead94623f4a25e3ab1f33 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 8 Oct 2020 20:25:54 +0200 Subject: [PATCH] config/Parser: use std::size_t --- src/config/Parser.cxx | 20 ++++++++++---------- 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 -static size_t -Multiply(size_t value) +template +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