bt2c::Uuid::Uuid(): accept `bt2s::string_view` instead of `CStringView`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 10 May 2024 19:23:45 +0000 (15:23 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
The input string doesn't need to be null-terminated.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1ae0be22ee44fc4b7969525224f0721689a12dd1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12760

src/cpp-common/bt2c/uuid.hpp

index 53a9321e4651f249dcdc99d06ca6e534b55c1c3c..ef481654bdfcb5ab445a76498808ba964a1582d5 100644 (file)
@@ -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);
     }
 
This page took 0.025107 seconds and 4 git commands to generate.