Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion include/boost/json/basic_parser_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ const char*
basic_parser<Handler>::
fail(const char* p) noexcept
{
BOOST_ASSERT( p != sentinel() );
end_ = p;
return sentinel();
}
Expand All @@ -302,6 +303,7 @@ fail(
error ev,
source_location const* loc) noexcept
{
BOOST_ASSERT( p != sentinel() );
end_ = p;
ec_.assign(ev, loc);
return sentinel();
Expand All @@ -314,7 +316,8 @@ maybe_suspend(
const char* p,
state st)
{
end_ = p;
if( p != sentinel() )
end_ = p;
if(BOOST_JSON_LIKELY(more_))
{
// suspend
Expand All @@ -332,6 +335,7 @@ maybe_suspend(
state st,
std::size_t n)
{
BOOST_ASSERT( p != sentinel() );
end_ = p;
if(BOOST_JSON_LIKELY(more_))
{
Expand All @@ -351,6 +355,7 @@ maybe_suspend(
state st,
const number& num)
{
BOOST_ASSERT( p != sentinel() );
end_ = p;
if(BOOST_JSON_LIKELY(more_))
{
Expand All @@ -369,6 +374,7 @@ suspend(
const char* p,
state st)
{
BOOST_ASSERT( p != sentinel() );
end_ = p;
// suspend
reserve();
Expand All @@ -384,6 +390,7 @@ suspend(
state st,
const number& num)
{
BOOST_ASSERT( p != sentinel() );
end_ = p;
// suspend
num_ = num;
Expand Down
6 changes: 4 additions & 2 deletions include/boost/json/impl/value_stack.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ grow_one()
reinterpret_cast<value*>(
sp_->allocate(
new_cap * sizeof(value)));
std::size_t const cur_size = top_ - begin_;
if(begin_)
{
std::memcpy(
Expand All @@ -140,7 +141,7 @@ grow_one()
capacity * sizeof(value));
}
// book-keeping
top_ = begin + (top_ - begin_);
top_ = begin + cur_size;
end_ = begin + new_cap;
begin_ = begin;
}
Expand Down Expand Up @@ -170,6 +171,7 @@ grow(std::size_t nchars)
reinterpret_cast<value*>(
sp_->allocate(
new_cap * sizeof(value)));
std::size_t const cur_size = top_ - begin_;
if(begin_)
{
std::size_t amount =
Expand All @@ -185,7 +187,7 @@ grow(std::size_t nchars)
capacity * sizeof(value));
}
// book-keeping
top_ = begin + (top_ - begin_);
top_ = begin + cur_size;
end_ = begin + new_cap;
begin_ = begin;
}
Expand Down
9 changes: 7 additions & 2 deletions test/monotonic_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ class monotonic_resource_test
std::size_t buffer_size)
{
using ptr_t = const volatile unsigned char*;
return reinterpret_cast<ptr_t>(ptr) >= reinterpret_cast<ptr_t>(buffer) &&
reinterpret_cast<ptr_t>(ptr) < reinterpret_cast<ptr_t>(buffer) + buffer_size;
return
std::greater_equal<ptr_t>()(
reinterpret_cast<ptr_t>(ptr),
reinterpret_cast<ptr_t>(buffer)) &&
std::less<ptr_t>()(
reinterpret_cast<ptr_t>(ptr),
reinterpret_cast<ptr_t>(buffer) + buffer_size);
}

bool
Expand Down
2 changes: 1 addition & 1 deletion test/value_from.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class value_from_test
BOOST_TEST(serialize(c) == serialize(b));
}
{
std::array<int, 1000> a;
std::array<int, 500> a;
a.fill(0);

value b;
Expand Down
2 changes: 1 addition & 1 deletion test/value_to.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class value_to_test
ctx... );

{
std::array<int, 1000> arr;
std::array<int, 500> arr;
arr.fill(0);
BOOST_TEST_CONV( arr, ctx... );
}
Expand Down