Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centos7 build fix #519

Merged
merged 4 commits into from
Jun 4, 2024
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
12 changes: 6 additions & 6 deletions include/jsoncons/json_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ namespace jsoncons {
members_.reserve(count);
for (auto s = first; s != last; ++s)
{
members_.emplace_back(key_type(s->first,get_allocator()), s->second);
members_.emplace_back(key_type(s->first.c_str(), s->first.size(), get_allocator()), s->second);
}
std::stable_sort(members_.begin(), members_.end(),
[](const key_value_type& a, const key_value_type& b) -> bool {return a.key().compare(b.key()) < 0;});
Expand Down Expand Up @@ -534,13 +534,13 @@ namespace jsoncons {
auto last = first + count;

std::sort(first, last, compare);
members_.emplace_back(key_type(first->name,get_allocator()), std::move(first->value));
members_.emplace_back(key_type(first->name.c_str(), first->name.size(), get_allocator()), std::move(first->value));
auto prev_it = first;
for (auto it = first+1; it != last; ++it)
{
if (it->name != prev_it->name)
{
members_.emplace_back(key_type(it->name,get_allocator()), std::move(it->value));
members_.emplace_back(key_type(it->name.c_str(), it->name.size(), get_allocator()), std::move(it->value));
}
++prev_it;
}
Expand All @@ -552,7 +552,7 @@ namespace jsoncons {
{
for (auto s = first; s != last; ++s)
{
members_.emplace_back(key_type(s->first,get_allocator()), s->second);
members_.emplace_back(key_type(s->first.c_str(), s->first.size(), get_allocator()), s->second);
}
std::stable_sort(members_.begin(),members_.end(),
[](const key_value_type& a, const key_value_type& b) -> bool {return a.key().compare(b.key()) < 0;});
Expand Down Expand Up @@ -1340,10 +1340,10 @@ namespace jsoncons {
std::unordered_set<key_type,MyHash> keys;
for (auto it = first; it != last; ++it)
{
key_type key{it->first, get_allocator()};
key_type key{it->first.c_str(), it->first.size(), get_allocator()};
if (keys.find(key) == keys.end())
{
keys.emplace(key, get_allocator());
keys.emplace(key.c_str(), key.size(), get_allocator());
members_.emplace_back(std::move(key), it->second);
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons_ext/cbor/cbor_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class basic_cbor_parser : public ser_context
byte_string_type bytes;

mapped_string(const string_type& str, const allocator_type& alloc = allocator_type())
: type(jsoncons::cbor::detail::cbor_major_type::text_string), str(str,alloc), bytes(alloc)
: type(jsoncons::cbor::detail::cbor_major_type::text_string), str(str.c_str(), str.size(), alloc), bytes(alloc)
{
}

Expand Down
2 changes: 1 addition & 1 deletion test/corelib/src/detail/span_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TEST_CASE("jsoncons::detail::span constructor tests")
SECTION("jsoncons::detail::span(C& c)")
{
using C = std::vector<uint8_t>;
C c = {1,2,3,4};
C c = {{1,2,3,4}};

jsoncons::detail::span<const uint8_t> s(c);
CHECK(s.size() == c.size());
Expand Down
Loading