From e8e93756dfac3fae20599246a2e07c07dceacfd7 Mon Sep 17 00:00:00 2001 From: Dmitry Arkhipov Date: Mon, 25 Mar 2024 20:22:20 +0300 Subject: [PATCH] format_ functions return std::size_t --- include/boost/json/detail/format.hpp | 6 +++--- include/boost/json/detail/impl/format.ipp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/json/detail/format.hpp b/include/boost/json/detail/format.hpp index 4931b5027..05ee482c5 100644 --- a/include/boost/json/detail/format.hpp +++ b/include/boost/json/detail/format.hpp @@ -22,18 +22,18 @@ int constexpr max_number_chars = 5; // unsigned 16-bit exponent BOOST_JSON_DECL -unsigned +std::size_t format_uint64( char* dest, std::uint64_t value) noexcept; BOOST_JSON_DECL -unsigned +std::size_t format_int64( char* dest, int64_t i) noexcept; BOOST_JSON_DECL -unsigned +std::size_t format_double( char* dest, double d, bool allow_infinity_and_nan = false) noexcept; diff --git a/include/boost/json/detail/impl/format.ipp b/include/boost/json/detail/impl/format.ipp index 55039c4ab..c91229869 100644 --- a/include/boost/json/detail/impl/format.ipp +++ b/include/boost/json/detail/impl/format.ipp @@ -58,7 +58,7 @@ inline void format_digit( char * dest, unsigned v ) *dest = static_cast( v + '0' ); } -unsigned +std::size_t format_uint64( char* dest, std::uint64_t v) noexcept @@ -93,13 +93,13 @@ format_uint64( format_digit( p, static_cast(v) ); } - unsigned const n = static_cast( buffer + 24 - p ); + std::size_t const n = static_cast( buffer + 24 - p ); std::memcpy( dest, p, n ); return n; } -unsigned +std::size_t format_int64( char* dest, int64_t i) noexcept { @@ -112,7 +112,7 @@ format_int64( return 1 + format_uint64(dest, ui); } -unsigned +std::size_t format_double( char* dest, double d, bool allow_infinity_and_nan) noexcept {