Replace Uses of .compare() in Device Files

(This is a merge of http://go/wvgerrit/13390 from the Widevine CDM
repository.)

Change-Id: I5b3595d5ef52b670e5ba5019746f03d934ae9625
This commit is contained in:
John "Juce" Bruce
2015-03-05 16:51:58 -08:00
parent a3b0d83d19
commit 2c809b62ca

View File

@@ -393,8 +393,7 @@ bool DeviceFiles::DeleteUsageInfo(const std::string& app_id,
int index = 0; int index = 0;
bool found = false; bool found = false;
for (; index < usage_info->sessions_size(); ++index) { for (; index < usage_info->sessions_size(); ++index) {
if (usage_info->sessions(index).token().compare(provider_session_token) == if (usage_info->sessions(index).token() == provider_session_token) {
0) {
found = true; found = true;
break; break;
} }
@@ -505,8 +504,7 @@ bool DeviceFiles::RetrieveUsageInfo(const std::string& app_id,
int index = 0; int index = 0;
bool found = false; bool found = false;
for (; index < file.usage_info().sessions_size(); ++index) { for (; index < file.usage_info().sessions_size(); ++index) {
if (file.usage_info().sessions(index).token().compare( if (file.usage_info().sessions(index).token() == provider_session_token) {
provider_session_token) == 0) {
found = true; found = true;
break; break;
} }
@@ -667,7 +665,7 @@ bool DeviceFiles::RetrieveHashedFile(const char* name,
return false; return false;
} }
if (hash.compare(hash_file.hash())) { if (hash != hash_file.hash()) {
LOGW("DeviceFiles::RetrieveHashedFile: Hash mismatch"); LOGW("DeviceFiles::RetrieveHashedFile: Hash mismatch");
// Remove the corrupted file so the caller will not get the same error // Remove the corrupted file so the caller will not get the same error
// when trying to access the file repeatedly, causing the system to stall. // when trying to access the file repeatedly, causing the system to stall.