Remove unused methods
[ Merge of http://go/wvgerrit/16405/ ] Methods in string conversion and license request tests were not being used. This was detected by static analysis cppcheck reports. b/26349052 Change-Id: I44779abf6b6fdc01b5391bff7d47be1d20ef84d2
This commit is contained in:
@@ -20,7 +20,6 @@ std::string Base64SafeEncodeNoPad(const std::vector<uint8_t>& bin_input);
|
|||||||
std::vector<uint8_t> Base64SafeDecode(const std::string& bin_input);
|
std::vector<uint8_t> Base64SafeDecode(const std::string& bin_input);
|
||||||
std::string HexEncode(const uint8_t* bytes, unsigned size);
|
std::string HexEncode(const uint8_t* bytes, unsigned size);
|
||||||
std::string IntToString(int value);
|
std::string IntToString(int value);
|
||||||
std::string UintToString(unsigned int value);
|
|
||||||
int64_t htonll64(int64_t x);
|
int64_t htonll64(int64_t x);
|
||||||
inline int64_t ntohll64(int64_t x) { return htonll64(x); }
|
inline int64_t ntohll64(int64_t x) { return htonll64(x); }
|
||||||
|
|
||||||
|
|||||||
@@ -157,18 +157,6 @@ std::string IntToString(int value) {
|
|||||||
return out_string;
|
return out_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UintToString(unsigned int value) {
|
|
||||||
// log10(2) ~= 0.3 bytes needed per bit or per byte log10(2**8) ~= 2.4.
|
|
||||||
// So round up to allocate 3 output characters per byte.
|
|
||||||
const int kOutputBufSize = 3 * sizeof(unsigned int);
|
|
||||||
char buffer[kOutputBufSize];
|
|
||||||
memset(buffer, 0, kOutputBufSize);
|
|
||||||
snprintf(buffer, kOutputBufSize, "%u", value);
|
|
||||||
|
|
||||||
std::string out_string(buffer);
|
|
||||||
return out_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t htonll64(int64_t x) { // Convert to big endian (network-byte-order)
|
int64_t htonll64(int64_t x) { // Convert to big endian (network-byte-order)
|
||||||
union {
|
union {
|
||||||
uint32_t array[2];
|
uint32_t array[2];
|
||||||
|
|||||||
@@ -55,30 +55,4 @@ void LicenseRequest::GetDrmMessage(const std::string& response,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns heartbeat url in heartbeat_url.
|
|
||||||
// The heartbeat url is stored as meta data in the response message.
|
|
||||||
void LicenseRequest::GetHeartbeatUrl(const std::string& response,
|
|
||||||
std::string& heartbeat_url) {
|
|
||||||
if (response.empty()) {
|
|
||||||
heartbeat_url.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t header_end_pos = FindHeaderEndPosition(response);
|
|
||||||
if (header_end_pos != std::string::npos) {
|
|
||||||
header_end_pos += kTwoBlankLines.size(); // points to response body
|
|
||||||
|
|
||||||
heartbeat_url.clear();
|
|
||||||
size_t heartbeat_url_pos = response.find("Heartbeat-Url: ", header_end_pos);
|
|
||||||
if (heartbeat_url_pos != std::string::npos) {
|
|
||||||
heartbeat_url_pos += sizeof("Heartbeat-Url: ");
|
|
||||||
heartbeat_url.assign(response.substr(heartbeat_url_pos));
|
|
||||||
} else {
|
|
||||||
LOGE("heartbeat url not found");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOGE("response body not found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ class LicenseRequest {
|
|||||||
~LicenseRequest() {};
|
~LicenseRequest() {};
|
||||||
|
|
||||||
void GetDrmMessage(const std::string& response, std::string& drm_msg);
|
void GetDrmMessage(const std::string& response, std::string& drm_msg);
|
||||||
void GetHeartbeatUrl(const std::string& response, std::string& heartbeat_url);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t FindHeaderEndPosition(const std::string& response) const;
|
size_t FindHeaderEndPosition(const std::string& response) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user