Fix the build on sparc64. Two of these patches were taken from GNOME git,

and the other was submitted by Andrew Belashov <bel@orel.ru>.  Thanks
to linimon for providing a test bed.
This commit is contained in:
Joe Marcus Clarke 2010-02-11 07:19:22 +00:00
parent 236a7514fa
commit fae17ad287
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=249561
3 changed files with 2710 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
From e7b9f873f0152136af60753598077156e7ae1545 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 07 Jan 2010 21:12:15 +0000
Subject: Correctly cast to a CommonBlob when looking up embedded types
When looking at an embedded type (e.g. a Callback after a Field), the
offset we put in the info structure was to the CallbackBlob itself.
However the code in g_type_info_get_interface assumed that the offset
was to a SimpleTypeBlob, which it wasn't.
https://bugzilla.gnome.org/show_bug.cgi?id=606180
---
diff --git a/girepository/ginfo.c b/girepository/ginfo.c
index b11cc8f..ed2fc93 100644
--- girepository/ginfo.c
+++ girepository/ginfo.c
@@ -997,18 +997,38 @@ GIBaseInfo *
g_type_info_get_interface (GITypeInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
- SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
+ /* For embedded types, the given offset is a pointer to the actual blob,
+ * after the end of the field. In that case we know it's a "subclass" of
+ * CommonBlob, so use that to determine the info type.
+ */
if (rinfo->type_is_embedded)
- return (GIBaseInfo *) g_info_new (type->offset, (GIBaseInfo*)info, rinfo->typelib,
- rinfo->offset);
+ {
+ CommonBlob *common = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
+ GIInfoType info_type;
- if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
+ switch (common->blob_type)
+ {
+ case BLOB_TYPE_CALLBACK:
+ info_type = GI_INFO_TYPE_CALLBACK;
+ break;
+ default:
+ g_assert_not_reached ();
+ return NULL;
+ }
+ return (GIBaseInfo *) g_info_new (info_type, (GIBaseInfo*)info, rinfo->typelib,
+ rinfo->offset);
+ }
+ else
{
- InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset];
-
- if (blob->tag == GI_TYPE_TAG_INTERFACE)
- return g_info_from_entry (rinfo->repository, rinfo->typelib, blob->interface);
+ SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
+ if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
+ {
+ InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->tag == GI_TYPE_TAG_INTERFACE)
+ return g_info_from_entry (rinfo->repository, rinfo->typelib, blob->interface);
+ }
}
return NULL;
--
cgit v0.8.3.1

View file

@ -0,0 +1,12 @@
--- girepository/girnode.c.orig 2009-07-09 21:20:46.000000000 +0400
+++ girepository/girnode.c 2009-12-09 16:12:24.000000000 +0300
@@ -2288,7 +2288,8 @@
break;
case GI_TYPE_TAG_DOUBLE:
blob->size = sizeof (gdouble);
- *(gdouble*)&data[blob->offset] = (gdouble) parse_float_value (constant->value);
+ gdouble tmp = parse_float_value (constant->value);
+ memcpy (&data[blob->offset], &tmp, blob->size);
break;
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME: