From 1b514ab2e878216426acc493eeab96088576faf9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 20 Mar 2025 18:10:08 -0700
Subject: [PATCH] Make bt_field_blob_get_length return size_t instead of
 uint64_t

Fixes errors e.g.
| ../../git/src/cpp-common/bt2/field.hpp:1139:82: error: non-constant-expression cannot be narrowed from type 'std::uint64_t' (aka 'unsigned long long') to 'size_type' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
|  1139 |         return {internal::CommonBlobFieldSpec<LibObjT>::data(this->libObjPtr()), this->length()};
|       |                                                                                  ^~~~~~~~~~~~~~
| ../../git/src/plugins/ctf/common/src/msg-iter.cpp:744:56: note: in instantiation of member function 'bt2::CommonBlobField<bt_field>::data' requested here
|   744 |     std::memcpy(&this->_stackTopCurSubField().asBlob().data()[_mCurBlobFieldDataOffset],
|       |                                                        ^
| ../../git/src/cpp-common/bt2/field.hpp:1139:82: note: insert an explicit cast to silence this issue
|  1139 |         return {internal::CommonBlobFieldSpec<LibObjT>::data(this->libObjPtr()), this->length()};
|       |                                                                                  ^~~~~~~~~~~~~~
|       |                                                                                  static_cast<size_type>( )

Upstream-Status: Submitted [https://github.com/efficios/babeltrace/pull/120]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/cpp-common/bt2/field.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpp-common/bt2/field.hpp b/src/cpp-common/bt2/field.hpp
index 8b291f7a1..cbfff84f0 100644
--- a/src/cpp-common/bt2/field.hpp
+++ b/src/cpp-common/bt2/field.hpp
@@ -1139,7 +1139,7 @@ public:
         return {internal::CommonBlobFieldSpec<LibObjT>::data(this->libObjPtr()), this->length()};
     }
 
-    std::uint64_t length() const noexcept
+    std::size_t length() const noexcept
     {
         return bt_field_blob_get_length(this->libObjPtr());
     }
