Use absl::string_view in ODK

Since enabling C++17 for Widevine, we should be able to use absl::string_view since copybara can automatically translate between absl::string_view and std::string_view.

PiperOrigin-RevId: 586780379
Change-Id: I94d04bd3ab75085c482682539cf4bb2f046db864
This commit is contained in:
Vicky Min
2023-11-30 14:01:39 -08:00
committed by Robert Shih
parent 9e08fd15cf
commit 49debffe63
2 changed files with 5 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ extern "C" {
#define ODK_MINOR_VERSION 0 #define ODK_MINOR_VERSION 0
/* ODK Version string. Date changed automatically on each release. */ /* ODK Version string. Date changed automatically on each release. */
#define ODK_RELEASE_DATE "ODK v19.0 2023-11-21" #define ODK_RELEASE_DATE "ODK v19.0 2023-11-30"
/* The lowest version number for an ODK message. */ /* The lowest version number for an ODK message. */
#define ODK_FIRST_VERSION 16 #define ODK_FIRST_VERSION 16

View File

@@ -9,8 +9,10 @@
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
#include <string> #include <string>
#include <string_view>
#include <vector> #include <vector>
#include "OEMCryptoCENCCommon.h"
#include "core_message_serialize.h" #include "core_message_serialize.h"
#include "license_protocol.pb.h" #include "license_protocol.pb.h"
#include "odk_serialize.h" #include "odk_serialize.h"
@@ -32,8 +34,8 @@ using oemcrypto_core_message::features::CoreMessageFeatures;
* message: serialized license protobuf * message: serialized license protobuf
* field: substring value * field: substring value
*/ */
OEMCrypto_Substring GetOecSubstring(const std::string& message, OEMCrypto_Substring GetOecSubstring(std::string_view message,
const std::string& field) { std::string_view field) {
OEMCrypto_Substring substring = {}; OEMCrypto_Substring substring = {};
size_t pos = message.find(field); size_t pos = message.find(field);
if (pos != std::string::npos) { if (pos != std::string::npos) {