Skip to content

Commit

Permalink
format_ functions return std::size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
grisumbras committed Mar 25, 2024
1 parent 59251c6 commit e8e9375
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions include/boost/json/detail/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions include/boost/json/detail/impl/format.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ inline void format_digit( char * dest, unsigned v )
*dest = static_cast<char>( v + '0' );
}

unsigned
std::size_t
format_uint64(
char* dest,
std::uint64_t v) noexcept
Expand Down Expand Up @@ -93,13 +93,13 @@ format_uint64(
format_digit( p, static_cast<unsigned>(v) );
}

unsigned const n = static_cast<unsigned>( buffer + 24 - p );
std::size_t const n = static_cast<std::size_t>( buffer + 24 - p );
std::memcpy( dest, p, n );

return n;
}

unsigned
std::size_t
format_int64(
char* dest, int64_t i) noexcept
{
Expand All @@ -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
{
Expand Down

0 comments on commit e8e9375

Please sign in to comment.