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:
@@ -25,7 +25,7 @@ std::unique_ptr<CdmClientPropertySetMap> Properties::session_property_set_;
|
||||
|
||||
bool Properties::AddSessionPropertySet(const CdmSessionId& session_id,
|
||||
CdmClientPropertySet* property_set) {
|
||||
if (NULL == session_property_set_.get()) {
|
||||
if (!session_property_set_) {
|
||||
return false;
|
||||
}
|
||||
std::pair<CdmClientPropertySetMap::iterator, bool> result =
|
||||
@@ -36,7 +36,7 @@ bool Properties::AddSessionPropertySet(const CdmSessionId& session_id,
|
||||
}
|
||||
|
||||
bool Properties::RemoveSessionPropertySet(const CdmSessionId& session_id) {
|
||||
if (NULL == session_property_set_.get()) {
|
||||
if (!session_property_set_) {
|
||||
return false;
|
||||
}
|
||||
return (1 == session_property_set_->erase(session_id));
|
||||
@@ -44,21 +44,21 @@ bool Properties::RemoveSessionPropertySet(const CdmSessionId& session_id) {
|
||||
|
||||
CdmClientPropertySet* Properties::GetCdmClientPropertySet(
|
||||
const CdmSessionId& session_id) {
|
||||
if (NULL != session_property_set_.get()) {
|
||||
if (session_property_set_) {
|
||||
CdmClientPropertySetMap::iterator it =
|
||||
session_property_set_->find(session_id);
|
||||
if (it != session_property_set_->end()) {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Properties::GetApplicationId(const CdmSessionId& session_id,
|
||||
std::string* app_id) {
|
||||
const CdmClientPropertySet* property_set =
|
||||
GetCdmClientPropertySet(session_id);
|
||||
if (NULL == property_set) {
|
||||
if (property_set == nullptr) {
|
||||
return false;
|
||||
}
|
||||
*app_id = property_set->app_id();
|
||||
@@ -69,7 +69,7 @@ bool Properties::GetServiceCertificate(const CdmSessionId& session_id,
|
||||
std::string* service_certificate) {
|
||||
const CdmClientPropertySet* property_set =
|
||||
GetCdmClientPropertySet(session_id);
|
||||
if (property_set == NULL) {
|
||||
if (property_set == nullptr) {
|
||||
return false;
|
||||
}
|
||||
*service_certificate = property_set->service_certificate();
|
||||
@@ -79,7 +79,7 @@ bool Properties::GetServiceCertificate(const CdmSessionId& session_id,
|
||||
bool Properties::SetServiceCertificate(const CdmSessionId& session_id,
|
||||
const std::string& service_certificate) {
|
||||
CdmClientPropertySet* property_set = GetCdmClientPropertySet(session_id);
|
||||
if (property_set == NULL) {
|
||||
if (property_set == nullptr) {
|
||||
return false;
|
||||
}
|
||||
property_set->set_service_certificate(service_certificate);
|
||||
@@ -89,7 +89,7 @@ bool Properties::SetServiceCertificate(const CdmSessionId& session_id,
|
||||
bool Properties::UsePrivacyMode(const CdmSessionId& session_id) {
|
||||
const CdmClientPropertySet* property_set =
|
||||
GetCdmClientPropertySet(session_id);
|
||||
if (NULL == property_set) {
|
||||
if (property_set == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return property_set->use_privacy_mode();
|
||||
@@ -98,7 +98,7 @@ bool Properties::UsePrivacyMode(const CdmSessionId& session_id) {
|
||||
uint32_t Properties::GetSessionSharingId(const CdmSessionId& session_id) {
|
||||
const CdmClientPropertySet* property_set =
|
||||
GetCdmClientPropertySet(session_id);
|
||||
if (NULL == property_set) {
|
||||
if (property_set == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return property_set->session_sharing_id();
|
||||
|
||||
Reference in New Issue
Block a user