[gjs: 1/5] maint: Fix cppcheck warning about returning integer as pointer




commit adbd6f2612698ce9ded5b406e238b05f1521665f
Author: Philip Chimento <philip chimento gmail com>
Date:   Fri Mar 12 11:07:44 2021 -0800

    maint: Fix cppcheck warning about returning integer as pointer
    
    cppcheck does not know that gboolean is treated as a bool and is not a
    regular integer type, so add an explicit cast to type T.

 gi/arg-inl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gi/arg-inl.h b/gi/arg-inl.h
index 583980fa..19de766b 100644
--- a/gi/arg-inl.h
+++ b/gi/arg-inl.h
@@ -146,7 +146,7 @@ template <typename T, GITypeTag TAG = GI_TYPE_TAG_VOID>
 [[nodiscard]] inline T gjs_arg_get(GIArgument* arg) {
     if constexpr (std::is_same_v<T, bool> ||
                   (std::is_same_v<T, gboolean> && TAG == GI_TYPE_TAG_BOOLEAN))
-        return !!gjs_arg_member<T, TAG>(arg);
+        return T(!!gjs_arg_member<T, TAG>(arg));
 
     return gjs_arg_member<T, TAG>(arg);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]