From: Colin Walters Date: Sat, 23 Aug 2008 21:30:01 +0000 (+0000) Subject: Redo signature_offset to be cleaner and correct for vfuncs X-Git-Tag: GOBJECT_INTROSPECTION_0_5_0~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18adae33a7f353e2d4d0c5db3d78a9dbac3e0c1b;p=platform%2Fupstream%2Fgobject-introspection.git Redo signature_offset to be cleaner and correct for vfuncs svn path=/trunk/; revision=475 --- diff --git a/girepository/ginfo.c b/girepository/ginfo.c index 492d660..b48541a 100644 --- a/girepository/ginfo.c +++ b/girepository/ginfo.c @@ -515,16 +515,24 @@ g_function_info_get_vfunc (GIFunctionInfo *info) static guint32 signature_offset (GICallableInfo *info) { + int sigoff = -1; switch (info->base.type) { case GI_INFO_TYPE_FUNCTION: + sigoff = G_STRUCT_OFFSET (FunctionBlob, signature); + break; case GI_INFO_TYPE_VFUNC: - return *(guint32 *)&info->base.typelib->data[info->base.offset + 12]; + sigoff = G_STRUCT_OFFSET (VFuncBlob, signature); + break; case GI_INFO_TYPE_CALLBACK: + sigoff = G_STRUCT_OFFSET (CallbackBlob, signature); + break; case GI_INFO_TYPE_SIGNAL: - return *(guint32 *)&info->base.typelib->data[info->base.offset + 8]; + sigoff = G_STRUCT_OFFSET (SignalBlob, signature); + break; } - + if (sigoff >= 0) + return *(guint32 *)&info->base.typelib->data[info->base.offset + sigoff]; return 0; }