[gjs: 1/2] gi/function: Fix condition in set_ffi_arg()




commit 90767fc9edae76c209c901ee00867ff19b8d8f16
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Jul 31 13:45:48 2022 +0200

    gi/function: Fix condition in set_ffi_arg()
    
    Commit 77aab924370 swapped '||' with '&&', which now leads to
    crashes when passing a GType down to C.
    
    https://gitlab.gnome.org/GNOME/gjs/-/issues/493

 gi/function.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index abb8b2c82..62e431d8f 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -181,7 +181,7 @@ template <typename T, GITypeTag TAG = GI_TYPE_TAG_VOID>
 static inline void set_ffi_arg(void* result, GIArgument* value) {
     if constexpr (std::is_integral_v<T> && std::is_signed_v<T>) {
         *static_cast<ffi_sarg*>(result) = gjs_arg_get<T, TAG>(value);
-    } else if constexpr (std::is_floating_point_v<T> && std::is_unsigned_v<T>) {
+    } else if constexpr (std::is_floating_point_v<T> || std::is_unsigned_v<T>) {
         *static_cast<ffi_arg*>(result) = gjs_arg_get<T, TAG>(value);
     } else if constexpr (std::is_pointer_v<T>) {
         *static_cast<ffi_arg*>(result) =


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