Replaced NULL with nullptr in Android CDM.

[ Merge of http://go/wvgerrit/85503 ]

Replacing a few instances of C's NULL with C++'s nullptr in some of the
smaller sub-directories in the CDM.

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

Bug: 120602075
Test: Android unittest
Change-Id: I926135ed4b85e9d2d58a014b4a62098b0cb7a373
This commit is contained in:
Alex Dale
2019-08-29 15:08:40 -07:00
parent 5bfdd515eb
commit 4e2c4d14fe
10 changed files with 322 additions and 331 deletions

View File

@@ -13,7 +13,7 @@ namespace wvcdm {
int64_t Clock::GetCurrentTime() {
struct timeval tv;
tv.tv_sec = tv.tv_usec = 0;
gettimeofday(&tv, NULL);
gettimeofday(&tv, nullptr);
return tv.tv_sec;
}

View File

@@ -38,10 +38,10 @@ bool FileUtils::Remove(const std::string& path) {
if (FileUtils::IsDirectory(path)) {
// Handle directory deletion
DIR* dir;
if ((dir = opendir(path.c_str())) != NULL) {
if ((dir = opendir(path.c_str())) != nullptr) {
// first remove files and dir within it
struct dirent* entry;
while ((entry = readdir(dir)) != NULL) {
while ((entry = readdir(dir)) != nullptr) {
if (!IsCurrentOrParentDirectory(entry->d_name)) {
std::string path_to_remove = path + kDirectoryDelimiter;
path_to_remove += entry->d_name;
@@ -76,7 +76,7 @@ bool FileUtils::Remove(const std::string& path) {
DIR* dir;
std::string dir_path = path.substr(0, delimiter_pos);
if ((dir = opendir(dir_path.c_str())) == NULL) {
if ((dir = opendir(dir_path.c_str())) == nullptr) {
LOGW("File::Remove: directory open failed for wildcard");
return false;
}
@@ -84,7 +84,7 @@ bool FileUtils::Remove(const std::string& path) {
struct dirent* entry;
std::string ext = path.substr(wildcard_pos + 1);
while ((entry = readdir(dir)) != NULL) {
while ((entry = readdir(dir)) != nullptr) {
size_t filename_len = strlen(entry->d_name);
if (filename_len > ext.size()) {
if (strcmp(entry->d_name + filename_len - ext.size(), ext.c_str()) ==
@@ -141,7 +141,7 @@ bool FileUtils::Copy(const std::string& src, const std::string& dest) {
}
bool FileUtils::List(const std::string& path, std::vector<std::string>* files) {
if (NULL == files) {
if (nullptr == files) {
LOGV("File::List: files destination not provided");
return false;
}
@@ -153,7 +153,7 @@ bool FileUtils::List(const std::string& path, std::vector<std::string>* files) {
}
DIR* dir = opendir(path.c_str());
if (dir == NULL) {
if (dir == nullptr) {
LOGW("File::List: unable to open directory %s: %d, %s", path.c_str(), errno,
strerror(errno));
return false;
@@ -161,7 +161,7 @@ bool FileUtils::List(const std::string& path, std::vector<std::string>* files) {
files->clear();
struct dirent* entry;
while ((entry = readdir(dir)) != NULL) {
while ((entry = readdir(dir)) != nullptr) {
if (!IsCurrentOrParentDirectory(entry->d_name)) {
files->push_back(entry->d_name);
}