Fix: field.hpp: various typos
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 30 May 2022 17:53:46 +0000 (13:53 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 11 Sep 2023 15:24:02 +0000 (11:24 -0400)
 * `Common{Unsigned, Signed}IntegerField` is derived by the
   `Common{Unsigned,Signed}EnumerationField` class so can't be final.

 * `CommonSignedIntegerField::value` should be `int64_t`.

 * Calling single precision function instead of double.

 * `CommonStringField::operator=` methods can throw.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib354f0bd4edc8f625494acedac1052c7f45ec67d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8185
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10828
Tested-by: jenkins <jenkins@lttng.org>
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>

src/cpp-common/bt2/field.hpp

index 7b6777182fd7fca144cf371811f60753a943aedc..a59ac9fdf686305060b96f26327dd133bb23978b 100644 (file)
@@ -402,7 +402,7 @@ struct TypeDescr<ConstBitArrayField> : public BitArrayFieldTypeDescr
 } /* namespace internal */
 
 template <typename LibObjT>
-class CommonUnsignedIntegerField final : public CommonField<LibObjT>
+class CommonUnsignedIntegerField : public CommonField<LibObjT>
 {
 private:
     using typename CommonField<LibObjT>::_ThisCommonField;
@@ -491,7 +491,7 @@ struct TypeDescr<ConstUnsignedIntegerField> : public UnsignedIntegerFieldTypeDes
 } /* namespace internal */
 
 template <typename LibObjT>
-class CommonSignedIntegerField final : public CommonField<LibObjT>
+class CommonSignedIntegerField : public CommonField<LibObjT>
 {
 private:
     using typename CommonField<LibObjT>::_ThisCommonField;
@@ -501,7 +501,7 @@ protected:
     using _ThisCommonSignedIntegerField = CommonSignedIntegerField<LibObjT>;
 
 public:
-    using Value = std::uint64_t;
+    using Value = std::int64_t;
 
     using Class = typename std::conditional<std::is_const<LibObjT>::value, ConstIntegerFieldClass,
                                             IntegerFieldClass>::type;
@@ -881,13 +881,13 @@ public:
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
-        bt_field_real_single_precision_set_value(this->libObjPtr(), val);
+        bt_field_real_double_precision_set_value(this->libObjPtr(), val);
         return *this;
     }
 
     Value value() const noexcept
     {
-        return bt_field_real_single_precision_get_value(this->libObjPtr());
+        return bt_field_real_double_precision_get_value(this->libObjPtr());
     }
 
     operator Value() const noexcept
@@ -944,7 +944,7 @@ public:
         return *this;
     }
 
-    CommonStringField<LibObjT>& operator=(const char * const val) noexcept
+    CommonStringField<LibObjT>& operator=(const char * const val)
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
@@ -957,7 +957,7 @@ public:
         return *this;
     }
 
-    CommonStringField<LibObjT>& operator=(const std::string& val) noexcept
+    CommonStringField<LibObjT>& operator=(const std::string& val)
     {
         return *this = val.data();
     }
This page took 0.02752 seconds and 4 git commands to generate.