@@ -108,7 +108,7 @@ static inline char* duplicateStringValue(const char* value, size_t length) {
108108 length = Value::maxInt - 1 ;
109109
110110 char * newString = static_cast <char *>(malloc (length + 1 ));
111- if (newString == NULL ) {
111+ if (newString == nullptr ) {
112112 throwRuntimeError (" in Json::Value::duplicateStringValue(): "
113113 " Failed to allocate string value buffer" );
114114 }
@@ -129,7 +129,7 @@ static inline char* duplicateAndPrefixStringValue(const char* value,
129129 " length too big for prefixing" );
130130 unsigned actualLength = length + static_cast <unsigned >(sizeof (unsigned )) + 1U ;
131131 char * newString = static_cast <char *>(malloc (actualLength));
132- if (newString == 0 ) {
132+ if (newString == nullptr ) {
133133 throwRuntimeError (" in Json::Value::duplicateAndPrefixStringValue(): "
134134 " Failed to allocate string value buffer" );
135135 }
@@ -210,7 +210,7 @@ JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg) {
210210// //////////////////////////////////////////////////////////////////
211211// //////////////////////////////////////////////////////////////////
212212
213- Value::CommentInfo::CommentInfo () : comment_(0 ) {}
213+ Value::CommentInfo::CommentInfo () : comment_(nullptr ) {}
214214
215215Value::CommentInfo::~CommentInfo () {
216216 if (comment_)
@@ -220,9 +220,9 @@ Value::CommentInfo::~CommentInfo() {
220220void Value::CommentInfo::setComment (const char * text, size_t len) {
221221 if (comment_) {
222222 releaseStringValue (comment_, 0u );
223- comment_ = 0 ;
223+ comment_ = nullptr ;
224224 }
225- JSON_ASSERT (text != 0 );
225+ JSON_ASSERT (text != nullptr );
226226 JSON_ASSERT_MESSAGE (
227227 text[0 ] == ' \0 ' || text[0 ] == ' /' ,
228228 " in Json::Value::setComment(): Comments must start with /" );
@@ -241,7 +241,7 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
241241// Notes: policy_ indicates if the string was allocated when
242242// a string is stored.
243243
244- Value::CZString::CZString (ArrayIndex index) : cstr_(0 ), index_(index) {}
244+ Value::CZString::CZString (ArrayIndex index) : cstr_(nullptr ), index_(index) {}
245245
246246Value::CZString::CZString (char const * str,
247247 unsigned length,
@@ -253,7 +253,7 @@ Value::CZString::CZString(char const* str,
253253}
254254
255255Value::CZString::CZString (const CZString& other) {
256- cstr_ = (other.storage_ .policy_ != noDuplication && other.cstr_ != 0
256+ cstr_ = (other.storage_ .policy_ != noDuplication && other.cstr_ != nullptr
257257 ? duplicateStringValue (other.cstr_ , other.storage_ .length_ )
258258 : other.cstr_ );
259259 storage_.policy_ =
@@ -413,7 +413,7 @@ Value::Value(double value) {
413413
414414Value::Value (const char * value) {
415415 initBasic (stringValue, true );
416- JSON_ASSERT_MESSAGE (value != NULL , " Null Value Passed to Value Constructor" );
416+ JSON_ASSERT_MESSAGE (value != nullptr , " Null Value Passed to Value Constructor" );
417417 value_.string_ = duplicateAndPrefixStringValue (
418418 value, static_cast <unsigned >(strlen (value)));
419419}
@@ -528,7 +528,7 @@ bool Value::operator<(const Value& other) const {
528528 case booleanValue:
529529 return value_.bool_ < other.value_ .bool_ ;
530530 case stringValue: {
531- if ((value_.string_ == 0 ) || (other.value_ .string_ == 0 )) {
531+ if ((value_.string_ == nullptr ) || (other.value_ .string_ == nullptr )) {
532532 if (other.value_ .string_ )
533533 return true ;
534534 else
@@ -590,7 +590,7 @@ bool Value::operator==(const Value& other) const {
590590 case booleanValue:
591591 return value_.bool_ == other.value_ .bool_ ;
592592 case stringValue: {
593- if ((value_.string_ == 0 ) || (other.value_ .string_ == 0 )) {
593+ if ((value_.string_ == nullptr ) || (other.value_ .string_ == nullptr )) {
594594 return (value_.string_ == other.value_ .string_ );
595595 }
596596 unsigned this_len;
@@ -622,8 +622,8 @@ bool Value::operator!=(const Value& other) const { return !(*this == other); }
622622const char * Value::asCString () const {
623623 JSON_ASSERT_MESSAGE (type_ == stringValue,
624624 " in Json::Value::asCString(): requires stringValue" );
625- if (value_.string_ == 0 )
626- return 0 ;
625+ if (value_.string_ == nullptr )
626+ return nullptr ;
627627 unsigned this_len;
628628 char const * this_str;
629629 decodePrefixedString (this ->allocated_ , this ->value_ .string_ , &this_len,
@@ -648,7 +648,7 @@ unsigned Value::getCStringLength() const {
648648bool Value::getString (char const ** begin, char const ** end) const {
649649 if (type_ != stringValue)
650650 return false ;
651- if (value_.string_ == 0 )
651+ if (value_.string_ == nullptr )
652652 return false ;
653653 unsigned length;
654654 decodePrefixedString (this ->allocated_ , this ->value_ .string_ , &length, begin);
@@ -661,7 +661,7 @@ JSONCPP_STRING Value::asString() const {
661661 case nullValue:
662662 return " " ;
663663 case stringValue: {
664- if (value_.string_ == 0 )
664+ if (value_.string_ == nullptr )
665665 return " " ;
666666 unsigned this_len;
667667 char const * this_str;
@@ -1006,7 +1006,7 @@ const Value& Value::operator[](int index) const {
10061006void Value::initBasic (ValueType type, bool allocated) {
10071007 type_ = type;
10081008 allocated_ = allocated;
1009- comments_ = 0 ;
1009+ comments_ = nullptr ;
10101010 start_ = 0 ;
10111011 limit_ = 0 ;
10121012}
@@ -1073,7 +1073,7 @@ void Value::dupMeta(const Value& other) {
10731073 strlen (otherComment.comment_ ));
10741074 }
10751075 } else {
1076- comments_ = 0 ;
1076+ comments_ = nullptr ;
10771077 }
10781078 start_ = other.start_ ;
10791079 limit_ = other.limit_ ;
@@ -1131,12 +1131,12 @@ Value const* Value::find(char const* begin, char const* end) const {
11311131 " in Json::Value::find(key, end, found): requires "
11321132 " objectValue or nullValue" );
11331133 if (type_ == nullValue)
1134- return NULL ;
1134+ return nullptr ;
11351135 CZString actualKey (begin, static_cast <unsigned >(end - begin),
11361136 CZString::noDuplication);
11371137 ObjectValues::const_iterator it = value_.map_ ->find (actualKey);
11381138 if (it == value_.map_ ->end ())
1139- return NULL ;
1139+ return nullptr ;
11401140 return &(*it).second ;
11411141}
11421142const Value& Value::operator [](const char * key) const {
@@ -1267,7 +1267,7 @@ Value Value::get(const CppTL::ConstString& key,
12671267
12681268bool Value::isMember (char const * begin, char const * end) const {
12691269 Value const * value = find (begin, end);
1270- return NULL != value;
1270+ return nullptr != value;
12711271}
12721272bool Value::isMember (char const * key) const {
12731273 return isMember (key, key + strlen (key));
@@ -1470,7 +1470,7 @@ void Value::setComment(const JSONCPP_STRING& comment,
14701470}
14711471
14721472bool Value::hasComment (CommentPlacement placement) const {
1473- return comments_ != 0 && comments_[placement].comment_ != 0 ;
1473+ return comments_ != nullptr && comments_[placement].comment_ != nullptr ;
14741474}
14751475
14761476JSONCPP_STRING Value::getComment (CommentPlacement placement) const {
0 commit comments