[gjs/mcatanzaro/#336] Fix build on 32-bit architectures
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/mcatanzaro/#336] Fix build on 32-bit architectures
- Date: Mon, 3 Aug 2020 21:43:59 +0000 (UTC)
commit ec20c4783de93f9b31f37c787a35d5cd602c9fec
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Aug 3 16:15:31 2020 -0500
Fix build on 32-bit architectures
Fixes #336
gi/arg-inl.h | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gi/arg-inl.h b/gi/arg-inl.h
index 7a109ef4..7f313769 100644
--- a/gi/arg-inl.h
+++ b/gi/arg-inl.h
@@ -113,7 +113,17 @@ GJS_USE inline decltype(auto) gjs_arg_member<char32_t>(GIArgument* arg) {
template <>
GJS_USE inline decltype(auto) gjs_arg_member<GType, GI_TYPE_TAG_GTYPE>(
GIArgument* arg) {
- return gjs_arg_member(arg, &GIArgument::v_size);
+ // GType is defined differently on 32-bit vs. 64-bit architectures. From gtype.h:
+ //
+ // #if GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined __cplusplus
+ // typedef gsize GType;
+ // #else /* for historic reasons, C++ links against gulong GTypes */
+ // typedef gulong GType;
+ // #endif
+ if constexpr (sizeof(gsize) != sizeof(gulong))
+ return gjs_arg_member(arg, &GIArgument::v_size);
+ else
+ return gjs_arg_member(arg, &GIArgument::v_ulong);
}
template <>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]