From dca534bf65ff84219258d5c9e4be4b3247978b96 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 10 May 2024 15:23:45 -0400 Subject: [PATCH] bt2c::Uuid::Uuid(): accept `bt2s::string_view` instead of `CStringView` The input string doesn't need to be null-terminated. Signed-off-by: Philippe Proulx Change-Id: I1ae0be22ee44fc4b7969525224f0721689a12dd1 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12760 --- src/cpp-common/bt2c/uuid.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp-common/bt2c/uuid.hpp b/src/cpp-common/bt2c/uuid.hpp index 53a9321e..ef481654 100644 --- a/src/cpp-common/bt2c/uuid.hpp +++ b/src/cpp-common/bt2c/uuid.hpp @@ -15,7 +15,7 @@ #include "common/assert.h" #include "common/uuid.h" -#include "cpp-common/bt2c/c-string-view.hpp" +#include "cpp-common/bt2s/string-view.hpp" namespace bt2c { @@ -135,9 +135,9 @@ public: this->_setFromPtr(uuid); } - explicit Uuid(const CStringView str) noexcept + explicit Uuid(const bt2s::string_view str) noexcept { - const auto ret = bt_uuid_from_c_str(str.data(), _mUuid.data()); + const auto ret = bt_uuid_from_str(str.data(), str.data() + str.size(), _mUuid.data()); BT_ASSERT(ret == 0); } -- 2.34.1