Commit 53111853 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Define the maximum number of digits in uint64_t

parent 2fc2a27a
......@@ -233,7 +233,7 @@ template <typename OutputIterator, typename T>
std::pair<OutputIterator, OutputIterator> copy(T n, OutputIterator d_first,
OutputIterator d_last) {
if (static_cast<size_t>(std::distance(d_first, d_last)) <
str_size("18446744073709551615")) {
NGHTTP2_MAX_UINT64_DIGITS) {
return std::make_pair(d_last, d_last);
}
return std::make_pair(util::utos(d_first, n), d_last);
......
......@@ -70,6 +70,8 @@ constexpr auto NGHTTP2_H2_14 = StringRef::from_lit("h2-14");
constexpr auto NGHTTP2_H1_1_ALPN = StringRef::from_lit("\x8http/1.1");
constexpr auto NGHTTP2_H1_1 = StringRef::from_lit("http/1.1");
constexpr size_t NGHTTP2_MAX_UINT64_DIGITS = str_size("18446744073709551615");
namespace util {
inline bool is_alpha(const char c) {
......@@ -382,7 +384,7 @@ template <typename T, typename OutputIt> OutputIt utos(OutputIt dst, T n) {
template <typename T>
StringRef make_string_ref_uint(BlockAllocator &balloc, T n) {
auto iov = make_byte_ref(balloc, str_size("18446744073709551615") + 1);
auto iov = make_byte_ref(balloc, NGHTTP2_MAX_UINT64_DIGITS + 1);
auto p = iov.base;
p = util::utos(p, n);
*p = '\0';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment