COMP: Use nullptr instead of 0 or NULL

The check converts the usage of null pointer constants (eg. NULL, 0) to
use the new C++11 nullptr keyword.

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-use-nullptr  -header-filter=.* -fix
This commit is contained in:
Hans Johnson
2018-12-12 13:41:06 -06:00
parent 6219eae304
commit f64244ed3f
7 changed files with 46 additions and 46 deletions

View File

@@ -137,8 +137,8 @@ bool Reader::parse(const char* beginDoc,
end_ = endDoc;
collectComments_ = collectComments;
current_ = begin_;
lastValueEnd_ = 0;
lastValue_ = 0;
lastValueEnd_ = nullptr;
lastValue_ = nullptr;
commentsBefore_.clear();
errors_.clear();
while (!nodes_.empty())
@@ -394,7 +394,7 @@ void Reader::addComment(Location begin,
assert(collectComments_);
const JSONCPP_STRING& normalized = normalizeEOL(begin, end);
if (placement == commentAfterOnSameLine) {
assert(lastValue_ != 0);
assert(lastValue_ != nullptr);
lastValue_->setComment(normalized, placement);
} else {
commentsBefore_ += normalized;
@@ -862,7 +862,7 @@ bool Reader::pushError(const Value& value, const JSONCPP_STRING& message) {
ErrorInfo info;
info.token_ = token;
info.message_ = message;
info.extra_ = 0;
info.extra_ = nullptr;
errors_.push_back(info);
return true;
}
@@ -1002,7 +1002,7 @@ private:
Location end,
unsigned int& unicode);
bool
addError(const JSONCPP_STRING& message, Token& token, Location extra = 0);
addError(const JSONCPP_STRING& message, Token& token, Location extra = nullptr);
bool recoverFromError(TokenType skipUntilToken);
bool addErrorAndRecover(const JSONCPP_STRING& message,
Token& token,
@@ -1061,8 +1061,8 @@ bool OurReader::parse(const char* beginDoc,
end_ = endDoc;
collectComments_ = collectComments;
current_ = begin_;
lastValueEnd_ = 0;
lastValue_ = 0;
lastValueEnd_ = nullptr;
lastValue_ = nullptr;
commentsBefore_.clear();
errors_.clear();
while (!nodes_.empty())
@@ -1368,7 +1368,7 @@ void OurReader::addComment(Location begin,
assert(collectComments_);
const JSONCPP_STRING& normalized = normalizeEOL(begin, end);
if (placement == commentAfterOnSameLine) {
assert(lastValue_ != 0);
assert(lastValue_ != nullptr);
lastValue_->setComment(normalized, placement);
} else {
commentsBefore_ += normalized;
@@ -1877,7 +1877,7 @@ bool OurReader::pushError(const Value& value, const JSONCPP_STRING& message) {
ErrorInfo info;
info.token_ = token;
info.message_ = message;
info.extra_ = 0;
info.extra_ = nullptr;
errors_.push_back(info);
return true;
}