Replace scoped_ptr With std::unique_ptr
(This is a merge of http://go/wvgerrit/65782) We have had our own scoped_ptr implementation that is used throughout the codebase. Now that we support C++11, we can replace these with std::unique_ptr. Doing this replacement exposed a few places where the two were not interchangeable. OEMCrypto Ref was doing some unsafe things with passing scoped_ptrs to functions and has been updated to use move semantics. And a few constructors were explicitly constructing a scoped_ptr with NULL, which is ambiguous with std::unique_ptr. These have been replaced with default constructor calls. Bug: 111851141 Test: CE CDM Unit Tests Test: Android Unit Tests Change-Id: I37d6d7aad4906709381c74f0c5439f826d2be768
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <time.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "file_store.h"
|
||||
#include "log.h"
|
||||
@@ -64,8 +65,8 @@ extern "C" OEMCryptoResult OEMCrypto_Initialize(void) {
|
||||
}
|
||||
// NOTE: This requires a compatible Filesystem implementation.
|
||||
// NOTE: Ownership of the FileSystem object is transferred to CryptoEngine
|
||||
scoped_ptr<wvcdm::FileSystem> fs(new wvcdm::FileSystem());
|
||||
crypto_engine = CryptoEngine::MakeCryptoEngine(fs);
|
||||
std::unique_ptr<wvcdm::FileSystem> fs(new wvcdm::FileSystem());
|
||||
crypto_engine = CryptoEngine::MakeCryptoEngine(std::move(fs));
|
||||
|
||||
if (!crypto_engine || !crypto_engine->Initialize()) {
|
||||
LOGE("[OEMCrypto_Initialize(): failed]");
|
||||
|
||||
Reference in New Issue
Block a user