Skip to content

Commit

Permalink
tidy includes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Jan 7, 2025
1 parent f6b45ea commit 90532c2
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 75 deletions.
6 changes: 3 additions & 3 deletions include/jsoncons/detail/string_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,12 @@ namespace std {
template <typename CharT,typename Traits>
struct hash<jsoncons::detail::basic_string_view<CharT, Traits>>
{
size_t operator()(const jsoncons::detail::basic_string_view<CharT, Traits>& s) const noexcept
std::size_t operator()(const jsoncons::detail::basic_string_view<CharT, Traits>& s) const noexcept
{
const int p = 53;
const int m = 1000000009;
size_t hash_value = 0;
size_t p_pow = 1;
std::size_t hash_value = 0;
std::size_t p_pow = 1;
for (CharT c : s) {
hash_value = (hash_value + (c - 'a' + 1) * p_pow) % m;
p_pow = (p_pow * p) % m;
Expand Down
2 changes: 2 additions & 0 deletions include/jsoncons/ser_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#ifndef JSONCONS_SER_CONTEXT_HPP
#define JSONCONS_SER_CONTEXT_HPP

#include <cstddef>

namespace jsoncons {

class ser_context
Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons/utility/bigint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ class basic_bigint : protected detail::basic_bigint_base<Allocator>
{
basic_bigint<Allocator> v(*this);

size_t len = (v.length() * basic_type_bits / 3) + 2;
std::size_t len = (v.length() * basic_type_bits / 3) + 2;
data.reserve(len);

static uint64_t p10 = 1;
Expand Down
18 changes: 9 additions & 9 deletions include/jsoncons_ext/bson/bson_decimal128.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,18 +582,18 @@ namespace jsoncons { namespace bson {
bool includes_sign = false; /* True if the input first contains a sign. */
bool found_nonzero = false;

size_t significant_digits = 0; /* Total number of significant digits
std::size_t significant_digits = 0; /* Total number of significant digits
* (no leading or trailing zero) */
size_t ndigits_read = 0; /* Total number of significand digits read */
size_t ndigits = 0; /* Total number of digits (no leading zeros) */
size_t radix_position = 0; /* The number of the digits after radix */
size_t first_nonzero = 0; /* The index of the first non-zero in *str* */
std::size_t ndigits_read = 0; /* Total number of significand digits read */
std::size_t ndigits = 0; /* Total number of digits (no leading zeros) */
std::size_t radix_position = 0; /* The number of the digits after radix */
std::size_t first_nonzero = 0; /* The index of the first non-zero in *str* */

uint16_t digits[decimal128_limits::max_digits] = {0};
uint16_t ndigits_stored = 0; /* The number of digits in digits */
uint16_t *digits_insert = digits; /* Insertion pointer for digits */
size_t first_digit = 0; /* The index of the first non-zero digit */
size_t last_digit = 0; /* The index of the last digit */
std::size_t first_digit = 0; /* The index of the first non-zero digit */
std::size_t last_digit = 0; /* The index of the last digit */

int32_t exponent = 0;
uint64_t significand_high = 0; /* The high 17 digits of the significand */
Expand Down Expand Up @@ -808,7 +808,7 @@ namespace jsoncons { namespace bson {
significand_high = 0;
significand_low = 0;
} else if (last_digit - first_digit < 17) {
size_t d_idx = first_digit;
std::size_t d_idx = first_digit;
significand_low = digits[d_idx++];

for (; d_idx <= last_digit; d_idx++) {
Expand All @@ -817,7 +817,7 @@ namespace jsoncons { namespace bson {
significand_high = 0;
}
} else {
size_t d_idx = first_digit;
std::size_t d_idx = first_digit;
significand_high = digits[d_idx++];

for (; d_idx <= last_digit - 17; d_idx++) {
Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons_ext/bson/bson_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class basic_bson_parser : public ser_context
}

uint8_t buf[sizeof(int32_t)];
size_t n = source_.read(buf, sizeof(int32_t));
std::size_t n = source_.read(buf, sizeof(int32_t));
if (JSONCONS_UNLIKELY(n != sizeof(int32_t)))
{
ec = bson_errc::unexpected_eof;
Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons_ext/jsonpointer/jsonpointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ namespace jsoncons { namespace jsonpointer {
for (auto it = ptr.begin(); it != ptr.end(); )
{
auto s = *it;
size_t n{0};
std::size_t n{0};
auto r = jsoncons::detail::decimal_to_integer(s.data(), s.size(), n);
if (r.ec == jsoncons::detail::to_integer_errc() && (index++ == n))
{
Expand Down
24 changes: 12 additions & 12 deletions include/jsoncons_ext/jsonschema/common/keyword_validators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,9 @@ namespace jsonschema {
}
else
{
size_t index = 0;
size_t start = 0;
size_t end = 0;
std::size_t index = 0;
std::size_t start = 0;
std::size_t end = 0;
for (const auto& item : instance.array_range())
{
jsonpointer::json_pointer item_location = instance_location / index;
Expand Down Expand Up @@ -810,7 +810,7 @@ namespace jsonschema {

if (schema_val_)
{
size_t index = 0;
std::size_t index = 0;
for (const auto& item : instance.array_range())
{
jsonpointer::json_pointer item_location = instance_location / index;
Expand Down Expand Up @@ -3368,8 +3368,8 @@ namespace jsonschema {
collecting_error_listener local_reporter;

std::size_t index = 0;
size_t start = 0;
size_t end = 0;
std::size_t start = 0;
std::size_t end = 0;
for (const auto& item : instance.array_range())
{
std::size_t errors = local_reporter.errors.size();
Expand Down Expand Up @@ -3642,12 +3642,12 @@ namespace jsonschema {
return walk_result::advance;
}

size_t data_index = 0;
std::size_t data_index = 0;

evaluation_context<Json> prefix_items_context(context, this->keyword_name());

size_t start = 0;
size_t end = 0;
std::size_t start = 0;
std::size_t end = 0;
for (std::size_t schema_index=0;
schema_index < prefix_item_validators_.size() && data_index < instance.size();
++schema_index, ++data_index)
Expand Down Expand Up @@ -3712,7 +3712,7 @@ namespace jsonschema {
return result;
}

size_t data_index = 0;
std::size_t data_index = 0;

evaluation_context<Json> prefix_items_context(context, this->keyword_name());

Expand Down Expand Up @@ -3922,8 +3922,8 @@ namespace jsonschema {
else
{
std::size_t index = 0;
size_t start = 0;
size_t end = 0;
std::size_t start = 0;
std::size_t end = 0;
for (const auto& item : instance.array_range())
{
// check if it is in "evaluated_items"
Expand Down
8 changes: 4 additions & 4 deletions include/jsoncons_ext/jsonschema/common/schema_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ namespace jsonschema {
uri schema_location = context.make_schema_location("allOf");
std::vector<schema_validator_type> subschemas;

size_t c = 0;
std::size_t c = 0;
for (const auto& subsch : sch.array_range())
{
std::string sub_keys[] = { "allOf", std::to_string(c++) };
Expand All @@ -792,7 +792,7 @@ namespace jsonschema {
uri schema_location = context.make_schema_location("anyOf");
std::vector<schema_validator_type> subschemas;

size_t c = 0;
std::size_t c = 0;
for (const auto& subsch : sch.array_range())
{
std::string sub_keys[] = { "anyOf", std::to_string(c++) };
Expand All @@ -807,7 +807,7 @@ namespace jsonschema {
uri schema_location{ context.make_schema_location("oneOf") };
std::vector<schema_validator_type> subschemas;

size_t c = 0;
std::size_t c = 0;
for (const auto& subsch : sch.array_range())
{
std::string sub_keys[] = { "oneOf", std::to_string(c++) };
Expand Down Expand Up @@ -940,7 +940,7 @@ namespace jsonschema {

if (sch.type() == json_type::array_value)
{
size_t c = 0;
std::size_t c = 0;
for (const auto& subsch : sch.array_range())
{
std::string sub_keys[] = {"items", std::to_string(c++)};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ namespace draft202012 {

if (sch.type() == json_type::array_value)
{
size_t c = 0;
std::size_t c = 0;
for (const auto& subsch : sch.array_range())
{
std::string sub_keys[] = {"prefixItems", std::to_string(c++)};
Expand Down
Loading

0 comments on commit 90532c2

Please sign in to comment.