summaryrefslogtreecommitdiff
path: root/girepository/gitypelib.c
diff options
context:
space:
mode:
authorTorsten Schönfeld <kaffeetisch@gmx.de>2011-08-13 17:28:30 +0200
committerTorsten Schönfeld <kaffeetisch@gmx.de>2011-08-16 18:43:23 +0200
commit169b206cbb4b347e4b17854e8f0c62a40404f803 (patch)
tree929ddaefcedf7c9d4778ea355e58f0b1cc2f2f96 /girepository/gitypelib.c
parent64848acb817369436d629d153c5750789c0addc3 (diff)
downloadgobject-introspection-169b206cbb4b347e4b17854e8f0c62a40404f803.tar.gz
Allow enums and bitfields to have static methods
This uses the same backcompat machinery that was introduced for static methods for non-class types, so this change does not break users of the existing presentations. New libgirepository API: g_enum_info_get_n_methods g_enum_info_get_method https://bugzilla.gnome.org/show_bug.cgi?id=656499
Diffstat (limited to 'girepository/gitypelib.c')
-rw-r--r--girepository/gitypelib.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c
index f610d458..2e5b0e1b 100644
--- a/girepository/gitypelib.c
+++ b/girepository/gitypelib.c
@@ -1428,6 +1428,7 @@ validate_enum_blob (ValidateContext *ctx,
GITypelib *typelib = ctx->typelib;
EnumBlob *blob;
gint i;
+ guint32 offset2;
if (typelib->len < offset + sizeof (EnumBlob))
{
@@ -1473,7 +1474,8 @@ validate_enum_blob (ValidateContext *ctx,
return FALSE;
if (typelib->len < offset + sizeof (EnumBlob) +
- blob->n_values * sizeof (ValueBlob))
+ blob->n_values * sizeof (ValueBlob) +
+ blob->n_methods * sizeof (FunctionBlob))
{
g_set_error (error,
G_TYPELIB_ERROR,
@@ -1482,22 +1484,22 @@ validate_enum_blob (ValidateContext *ctx,
return FALSE;
}
+ offset2 = offset + sizeof (EnumBlob);
+
push_context (ctx, get_string_nofail (typelib, blob->name));
- for (i = 0; i < blob->n_values; i++)
+ for (i = 0; i < blob->n_values; i++, offset2 += sizeof (ValueBlob))
{
if (!validate_value_blob (typelib,
- offset + sizeof (EnumBlob) +
- i * sizeof (ValueBlob),
+ offset2,
error))
return FALSE;
#if 0
- v1 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
- i * sizeof (ValueBlob)];
+ v1 = (ValueBlob *)&typelib->data[offset2];
for (j = 0; j < i; j++)
{
- v2 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
+ v2 = (ValueBlob *)&typelib->data[offset2 +
j * sizeof (ValueBlob)];
if (v1->value == v2->value)
@@ -1514,6 +1516,12 @@ validate_enum_blob (ValidateContext *ctx,
#endif
}
+ for (i = 0; i < blob->n_methods; i++, offset2 += sizeof (FunctionBlob))
+ {
+ if (!validate_function_blob (ctx, offset2, BLOB_TYPE_ENUM, error))
+ return FALSE;
+ }
+
pop_context (ctx);
return TRUE;