mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 23:20:05 +02:00
STYLE: Use range-based loops from C++11
C++11 Range based for loops can be used in Used as a more readable equivalent to the traditional for loop operating over a range of values, such as all elements in a container, in the forward direction.. Range based loopes are more explicit for only computing the end location once for containers. SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/ run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-loop-convert -header-filter=.* -fix
This commit is contained in:

committed by
Hans Johnson

parent
3beadff472
commit
cbeed7b076
@@ -150,9 +150,7 @@ void TestResult::printFailure(bool printTestName) const {
|
||||
}
|
||||
|
||||
// Print in reverse to display the callstack in the right order
|
||||
Failures::const_iterator itEnd = failures_.end();
|
||||
for (Failures::const_iterator it = failures_.begin(); it != itEnd; ++it) {
|
||||
const Failure& failure = *it;
|
||||
for (const auto & failure : failures_ ) {
|
||||
JSONCPP_STRING indent(failure.nestingLevel_ * 2, ' ');
|
||||
if (failure.file_) {
|
||||
printf("%s%s(%u): ", indent.c_str(), failure.file_, failure.line_);
|
||||
@@ -275,8 +273,7 @@ bool Runner::runAllTest(bool printSummary) const {
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
for (unsigned int index = 0; index < failures.size(); ++index) {
|
||||
TestResult& result = failures[index];
|
||||
for (auto & result : failures) {
|
||||
result.printFailure(count > 1);
|
||||
}
|
||||
|
||||
|
@@ -2365,8 +2365,7 @@ JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
|
||||
{ __LINE__, false, "{\"a\":.Infinity}" }, { __LINE__, false, "{\"a\":_Infinity}" },
|
||||
{ __LINE__, false, "{\"a\":_nfinity}" }, { __LINE__, true, "{\"a\":-Infinity}" }
|
||||
};
|
||||
for (size_t tdi = 0; tdi < sizeof(test_data) / sizeof(*test_data); ++tdi) {
|
||||
const TestData& td = test_data[tdi];
|
||||
for (const auto& td : test_data) {
|
||||
bool ok = reader->parse(&*td.in.begin(), &*td.in.begin() + td.in.size(),
|
||||
&root, &errs);
|
||||
JSONTEST_ASSERT(td.ok == ok) << "line:" << td.line << "\n"
|
||||
|
Reference in New Issue
Block a user