Replacing NULL with nullptr in core/

[ Merge of http://go/wvgerrit/84647 ]
[ Merge of http://go/wvgerrit/84648 ]

Replacing most instances of C's NULL with C++'s nullptr.  Also changed
how a NULL check is performed on smart pointers.  They provided an
implicit boolean operator for null checks, meaning the underlying
pointer does not need to be compared directly (as it was in some places
before).

Note that clang-format has performed additional changes to some of the
test files that have not yet been formatted.

Bug: 120602075
Test: Linux and Android unittests
Change-Id: I06ddebe34b0ea6dfecedb5527e7e808e32f5269a
This commit is contained in:
Alex Dale
2019-08-19 14:18:25 -07:00
parent f4360552b7
commit ee995d5fae
27 changed files with 432 additions and 408 deletions

View File

@@ -10,7 +10,7 @@
namespace wvcdm {
bool BufferReader::Read1(uint8_t* v) {
if (v == NULL) {
if (v == nullptr) {
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}
@@ -27,7 +27,7 @@ bool BufferReader::Read1(uint8_t* v) {
// Internal implementation of multi-byte reads
template <typename T>
bool BufferReader::Read(T* v) {
if (v == NULL) {
if (v == nullptr) {
LOGE("Parse failure: Null output parameter when expecting non-null (%s)",
__PRETTY_FUNCTION__);
return false;
@@ -55,7 +55,7 @@ bool BufferReader::Read8(uint64_t* v) { return Read(v); }
bool BufferReader::Read8s(int64_t* v) { return Read(v); }
bool BufferReader::ReadString(std::string* str, size_t count) {
if (str == NULL) {
if (str == nullptr) {
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}
@@ -71,7 +71,7 @@ bool BufferReader::ReadString(std::string* str, size_t count) {
}
bool BufferReader::ReadVec(std::vector<uint8_t>* vec, size_t count) {
if (vec == NULL) {
if (vec == nullptr) {
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}
@@ -98,7 +98,7 @@ bool BufferReader::SkipBytes(size_t bytes) {
}
bool BufferReader::Read4Into8(uint64_t* v) {
if (v == NULL) {
if (v == nullptr) {
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}
@@ -112,7 +112,7 @@ bool BufferReader::Read4Into8(uint64_t* v) {
}
bool BufferReader::Read4sInto8s(int64_t* v) {
if (v == NULL) {
if (v == nullptr) {
LOGE("Parse failure: Null output parameter when expecting non-null");
return false;
}