Fix deprecated and printf warnings.
[ Merge of http://go/wvgerrit/118703 ] Bug: 182058081 Test: WV unit/integration tests Change-Id: I2d8995b8aab864a2d2f5161d12a473d34e67bad4
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "crypto_session.h"
|
#include "crypto_session.h"
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -1745,11 +1746,11 @@ CdmResponseType CryptoSession::GenerateUsageReport(
|
|||||||
static_cast<int>(pst_report.pst_length()));
|
static_cast<int>(pst_report.pst_length()));
|
||||||
LOGV("OEMCrypto_PST_Report.padding: %d\n",
|
LOGV("OEMCrypto_PST_Report.padding: %d\n",
|
||||||
static_cast<int>(pst_report.padding()));
|
static_cast<int>(pst_report.padding()));
|
||||||
LOGV("OEMCrypto_PST_Report.seconds_since_license_received: %ld\n",
|
LOGV("OEMCrypto_PST_Report.seconds_since_license_received: %" PRId64 "\n",
|
||||||
pst_report.seconds_since_license_received());
|
pst_report.seconds_since_license_received());
|
||||||
LOGV("OEMCrypto_PST_Report.seconds_since_first_decrypt: %ld\n",
|
LOGV("OEMCrypto_PST_Report.seconds_since_first_decrypt: %" PRId64 "\n",
|
||||||
pst_report.seconds_since_first_decrypt());
|
pst_report.seconds_since_first_decrypt());
|
||||||
LOGV("OEMCrypto_PST_Report.seconds_since_last_decrypt: %ld\n",
|
LOGV("OEMCrypto_PST_Report.seconds_since_last_decrypt: %" PRId64 "\n",
|
||||||
pst_report.seconds_since_last_decrypt());
|
pst_report.seconds_since_last_decrypt());
|
||||||
LOGV("OEMCrypto_PST_Report: %s\n", b2a_hex(*usage_report).c_str());
|
LOGV("OEMCrypto_PST_Report: %s\n", b2a_hex(*usage_report).c_str());
|
||||||
|
|
||||||
|
|||||||
@@ -558,13 +558,16 @@ bool InitializationData::ConstructWidevineInitData(
|
|||||||
|
|
||||||
// Now format as Widevine init data protobuf
|
// Now format as Widevine init data protobuf
|
||||||
WidevinePsshData cenc_header;
|
WidevinePsshData cenc_header;
|
||||||
// TODO(rfrias): The algorithm is a deprecated field, but proto changes
|
// TODO(rfrias): The algorithm and provider are deprecated fields, but proto
|
||||||
// have not yet been pushed to production. Set until then.
|
// changes have not yet been pushed to production. Set until then.
|
||||||
|
CORE_UTIL_IGNORE_DEPRECATED
|
||||||
cenc_header.set_algorithm(WidevinePsshData_Algorithm_AESCTR);
|
cenc_header.set_algorithm(WidevinePsshData_Algorithm_AESCTR);
|
||||||
|
cenc_header.set_provider(provider);
|
||||||
|
CORE_UTIL_RESTORE_WARNINGS
|
||||||
|
|
||||||
for (size_t i = 0; i < key_ids.size(); ++i) {
|
for (size_t i = 0; i < key_ids.size(); ++i) {
|
||||||
cenc_header.add_key_ids(key_ids[i]);
|
cenc_header.add_key_ids(key_ids[i]);
|
||||||
}
|
}
|
||||||
cenc_header.set_provider(provider);
|
|
||||||
cenc_header.set_content_id(content_id);
|
cenc_header.set_content_id(content_id);
|
||||||
if (method == kHlsMethodAes128)
|
if (method == kHlsMethodAes128)
|
||||||
cenc_header.set_protection_scheme(kFourCcCbc1);
|
cenc_header.set_protection_scheme(kFourCcCbc1);
|
||||||
|
|||||||
@@ -716,8 +716,13 @@ TEST_P(HlsConstructionTest, InitData) {
|
|||||||
if (param.success_) {
|
if (param.success_) {
|
||||||
WidevinePsshData cenc_header;
|
WidevinePsshData cenc_header;
|
||||||
EXPECT_TRUE(cenc_header.ParseFromString(value));
|
EXPECT_TRUE(cenc_header.ParseFromString(value));
|
||||||
|
|
||||||
|
CORE_UTIL_IGNORE_DEPRECATED
|
||||||
EXPECT_EQ(video_widevine::WidevinePsshData_Algorithm_AESCTR,
|
EXPECT_EQ(video_widevine::WidevinePsshData_Algorithm_AESCTR,
|
||||||
cenc_header.algorithm());
|
cenc_header.algorithm());
|
||||||
|
EXPECT_EQ(param.provider_, cenc_header.provider());
|
||||||
|
CORE_UTIL_RESTORE_WARNINGS
|
||||||
|
|
||||||
for (size_t i = 0; i < param.key_ids_.size(); ++i) {
|
for (size_t i = 0; i < param.key_ids_.size(); ++i) {
|
||||||
bool key_id_found = false;
|
bool key_id_found = false;
|
||||||
if (param.key_ids_[i].size() != 32) continue;
|
if (param.key_ids_[i].size() != 32) continue;
|
||||||
@@ -729,7 +734,6 @@ TEST_P(HlsConstructionTest, InitData) {
|
|||||||
}
|
}
|
||||||
EXPECT_TRUE(key_id_found);
|
EXPECT_TRUE(key_id_found);
|
||||||
}
|
}
|
||||||
EXPECT_EQ(param.provider_, cenc_header.provider());
|
|
||||||
std::vector<uint8_t> param_content_id_vec(Base64Decode(param.content_id_));
|
std::vector<uint8_t> param_content_id_vec(Base64Decode(param.content_id_));
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
std::string(param_content_id_vec.begin(), param_content_id_vec.end()),
|
std::string(param_content_id_vec.begin(), param_content_id_vec.end()),
|
||||||
@@ -822,6 +826,8 @@ TEST_P(HlsParseTest, Parse) {
|
|||||||
|
|
||||||
WidevinePsshData cenc_header;
|
WidevinePsshData cenc_header;
|
||||||
EXPECT_TRUE(cenc_header.ParseFromString(init_data.data()));
|
EXPECT_TRUE(cenc_header.ParseFromString(init_data.data()));
|
||||||
|
|
||||||
|
CORE_UTIL_IGNORE_DEPRECATED
|
||||||
EXPECT_EQ(video_widevine::WidevinePsshData_Algorithm_AESCTR,
|
EXPECT_EQ(video_widevine::WidevinePsshData_Algorithm_AESCTR,
|
||||||
cenc_header.algorithm());
|
cenc_header.algorithm());
|
||||||
if (param.key_.compare(kJsonProvider) == 0) {
|
if (param.key_.compare(kJsonProvider) == 0) {
|
||||||
@@ -831,6 +837,7 @@ TEST_P(HlsParseTest, Parse) {
|
|||||||
} else if (param.key_.compare(kJsonKeyIds) == 0) {
|
} else if (param.key_.compare(kJsonKeyIds) == 0) {
|
||||||
EXPECT_EQ(param.value_, b2a_hex(cenc_header.key_ids(0)));
|
EXPECT_EQ(param.value_, b2a_hex(cenc_header.key_ids(0)));
|
||||||
}
|
}
|
||||||
|
CORE_UTIL_RESTORE_WARNINGS
|
||||||
|
|
||||||
EXPECT_EQ(kHlsIvHexValue, b2a_hex(init_data.hls_iv()));
|
EXPECT_EQ(kHlsIvHexValue, b2a_hex(init_data.hls_iv()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -78,9 +78,7 @@ struct LoggingUidSetter {
|
|||||||
// unit tests.
|
// unit tests.
|
||||||
CORE_UTIL_EXPORT void InitLogging();
|
CORE_UTIL_EXPORT void InitLogging();
|
||||||
|
|
||||||
// Only enable format specifier warnings on LP64 systems. There is
|
#ifdef __GNUC__
|
||||||
// no easy portable method to handle format specifiers for int64_t.
|
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && defined(__LP64__)
|
|
||||||
[[gnu::format(printf, 5, 6)]] CORE_UTIL_EXPORT void Log(const char* file,
|
[[gnu::format(printf, 5, 6)]] CORE_UTIL_EXPORT void Log(const char* file,
|
||||||
const char* function,
|
const char* function,
|
||||||
int line,
|
int line,
|
||||||
|
|||||||
@@ -11,12 +11,23 @@
|
|||||||
# else
|
# else
|
||||||
# define CORE_UTIL_EXPORT __declspec(dllimport)
|
# define CORE_UTIL_EXPORT __declspec(dllimport)
|
||||||
# endif
|
# endif
|
||||||
|
# define CORE_UTIL_IGNORE_DEPRECATED
|
||||||
|
# define CORE_UTIL_RESTORE_WARNINGS
|
||||||
#else
|
#else
|
||||||
# ifdef CORE_UTIL_IMPLEMENTATION
|
# ifdef CORE_UTIL_IMPLEMENTATION
|
||||||
# define CORE_UTIL_EXPORT __attribute__((visibility("default")))
|
# define CORE_UTIL_EXPORT __attribute__((visibility("default")))
|
||||||
# else
|
# else
|
||||||
# define CORE_UTIL_EXPORT
|
# define CORE_UTIL_EXPORT
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef __GNUC__
|
||||||
|
# define CORE_UTIL_IGNORE_DEPRECATED \
|
||||||
|
_Pragma("GCC diagnostic push") \
|
||||||
|
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||||
|
# define CORE_UTIL_RESTORE_WARNINGS _Pragma("GCC diagnostic pop")
|
||||||
|
# else
|
||||||
|
# define CORE_UTIL_IGNORE_DEPRECATED
|
||||||
|
# define CORE_UTIL_RESTORE_WARNINGS
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // WVCDM_UTIL_UTIL_COMMON_H_
|
#endif // WVCDM_UTIL_UTIL_COMMON_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user