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
diff --git a/include/json/reader.h b/include/json/reader.h
index d8f1be1..b700d95 100644
--- a/include/json/reader.h
+++ b/include/json/reader.h
@@ -221,7 +221,7 @@
                                    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,
diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp
index 3e58f44..96735de 100644
--- a/src/lib_json/json_reader.cpp
+++ b/src/lib_json/json_reader.cpp
@@ -137,8 +137,8 @@
   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 @@
   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 @@
   ErrorInfo info;
   info.token_ = token;
   info.message_ = message;
-  info.extra_ = 0;
+  info.extra_ = nullptr;
   errors_.push_back(info);
   return true;
 }
@@ -1002,7 +1002,7 @@
                                    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 @@
   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 @@
   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 @@
   ErrorInfo info;
   info.token_ = token;
   info.message_ = message;
-  info.extra_ = 0;
+  info.extra_ = nullptr;
   errors_.push_back(info);
   return true;
 }
diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp
index c77d1df..8f3355c 100644
--- a/src/lib_json/json_value.cpp
+++ b/src/lib_json/json_value.cpp
@@ -108,7 +108,7 @@
     length = Value::maxInt - 1;
 
   char* newString = static_cast<char*>(malloc(length + 1));
-  if (newString == NULL) {
+  if (newString == nullptr) {
     throwRuntimeError("in Json::Value::duplicateStringValue(): "
                       "Failed to allocate string value buffer");
   }
@@ -129,7 +129,7 @@
                       "length too big for prefixing");
   unsigned actualLength = length + static_cast<unsigned>(sizeof(unsigned)) + 1U;
   char* newString = static_cast<char*>(malloc(actualLength));
