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

@@ -179,8 +179,8 @@ class WvContentDecryptionModule : public android::RefBase, public TimerHandler {
// Finds the CdmEngine instance for the given identifier, creating one if
// needed.
CdmEngine* EnsureCdmForIdentifier(const CdmIdentifier& identifier);
// Finds the CdmEngine instance for the given session id, returning NULL if
// not found.
// Finds the CdmEngine instance for the given session id, returning nullptr
// if not found.
CdmEngine* GetCdmForSessionId(const std::string& session_id);
// Close all of the open CdmEngine instances. This is used when ready to close

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;
}

View File

@@ -279,7 +279,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
*response = decryptor_->GenerateKeyRequest(
session_id_, key_set_id_, "video/mp4", init_data,
license_type, app_parameters, NULL,
license_type, app_parameters, nullptr,
kDefaultCdmIdentifier, &key_request);
if (*response == KEY_MESSAGE) {
EXPECT_EQ(kKeyRequestTypeInitial, key_request.type);
@@ -299,7 +299,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
EXPECT_EQ(KEY_MESSAGE, decryptor_->GenerateKeyRequest(
session_id_, key_set_id_, "video/mp4", init_data,
license_type, app_parameters, NULL,
license_type, app_parameters, nullptr,
kDefaultCdmIdentifier, &key_request));
*server_url = key_request.url;
@@ -319,7 +319,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
EXPECT_EQ(expected_response, decryptor_->GenerateKeyRequest(
session_id, key_set_id, "video/mp4", init_data,
kLicenseTypeRelease, app_parameters, NULL,
kLicenseTypeRelease, app_parameters, nullptr,
kDefaultCdmIdentifier, &key_request));
if (expected_response == KEY_MESSAGE) {
@@ -414,7 +414,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
void VerifyKeyRequestResponse(const std::string& server_url,
const std::string& client_auth,
bool is_renewal) {
VerifyKeyRequestResponse(server_url, client_auth, is_renewal, NULL);
VerifyKeyRequestResponse(server_url, client_auth, is_renewal, nullptr);
}
void VerifyKeyRequestResponse(const std::string& server_url,
@@ -425,7 +425,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
CdmResponseType sts =
decryptor_->AddKey(session_id_, resp, &key_set_id_);
if (status == NULL) {
if (status == nullptr) {
EXPECT_EQ(KEY_ADDED, sts);
} else {
*status = sts;
@@ -441,7 +441,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
void Provision() {
CdmResponseType status = decryptor_->OpenSession(
config_.key_system(), NULL, kDefaultCdmIdentifier, NULL, &session_id_);
config_.key_system(), nullptr, kDefaultCdmIdentifier, nullptr, &session_id_);
switch (status) {
case NO_ERROR:
decryptor_->CloseSession(session_id_);
@@ -683,7 +683,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
std::string GetSecurityLevel(TestWvCdmClientPropertySet* property_set) {
decryptor_->OpenSession(config_.key_system(), property_set,
kDefaultCdmIdentifier, NULL, &session_id_);
kDefaultCdmIdentifier, nullptr, &session_id_);
CdmQueryMap query_info;
EXPECT_EQ(NO_ERROR,
decryptor_->QuerySessionStatus(session_id_, &query_info));
@@ -694,7 +694,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
}
CdmSecurityLevel GetDefaultSecurityLevel() {
std::string level = GetSecurityLevel(NULL);
std::string level = GetSecurityLevel(nullptr);
CdmSecurityLevel security_level = kSecurityLevelUninitialized;
if (level == QUERY_VALUE_SECURITY_LEVEL_L1) {
security_level = kSecurityLevelL1;
@@ -752,8 +752,8 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRequestTest) {
Provision();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(binary_key_id(), kLicenseTypeStreaming);
EXPECT_TRUE(!key_msg_.empty());
@@ -821,8 +821,8 @@ TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRequestTest) {
TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRenewalTest) {
Provision();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(binary_key_id(), kLicenseTypeStreaming);
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth(),
false);
@@ -901,12 +901,12 @@ TEST_F(WvCdmExtendedDurationTest, DecryptionCloseSessionConcurrencyTest) {
// Leave session open to avoid CDM termination
CdmSessionId session_id;
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id);
// Retrieve offline license
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(kOfflineClip2PstInitData, kLicenseTypeOffline);
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth(),
false);
@@ -916,8 +916,8 @@ TEST_F(WvCdmExtendedDurationTest, DecryptionCloseSessionConcurrencyTest) {
decryptor_->CloseSession(session_id_);
for (uint32_t j = 0; j < 500; ++j) {
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
EXPECT_EQ(KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id_));
CdmResponseType status = NO_ERROR;
@@ -927,7 +927,7 @@ TEST_F(WvCdmExtendedDurationTest, DecryptionCloseSessionConcurrencyTest) {
CloseSessionThread* thread = new CloseSessionThread();
thread->Start(decryptor_, session_id_, 500 /* 500 ms */);
thread = NULL;
thread = nullptr;
while (status == NO_ERROR) {
struct timespec delay_remaining;
@@ -973,7 +973,7 @@ TEST_F(WvCdmExtendedDurationTest, DecryptionCloseSessionConcurrencyTest) {
TEST_F(WvCdmExtendedDurationTest, DISABLED_UsageOverflowTest) {
Provision();
TestWvCdmClientPropertySet client_property_set;
TestWvCdmClientPropertySet* property_set = NULL;
TestWvCdmClientPropertySet* property_set = nullptr;
CdmSecurityLevel security_level = GetDefaultSecurityLevel();
FileSystem file_system;
@@ -985,7 +985,7 @@ TEST_F(WvCdmExtendedDurationTest, DISABLED_UsageOverflowTest) {
for (size_t i = 0; i < kMaxUsageTableSize + 100; ++i) {
decryptor_->OpenSession(config_.key_system(), property_set,
kDefaultCdmIdentifier, NULL, &session_id_);
kDefaultCdmIdentifier, nullptr, &session_id_);
std::string key_id = a2bs_hex(
"000000427073736800000000" // blob size and pssh
"EDEF8BA979D64ACEA3C827DCD51D21ED00000022" // Widevine system id
@@ -1038,8 +1038,8 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnTimerEvent) {
// Leave session open to run the CDM timer
CdmSessionId streaming_session_id;
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &streaming_session_id);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &streaming_session_id);
// override default settings unless configured through the command line
std::string key_id;
@@ -1049,8 +1049,8 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnTimerEvent) {
uint32_t initial_open_sessions =
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS);
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
VerifyKeyRequestResponse(kUatLicenseServer, client_auth, false);
@@ -1060,8 +1060,8 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnTimerEvent) {
session_id_.clear();
key_set_id_.clear();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id));
decryptor_->CloseSession(session_id_);
@@ -1102,8 +1102,8 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnOpenSession) {
uint32_t initial_open_sessions =
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS);
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
VerifyKeyRequestResponse(kUatLicenseServer, client_auth, false);
@@ -1113,16 +1113,16 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnOpenSession) {
session_id_.clear();
key_set_id_.clear();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id));
decryptor_->CloseSession(session_id_);
session_id_.clear();
GenerateKeyRelease(key_set_id);
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
EXPECT_GT(
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS),
@@ -1140,8 +1140,8 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnOpenSession) {
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS),
initial_open_sessions);
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
EXPECT_GT(
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS),
@@ -1184,8 +1184,8 @@ TEST_F(WvCdmExtendedDurationTest, DISABLED_AutomatedOfflineSessionReleaseTest) {
std::set<std::string> key_set_id_map;
for (uint32_t i = 0; i < num_key_set_ids; ++i) {
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
VerifyKeyRequestResponse(kUatLicenseServer, client_auth, false);
@@ -1198,8 +1198,8 @@ TEST_F(WvCdmExtendedDurationTest, DISABLED_AutomatedOfflineSessionReleaseTest) {
for (iter = key_set_id_map.begin(); iter != key_set_id_map.end(); ++iter) {
session_id_.clear();
key_set_id_.clear();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, *iter));
decryptor_->CloseSession(session_id_);
}
@@ -1241,8 +1241,8 @@ TEST_P(WvCdmStreamingNoPstTest, UsageTest) {
Unprovision();
Provision();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(binary_key_id(), kLicenseTypeStreaming);
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth(),
false);
@@ -1317,8 +1317,8 @@ TEST_P(WvCdmStreamingPstTest, UsageTest) {
Unprovision();
Provision();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(kStreamingClip8PstInitData, kLicenseTypeStreaming);
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth(),
false);
@@ -1384,8 +1384,8 @@ TEST_P(WvCdmStreamingUsageReportTest, UsageTest) {
Unprovision();
Provision();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(kStreamingClip8PstInitData, kLicenseTypeStreaming);
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth(),
false);
@@ -1493,8 +1493,8 @@ TEST_P(WvCdmOfflineUsageReportTest, UsageTest) {
Unprovision();
Provision();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(kOfflineClip2PstInitData, kLicenseTypeOffline);
VerifyKeyRequestResponse(config_.license_server(), config_.client_auth(),
false);
@@ -1518,8 +1518,8 @@ TEST_P(WvCdmOfflineUsageReportTest, UsageTest) {
for (size_t i = 0; i < GetParam(); ++i) {
session_id_.clear();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
EXPECT_EQ(KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id));
// Query and validate usage information
@@ -1562,8 +1562,8 @@ TEST_P(WvCdmOfflineUsageReportTest, UsageTest) {
}
session_id_.clear();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
EXPECT_EQ(KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id));
// Query and validate usage information
@@ -1612,8 +1612,8 @@ TEST_F(WvCdmExtendedDurationTest, MaxUsageEntryOfflineRecoveryTest) {
// licenses will be deleted internally to make space and we will
// not encounter an error.
for (size_t i = 0; i < 2000; ++i) {
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(kOfflineClip2PstInitData, kLicenseTypeOffline);
VerifyKeyRequestResponse(config_.license_server(), client_auth, false);
@@ -1625,8 +1625,8 @@ TEST_F(WvCdmExtendedDurationTest, MaxUsageEntryOfflineRecoveryTest) {
uint32_t number_of_valid_offline_sessions = 0;
for (size_t i = 0; i < key_set_ids.size(); ++i) {
session_id_.clear();
decryptor_->OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
CdmResponseType result = decryptor_->RestoreKey(session_id_,
key_set_ids[i]);

View File

@@ -298,7 +298,7 @@ class WvCdmFeatureTest : public WvCdmTestBase {
void GenerateKeyRequest(const std::string& init_data,
CdmLicenseType license_type) {
GenerateKeyRequest(init_data, license_type, NULL);
GenerateKeyRequest(init_data, license_type, nullptr);
}
void GenerateKeyRequest(const std::string& init_data,
@@ -401,8 +401,8 @@ class WvCdmFeatureTest : public WvCdmTestBase {
// To run this test set options,
// * use_keybox 0
TEST_F(WvCdmFeatureTest, OEMCertificateProvisioning) {
decryptor_.OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_.OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
std::string provisioning_server_url;
CdmCertificateType cert_type = kCertificateWidevine;
std::string cert_authority, cert, wrapped_key;
@@ -438,8 +438,8 @@ TEST_F(WvCdmFeatureTest, OEMCertificateProvisioning) {
// To run this test set options,
// * use_keybox 1
TEST_F(WvCdmFeatureTest, KeyboxProvisioning) {
decryptor_.OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
NULL, &session_id_);
decryptor_.OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
std::string provisioning_server_url;
CdmCertificateType cert_type = kCertificateWidevine;
std::string cert_authority, cert, wrapped_key;
@@ -495,7 +495,7 @@ TEST_P(WvCdmSrmTest, Srm) {
StrictMock<TestWvCdmEventListener> listener;
TestKeyVerifier verify_keys_callback(config->expected_key_ids);
decryptor_.OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
decryptor_.OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
&listener, &session_id_);
EXPECT_CALL(listener,
@@ -552,7 +552,7 @@ TEST_P(WvCdmSrmNotSupportedTest, Srm) {
StrictMock<TestWvCdmEventListener> listener;
TestKeyVerifier verify_keys_callback(config->expected_key_ids);
decryptor_.OpenSession(config_.key_system(), NULL, kDefaultCdmIdentifier,
decryptor_.OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
&listener, &session_id_);
EXPECT_CALL(listener,

File diff suppressed because it is too large Load Diff

View File

@@ -22,7 +22,7 @@ class TestTimerHandler : public TimerHandler {
TEST(TimerTest, ParametersCheck) {
Timer timer;
EXPECT_FALSE(timer.Start(NULL, 10));
EXPECT_FALSE(timer.Start(nullptr, 10));
TestTimerHandler handler;
EXPECT_FALSE(timer.Start(&handler, 0));

View File

@@ -101,8 +101,8 @@ TEST_F(WvContentDecryptionModuleMetricsTest, EngineAndSessionMetrics) {
// Openning the session will fail with NEEDS_PROVISIONING error. But it will
// still create some session-level stats.
EXPECT_EQ(CdmResponseType::NEED_PROVISIONING,
decryptor_.OpenSession(key_system, NULL,
kDefaultCdmIdentifier, NULL, &session_id));
decryptor_.OpenSession(key_system, nullptr, kDefaultCdmIdentifier,
nullptr, &session_id));
drm_metrics::WvCdmMetrics metrics;
ASSERT_EQ(wvcdm::NO_ERROR,
@@ -155,8 +155,8 @@ TEST_F(WvContentDecryptionModuleMetricsTest,
// each identifier.
for (int j = 0; j <= i; j ++) {
EXPECT_EQ(CdmResponseType::NEED_PROVISIONING,
decryptor_.OpenSession(key_system, NULL,
identifiers[i], NULL, &session_id));
decryptor_.OpenSession(key_system, nullptr, identifiers[i],
nullptr, &session_id));
}
}

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);
}