From 03734c7fb58f4a4b1dcebaf9db964184677bcc8c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 23 Aug 2017 15:02:24 -0600 Subject: [PATCH] ircd::json: Fixes to grammar and generator related. --- ircd/json.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ircd/json.cc b/ircd/json.cc index 368a5b433..c9fcf3a27 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -350,7 +350,7 @@ const { const auto gg { - maxwidth(stop - out)[std::forward(g)] | eps[failed_to_serialize_object] + maxwidth(size_t(stop - out))[std::forward(g)] | eps[failed_to_serialize_object] }; return karma::generate(out, gg, std::forward(a)); @@ -365,7 +365,7 @@ const { const auto gg { - maxwidth(stop - out)[std::forward(g)] | eps[failed_to_serialize_object] + maxwidth(size_t(stop - out))[std::forward(g)] | eps[failed_to_serialize_object] }; return karma::generate(out, gg); @@ -690,7 +690,7 @@ ircd::json::obj::obj(recursive_t recursive, const doc &doc) :idx{doc.count()} { - static const auto transform([&] + std::transform(std::begin(doc), std::end(doc), std::begin(idx), [&] (const doc::member &m) -> obj::member { switch(type(m.second)) @@ -702,8 +702,6 @@ ircd::json::obj::obj(recursive_t recursive, return obj::member{m}; }; }); - - std::transform(std::begin(doc), std::end(doc), std::begin(idx), transform); } ircd::json::obj::obj(const doc &doc) @@ -773,7 +771,7 @@ const const auto &val(it->second); if(!indice.empty()) { - const auto idx(lex_cast(chomp(indice, "]"))); + const auto idx(lex_cast(rstrip(indice, ']'))); if(type(val) != ARRAY) throw not_found("cannot recurse through non-array \"%s\" for indice [%zu]", name, idx);