-  if (newString == 0) {
+  if (newString == nullptr) {
     throwRuntimeError("in Json::Value::duplicateAndPrefixStringValue(): "
                       "Failed to allocate string value buffer");
   }
@@ -210,7 +210,7 @@
 // //////////////////////////////////////////////////////////////////
 // //////////////////////////////////////////////////////////////////
 
-Value::CommentInfo::CommentInfo() : comment_(0) {}
+Value::CommentInfo::CommentInfo() : comment_(nullptr) {}
 
 Value::CommentInfo::~CommentInfo() {
   if (comment_)
@@ -220,9 +220,9 @@
 void Value::CommentInfo::setComment(const char* text, size_t len) {
   if (comment_) {
     releaseStringValue(comment_, 0u);
-    comment_ = 0;
+    comment_ = nullptr;
   }
-  JSON_ASSERT(text != 0);
+  JSON_ASSERT(text != nullptr);
   JSON_ASSERT_MESSAGE(
       text[0] == '\0' || text[0] == '/',
       "in Json::Value::setComment(): Comments must start with /");
@@ -241,7 +241,7 @@
 // Notes: policy_ indicates if the string was allocated when
 // a string is stored.
 
-Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {}
+Value::CZString::CZString(ArrayIndex index) : cstr_(nullptr), index_(index) {}
 
 Value::CZString::CZString(char const* str,
                           unsigned length,
@@ -253,7 +253,7 @@
 }
 
 Value::CZString::CZString(const CZString& other) {
-  cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ != 0
+  cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ != nullptr
                ? duplicateStringValue(other.cstr_, other.storage_.length_)
                : other.cstr_);
   storage_.policy_ =
@@ -413,7 +413,7 @@
 
 Value::Value(const char* value) {
   initBasic(stringValue, true);
-  JSON_ASSERT_MESSAGE(value != NULL, "Null Value Passed to Value Constructor");
+  JSON_ASSERT_MESSAGE(value != nullptr, "Null Value Passed to Value Constructor");
   value_.string_ = duplicateAndPrefixStringValue(
       value, static_cast<unsigned>(strlen(value)));
 }
@@ -528,7 +528,7 @@
   case booleanValue:
     return value_.bool_ < other.value_.bool_;
   case stringValue: {
-    if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
+    if ((value_.string_ == nullptr) || (other.value_.string_ == nullptr)) {
       if (other.value_.string_)
         return true;
       else
@@ -590,7 +590,7 @@
   case booleanValue:
     return value_.bool_ == other.value_.bool_;
   case stringValue: {
-    if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
+    if ((value_.string_ == nullptr) || (other.value_.string_ == nullptr)) {
       return (value_.string_ == other.value_.string_);
     }
     unsigned this_len;
@@ -622,8 +622,8 @@
 const char* Value::asCString() const {
   JSON_ASSERT_MESSAGE(type_ == stringValue,
                       "in Json::Value::asCString(): requires stringValue");
-  if (value_.string_ == 0)
-    return 0;
+  if (value_.string_ == nullptr)
+    return nullptr;
   unsigned this_len;
   char const* this_str;
   decodePrefixedString(this->allocated_, this->value_.string_, &this_len,
@@ -648,7 +648,7 @@
 bool Value::getString(char const** begin, char const** end) const {
   if (type_ != stringValue)
     return false;
-  if (value_.string_ == 0)
+  if (value_.string_ == nullptr)
     return false;
   unsigned length;
   decodePrefixedString(this->allocated_, this->value_.string_, &length, begin);
@@ -661,7 +661,7 @@
   case nullValue:
     return "";
   case stringValue: {
-    if (value_.string_ == 0)
+    if (value_.string_ == nullptr)
       return "";
     unsigned this_len;
     char const* this_str;
@@ -1006,7 +1006,7 @@
 void Value::initBasic(ValueType type, bool allocated) {
   type_ = type;
   allocated_ = allocated;
-  comments_ = 0;
+  comments_ = nullptr;
   start_ = 0;
   limit_ = 0;
 }
@@ -1073,7 +1073,7 @@
                                       strlen(otherComment.comment_));
     }
   } else {
-    comments_ = 0;
+    comments_ = nullptr;
   }
   start_ = other.start_;
   limit_ = other.limit_;
@@ -1131,12 +1131,12 @@
                       "in Json::Value::find(key, end, found): requires "
                       "objectValue or nullValue");
   if (type_ == nullValue)
-    return NULL;
+    return nullptr;
   CZString actualKey(begin, static_cast<unsigned>(end - begin),
                      CZString::noDuplication);
   ObjectValues::const_iterator it = value_.map_->find(actualKey);
   if (it == value_.map_->end())
-    return NULL;
+    return nullptr;
   return &(*it).second;
 }
 const Value& Value::operator[](const char* key) const {
@@ -1267,7 +1267,7 @@
 
 bool Value::isMember(char const* begin, char const* end) const {
   Value const* value = find(begin, end);
-  return NULL != value;
+  return nullptr != value;
 }
 bool Value::isMember(char const* key) const {
   return isMember(key, key + strlen(key));
@@ -1470,7 +1470,7 @@
 }
 
 bool Value::hasComment(CommentPlacement placement) const {
-  return comments_ != 0 && comments_[placement].comment_ != 0;
+  return comments_ != nullptr && comments_[placement].comment_ != nullptr;
 }
 
 JSONCPP_STRING Value::getComment(CommentPlacement placement) const {
diff --git a/src/lib_json/json_valueiterator.inl b/src/lib_json/json_valueiterator.inl
index 5243bfe..7cc3792 100644
--- a/src/lib_json/json_valueiterator.inl
+++ b/src/lib_json/json_valueiterator.inl
@@ -108,8 +108,8 @@
 char const* ValueIteratorBase::memberName(char const** end) const {
   const char* cname = (*current_).first.data();
   if (!cname) {
-    *end = NULL;
-    return NULL;
+    *end = nullptr;
+    return nullptr;
   }
   *end = cname + (*current_).first.length();
   return cname;
diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp
index a8b56ff..60d3251 100644
--- a/src/lib_json/json_writer.cpp
+++ b/src/lib_json/json_writer.cpp
@@ -275,7 +275,7 @@
 }
 
 static JSONCPP_STRING valueToQuotedStringN(const char* value, unsigned length) {
-  if (value == NULL)
+  if (value == nullptr)
     return "";
 
   if (!isAnyCharRequiredQuoting(value, length))
@@ -646,7 +646,7 @@
 // //////////////////////////////////////////////////////////////////
 
 StyledStreamWriter::StyledStreamWriter(const JSONCPP_STRING& indentation)
-    : document_(NULL), rightMargin_(74), indentation_(indentation),
+    : document_(nullptr), rightMargin_(74), indentation_(indentation),
       addChildValues_(), indented_(false) {}
 
 void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) {
@@ -661,7 +661,7 @@
   writeValue(root);
   writeCommentAfterValueOnSameLine(root);
   *document_ << "\n";
-  document_ = NULL; // Forget the stream, for safety.
+  document_ = nullptr; // Forget the stream, for safety.
 }
 
 void StyledStreamWriter::writeValue(const Value& value) {
@@ -940,7 +940,7 @@
   writeValue(root);
   writeCommentAfterValueOnSameLine(root);
   *sout_ << endingLineFeedSymbol_;
-  sout_ = NULL;
+  sout_ = nullptr;
   return 0;
 }
 void BuiltStyledStreamWriter::writeValue(Value const& value) {
@@ -1158,7 +1158,7 @@
 ///////////////
 // StreamWriter
 
-StreamWriter::StreamWriter() : sout_(NULL) {}
+StreamWriter::StreamWriter() : sout_(nullptr) {}
 StreamWriter::~StreamWriter() {}
 StreamWriter::Factory::~Factory() {}
 StreamWriterBuilder::StreamWriterBuilder() { setDefaults(&settings_); }
diff --git a/src/test_lib_json/jsontest.cpp b/src/test_lib_json/jsontest.cpp
index 86ed4c1..76e6832 100644
--- a/src/test_lib_json/jsontest.cpp
+++ b/src/test_lib_json/jsontest.cpp
@@ -74,10 +74,10 @@
 // //////////////////////////////////////////////////////////////////
 
 TestResult::TestResult()
-    : predicateId_(1), lastUsedPredicateId_(0), messageTarget_(0) {
+    : predicateId_(1), lastUsedPredicateId_(0), messageTarget_(nullptr) {
   // The root predicate has id 0
   rootPredicateNode_.id_ = 0;
-  rootPredicateNode_.next_ = 0;
+  rootPredicateNode_.next_ = nullptr;
   predicateStackTail_ = &rootPredicateNode_;
 }
 
@@ -89,7 +89,7 @@
   /// added.
   unsigned int nestingLevel = 0;
   PredicateContext* lastNode = rootPredicateNode_.next_;
-  for (; lastNode != 0; lastNode = lastNode->next_) {
+  for (; lastNode != nullptr; lastNode = lastNode->next_) {
     if (lastNode->id_ > lastUsedPredicateId_) // new PredicateContext
     {
       lastUsedPredicateId_ = lastNode->id_;
@@ -124,17 +124,17 @@
 
 TestResult& TestResult::popPredicateContext() {
   PredicateContext* lastNode = &rootPredicateNode_;
-  while (lastNode->next_ != 0 && lastNode->next_->next_ != 0) {
+  while (lastNode->next_ != nullptr && lastNode->next_->next_ != nullptr) {
     lastNode = lastNode->next_;
   }
   // Set message target to popped failure
   PredicateContext* tail = lastNode->next_;
-  if (tail != 0 && tail->failure_ != 0) {
+  if (tail != nullptr && tail->failure_ != nullptr) {
     messageTarget_ = tail->failure_;
   }
   // Remove tail from list
   predicateStackTail_ = lastNode;
-  lastNode->next_ = 0;
+  lastNode->next_ = nullptr;
   return *this;
 }
 
@@ -186,7 +186,7 @@
 }
 
 TestResult& TestResult::addToLastFailure(const JSONCPP_STRING& message) {
-  if (messageTarget_ != 0) {
+  if (messageTarget_ != nullptr) {
     messageTarget_->message_ += message;
   }
   return *this;
@@ -207,7 +207,7 @@
 // class TestCase
 // //////////////////////////////////////////////////////////////////
 
-TestCase::TestCase() : result_(0) {}
+TestCase::TestCase() : result_(nullptr) {}
 
 TestCase::~TestCase() {}
 
diff --git a/src/test_lib_json/jsontest.h b/src/test_lib_json/jsontest.h
index 9aab538..58c5251 100644
--- a/src/test_lib_json/jsontest.h
+++ b/src/test_lib_json/jsontest.h
@@ -69,7 +69,7 @@
 
   /// Adds an assertion failure.
   TestResult&
-  addFailure(const char* file, unsigned int line, const char* expr = 0);
+  addFailure(const char* file, unsigned int line, const char* expr = nullptr);
 
   /// Removes the last PredicateContext added to the predicate stack
   /// chained list.