Skip to content

Commit

Permalink
tidy code
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Dec 29, 2024
1 parent 473b76e commit 1735c06
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 88 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# See https://github.com/danielaparker/jsoncons for latest version

Checks: '*,
-google-readability-casting,
-bugprone-branch-clone,
-hicpp-named-parameter,
-readability-named-parameter,
Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons/config/binary_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace binary {
#else
uint64_t v;
std::memcpy(&v, &val, sizeof(v));
int64_t sign = static_cast<int64_t>(v >> 63 << 15);
auto sign = static_cast<int64_t>(v >> 63 << 15);
int64_t exp = (v >> 52) & 0x7ff;
int64_t mant = v << 12 >> 12 >> (53-11); /* keep only the 11 most significant bits of the mantissa */
exp -= 1023;
Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons_ext/jmespath/jmespath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2889,7 +2889,7 @@ namespace detail {
{
return context.null_value();
}
int64_t slen = static_cast<int64_t>(val.size());
auto slen = static_cast<int64_t>(val.size());
if (index_ >= 0 && index_ < slen)
{
std::size_t index = static_cast<std::size_t>(index_);
Expand Down
72 changes: 36 additions & 36 deletions include/jsoncons_ext/jsonpath/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ namespace detail {
if (level > 0)
{
//s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("or operator");
return s;
Expand Down Expand Up @@ -607,7 +607,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("and operator");
return s;
Expand Down Expand Up @@ -636,7 +636,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("equal operator");
return s;
Expand Down Expand Up @@ -665,7 +665,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("not equal operator");
return s;
Expand Down Expand Up @@ -702,7 +702,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("less than operator");
return s;
Expand Down Expand Up @@ -739,7 +739,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("less than or equal operator");
return s;
Expand Down Expand Up @@ -778,7 +778,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("greater than operator");
return s;
Expand Down Expand Up @@ -815,7 +815,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("greater than or equal operator");
return s;
Expand Down Expand Up @@ -859,7 +859,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("plus operator");
return s;
Expand Down Expand Up @@ -903,7 +903,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("minus operator");
return s;
Expand Down Expand Up @@ -947,7 +947,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("multiply operator");
return s;
Expand Down Expand Up @@ -993,7 +993,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("divide operator");
return s;
Expand Down Expand Up @@ -1039,7 +1039,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("modulus operator");
return s;
Expand Down Expand Up @@ -1076,7 +1076,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("function");
return s;
Expand Down Expand Up @@ -1168,7 +1168,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("contains function");
return s;
Expand Down Expand Up @@ -1230,7 +1230,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("ends_with function");
return s;
Expand Down Expand Up @@ -1292,7 +1292,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("starts_with function");
return s;
Expand Down Expand Up @@ -1349,7 +1349,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("sum function");
return s;
Expand Down Expand Up @@ -1420,7 +1420,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("tokenize function");
return s;
Expand Down Expand Up @@ -1474,7 +1474,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("ceil function");
return s;
Expand Down Expand Up @@ -1526,7 +1526,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("floor function");
return s;
Expand Down Expand Up @@ -1600,7 +1600,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("to_number function");
return s;
Expand Down Expand Up @@ -1655,7 +1655,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("prod function");
return s;
Expand Down Expand Up @@ -1713,7 +1713,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("to_string function");
return s;
Expand Down Expand Up @@ -1783,7 +1783,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("min function");
return s;
Expand Down Expand Up @@ -1854,7 +1854,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("max function");
return s;
Expand Down Expand Up @@ -1909,7 +1909,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("abs function");
return s;
Expand Down Expand Up @@ -1966,7 +1966,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("length function");
return s;
Expand Down Expand Up @@ -2022,7 +2022,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("keys function");
return s;
Expand Down Expand Up @@ -2990,23 +2990,23 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("root node");
break;
case jsonpath_token_kind::current_node:
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("current node");
break;
case jsonpath_token_kind::argument:
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("argument");
break;
Expand All @@ -3021,7 +3021,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
auto sbuf = value_.to_string();
unicode_traits::convert(sbuf.data(), sbuf.size(), s);
Expand All @@ -3037,7 +3037,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("token kind: ");
s.append(jsoncons::jsonpath::detail::to_string(token_kind_));
Expand Down Expand Up @@ -3243,7 +3243,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("expression ");
if (selector_ != nullptr)
Expand Down Expand Up @@ -3438,7 +3438,7 @@ namespace detail {
if (level > 0)
{
s.append("\n");
s.append(std::size_t(level*2), ' ');
s.append(std::size_t(level)*2, ' ');
}
s.append("expression ");
for (const auto& item : token_list_)
Expand Down
Loading

0 comments on commit 1735c06

Please sign in to comment.