Fix C++11 Narrowing Errors in WVDrmPlugin

(This contains a merge of http://go/wvgerrit/13382 from the Widevine
repository.)

This undoes the previous change to silence harmless C++11 narrowing
warnings and instead changes the code to no longer trigger them. The
fix was to delcare the type of our PSSH prefix constant to be uint8_t*
and then convert it to char* at usage-time rather than defining the
not-technically-char* data as a char* to start.

Change-Id: I68ff8c3ed0859096863b49c61cd60ae8461b5b29
This commit is contained in:
John "Juce" Bruce
2015-03-06 15:32:47 -08:00
parent dff91b48c1
commit b331822558
2 changed files with 3 additions and 4 deletions

View File

@@ -1,8 +1,6 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CLANG_CFLAGS += -Wno-error=c++11-narrowing
LOCAL_SRC_FILES := \
src/WVDrmPlugin.cpp \
src/WVGenericCryptoInterface.cpp \

View File

@@ -170,7 +170,7 @@ status_t WVDrmPlugin::getKeyRequest(
!InitDataResemblesPSSH(initData)) {
// This data was passed in the old format, pre-unwrapped. We need to wrap
// the init data in a new PSSH header.
static const char psshPrefix[] = {
static const uint8_t psshPrefix[] = {
0, 0, 0, 0, // Total size
'p', 's', 's', 'h', // "PSSH"
0, 0, 0, 0, // Flags - must be zero
@@ -178,7 +178,8 @@ status_t WVDrmPlugin::getKeyRequest(
0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED,
0, 0, 0, 0 // Size of initData
};
processedInitData.assign(psshPrefix, sizeof(psshPrefix) / sizeof(char));
processedInitData.assign(reinterpret_cast<const char*>(psshPrefix),
sizeof(psshPrefix) / sizeof(uint8_t));
processedInitData.append(reinterpret_cast<const char*>(initData.array()),
initData.size());
const size_t kPsshBoxSizeLocation = 0;