From ce0ea7b20b29b6b430d0cdfed981ceac97f53989 Mon Sep 17 00:00:00 2001 From: Alex Dale Date: Fri, 7 Jun 2019 11:15:42 -0700 Subject: [PATCH] Replace `typedef` with `using` statement in cdm/core/ files. [ Merge of http://go/wvgerrit/80805 ] This change was used only where `typedef` was used for type aliasing, and not for defining a new type (such as enums, structs, or function pointer types). Clang-format was used on the changed files. Test: WV unit tests Bug: 134437705 Change-Id: I730b9709a5ac773b3036daa79024caab665b3daa --- libwvdrmengine/cdm/core/include/cdm_engine.h | 4 +- .../cdm/core/include/cdm_session_map.h | 6 +-- .../cdm/core/include/crypto_session.h | 4 +- .../cdm/core/include/license_key_status.h | 20 +++++----- libwvdrmengine/cdm/core/include/properties.h | 2 +- .../cdm/core/include/wv_cdm_types.h | 40 +++++++++---------- .../cdm/core/src/license_key_status.cpp | 12 +++--- .../core/src/oemcrypto_adapter_dynamic.cpp | 2 +- .../cdm/core/test/license_keys_unittest.cpp | 4 +- .../policy_engine_constraints_unittest.cpp | 18 ++++----- 10 files changed, 56 insertions(+), 56 deletions(-) diff --git a/libwvdrmengine/cdm/core/include/cdm_engine.h b/libwvdrmengine/cdm/core/include/cdm_engine.h index e041ba18..309e72f7 100644 --- a/libwvdrmengine/cdm/core/include/cdm_engine.h +++ b/libwvdrmengine/cdm/core/include/cdm_engine.h @@ -33,8 +33,8 @@ class UsagePropertySet; class WvCdmEventListener; // Keep expiration time for each key set -typedef std::map > - CdmReleaseKeySetMap; +using CdmReleaseKeySetMap = + std::map >; class CdmEngine { public: diff --git a/libwvdrmengine/cdm/core/include/cdm_session_map.h b/libwvdrmengine/cdm/core/include/cdm_session_map.h index a52a553a..74b54906 100644 --- a/libwvdrmengine/cdm/core/include/cdm_session_map.h +++ b/libwvdrmengine/cdm/core/include/cdm_session_map.h @@ -15,7 +15,7 @@ namespace wvcdm { -typedef std::list > CdmSessionList; +using CdmSessionList = std::list >; // TODO(rfrias): Concurrency protection for this class has moved to CdmEngine. // Add it back when locks to control access to session usage and destruction @@ -43,8 +43,8 @@ class CdmSessionMap { void GetSessionList(CdmSessionList& sessions); private: - typedef std::map > - CdmIdToSessionMap; + using CdmIdToSessionMap = + std::map >; bool FindSessionNoLock(const CdmSessionId& session_id, std::shared_ptr* session); diff --git a/libwvdrmengine/cdm/core/include/crypto_session.h b/libwvdrmengine/cdm/core/include/crypto_session.h index 3974a0d1..6de7d0fe 100644 --- a/libwvdrmengine/cdm/core/include/crypto_session.h +++ b/libwvdrmengine/cdm/core/include/crypto_session.h @@ -26,7 +26,7 @@ namespace wvcdm { class CryptoKey; class UsageTableHeader; -typedef std::map CryptoKeyMap; +using CryptoKeyMap = std::map; // Crypto session utility functions used by KeySession implementations. void GenerateMacContext(const std::string& input_context, @@ -43,7 +43,7 @@ class CryptoSessionFactory; class CryptoSession { public: - typedef OEMCrypto_HDCP_Capability HdcpCapability; + using HdcpCapability = OEMCrypto_HDCP_Capability; typedef enum { kUsageDurationsInvalid = 0, kUsageDurationPlaybackNotBegun = 1, diff --git a/libwvdrmengine/cdm/core/include/license_key_status.h b/libwvdrmengine/cdm/core/include/license_key_status.h index 4c625da2..1c0d46f1 100644 --- a/libwvdrmengine/cdm/core/include/license_key_status.h +++ b/libwvdrmengine/cdm/core/include/license_key_status.h @@ -77,9 +77,9 @@ class LicenseKeys { } private: - typedef ::video_widevine::License::KeyContainer KeyContainer; - typedef std::map::const_iterator - LicenseKeyStatusIterator; + using KeyContainer = ::video_widevine::License::KeyContainer; + using LicenseKeyStatusIterator = + std::map::const_iterator; void Clear(); @@ -135,13 +135,13 @@ class LicenseKeyStatus { CryptoSession::HdcpCapability new_hdcp_level); protected: - typedef ::video_widevine::License::KeyContainer KeyContainer; - typedef KeyContainer::OperatorSessionKeyPermissions - OperatorSessionKeyPermissions; - typedef KeyContainer::OutputProtection OutputProtection; - typedef KeyContainer::VideoResolutionConstraint VideoResolutionConstraint; - typedef ::google::protobuf::RepeatedPtrField - ConstraintList; + using KeyContainer = ::video_widevine::License::KeyContainer; + using OperatorSessionKeyPermissions = + KeyContainer::OperatorSessionKeyPermissions; + using OutputProtection = KeyContainer::OutputProtection; + using VideoResolutionConstraint = KeyContainer::VideoResolutionConstraint; + using ConstraintList = + ::google::protobuf::RepeatedPtrField; LicenseKeyStatus(const KeyContainer& key, const CdmSecurityLevel level); diff --git a/libwvdrmengine/cdm/core/include/properties.h b/libwvdrmengine/cdm/core/include/properties.h index 3dc1b448..3e7aa62e 100644 --- a/libwvdrmengine/cdm/core/include/properties.h +++ b/libwvdrmengine/cdm/core/include/properties.h @@ -20,7 +20,7 @@ namespace wvcdm { -typedef std::map CdmClientPropertySetMap; +using CdmClientPropertySetMap = std::map; // This class saves information about features and properties enabled // for a given platform. At initialization it initializes properties from diff --git a/libwvdrmengine/cdm/core/include/wv_cdm_types.h b/libwvdrmengine/cdm/core/include/wv_cdm_types.h index 43cbca25..88c26046 100644 --- a/libwvdrmengine/cdm/core/include/wv_cdm_types.h +++ b/libwvdrmengine/cdm/core/include/wv_cdm_types.h @@ -14,25 +14,25 @@ namespace wvcdm { -typedef std::string CdmKeySystem; -typedef std::string CdmInitData; -typedef std::string CdmKeyMessage; -typedef std::string CdmKeyResponse; -typedef std::string KeyId; -typedef std::string CdmSecureStopId; -typedef std::string CdmSessionId; -typedef std::string CdmKeySetId; -typedef std::string RequestId; -typedef uint32_t CryptoResult; -typedef uint32_t CryptoSessionId; -typedef std::map CdmAppParameterMap; -typedef std::map CdmQueryMap; -typedef std::vector CdmUsageInfo; -typedef std::string CdmUsageInfoReleaseMessage; -typedef std::string CdmProvisioningRequest; -typedef std::string CdmProvisioningResponse; -typedef std::string CdmUsageTableHeader; -typedef std::string CdmUsageEntry; +using CdmKeySystem = std::string; +using CdmInitData = std::string; +using CdmKeyMessage = std::string; +using CdmKeyResponse = std::string; +using KeyId = std::string; +using CdmSecureStopId = std::string; +using CdmSessionId = std::string; +using CdmKeySetId = std::string; +using RequestId = std::string; +using CryptoResult = uint32_t; +using CryptoSessionId = uint32_t; +using CdmAppParameterMap = std::map; +using CdmQueryMap = std::map; +using CdmUsageInfo = std::vector; +using CdmUsageInfoReleaseMessage = std::string; +using CdmProvisioningRequest = std::string; +using CdmProvisioningResponse = std::string; +using CdmUsageTableHeader = std::string; +using CdmUsageEntry = std::string; enum CdmKeyRequestType { kKeyRequestTypeUnknown, @@ -411,7 +411,7 @@ enum CdmKeyStatus { kKeyStatusInternalError, kKeyStatusUsableInFuture, }; -typedef std::map CdmKeyStatusMap; +using CdmKeyStatusMap = std::map; enum CdmLicenseType { kLicenseTypeOffline, diff --git a/libwvdrmengine/cdm/core/src/license_key_status.cpp b/libwvdrmengine/cdm/core/src/license_key_status.cpp index ace80a17..ec8240dc 100644 --- a/libwvdrmengine/cdm/core/src/license_key_status.cpp +++ b/libwvdrmengine/cdm/core/src/license_key_status.cpp @@ -11,11 +11,11 @@ namespace { // License protocol aliases -typedef ::video_widevine::License::KeyContainer KeyContainer; -typedef KeyContainer::OutputProtection OutputProtection; -typedef KeyContainer::VideoResolutionConstraint VideoResolutionConstraint; -typedef ::google::protobuf::RepeatedPtrField - ConstraintList; +using KeyContainer = ::video_widevine::License::KeyContainer; +using OutputProtection = KeyContainer::OutputProtection; +using VideoResolutionConstraint = KeyContainer::VideoResolutionConstraint; +using ConstraintList = + ::google::protobuf::RepeatedPtrField; // Map the HDCP protection associated with a key in the license to // an equivalent OEMCrypto HDCP protection level @@ -49,7 +49,7 @@ wvcdm::CryptoSession::HdcpCapability ProtobufHdcpToOemCryptoHdcp( // specified resolution, or null if none match VideoResolutionConstraint* GetConstraintForRes( uint32_t res, ConstraintList& constraints_from_key) { - typedef ConstraintList::pointer_iterator Iterator; + using Iterator = ConstraintList::pointer_iterator; for (Iterator i = constraints_from_key.pointer_begin(); i != constraints_from_key.pointer_end(); ++i) { VideoResolutionConstraint* constraint = *i; diff --git a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp index 082dd83a..9dfce039 100644 --- a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp +++ b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp @@ -590,7 +590,7 @@ struct LevelSession { // 3 function pointers. The Adapter is a global singleton. class Adapter { public: - typedef std::map::iterator map_iterator; + using map_iterator = std::map::iterator; Adapter() : level1_valid_(false), level1_library_(NULL) {} diff --git a/libwvdrmengine/cdm/core/test/license_keys_unittest.cpp b/libwvdrmengine/cdm/core/test/license_keys_unittest.cpp index cbfa77d8..dcb7ca0e 100644 --- a/libwvdrmengine/cdm/core/test/license_keys_unittest.cpp +++ b/libwvdrmengine/cdm/core/test/license_keys_unittest.cpp @@ -67,8 +67,8 @@ using video_widevine::LicenseIdentification; using video_widevine::STREAMING; using video_widevine::OFFLINE; -typedef ::video_widevine::License::KeyContainer KeyContainer; -typedef KeyContainer::VideoResolutionConstraint VideoResolutionConstraint; +using KeyContainer = ::video_widevine::License::KeyContainer; +using VideoResolutionConstraint = KeyContainer::VideoResolutionConstraint; class LicenseKeysTest : public ::testing::Test { protected: diff --git a/libwvdrmengine/cdm/core/test/policy_engine_constraints_unittest.cpp b/libwvdrmengine/cdm/core/test/policy_engine_constraints_unittest.cpp index 1f5c1c6d..853b1b30 100644 --- a/libwvdrmengine/cdm/core/test/policy_engine_constraints_unittest.cpp +++ b/libwvdrmengine/cdm/core/test/policy_engine_constraints_unittest.cpp @@ -24,15 +24,15 @@ using video_widevine::STREAMING; namespace wvcdm { -typedef ::video_widevine::License License; -typedef ::video_widevine::License::KeyContainer KeyContainer; -typedef ::video_widevine::License::KeyContainer::OutputProtection - OutputProtection; -typedef ::video_widevine::License::KeyContainer:: - VideoResolutionConstraint VideoResolutionConstraint; -typedef ::google::protobuf::RepeatedPtrField KeyList; -typedef ::google::protobuf::RepeatedPtrField - ConstraintList; +using License = ::video_widevine::License; +using KeyContainer = ::video_widevine::License::KeyContainer; +using OutputProtection = + ::video_widevine::License::KeyContainer::OutputProtection; +using VideoResolutionConstraint = + ::video_widevine::License::KeyContainer::VideoResolutionConstraint; +using KeyList = ::google::protobuf::RepeatedPtrField; +using ConstraintList = + ::google::protobuf::RepeatedPtrField; using namespace testing;