Skip to content

Commit cb8259f

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

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
@@ -126,7 +126,7 @@ inline static void decodePrefixedString(
126126
unsigned* length, char const** value)
127127
{
128128
if (!isPrefixed) {
129-
*length = strlen(prefixed);
129+
*length = static_cast<unsigned>(strlen(prefixed));
130130
*value = prefixed;
131131
} else {
132132
*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
@@ -343,7 +343,7 @@ void FastWriter::writeValue(const Value& value) {
343343
const std::string& name = *it;
344344
if (it != members.begin())
345345
document_ += ',';
346-
document_ += valueToQuotedStringN(name.data(), name.length());
346+
document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
347347
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
348348
writeValue(value[name]);
349349
}
@@ -903,7 +903,7 @@ void BuiltStyledStreamWriter::writeValue(Value const& value) {
903903
std::string const& name = *it;
904904
Value const& childValue = value[name];
905905
writeCommentBeforeValue(childValue);
906-
writeWithIndent(valueToQuotedStringN(name.data(), name.length()));
906+
writeWithIndent(valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length())));
907907
*sout_ << colonSymbol_;
908908
writeValue(childValue);
909909
if (++it == members.end()) {

0 commit comments

Comments
 (0)