mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-01-14 09:57:56 +08:00
Fix improper format specifier in printf
%d in format string requires 'int' but the argument type is 'unsigned int'.
This commit is contained in:
parent
cfab607c0d
commit
85a263e89f
@ -106,9 +106,9 @@ static void printValueTree(FILE* fout,
|
||||
for (Json::ArrayIndex index = 0; index < size; ++index) {
|
||||
static char buffer[16];
|
||||
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
|
||||
sprintf_s(buffer, sizeof(buffer), "[%d]", index);
|
||||
sprintf_s(buffer, sizeof(buffer), "[%u]", index);
|
||||
#else
|
||||
snprintf(buffer, sizeof(buffer), "[%d]", index);
|
||||
snprintf(buffer, sizeof(buffer), "[%u]", index);
|
||||
#endif
|
||||
printValueTree(fout, value[index], path + buffer);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ void TestResult::printFailure(bool printTestName) const {
|
||||
const Failure& failure = *it;
|
||||
JSONCPP_STRING indent(failure.nestingLevel_ * 2, ' ');
|
||||
if (failure.file_) {
|
||||
printf("%s%s(%d): ", indent.c_str(), failure.file_, failure.line_);
|
||||
printf("%s%s(%u): ", indent.c_str(), failure.file_, failure.line_);
|
||||
}
|
||||
if (!failure.expr_.empty()) {
|
||||
printf("%s\n", failure.expr_.c_str());
|
||||
@ -281,7 +281,7 @@ bool Runner::runAllTest(bool printSummary) const {
|
||||
|
||||
if (failures.empty()) {
|
||||
if (printSummary) {
|
||||
printf("All %d tests passed\n", count);
|
||||
printf("All %u tests passed\n", count);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
@ -293,7 +293,7 @@ bool Runner::runAllTest(bool printSummary) const {
|
||||
if (printSummary) {
|
||||
unsigned int failedCount = static_cast<unsigned int>(failures.size());
|
||||
unsigned int passedCount = count - failedCount;
|
||||
printf("%d/%d tests passed (%d failure(s))\n", passedCount, count,
|
||||
printf("%u/%u tests passed (%u failure(s))\n", passedCount, count,
|
||||
failedCount);
|
||||
}
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user