[gjs: 4/7] arg-cache: Make TypeInfo::type_info() non-const




commit 65f787fa73b2fa6f71d301ad8ecfbc97ed279adf
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Mar 5 17:56:36 2022 -0800

    arg-cache: Make TypeInfo::type_info() non-const
    
    In spirit is is a const object, but that cannot be passed to
    gobject-introspection C APIs because they take a non-const pointer.

 gi/arg-cache.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gi/arg-cache.cpp b/gi/arg-cache.cpp
index 177f246f4..6fa44fc9d 100644
--- a/gi/arg-cache.cpp
+++ b/gi/arg-cache.cpp
@@ -166,7 +166,10 @@ struct String {
 };
 
 struct TypeInfo {
-    constexpr const GITypeInfo* type_info() const { return &m_type_info; }
+    constexpr GITypeInfo* type_info() const {
+        // Should be const GITypeInfo*, but G-I APIs won't accept that
+        return const_cast<GITypeInfo*>(&m_type_info);
+    }
 
     GITypeInfo m_type_info;
 };


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