mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-06-09 17:57:34 +02: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) {
|
for (Json::ArrayIndex index = 0; index < size; ++index) {
|
||||||
static char buffer[16];
|
static char buffer[16];
|
||||||
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
|
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
|
||||||
sprintf_s(buffer, sizeof(buffer), "[%d]", index);
|
sprintf_s(buffer, sizeof(buffer), "[%u]", index);
|
||||||
#else
|
#else
|
||||||
snprintf(buffer, sizeof(buffer), "[%d]", index);
|
snprintf(buffer, sizeof(buffer), "[%u]", index);
|
||||||
#endif
|
#endif
|
||||||
printValueTree(fout, value[index], path + buffer);
|
printValueTree(fout, value[index], path + buffer);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ void TestResult::printFailure(bool printTestName) const {
|
|||||||
const Failure& failure = *it;
|
const Failure& failure = *it;
|
||||||
JSONCPP_STRING indent(failure.nestingLevel_ * 2, ' ');
|
JSONCPP_STRING indent(failure.nestingLevel_ * 2, ' ');
|
||||||
if (failure.file_) {
|
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()) {
|
if (!failure.expr_.empty()) {
|
||||||
printf("%s\n", failure.expr_.c_str());
|
printf("%s\n", failure.expr_.c_str());
|
||||||
@ -281,7 +281,7 @@ bool Runner::runAllTest(bool printSummary) const {
|
|||||||
|
|
||||||
if (failures.empty()) {
|
if (failures.empty()) {
|
||||||
if (printSummary) {
|
if (printSummary) {
|
||||||
printf("All %d tests passed\n", count);
|
printf("All %u tests passed\n", count);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -293,7 +293,7 @@ bool Runner::runAllTest(bool printSummary) const {
|
|||||||
if (printSummary) {
|
if (printSummary) {
|
||||||
unsigned int failedCount = static_cast<unsigned int>(failures.size());
|
unsigned int failedCount = static_cast<unsigned int>(failures.size());
|
||||||
unsigned int passedCount = count - failedCount;
|
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);
|
failedCount);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user