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

@@ -19,7 +19,7 @@ class Timer::Impl : virtual public android::RefBase {
private:
class ImplThread : public android::Thread {
public:
ImplThread() : Thread(false), handler_(NULL), period_ns_(0) {}
ImplThread() : Thread(false), handler_(nullptr), period_ns_(0) {}
virtual ~ImplThread() {};
bool Start(TimerHandler *handler, uint32_t time_in_secs) {
@@ -69,7 +69,7 @@ class Timer::Impl : virtual public android::RefBase {
}
bool IsRunning() {
return (impl_thread_ != NULL) && (impl_thread_->isRunning());
return (impl_thread_ != nullptr) && (impl_thread_->isRunning());
}
CORE_DISALLOW_COPY_AND_ASSIGN(Impl);

View File

@@ -100,7 +100,7 @@ CdmResponseType WvContentDecryptionModule::GenerateKeyRequest(
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
CdmResponseType sts;
if (license_type == kLicenseTypeRelease) {
sts = cdm_engine->OpenKeySetSession(key_set_id, property_set, NULL);
sts = cdm_engine->OpenKeySetSession(key_set_id, property_set, nullptr);
if (sts != NO_ERROR) return sts;
cdm_by_session_id_[key_set_id] = cdm_engine;
}
@@ -147,7 +147,7 @@ CdmResponseType WvContentDecryptionModule::AddKey(
if (!cdm_engine) return SESSION_NOT_FOUND_3;
// Save key_set_id, as CDM will return an empty key_set_id on release
CdmKeySetId release_key_set_id;
if (session_id.empty() && key_set_id != NULL) {
if (session_id.empty() && key_set_id != nullptr) {
release_key_set_id = *key_set_id;
}
CdmResponseType sts;
@@ -276,18 +276,18 @@ CdmResponseType WvContentDecryptionModule::GetSecureStopIds(
const std::string& app_id,
const CdmIdentifier& identifier,
std::vector<CdmSecureStopId>* ssids) {
if (ssids == NULL) {
if (ssids == nullptr) {
LOGE("WvContentDecryptionModule::GetSecureStopIds: ssid destination not "
"provided");
return PARAMETER_NULL;
}
CdmEngine* cdm_engine = EnsureCdmForIdentifier(identifier);
CdmResponseType sts = cdm_engine->ListUsageIds(app_id, kSecurityLevelL1,
NULL, ssids);
CdmResponseType sts =
cdm_engine->ListUsageIds(app_id, kSecurityLevelL1, nullptr, ssids);
std::vector<CdmSecureStopId> secure_stop_ids;
CdmResponseType sts_l3 = cdm_engine->ListUsageIds(app_id, kSecurityLevelL3,
NULL, &secure_stop_ids);
nullptr, &secure_stop_ids);
ssids->insert(ssids->end(), secure_stop_ids.begin(), secure_stop_ids.end());
return sts_l3 != NO_ERROR ? sts_l3 : sts;
}
@@ -381,7 +381,7 @@ CdmEngine* WvContentDecryptionModule::GetCdmForSessionId(
const std::string& session_id) {
// Use find to avoid creating empty entries when not found.
auto it = cdm_by_session_id_.find(session_id);
if (it == cdm_by_session_id_.end()) return NULL;
if (it == cdm_by_session_id_.end()) return nullptr;
return it->second;
}