Skip to content

Commit 2dce33d

Browse files
committed
[ci] fix additional ci errors
1 parent 82add93 commit 2dce33d

File tree

3 files changed

+144
-108
lines changed

3 files changed

+144
-108
lines changed

include/nlohmann/detail/input/binary_reader.hpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2880,6 +2880,20 @@ class binary_reader
28802880
return sax->number_unsigned(lex.get_number_unsigned());
28812881
case tt::value_float:
28822882
return sax->number_float(lex.get_number_float(), lex.get_token_string());
2883+
case tt::uninitialized:
2884+
case tt::literal_true:
2885+
case tt::literal_false:
2886+
case tt::literal_null:
2887+
case tt::value_string:
2888+
case tt::begin_array:
2889+
case tt::begin_object:
2890+
case tt::end_array:
2891+
case tt::end_object:
2892+
case tt::name_separator:
2893+
case tt::value_separator:
2894+
case tt::parse_error:
2895+
case tt::end_of_input:
2896+
case tt::literal_or_value:
28832897
default:
28842898
return sax->string(s);
28852899
}
@@ -3154,7 +3168,7 @@ class binary_reader
31543168
{
31553169
return false;
31563170
}
3157-
data.floats.push_back(v);
3171+
data.floats.push_back(static_cast<double>(v));
31583172
return true;
31593173
}
31603174

@@ -3305,6 +3319,20 @@ class binary_reader
33053319
return sax->number_unsigned(lex.get_number_unsigned());
33063320
case tt::value_float:
33073321
return sax->number_float(lex.get_number_float(), lex.get_token_string());
3322+
case tt::uninitialized:
3323+
case tt::literal_true:
3324+
case tt::literal_false:
3325+
case tt::literal_null:
3326+
case tt::value_string:
3327+
case tt::begin_array:
3328+
case tt::begin_object:
3329+
case tt::end_array:
3330+
case tt::end_object:
3331+
case tt::name_separator:
3332+
case tt::value_separator:
3333+
case tt::parse_error:
3334+
case tt::end_of_input:
3335+
case tt::literal_or_value:
33083336
default:
33093337
return sax->string(data.strings[ri]);
33103338
}

include/nlohmann/detail/output/binary_writer.hpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,8 +1827,12 @@ class binary_writer
18271827
case value_t::string:
18281828
t = 0x53; // 'S' - string type marker
18291829
break;
1830+
case value_t::object:
1831+
case value_t::array:
1832+
case value_t::binary:
1833+
case value_t::discarded:
18301834
default:
1831-
// String, array, object, binary types not supported in basic SOA
1835+
// Complex types not supported in basic SOA
18321836
return false;
18331837
}
18341838
schema.emplace_back(el.first, t);
@@ -1868,6 +1872,10 @@ class binary_writer
18681872
case value_t::string:
18691873
t = 0x53; // 'S' - string type marker
18701874
break;
1875+
case value_t::object:
1876+
case value_t::array:
1877+
case value_t::binary:
1878+
case value_t::discarded:
18711879
default:
18721880
return false;
18731881
}
@@ -1937,7 +1945,7 @@ class binary_writer
19371945
std::size_t offset_cost = arr.size() * off_size + (arr.size() + 1) * off_size + total_len;
19381946

19391947
// Decision logic
1940-
if (unique_count <= static_cast<std::size_t>(arr.size() * thresh) &&
1948+
if (unique_count <= static_cast<std::size_t>(static_cast<double>(arr.size()) * thresh) &&
19411949
dict_cost < fixed_cost && dict_cost < offset_cost)
19421950
{
19431951
// Dictionary encoding
@@ -1998,7 +2006,7 @@ class binary_writer
19982006

19992007
oa->write_character(to_char_type(0x5B)); // '['
20002008
oa->write_character(to_char_type(0x24)); // '$'
2001-
oa->write_character(to_char_type(index_type));
2009+
oa->write_character(to_char_type(static_cast<std::uint8_t>(index_type)));
20022010
oa->write_character(to_char_type(0x5D)); // ']'
20032011
}
20042012
else // fixed
@@ -2020,7 +2028,7 @@ class binary_writer
20202028
{
20212029
// Write index
20222030
auto it = std::find(field.str_dict.begin(), field.str_dict.end(), value);
2023-
std::size_t idx = std::distance(field.str_dict.begin(), it);
2031+
std::size_t idx = static_cast<std::size_t>(std::distance(field.str_dict.begin(), it));
20242032

20252033
if (idx < 256)
20262034
{
@@ -2138,7 +2146,7 @@ class binary_writer
21382146
}
21392147
else
21402148
{
2141-
oa->write_character(to_char_type(f.second));
2149+
oa->write_character(to_char_type(static_cast<std::uint8_t>(f.second)));
21422150
}
21432151
}
21442152

0 commit comments

Comments
 (0)