Skip to content

Commit 5ed0709

Browse files
authored
Fix -Wtautological-constant-out-of-range-compare in serializer (nlohmann#5050)
Signed-off-by: Charles Cabergs <me@cacharle.xyz>
1 parent e3014f1 commit 5ed0709

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

include/nlohmann/detail/output/serializer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ class serializer
919919
}
920920
};
921921

922-
JSON_ASSERT(byte < utf8d.size());
922+
JSON_ASSERT(static_cast<std::size_t>(byte) < utf8d.size());
923923
const std::uint8_t type = utf8d[byte];
924924

925925
codep = (state != UTF8_ACCEPT)

single_include/nlohmann/json.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19755,7 +19755,7 @@ class serializer
1975519755
}
1975619756
};
1975719757

19758-
JSON_ASSERT(byte < utf8d.size());
19758+
JSON_ASSERT(static_cast<std::size_t>(byte) < utf8d.size());
1975919759
const std::uint8_t type = utf8d[byte];
1976019760

1976119761
codep = (state != UTF8_ACCEPT)

0 commit comments

Comments
 (0)