From: Philippe Proulx Date: Fri, 10 May 2024 19:23:45 +0000 (-0400) Subject: bt2c::Uuid::Uuid(): accept `bt2s::string_view` instead of `CStringView` X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=dca534bf65ff84219258d5c9e4be4b3247978b96;p=babeltrace.git 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 --- 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); }