Skip to content

Commit 702a539

Browse files
fivemicrocdunn2001
authored andcommitted
Fix open-source-parsers#296: Explicitly cast size_t results to unsigned when needed
This is rebased from open-source-parsers#297, where AppVeyor had been failing, and which was not properly based on the master branch.
1 parent 81cb7e5 commit 702a539

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/lib_json/json_value.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ inline static void decodePrefixedString(
125125
unsigned* length, char const** value)
126126
{
127127
if (!isPrefixed) {
128-
*length = strlen(prefixed);
128+
*length = static_cast<unsigned>(strlen(prefixed));
129129
*value = prefixed;
130130
} else {
131131
*length = *reinterpret_cast<unsigned const*>(prefixed);

src/lib_json/json_writer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ void FastWriter::writeValue(const Value& value) {
354354
const std::string& name = *it;
355355
if (it != members.begin())
356356
document_ += ',';
357-
document_ += valueToQuotedStringN(name.data(), name.length());
357+
document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
358358
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
359359
writeValue(value[name]);
360360
}
@@ -914,7 +914,7 @@ void BuiltStyledStreamWriter::writeValue(Value const& value) {
914914
std::string const& name = *it;
915915
Value const& childValue = value[name];
916916
writeCommentBeforeValue(childValue);
917-
writeWithIndent(valueToQuotedStringN(name.data(), name.length()));
917+
writeWithIndent(valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length())));
918918
*sout_ << colonSymbol_;
919919
writeValue(childValue);
920920
if (++it == members.end()) {

0 commit comments

Comments
 (0)