OEMCrypto_DeleteUsageTable now returns OEMCrypto_SUCCESS

Copy of widevine change:
https://widevine-internal-review.googlesource.com/#/c/10911/

OEMCrypto_DeleteUsageTable used to return an error on every call
because UsageTable::Clear always returned false.  Since there is no
error checking that Clear can do, its return type has been changed to
void, and DeleteUsageTable now returns OEMCrypto_SUCCESS for all
calls.

bug: 16799906
Change-Id: Iaa2f572e4b0feb554877579596a7f43a64d20954
This commit is contained in:
Fred Gylys-Colwell
2014-08-12 14:14:46 -07:00
parent 50c7821602
commit 909887923d
3 changed files with 4 additions and 7 deletions

View File

@@ -1277,10 +1277,8 @@ OEMCryptoResult OEMCrypto_DeleteUsageTable() {
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) { if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
LOGI("-- OEMCryptoResult OEMCrypto_DeleteUsageTable()\n"); LOGI("-- OEMCryptoResult OEMCrypto_DeleteUsageTable()\n");
} }
if (crypto_engine->usage_table()->Clear()) { crypto_engine->usage_table()->Clear();
return OEMCrypto_SUCCESS; return OEMCrypto_SUCCESS;
} }
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
}
}; // namespace wvoec_mock }; // namespace wvoec_mock

View File

@@ -406,13 +406,12 @@ bool UsageTable::DeleteEntry(const std::vector<uint8_t> &pst) {
return SaveToFile(); return SaveToFile();
} }
bool UsageTable::Clear() { void UsageTable::Clear() {
wvcdm::AutoLock lock(lock_); wvcdm::AutoLock lock(lock_);
for (EntryMap::iterator i = table_.begin(); i != table_.end(); ++i) { for (EntryMap::iterator i = table_.begin(); i != table_.end(); ++i) {
if (i->second) delete i->second; if (i->second) delete i->second;
} }
table_.clear(); table_.clear();
return false;
} }
bool UsageTable::ComputeHash(const std::vector<uint8_t> &pst, bool UsageTable::ComputeHash(const std::vector<uint8_t> &pst,

View File

@@ -86,7 +86,7 @@ class UsageTable {
OEMCryptoResult UpdateTable(); OEMCryptoResult UpdateTable();
OEMCryptoResult DeactivateEntry(const std::vector<uint8_t> &pst); OEMCryptoResult DeactivateEntry(const std::vector<uint8_t> &pst);
bool DeleteEntry(const std::vector<uint8_t> &pst); bool DeleteEntry(const std::vector<uint8_t> &pst);
bool Clear(); void Clear();
private: private:
UsageTableEntry *FindEntryLocked(const std::vector<uint8_t> &pst); UsageTableEntry *FindEntryLocked(const std::vector<uint8_t> &pst);