diff --git a/gfield.c b/gfield.c index 94c2fb597..486211fa9 100644 --- a/gfield.c +++ b/gfield.c @@ -2,6 +2,7 @@ #include "girepository.h" #include "girffi.h" +#include "config.h" /** * g_field_info_get_field: @@ -92,7 +93,13 @@ g_field_info_get_field (GIFieldInfo *field_info, result = TRUE; break; case GI_TYPE_TAG_TIME_T: - value->v_long = G_STRUCT_MEMBER(time_t, mem, offset); +#if SIZEOF_TIME_T == 4 + value->v_int32 = G_STRUCT_MEMBER(time_t, mem, offset); +#elif SIZEOF_TIME_T == 8 + value->v_int64 = G_STRUCT_MEMBER(time_t, mem, offset); +#else +# error "Unexpected size for time_t: not 4 or 8" +#endif result = TRUE; break; case GI_TYPE_TAG_UTF8: @@ -292,7 +299,13 @@ g_field_info_set_field (GIFieldInfo *field_info, result = TRUE; break; case GI_TYPE_TAG_TIME_T: - G_STRUCT_MEMBER(time_t, mem, offset) = value->v_long; +#if SIZEOF_TIME_T == 4 + G_STRUCT_MEMBER(time_t, mem, offset) = value->v_int32; +#elif SIZEOF_TIME_T == 8 + G_STRUCT_MEMBER(time_t, mem, offset) = value->v_int64; +#else +# error "Unexpected size for time_t: not 4 or 8" +#endif result = TRUE; break; case GI_TYPE_TAG_UTF8: diff --git a/girffi.c b/girffi.c index d7c52f696..d67cbf65c 100644 --- a/girffi.c +++ b/girffi.c @@ -152,20 +152,28 @@ g_ir_ffi_convert_arguments(GICallableInfo *callable_info, void **args) g_args[i].v_uint32 = *(guint32 *) args[i]; break; case GI_TYPE_TAG_LONG: + g_args[i].v_long = *(glong *) args[i]; + break; case GI_TYPE_TAG_INT64: - g_args[i].v_int64 = *(glong *) args[i]; + g_args[i].v_int64 = *(gint64 *) args[i]; break; case GI_TYPE_TAG_ULONG: + g_args[i].v_ulong = *(gulong *) args[i]; + break; case GI_TYPE_TAG_UINT64: - g_args[i].v_uint64 = *(glong *) args[i]; + g_args[i].v_uint64 = *(guint64 *) args[i]; break; case GI_TYPE_TAG_INT: + g_args[i].v_int = *(gint *) args[i]; + break; case GI_TYPE_TAG_SSIZE: + g_args[i].v_ssize = *(gssize *) args[i]; + break; case GI_TYPE_TAG_SIZE: - g_args[i].v_int32 = *(gint *) args[i]; + g_args[i].v_size = *(gsize *) args[i]; break; case GI_TYPE_TAG_UINT: - g_args[i].v_uint32 = *(guint *) args[i]; + g_args[i].v_uint = *(guint *) args[i]; break; case GI_TYPE_TAG_FLOAT: g_args[i].v_float = *(gfloat *) args[i];