From 6bf182af450094c2515bc4b815e051ed82439b72 Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 25 Jan 2024 04:45:44 -0800 Subject: [PATCH] Fix 2 AbslSpanParams findings: * This is a change required to migrate function parameters to absl::Span from const std::vector (2 times) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See go/vector2span for more information on why you've received this change and why it is important. This CL looks good? Just LGTM and Approve it! This CL doesn’t look good? This is what you can do: * Revert this CL, by replying "REVERT: " * File a bug under go/absl-span-params-bug for category AbslSpanParams if there's an issue with the CL content. * File a bug under go/rosie-bug if there's an issue with how the CL was managed. * For all other issues such as the formatting of the CL, please file a bug under go/clrobot-bug. * Revert this CL and not get a CL that cleans up these paths in the future by replying "BLOCKLIST: ". This is not reversible! We recommend to opt out the respective paths in your CL Robot configuration instead: go/clrobot-opt-out. This CL was generated by CL Robot - a tool that cleans up code findings (go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/METADATA by following go/clrobot#how-to-opt-in. Anything wrong with the signup? File a bug at go/clrobot-bug. #codehealth Tested: Local presubmit tests passed. PiperOrigin-RevId: 601411040 Change-Id: I4235e711867fde7cf3c9f27bb0cae3453853394d --- libwvdrmengine/oemcrypto/odk/test/odk_test_helper.cpp | 5 +++-- libwvdrmengine/oemcrypto/odk/test/odk_test_helper.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libwvdrmengine/oemcrypto/odk/test/odk_test_helper.cpp b/libwvdrmengine/oemcrypto/odk/test/odk_test_helper.cpp index 09841692..3bfa37cd 100644 --- a/libwvdrmengine/oemcrypto/odk/test/odk_test_helper.cpp +++ b/libwvdrmengine/oemcrypto/odk/test/odk_test_helper.cpp @@ -20,6 +20,7 @@ #include "odk_endian.h" #include "odk_structs.h" #include "odk_structs_priv.h" +#include "third_party/absl/types/span.h" namespace wvodk_test { @@ -670,7 +671,7 @@ OEMCryptoResult ODK_DumpSingleField(const uint8_t* buf, */ OEMCryptoResult ODK_IterFields(ODK_FieldMode mode, uint8_t* buf, const size_t size_in, size_t* size_out, - const std::vector& fields) { + absl::Span fields) { if (buf == nullptr || size_out == nullptr) { return ODK_ERROR_CORE_MESSAGE; } @@ -708,7 +709,7 @@ OEMCryptoResult ODK_IterFields(ODK_FieldMode mode, uint8_t* buf, } std::vector ODK_MakeTotalFields( - const std::vector& extra_fields, ODK_CoreMessage* core_message) { + absl::Span extra_fields, ODK_CoreMessage* core_message) { std::vector total_fields = { {ODK_UINT32, &(core_message->message_type), "message_type"}, {ODK_UINT32, &(core_message->message_length), "message_size"}, diff --git a/libwvdrmengine/oemcrypto/odk/test/odk_test_helper.h b/libwvdrmengine/oemcrypto/odk/test/odk_test_helper.h index 6dc26435..744ca51c 100644 --- a/libwvdrmengine/oemcrypto/odk/test/odk_test_helper.h +++ b/libwvdrmengine/oemcrypto/odk/test/odk_test_helper.h @@ -11,6 +11,7 @@ #include "odk_structs.h" #include "odk_structs_priv.h" +#include "third_party/absl/types/span.h" namespace wvodk_test { @@ -115,7 +116,7 @@ OEMCryptoResult ODK_ReadSingleField(const uint8_t* buf, const ODK_Field* field); OEMCryptoResult ODK_DumpSingleField(const uint8_t* buf, const ODK_Field* field); OEMCryptoResult ODK_IterFields(ODK_FieldMode mode, uint8_t* buf, size_t size_in, size_t* size_out, - const std::vector& fields); + absl::Span fields); void ODK_ExpectEqualBuf(const void* s1, const void* s2, size_t n, const std::vector& fields); void ODK_ResetOdkFields(std::vector* fields);