[girepository] Remove trailing whitespace

This commit is contained in:
Johan Dahlin 2010-03-24 15:00:06 -03:00
parent a837d99ee6
commit 6b0463dd16
16 changed files with 971 additions and 971 deletions

View File

@ -158,7 +158,7 @@ dump_object_type (GType type, const char *symbol, GOutputStream *out)
GString *parent_str;
GType parent;
gboolean first = TRUE;
parent = type;
parent_str = g_string_new ("");
do
@ -170,9 +170,9 @@ dump_object_type (GType type, const char *symbol, GOutputStream *out)
g_string_append_c (parent_str, ',');
g_string_append (parent_str, g_type_name (parent));
} while (parent != G_TYPE_OBJECT && parent != G_TYPE_INVALID);
escaped_printf (out, " parents=\"%s\"", parent_str->str);
g_string_free (parent_str, TRUE);
}

318
ginfo.c
View File

@ -48,10 +48,10 @@ struct _GIRealInfo
GTypelib *typelib;
guint32 offset;
guint32 type_is_embedded : 1; /* Used by GITypeInfo */
guint32 reserved : 31;
gpointer reserved2[4];
};
@ -76,7 +76,7 @@ g_info_init (GIRealInfo *info,
GIInfoType type,
GIRepository *repository,
GIBaseInfo *container,
GTypelib *typelib,
GTypelib *typelib,
guint32 offset)
{
memset (info, 0, sizeof (GIRealInfo));
@ -100,7 +100,7 @@ GIBaseInfo *
g_info_new_full (GIInfoType type,
GIRepository *repository,
GIBaseInfo *container,
GTypelib *typelib,
GTypelib *typelib,
guint32 offset)
{
GIRealInfo *info;
@ -108,7 +108,7 @@ g_info_new_full (GIInfoType type,
g_return_val_if_fail (container != NULL || repository != NULL, NULL);
info = g_new (GIRealInfo, 1);
g_info_init (info, type, repository, container, typelib, offset);
info->ref_count = 1;
@ -123,7 +123,7 @@ g_info_new_full (GIInfoType type,
GIBaseInfo *
g_info_new (GIInfoType type,
GIBaseInfo *container,
GTypelib *typelib,
GTypelib *typelib,
guint32 offset)
{
return g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
@ -201,7 +201,7 @@ g_base_info_unref (GIBaseInfo *info)
GIInfoType
g_base_info_get_type (GIBaseInfo *info)
{
return ((GIRealInfo*)info)->type;
}
@ -265,7 +265,7 @@ g_base_info_get_name (GIBaseInfo *info)
case GI_INFO_TYPE_FIELD:
{
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
return g_typelib_get_string (rinfo->typelib, blob->name);
}
break;
@ -273,7 +273,7 @@ g_base_info_get_name (GIBaseInfo *info)
case GI_INFO_TYPE_ARG:
{
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
return g_typelib_get_string (rinfo->typelib, blob->name);
}
break;
@ -304,14 +304,14 @@ g_base_info_get_namespace (GIBaseInfo *info)
if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
{
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
return unresolved->namespace;
}
return g_typelib_get_string (rinfo->typelib, header->namespace);
}
gboolean
gboolean
g_base_info_is_deprecated (GIBaseInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo*) info;
@ -365,7 +365,7 @@ g_base_info_is_deprecated (GIBaseInfo *info)
default: ;
/* no deprecation flag for these */
}
return FALSE;
}
@ -399,7 +399,7 @@ cmp_attribute (const void *av,
{
const AttributeBlob *a = av;
const AttributeBlob *b = bv;
if (a->offset < b->offset)
return -1;
else if (a->offset == b->offset)
@ -415,7 +415,7 @@ find_first_attribute (GIRealInfo *rinfo)
AttributeBlob blob, *first, *res, *previous;
blob.offset = rinfo->offset;
first = (AttributeBlob *) &rinfo->typelib->data[header->attributes];
res = bsearch (&blob, first, header->n_attributes,
@ -545,13 +545,13 @@ g_function_info_get_flags (GIFunctionInfo *info)
GIFunctionInfoFlags flags;
GIRealInfo *rinfo = (GIRealInfo *)info;
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
flags = 0;
/* Make sure we don't flag Constructors as methods */
if (!blob->constructor && !blob->is_static)
flags = flags | GI_FUNCTION_IS_METHOD;
if (blob->constructor)
flags = flags | GI_FUNCTION_IS_CONSTRUCTOR;
@ -576,8 +576,8 @@ g_function_info_get_property (GIFunctionInfo *info)
GIRealInfo *rinfo = (GIRealInfo *)info;
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
GIInterfaceInfo *container = (GIInterfaceInfo *)rinfo->container;
return g_interface_info_get_property (container, blob->index);
return g_interface_info_get_property (container, blob->index);
}
GIVFuncInfo *
@ -586,8 +586,8 @@ g_function_info_get_vfunc (GIFunctionInfo *info)
GIRealInfo *rinfo = (GIRealInfo*)info;
FunctionBlob *blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
GIInterfaceInfo *container = (GIInterfaceInfo *)rinfo->container;
return g_interface_info_get_vfunc (container, blob->index);
return g_interface_info_get_vfunc (container, blob->index);
}
/* GICallableInfo functions */
@ -636,7 +636,7 @@ g_type_info_init (GIBaseInfo *info,
{
GIRealInfo *rinfo = (GIRealInfo*)container;
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
g_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib,
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
}
@ -734,7 +734,7 @@ g_callable_info_get_caller_owns (GICallableInfo *info)
*
* Returns: The number of arguments this callable expects.
*/
gint
gint
g_callable_info_get_n_args (GICallableInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
@ -765,8 +765,8 @@ g_callable_info_get_arg (GICallableInfo *info,
gint offset;
offset = signature_offset (info);
return (GIArgInfo *) g_info_new (GI_INFO_TYPE_ARG, (GIBaseInfo*)info, rinfo->typelib,
return (GIArgInfo *) g_info_new (GI_INFO_TYPE_ARG, (GIBaseInfo*)info, rinfo->typelib,
offset + header->signature_blob_size + n * header->arg_blob_size);
}
@ -792,9 +792,9 @@ g_callable_info_load_arg (GICallableInfo *info,
gint offset;
offset = signature_offset (info);
g_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
offset + header->signature_blob_size + n * header->arg_blob_size);
g_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
offset + header->signature_blob_size + n * header->arg_blob_size);
}
/* GIArgInfo function */
@ -803,7 +803,7 @@ g_arg_info_get_direction (GIArgInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->in && blob->out)
return GI_DIRECTION_INOUT;
else if (blob->out)
@ -817,7 +817,7 @@ g_arg_info_is_return_value (GIArgInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->return_value;
}
@ -826,7 +826,7 @@ g_arg_info_is_dipper (GIArgInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->dipper;
}
@ -835,7 +835,7 @@ g_arg_info_is_optional (GIArgInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->optional;
}
@ -844,7 +844,7 @@ g_arg_info_may_be_null (GIArgInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ArgBlob *blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->allow_none;
}
@ -899,7 +899,7 @@ GITypeInfo *
g_arg_info_get_type (GIArgInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
}
@ -919,7 +919,7 @@ g_arg_info_load_type (GIArgInfo *info,
GITypeInfo *type)
{
GIRealInfo *rinfo = (GIRealInfo*) info;
g_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
g_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
}
/* GITypeInfo functions */
@ -928,13 +928,13 @@ g_type_info_is_pointer (GITypeInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
return type->flags.pointer;
else
{
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&rinfo->typelib->data[rinfo->offset];
return iface->pointer;
}
}
@ -963,14 +963,14 @@ g_type_info_get_param_type (GITypeInfo *info,
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
{
ParamTypeBlob *param = (ParamTypeBlob *)&rinfo->typelib->data[rinfo->offset];
switch (param->tag)
{
case GI_TYPE_TAG_ARRAY:
case GI_TYPE_TAG_ARRAY:
case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
@ -1041,7 +1041,7 @@ g_type_info_get_array_length (GITypeInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
{
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
@ -1061,7 +1061,7 @@ g_type_info_get_array_fixed_size (GITypeInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
{
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
@ -1081,7 +1081,7 @@ g_type_info_is_zero_terminated (GITypeInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
{
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
@ -1098,7 +1098,7 @@ g_type_info_get_n_error_domains (GITypeInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
{
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
@ -1116,7 +1116,7 @@ g_type_info_get_error_domain (GITypeInfo *info,
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
{
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
@ -1146,13 +1146,13 @@ g_error_domain_info_get_codes (GIErrorDomainInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ErrorDomainBlob *blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
return (GIInterfaceInfo *) g_info_from_entry (rinfo->repository,
rinfo->typelib, blob->error_codes);
}
/* GIValueInfo functions */
/* GIValueInfo functions */
glong
g_value_info_get_value (GIValueInfo *info)
{
@ -1187,7 +1187,7 @@ g_field_info_get_size (GIFieldInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->bits;
}
@ -1196,7 +1196,7 @@ g_field_info_get_offset (GIFieldInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->struct_offset;
}
@ -1253,19 +1253,19 @@ g_registered_type_info_get_g_type (GIRegisteredTypeInfo *info)
GType (* get_type_func) (void);
GIRealInfo *rinfo = (GIRealInfo*)info;
type_init = g_registered_type_info_get_type_init (info);
type_init = g_registered_type_info_get_type_init (info);
if (type_init == NULL)
return G_TYPE_NONE;
else if (!strcmp (type_init, "intern"))
return G_TYPE_OBJECT;
get_type_func = NULL;
if (!g_typelib_symbol (rinfo->typelib,
type_init,
(void**) &get_type_func))
return G_TYPE_NONE;
return (* get_type_func) ();
}
@ -1275,7 +1275,7 @@ g_struct_info_get_n_fields (GIStructInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_fields;
}
@ -1305,8 +1305,8 @@ g_struct_info_get_field (GIStructInfo *info,
gint n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
g_struct_get_field_offset (info, n));
}
@ -1315,7 +1315,7 @@ g_struct_info_get_n_methods (GIStructInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_methods;
}
@ -1325,11 +1325,11 @@ g_struct_info_get_method (GIStructInfo *info,
{
GIRealInfo *rinfo = (GIRealInfo *)info;
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
gint offset;
offset = g_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
@ -1341,7 +1341,7 @@ find_method (GIBaseInfo *base,
{
/* FIXME hash */
GIRealInfo *rinfo = (GIRealInfo*)base;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
gint i;
for (i = 0; i < n_methods; i++)
@ -1350,12 +1350,12 @@ find_method (GIBaseInfo *base,
const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
if (strcmp (name, fname) == 0)
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, base,
rinfo->typelib, offset);
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, base,
rinfo->typelib, offset);
offset += header->function_blob_size;
}
return NULL;
}
@ -1365,7 +1365,7 @@ g_struct_info_find_method (GIStructInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->struct_blob_size
@ -1395,7 +1395,7 @@ g_struct_info_get_alignment (GIStructInfo *info)
/**
* g_struct_info_is_gtype_struct:
* @info: GIStructInfo
*
*
* Return true if this structure represents the "class structure" for some
* #GObject or #GInterface. This function is mainly useful to hide this kind of structure
* from generated public APIs.
@ -1425,10 +1425,10 @@ g_enum_info_get_value (GIEnumInfo *info,
gint n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
gint offset;
offset = rinfo->offset + header->enum_blob_size
offset = rinfo->offset + header->enum_blob_size
+ n * header->value_blob_size;
return (GIValueInfo *) g_info_new (GI_INFO_TYPE_VALUE, (GIBaseInfo*)info, rinfo->typelib, offset);
}
@ -1530,13 +1530,13 @@ g_object_info_get_field (GIObjectInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->object_blob_size
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ n * header->field_blob_size;
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset);
}
@ -1546,7 +1546,7 @@ g_object_info_get_n_properties (GIObjectInfo *info)
GIRealInfo *rinfo = (GIRealInfo *)info;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_properties;
return blob->n_properties;
}
GIPropertyInfo *
@ -1555,15 +1555,15 @@ g_object_info_get_property (GIObjectInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->object_blob_size
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ blob->n_fields * header->field_blob_size
+ n * header->property_blob_size;
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
@ -1582,17 +1582,17 @@ g_object_info_get_method (GIObjectInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->object_blob_size
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ blob->n_fields * header->field_blob_size
+ blob->n_properties * header->property_blob_size
+ n * header->function_blob_size;
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
GIFunctionInfo *
@ -1601,7 +1601,7 @@ g_object_info_find_method (GIObjectInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->object_blob_size
@ -1627,18 +1627,18 @@ g_object_info_get_signal (GIObjectInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->object_blob_size
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ blob->n_fields * header->field_blob_size
+ blob->n_properties * header->property_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_methods * header->function_blob_size
+ n * header->signal_blob_size;
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
gint
@ -1646,7 +1646,7 @@ g_object_info_get_n_vfuncs (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_vfuncs;
}
@ -1656,19 +1656,19 @@ g_object_info_get_vfunc (GIObjectInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->object_blob_size
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ blob->n_fields * header->field_blob_size
+ blob->n_properties * header->property_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size
+ n * header->vfunc_blob_size;
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
static GIVFuncInfo *
@ -1733,7 +1733,7 @@ g_object_info_get_n_constants (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_constants;
}
@ -1743,26 +1743,26 @@ g_object_info_get_constant (GIObjectInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->object_blob_size
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ blob->n_fields * header->field_blob_size
+ blob->n_properties * header->property_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size
+ blob->n_vfuncs * header->vfunc_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size
+ blob->n_vfuncs * header->vfunc_blob_size
+ n * header->constant_blob_size;
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
/**
* g_object_info_get_class_struct:
* @info: A #GIObjectInfo to query
*
*
* Every #GObject has two structures; an instance structure and a class
* structure. This function returns the metadata for the class structure.
*
@ -1809,7 +1809,7 @@ g_interface_info_get_n_properties (GIInterfaceInfo *info)
GIRealInfo *rinfo = (GIRealInfo *)info;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_properties;
return blob->n_properties;
}
GIPropertyInfo *
@ -1818,14 +1818,14 @@ g_interface_info_get_property (GIInterfaceInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->interface_blob_size
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ n * header->property_blob_size;
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
@ -1844,16 +1844,16 @@ g_interface_info_get_method (GIInterfaceInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->interface_blob_size
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ blob->n_properties * header->property_blob_size
+ blob->n_properties * header->property_blob_size
+ n * header->function_blob_size;
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
GIFunctionInfo *
@ -1862,7 +1862,7 @@ g_interface_info_find_method (GIInterfaceInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->interface_blob_size
@ -1887,17 +1887,17 @@ g_interface_info_get_signal (GIInterfaceInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->interface_blob_size
offset = rinfo->offset + header->interface_blob_size
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ blob->n_properties * header->property_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_properties * header->property_blob_size
+ blob->n_methods * header->function_blob_size
+ n * header->signal_blob_size;
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
gint
@ -1915,18 +1915,18 @@ g_interface_info_get_vfunc (GIInterfaceInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->interface_blob_size
offset = rinfo->offset + header->interface_blob_size
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ blob->n_properties * header->property_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_properties * header->property_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size
+ n * header->vfunc_blob_size;
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
/**
@ -1962,7 +1962,7 @@ g_interface_info_get_n_constants (GIInterfaceInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_constants;
}
@ -1972,19 +1972,19 @@ g_interface_info_get_constant (GIInterfaceInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->interface_blob_size
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ blob->n_properties * header->property_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size
+ blob->n_vfuncs * header->vfunc_blob_size
+ blob->n_methods * header->function_blob_size
+ blob->n_signals * header->signal_blob_size
+ blob->n_vfuncs * header->vfunc_blob_size
+ n * header->constant_blob_size;
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
/**
@ -2015,7 +2015,7 @@ g_property_info_get_flags (GIPropertyInfo *info)
GParamFlags flags;
GIRealInfo *rinfo = (GIRealInfo *)info;
PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
flags = 0;
if (blob->readable)
@ -2126,7 +2126,7 @@ g_vfunc_info_get_offset (GIVFuncInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->struct_offset;
}
@ -2138,7 +2138,7 @@ g_vfunc_info_get_signal (GIVFuncInfo *info)
if (blob->class_closure)
return g_interface_info_get_signal ((GIInterfaceInfo *)rinfo->container, blob->signal);
return NULL;
}
@ -2179,12 +2179,12 @@ GITypeInfo *
g_constant_info_get_type (GIConstantInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
}
gint
g_constant_info_get_value (GIConstantInfo *info,
g_constant_info_get_value (GIConstantInfo *info,
GArgument *value)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
@ -2266,7 +2266,7 @@ g_union_info_get_n_fields (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_fields;
}
@ -2275,10 +2275,10 @@ g_union_info_get_field (GIUnionInfo *info,
gint n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
rinfo->offset + header->union_blob_size +
Header *header = (Header *)rinfo->typelib->data;
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
rinfo->offset + header->union_blob_size +
n * header->field_blob_size);
}
@ -2287,7 +2287,7 @@ g_union_info_get_n_methods (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->n_functions;
}
@ -2297,13 +2297,13 @@ g_union_info_get_method (GIUnionInfo *info,
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
gint offset;
offset = rinfo->offset + header->union_blob_size
+ blob->n_fields * header->field_blob_size
offset = rinfo->offset + header->union_blob_size
+ blob->n_fields * header->field_blob_size
+ n * header->function_blob_size;
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
@ -2312,7 +2312,7 @@ g_union_info_is_discriminated (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->discriminated;
}
@ -2321,7 +2321,7 @@ g_union_info_get_discriminator_offset (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
return blob->discriminator_offset;
}
@ -2329,7 +2329,7 @@ GITypeInfo *
g_union_info_get_discriminator_type (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
}
@ -2339,19 +2339,19 @@ g_union_info_get_discriminator (GIUnionInfo *info,
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->discriminated)
{
Header *header = (Header *)rinfo->typelib->data;
Header *header = (Header *)rinfo->typelib->data;
gint offset;
offset = rinfo->offset + header->union_blob_size
+ blob->n_fields * header->field_blob_size
offset = rinfo->offset + header->union_blob_size
+ blob->n_fields * header->field_blob_size
+ blob->n_functions * header->function_blob_size
+ n * header->constant_blob_size;
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset);
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset);
}
return NULL;

View File

@ -40,31 +40,31 @@ g_invoke_error_quark (void)
/**
* g_function_info_invoke:
* @info: a #GIFunctionInfo describing the function to invoke
* @in_args: an array of #GArgument<!-- -->s, one for each in
* @in_args: an array of #GArgument<!-- -->s, one for each in
* parameter of @info. If there are no in parameter, @in_args
* can be %NULL
* @n_in_args: the length of the @in_args array
* @out_args: an array of #GArgument<!-- -->s, one for each out
* parameter of @info. If there are no out parameters, @out_args
* may be %NULL
* may be %NULL
* @n_out_args: the length of the @out_args array
* @return_value: return location for the return value of the
* @return_value: return location for the return value of the
* function. If the function returns void, @return_value may be
* %NULL
* @error: return location for detailed error information, or %NULL
*
* Invokes the function described in @info with the given
* Invokes the function described in @info with the given
* arguments. Note that inout parameters must appear in both
* argument lists. This function uses dlsym() to obtain a pointer
* to the function, so the library or shared object containing the
* described function must either be linked to the caller, or must
* to the function, so the library or shared object containing the
* described function must either be linked to the caller, or must
* have been dlopen()<!-- -->ed before calling this function.
*
* Returns: %TRUE if the function has been invoked, %FALSE if an
* error occurred.
* error occurred.
*/
gboolean
g_function_info_invoke (GIFunctionInfo *info,
gboolean
g_function_info_invoke (GIFunctionInfo *info,
const GArgument *in_args,
int n_in_args,
const GArgument *out_args,
@ -134,7 +134,7 @@ g_function_info_invoke (GIFunctionInfo *info,
atypes = g_alloca (sizeof (ffi_type*) * n_invoke_args);
args = g_alloca (sizeof (gpointer) * n_invoke_args);
if (is_method)
{
atypes[0] = &ffi_type_pointer;
@ -162,7 +162,7 @@ g_function_info_invoke (GIFunctionInfo *info,
args[i+offset] = (gpointer)&in_args[in_pos];
in_pos++;
break;
case GI_DIRECTION_OUT:
atypes[i+offset] = &ffi_type_pointer;
@ -172,12 +172,12 @@ g_function_info_invoke (GIFunctionInfo *info,
g_set_error (error,
G_INVOKE_ERROR,
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
"Too few \"out\" arguments (handling out)");
"Too few \"out\" arguments (handling out)");
goto out;
}
args[i+offset] = (gpointer)&out_args[out_pos];
out_pos++;
out_pos++;
break;
case GI_DIRECTION_INOUT:
atypes[i+offset] = &ffi_type_pointer;
@ -196,13 +196,13 @@ g_function_info_invoke (GIFunctionInfo *info,
g_set_error (error,
G_INVOKE_ERROR,
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
"Too few \"out\" arguments (handling inout)");
"Too few \"out\" arguments (handling inout)");
goto out;
}
args[i+offset] = (gpointer)&in_args[in_pos];
in_pos++;
out_pos++;
in_pos++;
out_pos++;
break;
default:
g_assert_not_reached ();
@ -229,7 +229,7 @@ g_function_info_invoke (GIFunctionInfo *info,
g_set_error (error,
G_INVOKE_ERROR,
G_INVOKE_ERROR_ARGUMENT_MISMATCH,
"Too many \"out\" arguments (at end)");
"Too many \"out\" arguments (at end)");
goto out;
}
@ -382,17 +382,17 @@ gi_cclosure_marshal_generic (GClosure *closure,
ffi_cif cif;
GCClosure *cc = (GCClosure*) closure;
if (return_gvalue && G_VALUE_TYPE (return_gvalue))
if (return_gvalue && G_VALUE_TYPE (return_gvalue))
{
rtype = value_to_ffi_type (return_gvalue, &rvalue);
}
else
else
{
rtype = &ffi_type_void;
}
rvalue = g_alloca (MAX (rtype->size, sizeof (ffi_arg)));
n_args = n_param_values + 1;
atypes = g_alloca (sizeof (ffi_type *) * n_args);
args = g_alloca (sizeof (gpointer) * n_args);
@ -401,7 +401,7 @@ gi_cclosure_marshal_generic (GClosure *closure,
{
if (G_CCLOSURE_SWAP_DATA (closure))
{
atypes[n_args-1] = value_to_ffi_type (param_values + 0,
atypes[n_args-1] = value_to_ffi_type (param_values + 0,
&args[n_args-1]);
atypes[0] = &ffi_type_pointer;
args[0] = &closure->data;

View File

@ -40,7 +40,7 @@ static GIRepository *default_repository = NULL;
static GSList *search_path = NULL;
static GSList *override_search_path = NULL;
struct _GIRepositoryPrivate
struct _GIRepositoryPrivate
{
GHashTable *typelibs; /* (string) namespace -> GTypelib */
GHashTable *lazy_typelibs; /* (string) namespace-version -> GTypelib */
@ -49,16 +49,16 @@ struct _GIRepositoryPrivate
G_DEFINE_TYPE (GIRepository, g_irepository, G_TYPE_OBJECT);
static void
static void
g_irepository_init (GIRepository *repository)
{
repository->priv = G_TYPE_INSTANCE_GET_PRIVATE (repository, G_TYPE_IREPOSITORY,
GIRepositoryPrivate);
repository->priv->typelibs
repository->priv->typelibs
= g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) NULL,
(GDestroyNotify) g_typelib_free);
repository->priv->lazy_typelibs
repository->priv->lazy_typelibs
= g_hash_table_new (g_str_hash, g_str_equal);
repository->priv->info_by_gtype
= g_hash_table_new_full (g_direct_hash, g_direct_equal,
@ -74,7 +74,7 @@ g_irepository_finalize (GObject *object)
g_hash_table_destroy (repository->priv->typelibs);
g_hash_table_destroy (repository->priv->lazy_typelibs);
g_hash_table_destroy (repository->priv->info_by_gtype);
(* G_OBJECT_CLASS (g_irepository_parent_class)->finalize) (G_OBJECT (repository));
}
@ -87,7 +87,7 @@ g_irepository_class_init (GIRepositoryClass *class)
gobject_class->finalize = g_irepository_finalize;
g_type_class_add_private (class, sizeof (GIRepositoryPrivate));
g_type_class_add_private (class, sizeof (GIRepositoryPrivate));
}
static void
@ -170,11 +170,11 @@ GSList *
build_search_path_with_overrides (void)
{
GSList *result;
if (override_search_path != NULL)
if (override_search_path != NULL)
{
result = g_slist_copy (override_search_path);
g_slist_last (result)->next = g_slist_copy (search_path);
}
}
else
result = g_slist_copy (search_path);
return result;
@ -216,7 +216,7 @@ get_repository (GIRepository *repository)
}
static GTypelib *
check_version_conflict (GTypelib *typelib,
check_version_conflict (GTypelib *typelib,
const gchar *namespace,
const gchar *expected_version,
char **version_conflict)
@ -230,11 +230,11 @@ check_version_conflict (GTypelib *typelib,
*version_conflict = NULL;
return typelib;
}
header = (Header*)typelib->data;
loaded_version = g_typelib_get_string (typelib, header->nsversion);
g_assert (loaded_version != NULL);
if (strcmp (expected_version, loaded_version) != 0)
{
if (version_conflict)
@ -259,7 +259,7 @@ get_registered_status (GIRepository *repository,
if (lazy_status)
*lazy_status = FALSE;
typelib = g_hash_table_lookup (repository->priv->typelibs, namespace);
if (typelib)
if (typelib)
return check_version_conflict (typelib, namespace, version, version_conflict);
typelib = g_hash_table_lookup (repository->priv->lazy_typelibs, namespace);
if (!typelib)
@ -291,7 +291,7 @@ load_dependencies_recurse (GIRepository *repository,
if (dependencies != NULL)
{
int i;
for (i = 0; dependencies[i]; i++)
{
char *dependency = dependencies[i];
@ -302,7 +302,7 @@ load_dependencies_recurse (GIRepository *repository,
last_dash = strrchr (dependency, '-');
dependency_namespace = g_strndup (dependency, last_dash - dependency);
dependency_version = last_dash+1;
if (!g_irepository_require (repository, dependency_namespace, dependency_version,
0, error))
{
@ -329,7 +329,7 @@ register_internal (GIRepository *repository,
const gchar *version;
g_return_val_if_fail (typelib != NULL, FALSE);
header = (Header *)typelib->data;
g_return_val_if_fail (header != NULL, FALSE);
@ -339,9 +339,9 @@ register_internal (GIRepository *repository,
if (lazy)
{
g_assert (!g_hash_table_lookup (repository->priv->lazy_typelibs,
g_assert (!g_hash_table_lookup (repository->priv->lazy_typelibs,
namespace));
g_hash_table_insert (repository->priv->lazy_typelibs,
g_hash_table_insert (repository->priv->lazy_typelibs,
build_typelib_key (namespace, source), (void *)typelib);
}
else
@ -352,9 +352,9 @@ register_internal (GIRepository *repository,
/* First, try loading all the dependencies */
if (!load_dependencies_recurse (repository, typelib, error))
return NULL;
/* Check if we are transitioning from lazily loaded state */
if (g_hash_table_lookup_extended (repository->priv->lazy_typelibs,
if (g_hash_table_lookup_extended (repository->priv->lazy_typelibs,
namespace,
(gpointer)&key, &value))
g_hash_table_remove (repository->priv->lazy_typelibs, key);
@ -416,7 +416,7 @@ g_irepository_load_typelib (GIRepository *repository,
namespace = g_typelib_get_string (typelib, header->namespace);
nsversion = g_typelib_get_string (typelib, header->nsversion);
if (get_registered_status (repository, namespace, nsversion, allow_lazy,
if (get_registered_status (repository, namespace, nsversion, allow_lazy,
&is_lazy, &version_conflict))
{
if (version_conflict != NULL)
@ -429,7 +429,7 @@ g_irepository_load_typelib (GIRepository *repository,
}
return namespace;
}
return register_internal (repository, "<builtin>",
return register_internal (repository, "<builtin>",
allow_lazy, typelib, error);
}
@ -445,11 +445,11 @@ g_irepository_load_typelib (GIRepository *repository,
* metadata in the namespace, you should call #g_irepository_require
* instead which will ensure the namespace is loaded, and return as
* quickly as this function will if it has already been loaded.
*
*
* Returns: %TRUE if namespace-version is loaded, %FALSE otherwise
*/
gboolean
g_irepository_is_registered (GIRepository *repository,
g_irepository_is_registered (GIRepository *repository,
const gchar *namespace,
const gchar *version)
{
@ -470,10 +470,10 @@ g_irepository_is_registered (GIRepository *repository,
* All methods on #GIRepository also accept %NULL as an instance
* parameter to mean this default repository, which is usually more
* convenient for C.
*
* Returns: (transfer none): The global singleton #GIRepository
*
* Returns: (transfer none): The global singleton #GIRepository
*/
GIRepository *
GIRepository *
g_irepository_get_default (void)
{
return get_repository (NULL);
@ -490,7 +490,7 @@ g_irepository_get_default (void)
*
* Returns: number of metadata entries
*/
gint
gint
g_irepository_get_n_infos (GIRepository *repository,
const gchar *namespace)
{
@ -500,7 +500,7 @@ g_irepository_get_n_infos (GIRepository *repository,
g_return_val_if_fail (namespace != NULL, -1);
repository = get_repository (repository);
typelib = get_registered (repository, namespace, NULL);
g_return_val_if_fail (typelib != NULL, -1);
@ -533,7 +533,7 @@ find_interface (gpointer key,
gint n_entries;
const gchar *name;
const gchar *type;
DirEntry *entry;
DirEntry *entry;
index = 0;
n_entries = ((Header *)typelib->data)->n_local_entries;
@ -624,7 +624,7 @@ find_interface (gpointer key,
*
* Returns: #GIBaseInfo containing metadata
*/
GIBaseInfo *
GIBaseInfo *
g_irepository_get_info (GIRepository *repository,
const gchar *namespace,
gint index)
@ -643,12 +643,12 @@ g_irepository_get_info (GIRepository *repository,
data.iface = NULL;
typelib = get_registered (repository, namespace, NULL);
g_return_val_if_fail (typelib != NULL, NULL);
find_interface ((void *)namespace, typelib, &data);
return data.iface;
return data.iface;
}
/**
@ -665,7 +665,7 @@ g_irepository_get_info (GIRepository *repository,
*
* Returns: #GIBaseInfo representing metadata about @type, or %NULL
*/
GIBaseInfo *
GIBaseInfo *
g_irepository_find_by_gtype (GIRepository *repository,
GType gtype)
{
@ -718,7 +718,7 @@ g_irepository_find_by_gtype (GIRepository *repository,
*
* Returns: #GIBaseInfo representing metadata about @name, or %NULL
*/
GIBaseInfo *
GIBaseInfo *
g_irepository_find_by_name (GIRepository *repository,
const gchar *namespace,
const gchar *name)
@ -737,7 +737,7 @@ g_irepository_find_by_name (GIRepository *repository,
data.iface = NULL;
typelib = get_registered (repository, namespace, NULL);
g_return_val_if_fail (typelib != NULL, NULL);
find_interface ((void *)namespace, typelib, &data);
@ -763,7 +763,7 @@ collect_namespaces (gpointer key,
*
* Returns: (utf8) (transfer full): List of namespaces
*/
gchar **
gchar **
g_irepository_get_loaded_namespaces (GIRepository *repository)
{
GList *l, *list = NULL;
@ -778,7 +778,7 @@ g_irepository_get_loaded_namespaces (GIRepository *repository)
names = g_malloc0 (sizeof (gchar *) * (g_list_length (list) + 1));
i = 0;
for (l = list; l; l = l->next)
names[i++] = g_strdup (l->data);
names[i++] = g_strdup (l->data);
g_list_free (list);
return names;
@ -895,14 +895,14 @@ g_irepository_get_c_prefix (GIRepository *repository,
* @namespace_: GI namespace to use, e.g. "Gtk"
*
* If namespace @namespace_ is loaded, return the full path to the
* .typelib file it was loaded from. If the typelib for
* .typelib file it was loaded from. If the typelib for
* namespace @namespace_ was included in a shared library, return
* the special string "$lt;builtin$gt;".
*
* Returns: Filesystem path (or $lt;builtin$gt;) if successful, %NULL if namespace is not loaded
*/
const gchar *
const gchar *
g_irepository_get_typelib_path (GIRepository *repository,
const gchar *namespace)
{
@ -915,7 +915,7 @@ g_irepository_get_typelib_path (GIRepository *repository,
{
if (!g_hash_table_lookup_extended (repository->priv->lazy_typelibs, namespace,
&orig_key, &value))
return NULL;
}
return ((char*)orig_key) + strlen ((char *) orig_key) + 1;
@ -933,14 +933,14 @@ find_namespace_version (const gchar *namespace,
GError *error = NULL;
GMappedFile *mfile = NULL;
char *fname;
fname = g_strdup_printf ("%s-%s.typelib", namespace, version);
tmp_path = build_search_path_with_overrides ();
for (ldir = tmp_path; ldir; ldir = ldir->next)
{
char *path = g_build_filename (ldir->data, fname, NULL);
mfile = g_mapped_file_new (path, FALSE, &error);
if (error)
{
@ -1022,7 +1022,7 @@ compare_candidate_reverse (struct NamespaceVersionCandidadate *c1,
return -1;
else if (result < 0)
return 1;
else
else
{
/* Now check the path index, which says how early in the search path
* we found it. This ensures that of equal version targets, we
@ -1067,7 +1067,7 @@ find_namespace_latest (const gchar *namespace,
namespace_typelib = g_strdup_printf ("%s.typelib", namespace);
index = 0;
tmp_path = build_search_path_with_overrides ();
tmp_path = build_search_path_with_overrides ();
for (ldir = tmp_path; ldir; ldir = ldir->next)
{
GDir *dir;
@ -1078,7 +1078,7 @@ find_namespace_latest (const gchar *namespace,
dir = g_dir_open (dirname, 0, NULL);
if (dir == NULL)
continue;
while ((entry = g_dir_read_name (dir)) != NULL)
while ((entry = g_dir_read_name (dir)) != NULL)
{
GMappedFile *mfile;
char *path, *version;
@ -1086,7 +1086,7 @@ find_namespace_latest (const gchar *namespace,
if (!g_str_has_suffix (entry, ".typelib"))
continue;
if (g_str_has_prefix (entry, namespace_dash))
{
const char *last_dash;
@ -1126,21 +1126,21 @@ find_namespace_latest (const gchar *namespace,
{
struct NamespaceVersionCandidadate *elected;
candidates = g_slist_sort (candidates, (GCompareFunc) compare_candidate_reverse);
elected = (struct NamespaceVersionCandidadate *) candidates->data;
/* Remove the elected one so we don't try to free its contents */
candidates = g_slist_delete_link (candidates, candidates);
result = elected->mfile;
*path_ret = elected->path;
*version_ret = elected->version;
g_free (elected); /* just free the container */
g_slist_foreach (candidates, (GFunc) free_candidate, NULL);
g_slist_free (candidates);
}
}
g_free (namespace_dash);
g_free (namespace_typelib);
g_slist_free (tmp_path);
g_slist_free (tmp_path);
return result;
}
@ -1182,7 +1182,7 @@ g_irepository_require (GIRepository *repository,
repository = get_repository (repository);
typelib = get_registered_status (repository, namespace, version, allow_lazy,
typelib = get_registered_status (repository, namespace, version, allow_lazy,
&is_lazy, &version_conflict);
if (typelib)
return typelib;
@ -1205,7 +1205,7 @@ g_irepository_require (GIRepository *repository,
{
mfile = find_namespace_latest (namespace, &tmp_version, &path);
}
if (mfile == NULL)
{
if (version != NULL)
@ -1225,7 +1225,7 @@ g_irepository_require (GIRepository *repository,
header = (Header *) typelib->data;
typelib_namespace = g_typelib_get_string (typelib, header->namespace);
typelib_version = g_typelib_get_string (typelib, header->nsversion);
if (strcmp (typelib_namespace, namespace) != 0)
{
g_set_error (error, G_IREPOSITORY_ERROR,
@ -1245,7 +1245,7 @@ g_irepository_require (GIRepository *repository,
goto out;
}
if (!register_internal (repository, path, allow_lazy,
if (!register_internal (repository, path, allow_lazy,
typelib, error))
{
g_typelib_free (typelib);
@ -1255,7 +1255,7 @@ g_irepository_require (GIRepository *repository,
out:
g_free (tmp_version);
g_free (path);
return ret;
return ret;
}
static gboolean

View File

@ -34,9 +34,9 @@ G_BEGIN_DECLS
#define G_IS_IREPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_IREPOSITORY))
#define G_IREPOSITORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_IREPOSITORY, GIRepositoryClass))
typedef struct _GIRepository GIRepository;
typedef struct _GIRepositoryClass GIRepositoryClass;
typedef struct _GIRepositoryPrivate GIRepositoryPrivate;
typedef struct _GIRepository GIRepository;
typedef struct _GIRepositoryClass GIRepositoryClass;
typedef struct _GIRepositoryPrivate GIRepositoryPrivate;
typedef struct _GIBaseInfoStub GIBaseInfo;
@ -73,8 +73,8 @@ typedef GIBaseInfo GIErrorDomainInfo;
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
typedef struct _GTypelib GTypelib;
struct _GIRepository
{
struct _GIRepository
{
GObject parent;
/*< private >*/
@ -82,8 +82,8 @@ struct _GIRepository
};
struct _GIRepositoryClass
{
GObjectClass parent;
{
GObjectClass parent;
};
typedef enum
@ -173,7 +173,7 @@ void gi_cclosure_marshal_generic (GClosure *closure,
/* Types of objects registered in the repository */
typedef enum
typedef enum
{
GI_INFO_TYPE_INVALID,
GI_INFO_TYPE_FUNCTION,
@ -226,7 +226,7 @@ gboolean g_base_info_equal (GIBaseInfo *info1,
GIBaseInfo * g_info_new (GIInfoType type,
GIBaseInfo *container,
GTypelib *typelib,
GTypelib *typelib,
guint32 offset);
@ -247,7 +247,7 @@ GIFunctionInfoFlags g_function_info_get_flags (GIFunctionInfo *info);
GIPropertyInfo * g_function_info_get_property (GIFunctionInfo *info);
GIVFuncInfo * g_function_info_get_vfunc (GIFunctionInfo *info);
typedef union
typedef union
{
gboolean v_boolean;
gint8 v_int8;
@ -282,7 +282,7 @@ typedef enum
G_INVOKE_ERROR_ARGUMENT_MISMATCH
} GInvokeError;
gboolean g_function_info_invoke (GIFunctionInfo *info,
gboolean g_function_info_invoke (GIFunctionInfo *info,
const GArgument *in_args,
int n_in_args,
const GArgument *out_args,
@ -323,8 +323,8 @@ typedef enum {
GI_SCOPE_TYPE_INVALID, /* The argument is not of callback type */
GI_SCOPE_TYPE_CALL, /* The callback and associated user_data is only used during the
call to this function */
GI_SCOPE_TYPE_ASYNC, /* The callback and associated user_data is
only used until the callback is invoked, and the callback
GI_SCOPE_TYPE_ASYNC, /* The callback and associated user_data is
only used until the callback is invoked, and the callback
is invoked always exactly once. */
GI_SCOPE_TYPE_NOTIFIED /* The callback and and associated user_data is
used until the caller is notfied via the destroy_notify */
@ -353,7 +353,7 @@ typedef enum {
GI_TYPE_TAG_INT8 = 2,
GI_TYPE_TAG_UINT8 = 3,
GI_TYPE_TAG_INT16 = 4,
GI_TYPE_TAG_UINT16 = 5,
GI_TYPE_TAG_UINT16 = 5,
GI_TYPE_TAG_INT32 = 6,
GI_TYPE_TAG_UINT32 = 7,
GI_TYPE_TAG_INT64 = 8,
@ -407,7 +407,7 @@ GIInterfaceInfo * g_error_domain_info_get_codes (GIErrorDomainInfo *in
/* GIValueInfo */
glong g_value_info_get_value (GIValueInfo *info);
@ -477,8 +477,8 @@ GITypeTag g_enum_info_get_storage_type (GIEnumInfo *in
/* GIObjectInfo */
const gchar * g_object_info_get_type_name (GIObjectInfo *info);
const gchar * g_object_info_get_type_init (GIObjectInfo *info);
const gchar * g_object_info_get_type_name (GIObjectInfo *info);
const gchar * g_object_info_get_type_init (GIObjectInfo *info);
gboolean g_object_info_get_abstract (GIObjectInfo *info);
GIObjectInfo * g_object_info_get_parent (GIObjectInfo *info);
gint g_object_info_get_n_interfaces (GIObjectInfo *info);
@ -508,7 +508,7 @@ GIConstantInfo * g_object_info_get_constant (GIObjectInfo *in
gint n);
GIStructInfo * g_object_info_get_class_struct (GIObjectInfo *info);
/* GIInterfaceInfo */
gint g_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
@ -521,7 +521,7 @@ gint g_interface_info_get_n_methods (GIInterfaceInfo *in
GIFunctionInfo * g_interface_info_get_method (GIInterfaceInfo *info,
gint n);
GIFunctionInfo * g_interface_info_find_method (GIInterfaceInfo *info,
const gchar *name);
const gchar *name);
gint g_interface_info_get_n_signals (GIInterfaceInfo *info);
GISignalInfo * g_interface_info_get_signal (GIInterfaceInfo *info,
gint n);

View File

@ -114,7 +114,7 @@ g_ir_ffi_get_ffi_type (GITypeTag tag,
g_assert_not_reached ();
return NULL;
}
}
/**
* g_type_info_get_ffi_type:
@ -140,13 +140,13 @@ g_callable_info_get_ffi_arg_types (GICallableInfo *callable_info)
{
ffi_type **arg_types;
gint n_args, i;
g_return_val_if_fail (callable_info != NULL, NULL);
n_args = g_callable_info_get_n_args (callable_info);
arg_types = (ffi_type **) g_new0 (ffi_type *, n_args + 1);
for (i = 0; i < n_args; ++i)
{
GIArgInfo *arg_info = g_callable_info_get_arg (callable_info, i);
@ -181,7 +181,7 @@ g_callable_info_get_ffi_return_type (GICallableInfo *callable_info)
type_tag = g_type_info_get_tag (return_type);
return_ffi_type = g_type_info_get_ffi_type (return_type);
g_base_info_unref((GIBaseInfo*)return_type);
return return_ffi_type;
}
@ -212,12 +212,12 @@ g_function_info_prep_invoker (GIFunctionInfo *info,
gboolean is_method;
gboolean throws;
gint n_args, n_invoke_args, i;
g_return_val_if_fail (info != NULL, FALSE);
g_return_val_if_fail (invoker != NULL, FALSE);
symbol = g_function_info_get_symbol ((GIFunctionInfo*) info);
if (!g_typelib_symbol (g_base_info_get_typelib((GIBaseInfo *) info),
symbol, &(invoker->native_address)))
{
@ -249,7 +249,7 @@ g_function_info_prep_invoker (GIFunctionInfo *info,
/* TODO: avoid malloc here? */
atypes = g_malloc0 (sizeof (ffi_type*) * n_invoke_args);
if (is_method)
{
atypes[0] = &ffi_type_pointer;
@ -286,7 +286,7 @@ g_function_info_prep_invoker (GIFunctionInfo *info,
/**
* g_function_info_invoker_destroy:
* @invoker: A #GIFunctionInvoker
*
*
* Release all resources allocated for the internals of @invoker; callers
* are responsible for freeing any resources allocated for the structure
* itself however.
@ -320,11 +320,11 @@ g_callable_info_prepare_closure (GICallableInfo *callable_info,
{
ffi_closure *closure;
ffi_status status;
g_return_val_if_fail (callable_info != NULL, FALSE);
g_return_val_if_fail (cif != NULL, FALSE);
g_return_val_if_fail (callback != NULL, FALSE);
closure = mmap (NULL, sizeof (ffi_closure),
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, sysconf (_SC_PAGE_SIZE));
@ -359,7 +359,7 @@ g_callable_info_prepare_closure (GICallableInfo *callable_info,
munmap(closure, sizeof (closure));
return NULL;
}
return closure;
}

View File

@ -36,7 +36,7 @@ typedef struct _GIFunctionInvoker GIFunctionInvoker;
struct _GIFunctionInvoker {
ffi_cif cif;
gpointer native_address;
gpointer padding[3];
};
@ -45,7 +45,7 @@ ffi_type * g_type_info_get_ffi_type (GITypeInfo *info);
gboolean g_function_info_prep_invoker (GIFunctionInfo *info,
GIFunctionInvoker *invoker,
GError **error);
void g_function_invoker_destroy (GIFunctionInvoker *invoker);

View File

@ -1,4 +1,4 @@
/* GObject introspection: Typelib creation
/* GObject introspection: Typelib creation
*
* Copyright (C) 2005 Matthias Clasen
*
@ -30,13 +30,13 @@
GIrModule *
g_ir_module_new (const gchar *name,
g_ir_module_new (const gchar *name,
const gchar *version,
const gchar *shared_library,
const gchar *c_prefix)
{
GIrModule *module;
module = g_new0 (GIrModule, 1);
module->name = g_strdup (name);
@ -94,18 +94,18 @@ g_ir_module_fatal (GIrModule *module,
char *formatted;
va_list args;
va_start (args, msg);
formatted = g_strdup_vprintf (msg, args);
if (line)
g_printerr ("%s-%s.gir:%d: error: %s\n", module->name, module->version, line, formatted);
else
g_printerr ("%s-%s.gir: error: %s\n", module->name, module->version, formatted);
exit (1);
va_end (args);
}
@ -247,7 +247,7 @@ g_ir_module_build_typelib (GIrModule *module,
g_message ("%d entries (%d local), %d dependencies\n", n_entries, n_local_entries,
g_list_length (module->dependencies));
dir_size = n_entries * sizeof (DirEntry);
size = header_size + dir_size;
@ -256,7 +256,7 @@ g_ir_module_build_typelib (GIrModule *module,
for (e = module->entries; e; e = e->next)
{
GIrNode *node = e->data;
size += g_ir_node_get_full_size (node);
size += g_ir_node_get_attribute_size (node);
@ -266,14 +266,14 @@ g_ir_module_build_typelib (GIrModule *module,
/* Adjust size for strings allocated in header below specially */
size += ALIGN_VALUE (strlen (module->name) + 1, 4);
if (module->shared_library)
if (module->shared_library)
size += ALIGN_VALUE (strlen (module->shared_library) + 1, 4);
if (dependencies != NULL)
size += ALIGN_VALUE (strlen (dependencies) + 1, 4);
if (module->c_prefix != NULL)
size += ALIGN_VALUE (strlen (module->c_prefix) + 1, 4);
g_message ("allocating %d bytes (%d header, %d directory, %d entries)\n",
g_message ("allocating %d bytes (%d header, %d directory, %d entries)\n",
size, header_size, dir_size, size - header_size - dir_size);
data = g_malloc0 (size);
@ -361,13 +361,13 @@ g_ir_module_build_typelib (GIrModule *module,
goto restart;
}
offset = offset2;
if (node->type == G_IR_NODE_XREF)
{
const char *namespace = ((GIrNodeXRef*)node)->namespace;
entry->blob_type = 0;
entry->local = FALSE;
entry->offset = write_string (namespace, strings, data, &offset2);
@ -419,7 +419,7 @@ g_ir_module_build_typelib (GIrModule *module,
write_attributes (module, node, strings, data, &offset, &offset2);
}
g_message ("reallocating to %d bytes", offset2);
data = g_realloc (data, offset2);

View File

@ -30,7 +30,7 @@ G_BEGIN_DECLS
typedef struct _GIrModule GIrModule;
struct _GIrModule
{
{
gchar *name;
gchar *version;
gchar *shared_library;

246
girnode.c
View File

@ -213,7 +213,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_CALLBACK:
{
GIrNodeFunction *function = (GIrNodeFunction *)node;
g_free (node->name);
g_free (function->symbol);
g_ir_node_free ((GIrNode *)function->result);
@ -226,7 +226,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_TYPE:
{
GIrNodeType *type = (GIrNodeType *)node;
g_free (node->name);
g_ir_node_free ((GIrNode *)type->parameter_type1);
g_ir_node_free ((GIrNode *)type->parameter_type2);
@ -240,7 +240,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_PARAM:
{
GIrNodeParam *param = (GIrNodeParam *)node;
g_free (node->name);
g_ir_node_free ((GIrNode *)param->type);
}
@ -249,7 +249,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_PROPERTY:
{
GIrNodeProperty *property = (GIrNodeProperty *)node;
g_free (node->name);
g_ir_node_free ((GIrNode *)property->type);
}
@ -258,7 +258,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_SIGNAL:
{
GIrNodeSignal *signal = (GIrNodeSignal *)node;
g_free (node->name);
for (l = signal->parameters; l; l = l->next)
g_ir_node_free ((GIrNode *)l->data);
@ -270,7 +270,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_VFUNC:
{
GIrNodeVFunc *vfunc = (GIrNodeVFunc *)node;
g_free (node->name);
g_free (vfunc->invoker);
for (l = vfunc->parameters; l; l = l->next)
@ -283,7 +283,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_FIELD:
{
GIrNodeField *field = (GIrNodeField *)node;
g_free (node->name);
g_ir_node_free ((GIrNode *)field->type);
g_ir_node_free ((GIrNode *)field->callback);
@ -294,7 +294,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_INTERFACE:
{
GIrNodeInterface *iface = (GIrNodeInterface *)node;
g_free (node->name);
g_free (iface->gtype_name);
g_free (iface->gtype_init);
@ -313,7 +313,7 @@ g_ir_node_free (GIrNode *node)
}
break;
case G_IR_NODE_VALUE:
{
g_free (node->name);
@ -324,7 +324,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_FLAGS:
{
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
g_free (node->name);
g_free (enum_->gtype_name);
g_free (enum_->gtype_init);
@ -338,7 +338,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_BOXED:
{
GIrNodeBoxed *boxed = (GIrNodeBoxed *)node;
g_free (node->name);
g_free (boxed->gtype_name);
g_free (boxed->gtype_init);
@ -366,7 +366,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_CONSTANT:
{
GIrNodeConstant *constant = (GIrNodeConstant *)node;
g_free (node->name);
g_free (constant->value);
g_ir_node_free ((GIrNode *)constant->type);
@ -376,7 +376,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_ERROR_DOMAIN:
{
GIrNodeErrorDomain *domain = (GIrNodeErrorDomain *)node;
g_free (node->name);
g_free (domain->getquark);
g_free (domain->codes);
@ -386,7 +386,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_XREF:
{
GIrNodeXRef *xref = (GIrNodeXRef *)node;
g_free (node->name);
g_free (xref->namespace);
}
@ -395,7 +395,7 @@ g_ir_node_free (GIrNode *node)
case G_IR_NODE_UNION:
{
GIrNodeUnion *union_ = (GIrNodeUnion *)node;
g_free (node->name);
g_free (union_->gtype_name);
g_free (union_->gtype_init);
@ -411,7 +411,7 @@ g_ir_node_free (GIrNode *node)
default:
g_error ("Unhandled node type %d\n", node->type);
break;
}
}
g_hash_table_destroy (node->attributes);
@ -472,7 +472,7 @@ g_ir_node_get_size (GIrNode *node)
case G_IR_NODE_FLAGS:
{
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
size = sizeof (EnumBlob);
for (l = enum_->values; l; l = l->next)
size += g_ir_node_get_size ((GIrNode *)l->data);
@ -549,7 +549,7 @@ g_ir_node_get_size (GIrNode *node)
}
break;
default:
default:
g_error ("Unhandled node type '%s'\n",
g_ir_node_type_to_string (node->type));
size = 0;
@ -617,12 +617,12 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
case G_IR_NODE_PARAM:
{
GIrNodeParam *param = (GIrNodeParam *)node;
/* See the comment in the G_IR_NODE_PARAM/ArgBlob writing below */
size = sizeof (ArgBlob) - sizeof (SimpleTypeBlob);
if (node->name)
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
size += g_ir_node_get_full_size_internal (node, (GIrNode *)param->type);
size += g_ir_node_get_full_size_internal (node, (GIrNode *)param->type);
}
break;
@ -661,7 +661,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
case GI_TYPE_TAG_ERROR:
{
gint n;
if (type->errors)
n = g_strv_length (type->errors);
else
@ -719,7 +719,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
case G_IR_NODE_FLAGS:
{
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
size = sizeof (EnumBlob);
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
if (enum_->gtype_name)
@ -729,7 +729,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
}
for (l = enum_->values; l; l = l->next)
size += g_ir_node_get_full_size_internal (node, (GIrNode *)l->data);
size += g_ir_node_get_full_size_internal (node, (GIrNode *)l->data);
}
break;
@ -774,10 +774,10 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
case G_IR_NODE_PROPERTY:
{
GIrNodeProperty *prop = (GIrNodeProperty *)node;
size = sizeof (PropertyBlob);
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
size += g_ir_node_get_full_size_internal (node, (GIrNode *)prop->type);
size += g_ir_node_get_full_size_internal (node, (GIrNode *)prop->type);
}
break;
@ -826,7 +826,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
/* FIXME non-string values */
size += ALIGN_VALUE (strlen (constant->value) + 1, 4);
size += g_ir_node_get_full_size_internal (node, (GIrNode *)constant->type);
size += g_ir_node_get_full_size_internal (node, (GIrNode *)constant->type);
}
break;
@ -843,7 +843,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
case G_IR_NODE_XREF:
{
GIrNodeXRef *xref = (GIrNodeXRef *)node;
size = 0;
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
size += ALIGN_VALUE (strlen (xref->namespace) + 1, 4);
@ -867,7 +867,7 @@ g_ir_node_get_full_size_internal (GIrNode *parent,
}
break;
default:
default:
g_error ("Unknown type tag %d\n", node->type);
size = 0;
}
@ -947,7 +947,7 @@ g_ir_node_add_member (GIrNode *node,
{
g_return_if_fail (node != NULL);
g_return_if_fail (member != NULL);
switch (node->type)
{
case G_IR_NODE_OBJECT:
@ -1026,7 +1026,7 @@ parse_boolean_value (const gchar *str)
{
if (strcmp (str, "TRUE") == 0)
return TRUE;
if (strcmp (str, "FALSE") == 0)
return FALSE;
@ -1048,31 +1048,31 @@ find_entry_node (GIrModule *module,
g_assert (name != NULL);
g_assert (strlen (name) > 0);
names = g_strsplit (name, ".", 0);
n_names = g_strv_length (names);
if (n_names > 2)
g_error ("Too many name parts");
for (l = module->entries, i = 1; l; l = l->next, i++)
{
GIrNode *node = (GIrNode *)l->data;
if (n_names > 1)
{
if (node->type != G_IR_NODE_XREF)
continue;
if (((GIrNodeXRef *)node)->namespace == NULL ||
strcmp (((GIrNodeXRef *)node)->namespace, names[0]) != 0)
continue;
}
if (strcmp (node->name, names[n_names - 1]) == 0)
{
if (idx)
*idx = i;
result = node;
goto out;
}
@ -1084,9 +1084,9 @@ find_entry_node (GIrModule *module,
((GIrNodeXRef *)node)->namespace = g_strdup (names[0]);
node->name = g_strdup (names[1]);
module->entries = g_list_append (module->entries, node);
if (idx)
*idx = g_list_length (module->entries);
@ -1229,23 +1229,23 @@ get_index_of_member_type (GIrNodeInterface *node,
}
static void
serialize_type (GIrModule *module,
serialize_type (GIrModule *module,
GList *modules,
GIrNodeType *node,
GIrNodeType *node,
GString *str)
{
gint i;
const gchar* basic[] = {
"void",
"boolean",
"int8",
"uint8",
"int16",
"uint16",
"int32",
"uint32",
"int64",
"uint64",
"void",
"boolean",
"int8",
"uint8",
"int16",
"uint16",
"int32",
"uint32",
"int64",
"uint64",
"short",
"ushort",
"int",
@ -1254,14 +1254,14 @@ serialize_type (GIrModule *module,
"ulong",
"ssize",
"size",
"float",
"float",
"double",
"time_t",
"GType",
"utf8",
"utf8",
"filename",
};
if (node->tag < GI_TYPE_TAG_ARRAY)
{
g_string_append_printf (str, "%s%s", basic[node->tag],
@ -1276,11 +1276,11 @@ serialize_type (GIrModule *module,
g_string_append_printf (str, "length=%d", node->length);
else if (node->has_size)
g_string_append_printf (str, "fixed-size=%d", node->size);
if (node->zero_terminated)
g_string_append_printf (str, "%szero-terminated=1",
g_string_append_printf (str, "%szero-terminated=1",
node->has_length ? "," : "");
g_string_append (str, "]");
}
else if (node->tag == GI_TYPE_TAG_INTERFACE)
@ -1309,9 +1309,9 @@ serialize_type (GIrModule *module,
g_string_append (str, "GList");
if (node->parameter_type1)
{
g_string_append (str, "<");
g_string_append (str, "<");
serialize_type (module, modules, node->parameter_type1, str);
g_string_append (str, ">");
g_string_append (str, ">");
}
}
else if (node->tag == GI_TYPE_TAG_GSLIST)
@ -1319,9 +1319,9 @@ serialize_type (GIrModule *module,
g_string_append (str, "GSList");
if (node->parameter_type1)
{
g_string_append (str, "<");
g_string_append (str, "<");
serialize_type (module, modules, node->parameter_type1, str);
g_string_append (str, ">");
g_string_append (str, ">");
}
}
else if (node->tag == GI_TYPE_TAG_GHASH)
@ -1329,11 +1329,11 @@ serialize_type (GIrModule *module,
g_string_append (str, "GHashTable<");
if (node->parameter_type1)
{
g_string_append (str, "<");
g_string_append (str, "<");
serialize_type (module, modules, node->parameter_type1, str);
g_string_append (str, ",");
g_string_append (str, ",");
serialize_type (module, modules, node->parameter_type2, str);
g_string_append (str, ">");
g_string_append (str, ">");
}
}
else if (node->tag == GI_TYPE_TAG_ERROR)
@ -1341,14 +1341,14 @@ serialize_type (GIrModule *module,
g_string_append (str, "GError");
if (node->errors)
{
g_string_append (str, "<");
g_string_append (str, "<");
for (i = 0; node->errors[i]; i++)
{
if (i > 0)
g_string_append (str, ",");
g_string_append (str, node->errors[i]);
}
g_string_append (str, ">");
g_string_append (str, ">");
}
}
}
@ -1450,27 +1450,27 @@ g_ir_node_build_typelib (GIrNode *node,
SimpleTypeBlob *blob = (SimpleTypeBlob *)&data[*offset];
*offset += sizeof (SimpleTypeBlob);
if (type->tag < GI_TYPE_TAG_ARRAY ||
type->tag == GI_TYPE_TAG_UTF8 ||
type->tag == GI_TYPE_TAG_FILENAME)
{
{
blob->flags.reserved = 0;
blob->flags.reserved2 = 0;
blob->flags.pointer = type->is_pointer;
blob->flags.reserved3 = 0;
blob->flags.tag = type->tag;
}
else
else
{
GString *str;
gchar *s;
gpointer value;
str = g_string_new (0);
serialize_type (module, modules, type, str);
s = g_string_free (str, FALSE);
types_count += 1;
value = g_hash_table_lookup (types, s);
if (value)
@ -1482,7 +1482,7 @@ g_ir_node_build_typelib (GIrNode *node,
{
unique_types_count += 1;
g_hash_table_insert (types, s, GUINT_TO_POINTER(*offset2));
blob->offset = *offset2;
switch (type->tag)
{
@ -1490,7 +1490,7 @@ g_ir_node_build_typelib (GIrNode *node,
{
ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
guint32 pos;
array->pointer = 1;
array->reserved = 0;
array->tag = type->tag;
@ -1504,15 +1504,15 @@ g_ir_node_build_typelib (GIrNode *node,
array->dimensions.size = type->size;
else
array->dimensions.length = -1;
pos = *offset2 + G_STRUCT_OFFSET (ArrayTypeBlob, type);
*offset2 += sizeof (ArrayTypeBlob);
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
node, build, &pos, offset2);
}
break;
case GI_TYPE_TAG_INTERFACE:
{
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&data[*offset2];
@ -1526,69 +1526,69 @@ g_ir_node_build_typelib (GIrNode *node,
}
break;
case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST:
{
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
guint32 pos;
param->pointer = 1;
param->reserved = 0;
param->tag = type->tag;
param->reserved2 = 0;
param->n_types = 1;
pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
*offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob);
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
node, build, &pos, offset2);
}
break;
case GI_TYPE_TAG_GHASH:
{
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
guint32 pos;
param->pointer = 1;
param->reserved = 0;
param->tag = type->tag;
param->reserved2 = 0;
param->n_types = 2;
pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
*offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob)*2;
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
g_ir_node_build_typelib ((GIrNode *)type->parameter_type1,
node, build, &pos, offset2);
g_ir_node_build_typelib ((GIrNode *)type->parameter_type2,
g_ir_node_build_typelib ((GIrNode *)type->parameter_type2,
node, build, &pos, offset2);
}
break;
case GI_TYPE_TAG_ERROR:
{
ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2];
gint i;
blob->pointer = 1;
blob->reserved = 0;
blob->tag = type->tag;
blob->reserved2 = 0;
if (type->errors)
if (type->errors)
blob->n_domains = g_strv_length (type->errors);
else
blob->n_domains = 0;
*offset2 = ALIGN_VALUE (*offset2 + G_STRUCT_OFFSET (ErrorTypeBlob, domains)
+ 2 * blob->n_domains, 4);
for (i = 0; i < blob->n_domains; i++)
blob->domains[i] = find_entry (module, modules, type->errors[i]);
}
break;
default:
g_error ("Unknown type tag %d\n", type->tag);
break;
@ -1649,7 +1649,7 @@ g_ir_node_build_typelib (GIrNode *node,
blob->construct_only = prop->construct_only;
blob->reserved = 0;
g_ir_node_build_typelib ((GIrNode *)prop->type,
g_ir_node_build_typelib ((GIrNode *)prop->type,
node, build, offset, offset2);
}
break;
@ -1683,7 +1683,7 @@ g_ir_node_build_typelib (GIrNode *node,
g_debug ("building function '%s'", function->symbol);
g_ir_node_build_typelib ((GIrNode *)function->result->type,
g_ir_node_build_typelib ((GIrNode *)function->result->type,
node, build, &signature, offset2);
blob2->may_return_null = function->result->allow_none;
@ -1693,7 +1693,7 @@ g_ir_node_build_typelib (GIrNode *node,
blob2->n_arguments = n;
signature += 4;
for (l = function->parameters; l; l = l->next)
{
GIrNode *param = (GIrNode *)l->data;
@ -1723,8 +1723,8 @@ g_ir_node_build_typelib (GIrNode *node,
blob->reserved = 0;
blob->name = write_string (node->name, strings, data, offset2);
blob->signature = signature;
g_ir_node_build_typelib ((GIrNode *)function->result->type,
g_ir_node_build_typelib ((GIrNode *)function->result->type,
node, build, &signature, offset2);
blob2->may_return_null = function->result->allow_none;
@ -1734,7 +1734,7 @@ g_ir_node_build_typelib (GIrNode *node,
blob2->n_arguments = n;
signature += 4;
for (l = function->parameters; l; l = l->next)
{
GIrNode *param = (GIrNode *)l->data;
@ -1772,8 +1772,8 @@ g_ir_node_build_typelib (GIrNode *node,
blob->class_closure = 0; /* FIXME */
blob->name = write_string (node->name, strings, data, offset2);
blob->signature = signature;
g_ir_node_build_typelib ((GIrNode *)signal->result->type,
g_ir_node_build_typelib ((GIrNode *)signal->result->type,
node, build, &signature, offset2);
blob2->may_return_null = signal->result->allow_none;
@ -1783,7 +1783,7 @@ g_ir_node_build_typelib (GIrNode *node,
blob2->n_arguments = n;
signature += 4;
for (l = signal->parameters; l; l = l->next)
{
GIrNode *param = (GIrNode *)l->data;
@ -1829,8 +1829,8 @@ g_ir_node_build_typelib (GIrNode *node,
blob->struct_offset = vfunc->offset;
blob->reserved2 = 0;
blob->signature = signature;
g_ir_node_build_typelib ((GIrNode *)vfunc->result->type,
g_ir_node_build_typelib ((GIrNode *)vfunc->result->type,
node, build, &signature, offset2);
blob2->may_return_null = vfunc->result->allow_none;
@ -1840,7 +1840,7 @@ g_ir_node_build_typelib (GIrNode *node,
blob2->n_arguments = n;
signature += 4;
for (l = vfunc->parameters; l; l = l->next)
{
GIrNode *param = (GIrNode *)l->data;
@ -1873,7 +1873,7 @@ g_ir_node_build_typelib (GIrNode *node,
blob->reserved = 0;
blob->closure = param->closure;
blob->destroy = param->destroy;
g_ir_node_build_typelib ((GIrNode *)param->type, node, build, offset, offset2);
}
break;
@ -1883,7 +1883,7 @@ g_ir_node_build_typelib (GIrNode *node,
StructBlob *blob = (StructBlob *)&data[*offset];
GIrNodeStruct *struct_ = (GIrNodeStruct *)node;
GList *members;
blob->blob_type = BLOB_TYPE_STRUCT;
blob->deprecated = struct_->deprecated;
blob->is_gtype_struct = struct_->is_gtype_struct;
@ -1995,7 +1995,7 @@ g_ir_node_build_typelib (GIrNode *node,
{
*offset += 28;
blob->discriminated = TRUE;
g_ir_node_build_typelib ((GIrNode *)union_->discriminator_type,
g_ir_node_build_typelib ((GIrNode *)union_->discriminator_type,
build, offset, offset2);
}
else
@ -2004,7 +2004,7 @@ g_ir_node_build_typelib (GIrNode *node,
*offset += sizeof (UnionBlob);
blob->discriminated = FALSE;
blob->discriminator_type.offset = 0;
members = g_list_copy (union_->members);
g_ir_node_build_members (&members, G_IR_NODE_FIELD, &blob->n_fields,
@ -2022,7 +2022,7 @@ g_ir_node_build_typelib (GIrNode *node,
for (l = union_->discriminators; l; l = l->next)
{
GIrNode *member = (GIrNode *)l->data;
g_ir_node_build_typelib (member, node, build, offset, offset2);
}
}
@ -2035,13 +2035,13 @@ g_ir_node_build_typelib (GIrNode *node,
EnumBlob *blob = (EnumBlob *)&data[*offset];
GIrNodeEnum *enum_ = (GIrNodeEnum *)node;
*offset += sizeof (EnumBlob);
*offset += sizeof (EnumBlob);
if (node->type == G_IR_NODE_ENUM)
blob->blob_type = BLOB_TYPE_ENUM;
else
blob->blob_type = BLOB_TYPE_FLAGS;
blob->deprecated = enum_->deprecated;
blob->reserved = 0;
blob->storage_type = enum_->storage_type;
@ -2071,7 +2071,7 @@ g_ir_node_build_typelib (GIrNode *node,
}
}
break;
case G_IR_NODE_OBJECT:
{
ObjectBlob *blob = (ObjectBlob *)&data[*offset];
@ -2101,7 +2101,7 @@ g_ir_node_build_typelib (GIrNode *node,
blob->n_signals = 0;
blob->n_vfuncs = 0;
blob->n_constants = 0;
*offset += sizeof(ObjectBlob);
for (l = object->interfaces; l; l = l->next)
{
@ -2109,7 +2109,7 @@ g_ir_node_build_typelib (GIrNode *node,
*(guint16*)&data[*offset] = find_entry (module, modules, (gchar *)l->data);
*offset += 2;
}
members = g_list_copy (object->members);
*offset = ALIGN_VALUE (*offset, 4);
@ -2164,7 +2164,7 @@ g_ir_node_build_typelib (GIrNode *node,
blob->n_signals = 0;
blob->n_vfuncs = 0;
blob->n_constants = 0;
*offset += sizeof (InterfaceBlob);
for (l = iface->prerequisites; l; l = l->next)
{
@ -2172,7 +2172,7 @@ g_ir_node_build_typelib (GIrNode *node,
*(guint16*)&data[*offset] = find_entry (module, modules, (gchar *)l->data);
*offset += 2;
}
members = g_list_copy (iface->members);
*offset = ALIGN_VALUE (*offset, 4);
@ -2306,7 +2306,7 @@ g_ir_node_build_typelib (GIrNode *node,
DO_ALIGNED_COPY(&data[blob->offset], parse_int_value (constant->value), glong);
break;
case GI_TYPE_TAG_SIZE: /* FIXME */
case GI_TYPE_TAG_TIME_T:
case GI_TYPE_TAG_TIME_T:
case GI_TYPE_TAG_ULONG:
blob->size = sizeof (gulong);
DO_ALIGNED_COPY(&data[blob->offset], parse_uint_value (constant->value), gulong);
@ -2326,14 +2326,14 @@ g_ir_node_build_typelib (GIrNode *node,
break;
}
*offset2 += ALIGN_VALUE (blob->size, 4);
g_ir_node_build_typelib ((GIrNode *)constant->type, node, build, &pos, offset2);
}
break;
default:
g_assert_not_reached ();
}
g_debug ("node %s%s%s%p type '%s', offset %d -> %d, offset2 %d -> %d",
node->name ? "'" : "",
node->name ? node->name : "",
@ -2347,12 +2347,12 @@ g_ir_node_build_typelib (GIrNode *node,
}
/* if str is already in the pool, return previous location, otherwise write str
* to the typelib at offset, put it in the pool and update offset. If the
* to the typelib at offset, put it in the pool and update offset. If the
* typelib is not large enough to hold the string, reallocate it.
*/
guint32
guint32
write_string (const gchar *str,
GHashTable *strings,
GHashTable *strings,
guchar *data,
guint32 *offset)
{
@ -2363,7 +2363,7 @@ write_string (const gchar *str,
string_size += strlen (str);
value = g_hash_table_lookup (strings, str);
if (value)
return GPOINTER_TO_UINT (value);
@ -2376,7 +2376,7 @@ write_string (const gchar *str,
*offset = ALIGN_VALUE (start + strlen (str) + 1, 4);
strcpy ((gchar*)&data[start], str);
return start;
}

View File

@ -28,7 +28,7 @@
G_BEGIN_DECLS
typedef struct _GIrTypelibBuild GIrTypelibBuild;
typedef struct _GIrNode GIrNode;
typedef struct _GIrNode GIrNode;
typedef struct _GIrNodeFunction GIrNodeFunction;
typedef struct _GIrNodeParam GIrNodeParam;
typedef struct _GIrNodeType GIrNodeType;
@ -53,10 +53,10 @@ struct _GIrTypelibBuild {
GHashTable *types;
GList *offset_ordered_nodes;
guint32 n_attributes;
guchar *data;
guchar *data;
};
typedef enum
typedef enum
{
G_IR_NODE_INVALID = 0,
G_IR_NODE_FUNCTION = 1,
@ -64,7 +64,7 @@ typedef enum
G_IR_NODE_STRUCT = 3,
G_IR_NODE_BOXED = 4,
G_IR_NODE_ENUM = 5,
G_IR_NODE_FLAGS = 6,
G_IR_NODE_FLAGS = 6,
G_IR_NODE_OBJECT = 7,
G_IR_NODE_INTERFACE = 8,
G_IR_NODE_CONSTANT = 9,
@ -102,7 +102,7 @@ struct _GIrNodeFunction
GIrNode node;
gboolean deprecated;
gboolean is_varargs; /* Not in typelib yet */
gboolean is_varargs; /* Not in typelib yet */
gboolean is_method;
gboolean is_setter;
@ -117,7 +117,7 @@ struct _GIrNodeFunction
GList *parameters;
};
struct _GIrNodeType
struct _GIrNodeType
{
GIrNode node;
@ -138,15 +138,15 @@ struct _GIrNodeType
gint length;
gboolean has_size;
gint size;
GIrNodeType *parameter_type1;
GIrNodeType *parameter_type2;
GIrNodeType *parameter_type2;
gchar *interface;
gchar **errors;
};
struct _GIrNodeParam
struct _GIrNodeParam
{
GIrNode node;
@ -159,10 +159,10 @@ struct _GIrNodeParam
gboolean transfer;
gboolean shallow_transfer;
GIScopeType scope;
gint8 closure;
gint8 destroy;
GIrNodeType *type;
};
@ -177,11 +177,11 @@ struct _GIrNodeProperty
gboolean writable;
gboolean construct;
gboolean construct_only;
GIrNodeType *type;
};
struct _GIrNodeSignal
struct _GIrNodeSignal
{
GIrNode node;
@ -194,30 +194,30 @@ struct _GIrNodeSignal
gboolean detailed;
gboolean action;
gboolean no_hooks;
gboolean has_class_closure;
gboolean true_stops_emit;
gint class_closure;
GList *parameters;
GIrNodeParam *result;
GIrNodeParam *result;
};
struct _GIrNodeVFunc
struct _GIrNodeVFunc
{
GIrNode node;
gboolean is_varargs; /* Not in typelib yet */
gboolean is_varargs; /* Not in typelib yet */
gboolean must_chain_up;
gboolean must_be_implemented;
gboolean must_not_be_implemented;
gboolean is_class_closure;
char *invoker;
GList *parameters;
GIrNodeParam *result;
GIrNodeParam *result;
gint offset;
};
@ -231,7 +231,7 @@ struct _GIrNodeField
gint bits;
gint offset;
GIrNodeFunction *callback;
GIrNodeType *type;
};
@ -247,13 +247,13 @@ struct _GIrNodeInterface
gchar *parent;
gchar *glib_type_struct;
GList *interfaces;
GList *prerequisites;
gint alignment;
gint size;
GList *members;
};
@ -273,7 +273,7 @@ struct _GIrNodeConstant
gboolean deprecated;
GIrNodeType *type;
gchar *value;
};
@ -291,7 +291,7 @@ struct _GIrNodeEnum
};
struct _GIrNodeBoxed
{
{
GIrNode node;
gboolean deprecated;
@ -301,7 +301,7 @@ struct _GIrNodeBoxed
gint alignment;
gint size;
GList *members;
};
@ -318,7 +318,7 @@ struct _GIrNodeStruct
gint alignment;
gint size;
GList *members;
};
@ -327,7 +327,7 @@ struct _GIrNodeUnion
GIrNode node;
gboolean deprecated;
GList *members;
GList *discriminators;
@ -347,7 +347,7 @@ struct _GIrNodeErrorDomain
GIrNode node;
gboolean deprecated;
gchar *name;
gchar *getquark;
gchar *codes;
@ -370,7 +370,7 @@ gboolean g_ir_node_can_have_member (GIrNode *node);
void g_ir_node_add_member (GIrNode *node,
GIrNodeFunction *member);
guint32 write_string (const gchar *str,
GHashTable *strings,
GHashTable *strings,
guchar *data,
guint32 *offset);

View File

@ -235,7 +235,7 @@ get_type_size_alignment (GIrNodeType *type,
if (type->tag == GI_TYPE_TAG_ARRAY)
{
gint elt_size, elt_alignment;
if (!type->has_size
|| !get_type_size_alignment(type->parameter_type1, module, modules,
&elt_size, &elt_alignment, who))
@ -244,10 +244,10 @@ get_type_size_alignment (GIrNodeType *type,
*alignment = -1;
return FALSE;
}
*size = type->size * elt_size;
*alignment = elt_alignment;
return TRUE;
}
else if (type->is_pointer)
@ -300,7 +300,7 @@ get_field_size_alignment (GIrNodeField *field,
{
gchar *who;
gboolean success;
who = g_strdup_printf ("field %s.%s.%s", module->name, parent_node->name, ((GIrNode *)field)->name);
if (field->callback)

File diff suppressed because it is too large Load Diff

View File

@ -170,7 +170,7 @@ function_generate (GIdlWriter * writer, GIdlNodeFunction * node)
{
GIdlNodeParam *param = l->data;
const gchar *direction = g_idl_node_param_direction_string (param);
markup_s = g_string_new ("<parameter");
g_string_append_printf (markup_s, " name=\"%s\"", param->node.name);
@ -186,7 +186,7 @@ function_generate (GIdlWriter * writer, GIdlNodeFunction * node)
if (param->allow_none)
g_string_append (markup_s,
g_markup_printf_escaped (" allow-none=\"1\""));
if (strcmp (direction, "in") != 0)
g_string_append (markup_s,
g_markup_printf_escaped (" direction=\"%s\"",

View File

@ -1,4 +1,4 @@
/* GObject introspection: typelib validation, auxiliary functions
/* GObject introspection: typelib validation, auxiliary functions
* related to the binary typelib format
*
* Copyright (C) 2005 Matthias Clasen
@ -46,7 +46,7 @@ static void
pop_context (ValidateContext *ctx)
{
g_assert (ctx->context_stack != NULL);
ctx->context_stack = g_slist_delete_link (ctx->context_stack,
ctx->context_stack = g_slist_delete_link (ctx->context_stack,
ctx->context_stack);
}
@ -69,7 +69,7 @@ get_dir_entry_checked (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Invalid directory index %d", index);
return FALSE;
return FALSE;
}
offset = header->directory + (index - 1) * header->entry_blob_size;
@ -139,7 +139,7 @@ g_typelib_get_dir_entry (GTypelib *typelib,
return (DirEntry *)&typelib->data[header->directory + (index - 1) * header->entry_blob_size];
}
void
void
g_typelib_check_sanity (void)
{
/* Check that struct layout is as we expect */
@ -161,7 +161,7 @@ g_typelib_check_sanity (void)
*
* Everything else in the code however should be using sizeof().
*/
CHECK_SIZE (Header, 112);
CHECK_SIZE (DirEntry, 12);
CHECK_SIZE (SimpleTypeBlob, 4);
@ -237,7 +237,7 @@ validate_name (GTypelib *typelib,
if (!name)
return FALSE;
if (!memchr (name, '\0', MAX_NAME_LEN))
if (!memchr (name, '\0', MAX_NAME_LEN))
{
g_set_error (error,
G_TYPELIB_ERROR,
@ -246,8 +246,8 @@ validate_name (GTypelib *typelib,
msg, name);
return FALSE;
}
if (strspn (name, G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "-_") < strlen (name))
if (strspn (name, G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "-_") < strlen (name))
{
g_set_error (error,
G_TYPELIB_ERROR,
@ -256,11 +256,11 @@ validate_name (GTypelib *typelib,
msg, name);
return FALSE;
}
return TRUE;
}
static gboolean
static gboolean
validate_header (ValidateContext *ctx,
GError **error)
{
@ -285,7 +285,7 @@ validate_header (ValidateContext *ctx,
G_TYPELIB_ERROR_INVALID_HEADER,
"Magic string not found");
return FALSE;
}
if (header->major_version != 2 || header->minor_version != 0)
@ -295,7 +295,7 @@ validate_header (ValidateContext *ctx,
G_TYPELIB_ERROR_INVALID_HEADER,
"Version mismatch");
return FALSE;
}
if (header->n_entries < header->n_local_entries)
@ -304,7 +304,7 @@ validate_header (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_HEADER,
"Inconsistent entry counts");
return FALSE;
return FALSE;
}
if (header->size != typelib->len)
@ -313,12 +313,12 @@ validate_header (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_HEADER,
"Typelib size mismatch");
return FALSE;
return FALSE;
}
/* This is a sanity check for a specific typelib; it
* prevents us from loading an incompatible typelib.
*
*
* The hardcoded checks in g_typelib_check_sanity to
* protect against inadvertent or buggy changes to the typelib format
* itself.
@ -347,7 +347,7 @@ validate_header (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_HEADER,
"Blob size mismatch");
return FALSE;
return FALSE;
}
if (!is_aligned (header->directory))
@ -356,7 +356,7 @@ validate_header (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_HEADER,
"Misaligned directory");
return FALSE;
return FALSE;
}
if (!is_aligned (header->attributes))
@ -365,7 +365,7 @@ validate_header (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_HEADER,
"Misaligned attributes");
return FALSE;
return FALSE;
}
if (header->attributes == 0 && header->n_attributes > 0)
@ -374,11 +374,11 @@ validate_header (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_HEADER,
"Wrong number of attributes");
return FALSE;
return FALSE;
}
if (!validate_name (typelib, "namespace", typelib->data, header->namespace, error))
return FALSE;
return FALSE;
return TRUE;
}
@ -406,7 +406,7 @@ validate_array_type_blob (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Pointer type exected for tag %d", blob->tag);
return FALSE;
return FALSE;
}
/* FIXME validate length */
@ -460,18 +460,18 @@ validate_param_type_blob (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Pointer type exected for tag %d", blob->tag);
return FALSE;
return FALSE;
}
if (blob->n_types != n_params)
{
g_set_error (error,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Parameter type number mismatch");
return FALSE;
return FALSE;
}
for (i = 0; i < n_params; i++)
{
if (!validate_type_blob (typelib,
@ -506,9 +506,9 @@ validate_error_type_blob (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Pointer type exected for tag %d", blob->tag);
return FALSE;
return FALSE;
}
for (i = 0; i < blob->n_domains; i++)
{
if (blob->domains[i] == 0 || blob->domains[i] > header->n_entries)
@ -517,7 +517,7 @@ validate_error_type_blob (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Invalid directory index %d", blob->domains[i]);
return FALSE;
return FALSE;
}
entry = g_typelib_get_dir_entry (typelib, blob->domains[i]);
@ -529,7 +529,7 @@ validate_error_type_blob (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Wrong blob type");
return FALSE;
return FALSE;
}
}
@ -545,10 +545,10 @@ validate_type_blob (GTypelib *typelib,
{
SimpleTypeBlob *simple;
InterfaceTypeBlob *iface;
simple = (SimpleTypeBlob *)&typelib->data[offset];
if (simple->flags.reserved == 0 &&
if (simple->flags.reserved == 0 &&
simple->flags.reserved2 == 0)
{
if (simple->flags.tag >= GI_TYPE_TAG_ARRAY)
@ -559,7 +559,7 @@ validate_type_blob (GTypelib *typelib,
"Wrong tag in simple type");
return FALSE;
}
if (simple->flags.tag >= GI_TYPE_TAG_UTF8 &&
!simple->flags.pointer)
{
@ -567,7 +567,7 @@ validate_type_blob (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Pointer type exected for tag %d", simple->flags.tag);
return FALSE;
return FALSE;
}
return TRUE;
@ -578,28 +578,28 @@ validate_type_blob (GTypelib *typelib,
switch (iface->tag)
{
case GI_TYPE_TAG_ARRAY:
if (!validate_array_type_blob (typelib, simple->offset,
if (!validate_array_type_blob (typelib, simple->offset,
signature_offset, return_type, error))
return FALSE;
break;
case GI_TYPE_TAG_INTERFACE:
if (!validate_iface_type_blob (typelib, simple->offset,
if (!validate_iface_type_blob (typelib, simple->offset,
signature_offset, return_type, error))
return FALSE;
break;
case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST:
if (!validate_param_type_blob (typelib, simple->offset,
if (!validate_param_type_blob (typelib, simple->offset,
signature_offset, return_type, 1, error))
return FALSE;
break;
case GI_TYPE_TAG_GHASH:
if (!validate_param_type_blob (typelib, simple->offset,
if (!validate_param_type_blob (typelib, simple->offset,
signature_offset, return_type, 2, error))
return FALSE;
break;
case GI_TYPE_TAG_ERROR:
if (!validate_error_type_blob (typelib, simple->offset,
if (!validate_error_type_blob (typelib, simple->offset,
signature_offset, return_type, error))
return FALSE;
break;
@ -634,10 +634,10 @@ validate_arg_blob (GTypelib *typelib,
blob = (ArgBlob*) &typelib->data[offset];
if (!validate_name (typelib, "argument", typelib->data, blob->name, error))
return FALSE;
if (!validate_type_blob (typelib,
offset + G_STRUCT_OFFSET (ArgBlob, arg_type),
return FALSE;
if (!validate_type_blob (typelib,
offset + G_STRUCT_OFFSET (ArgBlob, arg_type),
signature_offset, FALSE, error))
return FALSE;
@ -693,18 +693,18 @@ validate_signature_blob (GTypelib *typelib,
if (blob->return_type.offset != 0)
{
if (!validate_type_blob (typelib,
offset + G_STRUCT_OFFSET (SignatureBlob, return_type),
if (!validate_type_blob (typelib,
offset + G_STRUCT_OFFSET (SignatureBlob, return_type),
offset, TRUE, error))
return FALSE;
}
for (i = 0; i < blob->n_arguments; i++)
{
if (!validate_arg_blob (typelib,
offset + sizeof (SignatureBlob) +
i * sizeof (ArgBlob),
offset,
if (!validate_arg_blob (typelib,
offset + sizeof (SignatureBlob) +
i * sizeof (ArgBlob),
offset,
error))
return FALSE;
}
@ -746,12 +746,12 @@ validate_function_blob (ValidateContext *ctx,
}
if (!validate_name (typelib, "function", typelib->data, blob->name, error))
return FALSE;
return FALSE;
push_context (ctx, get_string_nofail (typelib, blob->name));
if (!validate_name (typelib, "function symbol", typelib->data, blob->symbol, error))
return FALSE;
return FALSE;
switch (container_type)
{
@ -765,7 +765,7 @@ validate_function_blob (ValidateContext *ctx,
default:
is_method = FALSE;
}
if (blob->constructor)
{
switch (container_type)
@ -820,7 +820,7 @@ validate_function_blob (ValidateContext *ctx,
sigblob = (SignatureBlob*) &typelib->data[blob->signature];
if (blob->constructor)
if (blob->constructor)
{
SimpleTypeBlob *simple = return_type_from_signature (typelib,
blob->signature,
@ -877,15 +877,15 @@ validate_callback_blob (ValidateContext *ctx,
}
if (!validate_name (typelib, "callback", typelib->data, blob->name, error))
return FALSE;
return FALSE;
push_context (ctx, get_string_nofail (typelib, blob->name));
if (!validate_signature_blob (typelib, blob->signature, error))
return FALSE;
pop_context (ctx);
return TRUE;
}
@ -950,9 +950,9 @@ validate_constant_blob (GTypelib *typelib,
}
if (!validate_name (typelib, "constant", typelib->data, blob->name, error))
return FALSE;
if (!validate_type_blob (typelib, offset + G_STRUCT_OFFSET (ConstantBlob, type),
return FALSE;
if (!validate_type_blob (typelib, offset + G_STRUCT_OFFSET (ConstantBlob, type),
0, FALSE, error))
return FALSE;
@ -964,7 +964,7 @@ validate_constant_blob (GTypelib *typelib,
"Misaligned constant value");
return FALSE;
}
type = (SimpleTypeBlob *)&typelib->data[offset + G_STRUCT_OFFSET (ConstantBlob, type)];
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
{
@ -1011,8 +1011,8 @@ validate_value_blob (GTypelib *typelib,
blob = (ValueBlob*) &typelib->data[offset];
if (!validate_name (typelib, "value", typelib->data, blob->name, error))
return FALSE;
return FALSE;
return TRUE;
}
@ -1035,9 +1035,9 @@ validate_field_blob (ValidateContext *ctx,
}
blob = (FieldBlob*) &typelib->data[offset];
if (!validate_name (typelib, "field", typelib->data, blob->name, error))
return FALSE;
return FALSE;
if (blob->has_embedded_type)
{
@ -1045,7 +1045,7 @@ validate_field_blob (ValidateContext *ctx,
return FALSE;
}
else if (!validate_type_blob (typelib,
offset + G_STRUCT_OFFSET (FieldBlob, type),
offset + G_STRUCT_OFFSET (FieldBlob, type),
0, FALSE, error))
return FALSE;
@ -1069,12 +1069,12 @@ validate_property_blob (GTypelib *typelib,
}
blob = (PropertyBlob*) &typelib->data[offset];
if (!validate_name (typelib, "property", typelib->data, blob->name, error))
return FALSE;
return FALSE;
if (!validate_type_blob (typelib,
offset + G_STRUCT_OFFSET (PropertyBlob, type),
offset + G_STRUCT_OFFSET (PropertyBlob, type),
0, FALSE, error))
return FALSE;
@ -1102,17 +1102,17 @@ validate_signal_blob (GTypelib *typelib,
blob = (SignalBlob*) &typelib->data[offset];
if (!validate_name (typelib, "signal", typelib->data, blob->name, error))
return FALSE;
if ((blob->run_first != 0) +
(blob->run_last != 0) +
return FALSE;
if ((blob->run_first != 0) +
(blob->run_last != 0) +
(blob->run_cleanup != 0) != 1)
{
g_set_error (error,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Invalid signal run flags");
return FALSE;
return FALSE;
}
if (blob->has_class_closure)
@ -1122,15 +1122,15 @@ validate_signal_blob (GTypelib *typelib,
ObjectBlob *object;
object = (ObjectBlob*)&typelib->data[container_offset];
n_signals = object->n_signals;
}
else
{
InterfaceBlob *iface;
iface = (InterfaceBlob*)&typelib->data[container_offset];
n_signals = iface->n_signals;
}
@ -1140,13 +1140,13 @@ validate_signal_blob (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Invalid class closure index");
return FALSE;
return FALSE;
}
}
if (!validate_signature_blob (typelib, blob->signature, error))
return FALSE;
return TRUE;
}
@ -1171,8 +1171,8 @@ validate_vfunc_blob (GTypelib *typelib,
blob = (VFuncBlob*) &typelib->data[offset];
if (!validate_name (typelib, "vfunc", typelib->data, blob->name, error))
return FALSE;
return FALSE;
if (blob->class_closure)
{
if (((CommonBlob*)&typelib->data[container_offset])->blob_type == BLOB_TYPE_OBJECT)
@ -1180,15 +1180,15 @@ validate_vfunc_blob (GTypelib *typelib,
ObjectBlob *object;
object = (ObjectBlob*)&typelib->data[container_offset];
n_vfuncs = object->n_vfuncs;
}
else
{
InterfaceBlob *iface;
iface = (InterfaceBlob*)&typelib->data[container_offset];
n_vfuncs = iface->n_vfuncs;
}
@ -1198,13 +1198,13 @@ validate_vfunc_blob (GTypelib *typelib,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Invalid class closure index");
return FALSE;
return FALSE;
}
}
if (!validate_signature_blob (typelib, blob->signature, error))
return FALSE;
return TRUE;
}
@ -1240,17 +1240,17 @@ validate_struct_blob (ValidateContext *ctx,
}
if (!validate_name (typelib, "struct", typelib->data, blob->name, error))
return FALSE;
return FALSE;
push_context (ctx, get_string_nofail (typelib, blob->name));
if (!blob->unregistered)
{
if (!validate_name (typelib, "boxed", typelib->data, blob->gtype_name, error))
return FALSE;
return FALSE;
if (!validate_name (typelib, "boxed", typelib->data, blob->gtype_init, error))
return FALSE;
return FALSE;
}
else
{
@ -1260,11 +1260,11 @@ validate_struct_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Gtype data in struct");
return FALSE;
return FALSE;
}
}
if (typelib->len < offset + sizeof (StructBlob) +
if (typelib->len < offset + sizeof (StructBlob) +
blob->n_fields * sizeof (FieldBlob) +
blob->n_methods * sizeof (FunctionBlob))
{
@ -1292,9 +1292,9 @@ validate_struct_blob (ValidateContext *ctx,
for (i = 0; i < blob->n_methods; i++)
{
if (!validate_function_blob (ctx,
field_offset +
i * sizeof (FunctionBlob),
if (!validate_function_blob (ctx,
field_offset +
i * sizeof (FunctionBlob),
blob_type,
error))
return FALSE;
@ -1334,14 +1334,14 @@ validate_enum_blob (ValidateContext *ctx,
"Wrong blob type");
return FALSE;
}
if (!blob->unregistered)
{
if (!validate_name (typelib, "enum", typelib->data, blob->gtype_name, error))
return FALSE;
return FALSE;
if (!validate_name (typelib, "enum", typelib->data, blob->gtype_init, error))
return FALSE;
return FALSE;
}
else
{
@ -1351,14 +1351,14 @@ validate_enum_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Gtype data in unregistered enum");
return FALSE;
return FALSE;
}
}
if (!validate_name (typelib, "enum", typelib->data, blob->name, error))
return FALSE;
if (typelib->len < offset + sizeof (EnumBlob) +
return FALSE;
if (typelib->len < offset + sizeof (EnumBlob) +
blob->n_values * sizeof (ValueBlob))
{
g_set_error (error,
@ -1369,21 +1369,21 @@ validate_enum_blob (ValidateContext *ctx,
}
push_context (ctx, get_string_nofail (typelib, blob->name));
for (i = 0; i < blob->n_values; i++)
{
if (!validate_value_blob (typelib,
offset + sizeof (EnumBlob) +
i * sizeof (ValueBlob),
if (!validate_value_blob (typelib,
offset + sizeof (EnumBlob) +
i * sizeof (ValueBlob),
error))
return FALSE;
#if 0
v1 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
v1 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
i * sizeof (ValueBlob)];
for (j = 0; j < i; j++)
for (j = 0; j < i; j++)
{
v2 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
v2 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) +
j * sizeof (ValueBlob)];
if (v1->value == v2->value)
@ -1397,11 +1397,11 @@ validate_enum_blob (ValidateContext *ctx,
return FALSE;
}
}
#endif
#endif
}
pop_context (ctx);
return TRUE;
}
@ -1437,15 +1437,15 @@ validate_object_blob (ValidateContext *ctx,
"Wrong blob type");
return FALSE;
}
if (!validate_name (typelib, "object", typelib->data, blob->gtype_name, error))
return FALSE;
return FALSE;
if (!validate_name (typelib, "object", typelib->data, blob->gtype_init, error))
return FALSE;
return FALSE;
if (!validate_name (typelib, "object", typelib->data, blob->name, error))
return FALSE;
return FALSE;
if (blob->parent > header->n_entries)
{
@ -1453,7 +1453,7 @@ validate_object_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Invalid parent index");
return FALSE;
return FALSE;
}
if (blob->parent != 0)
@ -1470,10 +1470,10 @@ validate_object_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Parent not object");
return FALSE;
return FALSE;
}
}
if (blob->gtype_struct != 0)
{
DirEntry *entry;
@ -1487,11 +1487,11 @@ validate_object_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Class struct invalid type or not local");
return FALSE;
return FALSE;
}
}
if (typelib->len < offset + sizeof (ObjectBlob) +
}
if (typelib->len < offset + sizeof (ObjectBlob) +
(blob->n_interfaces + blob->n_interfaces % 2) * 2 +
blob->n_fields * sizeof (FieldBlob) +
blob->n_properties * sizeof (PropertyBlob) +
@ -1499,7 +1499,7 @@ validate_object_blob (ValidateContext *ctx,
blob->n_signals * sizeof (SignalBlob) +
blob->n_vfuncs * sizeof (VFuncBlob) +
blob->n_constants * sizeof (ConstantBlob))
{
g_set_error (error,
G_TYPELIB_ERROR,
@ -1522,9 +1522,9 @@ validate_object_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Invalid interface index");
return FALSE;
return FALSE;
}
entry = get_dir_entry_checked (typelib, iface, error);
if (!entry)
return FALSE;
@ -1536,14 +1536,14 @@ validate_object_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Not an interface");
return FALSE;
return FALSE;
}
}
offset2 += 2 * (blob->n_interfaces %2);
push_context (ctx, get_string_nofail (typelib, blob->name));
for (i = 0; i < blob->n_fields; i++, offset2 += sizeof (FieldBlob))
{
if (!validate_field_blob (ctx, offset2, error))
@ -1595,7 +1595,7 @@ validate_interface_blob (ValidateContext *ctx,
InterfaceBlob *blob;
gint i;
guint32 offset2;
header = (Header *)typelib->data;
if (typelib->len < offset + sizeof (InterfaceBlob))
@ -1617,24 +1617,24 @@ validate_interface_blob (ValidateContext *ctx,
"Wrong blob type; expected interface, got %d", blob->blob_type);
return FALSE;
}
if (!validate_name (typelib, "interface", typelib->data, blob->gtype_name, error))
return FALSE;
return FALSE;
if (!validate_name (typelib, "interface", typelib->data, blob->gtype_init, error))
return FALSE;
return FALSE;
if (!validate_name (typelib, "interface", typelib->data, blob->name, error))
return FALSE;
if (typelib->len < offset + sizeof (InterfaceBlob) +
return FALSE;
if (typelib->len < offset + sizeof (InterfaceBlob) +
(blob->n_prerequisites + blob->n_prerequisites % 2) * 2 +
blob->n_properties * sizeof (PropertyBlob) +
blob->n_methods * sizeof (FunctionBlob) +
blob->n_signals * sizeof (SignalBlob) +
blob->n_vfuncs * sizeof (VFuncBlob) +
blob->n_constants * sizeof (ConstantBlob))
{
g_set_error (error,
G_TYPELIB_ERROR,
@ -1657,7 +1657,7 @@ validate_interface_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Invalid prerequisite index");
return FALSE;
return FALSE;
}
entry = g_typelib_get_dir_entry (typelib, req);
@ -1669,14 +1669,14 @@ validate_interface_blob (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_BLOB,
"Not an interface or object");
return FALSE;
return FALSE;
}
}
offset2 += 2 * (blob->n_prerequisites % 2);
push_context (ctx, get_string_nofail (typelib, blob->name));
for (i = 0; i < blob->n_properties; i++, offset2 += sizeof (PropertyBlob))
{
if (!validate_property_blob (typelib, offset2, error))
@ -1688,13 +1688,13 @@ validate_interface_blob (ValidateContext *ctx,
if (!validate_function_blob (ctx, offset2, BLOB_TYPE_INTERFACE, error))
return FALSE;
}
for (i = 0; i < blob->n_signals; i++, offset2 += sizeof (SignalBlob))
{
if (!validate_signal_blob (typelib, offset2, offset, error))
return FALSE;
}
for (i = 0; i < blob->n_vfuncs; i++, offset2 += sizeof (VFuncBlob))
{
if (!validate_vfunc_blob (typelib, offset2, offset, error))
@ -1746,7 +1746,7 @@ validate_blob (ValidateContext *ctx,
}
common = (CommonBlob*)&typelib->data[offset];
switch (common->blob_type)
{
case BLOB_TYPE_FUNCTION:
@ -1788,7 +1788,7 @@ validate_blob (ValidateContext *ctx,
return FALSE;
break;
default:
g_set_error (error,
g_set_error (error,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_ENTRY,
"Invalid blob type");
@ -1798,7 +1798,7 @@ validate_blob (ValidateContext *ctx,
return TRUE;
}
static gboolean
static gboolean
validate_directory (ValidateContext *ctx,
GError **error)
{
@ -1806,7 +1806,7 @@ validate_directory (ValidateContext *ctx,
Header *header = (Header *)typelib->data;
DirEntry *entry;
gint i;
if (typelib->len < header->directory + header->n_entries * sizeof (DirEntry))
{
g_set_error (error,
@ -1821,8 +1821,8 @@ validate_directory (ValidateContext *ctx,
entry = g_typelib_get_dir_entry (typelib, i + 1);
if (!validate_name (typelib, "entry", typelib->data, entry->name, error))
return FALSE;
return FALSE;
if ((entry->local && entry->blob_type == BLOB_TYPE_INVALID) ||
entry->blob_type > BLOB_TYPE_UNION)
{
@ -1830,7 +1830,7 @@ validate_directory (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID_DIRECTORY,
"Invalid entry type");
return FALSE;
return FALSE;
}
if (i < header->n_local_entries)
@ -1868,7 +1868,7 @@ validate_directory (ValidateContext *ctx,
}
if (!validate_name (typelib, "namespace", typelib->data, entry->offset, error))
return FALSE;
return FALSE;
}
}
@ -1888,9 +1888,9 @@ validate_attributes (ValidateContext *ctx,
G_TYPELIB_ERROR,
G_TYPELIB_ERROR_INVALID,
"The buffer is too short");
return FALSE;
return FALSE;
}
return TRUE;
}
@ -1902,7 +1902,7 @@ prefix_with_context (GError **error,
GString *str = g_string_new (NULL);
GSList *link;
char *buf;
link = ctx->context_stack;
if (!link)
{
@ -1922,7 +1922,7 @@ prefix_with_context (GError **error,
g_free (buf);
}
gboolean
gboolean
g_typelib_validate (GTypelib *typelib,
GError **error)
{
@ -1965,7 +1965,7 @@ _g_typelib_do_dlopen (GTypelib *typelib)
{
Header *header;
const char *shlib_str;
header = (Header *) typelib->data;
/* note that NULL shlib means to open the main app, which is allowed */
if (header->shared_library)
@ -2059,11 +2059,11 @@ _g_typelib_ensure_open (GTypelib *typelib)
* g_typelib_new_from_memory:
* @memory: address of memory chunk containing the typelib
* @len: length of memory chunk containing the typelib
*
*
* Creates a new #GTypelib from a memory location. The memory block
* pointed to by @typelib will be automatically g_free()d when the
* repository is destroyed.
*
*
* Return value: the new #GTypelib
**/
GTypelib *
@ -2084,9 +2084,9 @@ g_typelib_new_from_memory (guchar *memory, gsize len)
* g_typelib_new_from_const_memory:
* @memory: address of memory chunk containing the typelib
* @len: length of memory chunk containing the typelib
*
*
* Creates a new #GTypelib from a memory location.
*
*
* Return value: the new #GTypelib
**/
GTypelib *
@ -2106,9 +2106,9 @@ g_typelib_new_from_const_memory (const guchar *memory, gsize len)
/**
* g_typelib_new_from_mapped_file:
* @mfile: a #GMappedFile, that will be free'd when the repository is destroyed
*
*
* Creates a new #GTypelib from a #GMappedFile.
*
*
* Return value: the new #GTypelib
**/
GTypelib *
@ -2128,7 +2128,7 @@ g_typelib_new_from_mapped_file (GMappedFile *mfile)
/**
* g_typelib_free:
* @typelib: a #GTypelib
*
*
* Free a #GTypelib.
**/
void
@ -2167,7 +2167,7 @@ gboolean
g_typelib_symbol (GTypelib *typelib, const char *symbol_name, gpointer *symbol)
{
GList *l;
_g_typelib_ensure_open (typelib);
/*
@ -2177,9 +2177,9 @@ g_typelib_symbol (GTypelib *typelib, const char *symbol_name, gpointer *symbol)
* will be the custom one, which overrides the main one. A bit
* inefficient, but the problem will go away when gir-repository
* does.
*
*
* For modules with no shared library, we dlopen'd the current
* process above.
* process above.
*/
for (l = typelib->modules; l; l = l->next)
{

View File

@ -35,21 +35,21 @@ G_BEGIN_DECLS
*
* The "typelib" is a binary, readonly, memory-mappable database
* containing reflective information about a GObject library.
*
* The format of GObject typelib is strongly influenced by the Mozilla XPCOM
* format.
*
* The format of GObject typelib is strongly influenced by the Mozilla XPCOM
* format.
*
* Some of the differences to XPCOM include:
* - Type information is stored not quite as compactly (XPCOM stores it inline
* in function descriptions in variable-sized blobs of 1 to n bytes. We store
* 16 bits of type information for each parameter, which is enough to encode
* simple types inline. Complex (e.g. recursive) types are stored out of line
* - Type information is stored not quite as compactly (XPCOM stores it inline
* in function descriptions in variable-sized blobs of 1 to n bytes. We store
* 16 bits of type information for each parameter, which is enough to encode
* simple types inline. Complex (e.g. recursive) types are stored out of line
* in a separate list of types.
* - String and complex type data is stored outside of typelib entry blobs,
* references are stored as offsets relative to the start of the typelib.
* One possibility is to store the strings and types in a pools at the end
* of the typelib.
*
* - String and complex type data is stored outside of typelib entry blobs,
* references are stored as offsets relative to the start of the typelib.
* One possibility is to store the strings and types in a pools at the end
* of the typelib.
*
* The typelib has the following general format.
*
* typelib ::= header, directory, blobs, attributes, attributedata
@ -63,8 +63,8 @@ G_BEGIN_DECLS
* attributedata ::= string data for attributes
*
* Details
*
* We describe the fragments that make up the typelib in the form of C structs
*
* We describe the fragments that make up the typelib in the form of C structs
* (although some fall short of being valid C structs since they contain multiple
* flexible arrays).
*/
@ -113,11 +113,11 @@ Changes since 0.1:
- use 'blob' as collective name for the various blob types
- rename 'type' field in blobs to 'blob_type'
- rename 'type_name' and 'type_init' fields to 'gtype_name', 'gtype_init'
- shrink directory entries to 12 bytes
- shrink directory entries to 12 bytes
- merge struct and boxed blobs
- split interface blobs into enum, object and interface blobs
- add an 'unregistered' flag to struct and enum blobs
- add a 'wraps_vfunc' flag to function blobs and link them to
- add a 'wraps_vfunc' flag to function blobs and link them to
the vfuncs they wrap
- restrict value blobs to only occur inside enums and flags again
- add constant blobs, allow them toplevel, in interfaces and in objects
@ -133,8 +133,8 @@ Changes since 0.1:
/**
* G_IR_MAGIC:
*
* Identifying prefix for the typelib. This was inspired by XPCOM,
*
* Identifying prefix for the typelib. This was inspired by XPCOM,
* which in turn borrowed from PNG.
*/
#define G_IR_MAGIC "GOBJ\nMETADATA\r\n\032"
@ -153,7 +153,7 @@ Changes since 0.1:
* @BLOB_TYPE_CONSTANT: A #ConstantBlob
* @BLOB_TYPE_ERROR_DOMAIN: A #ErrorDomainBlob
* @BLOB_TYPE_UNION: A #UnionBlob
*
*
* The integral value of this enumeration appears in each "Blob"
* component of a typelib to identify its type.
*/
@ -182,8 +182,8 @@ typedef enum {
/**
* Header:
* @magic: See #G_IR_MAGIC.
* @major_version: The version of the typelib format. Minor version changes indicate
* compatible changes and should still allow the typelib to be parsed
* @major_version: The version of the typelib format. Minor version changes indicate
* compatible changes and should still allow the typelib to be parsed
* by a parser designed for the same major_version.
* @minor_version: See major_version.
* @n_entries: The number of entries in the directory.
@ -197,7 +197,7 @@ typedef enum {
* dependencies are required in order to avoid having programs
* consuming a typelib check for an "Unresolved" type return
* from every API call.
* @size: The size in bytes of the typelib.
* @size: The size in bytes of the typelib.
* @namespace: Offset of the namespace string in the typelib.
* @nsversion: Offset of the namespace version string in the typelib.
* @shared_library: This field is the set of shared libraries associated
@ -222,13 +222,13 @@ typedef enum {
* @struct_blob_size: See above.
* @error_domain_blob_size: See above.
* @interface_blob_size: For variable-size blobs, the size of the struct up to the first
* flexible array member. Recording this information here allows to
* write parser which continue to work if the format is extended by
* adding new fields before the first flexible array member in
* flexible array member. Recording this information here allows to
* write parser which continue to work if the format is extended by
* adding new fields before the first flexible array member in
* variable-size blobs.
*
*
* The header structure appears exactly once at the beginning of a typelib. It is a
* collection of meta-information, such as the number of entries and dependencies.
* collection of meta-information, such as the number of entries and dependencies.
*/
typedef struct {
gchar magic[16];
@ -268,7 +268,7 @@ typedef struct {
guint16 object_blob_size;
guint16 interface_blob_size;
guint16 union_blob_size;
guint16 padding[7];
} Header;
@ -280,10 +280,10 @@ typedef struct {
* @offset: If is_local is set, this is the offset of the blob in the typelib.
* Otherwise, it is the offset of the namespace in which the blob has
* to be looked up by name.
*
*
* References to directory entries are stored as 1-based 16-bit indexes.
*
* All blobs pointed to by a directory entry start with the same layout for
*
* All blobs pointed to by a directory entry start with the same layout for
* the first 8 bytes (the reserved flags may be used by some blob types)
*/
typedef struct {
@ -298,9 +298,9 @@ typedef struct {
/**
* SimpleTypeBlob:
* @is_pointer: Indicates whether the type is passed by reference.
* @is_pointer: Indicates whether the type is passed by reference.
* @tag: A #GITypeTag
* @offset: Offset relative to header->types that points to a TypeBlob.
* @offset: Offset relative to header->types that points to a TypeBlob.
* Unlike other offsets, this is in words (ie 32bit units) rather
* than bytes.
*
@ -320,53 +320,53 @@ typedef struct {
*/
typedef union
{
struct
struct
{
guint reserved : 8;
guint reserved2 :16;
guint pointer : 1;
guint reserved3 : 2;
guint tag : 5;
guint tag : 5;
} flags;
guint32 offset;
} SimpleTypeBlob;
/*
* ArgBlob:
* @name: A suggested name for the parameter.
* @name: A suggested name for the parameter.
* @in: The parameter is an input to the function
* @out: The parameter is used to return an output of the function.
* Parameters can be both in and out. Out parameters implicitly
* add another level of indirection to the parameter type. Ie if
* the type is uint32 in an out parameter, the function actually
* @out: The parameter is used to return an output of the function.
* Parameters can be both in and out. Out parameters implicitly
* add another level of indirection to the parameter type. Ie if
* the type is uint32 in an out parameter, the function actually
* takes an uint32*.
* @dipper: The parameter is a pointer to a struct or object that will
* receive an output of the function.
* @dipper: The parameter is a pointer to a struct or object that will
* receive an output of the function.
* @allow_none: Only meaningful for types which are passed as pointers.
* For an in parameter, indicates if it is ok to pass NULL in, for
* an out parameter, whether it may return NULL. Note that NULL is a
* For an in parameter, indicates if it is ok to pass NULL in, for
* an out parameter, whether it may return NULL. Note that NULL is a
* valid GList and GSList value, thus allow_none will normally be set
* for parameters of these types.
* @optional: For an out parameter, indicates that NULL may be passed in
* if the value is not needed.
* @transfer_ownership: For an in parameter, indicates that the function takes over
* ownership of the parameter value. For an out parameter, it
* indicates that the caller is responsible for freeing the return
* @transfer_ownership: For an in parameter, indicates that the function takes over
* ownership of the parameter value. For an out parameter, it
* indicates that the caller is responsible for freeing the return
* value.
* @transfer_container_ownership: For container types, indicates that the
* ownership of the container, but not of its contents is transferred. This is typically the case
* ownership of the container, but not of its contents is transferred. This is typically the case
* for out parameters returning lists of statically allocated things.
* @is_return_value: The parameter should be considered the return value of the function.
* Only out parameters can be marked as return value, and there can be
* at most one per function call. If an out parameter is marked as
* return value, the actual return value of the function should be
* @is_return_value: The parameter should be considered the return value of the function.
* Only out parameters can be marked as return value, and there can be
* at most one per function call. If an out parameter is marked as
* return value, the actual return value of the function should be
* either void or a boolean indicating the success of the call.
* @scope: A #GIScopeType. If the parameter is of a callback type, this denotes the scope
* of the user_data and the callback function pointer itself
* (for languages that emit code at run-time).
* @closure: Index of the closure (user_data) parameter associated with the callback,
* @closure: Index of the closure (user_data) parameter associated with the callback,
* or -1.
* @destroy: Index of the destroy notfication callback parameter associated with
* @destroy: Index of the destroy notfication callback parameter associated with
* the callback, or -1.
* @arg_type: Describes the type of the parameter. See details below.
*
@ -402,9 +402,9 @@ typedef struct {
* @caller_owns_return_value: If set, the caller is responsible for freeing the return value
* if it is no longer needed.
* @caller_owns_return_container: This flag is only relevant if the return type is a container type.
* If the flag is set, the caller is resonsible for freeing the
* If the flag is set, the caller is resonsible for freeing the
* container, but not its contents.
* @n_arguments: The number of arguments that this function expects, also the length
* @n_arguments: The number of arguments that this function expects, also the length
* of the array of ArgBlobs.
* @arguments: An array of ArgBlob for the arguments of the function.
*/
@ -426,9 +426,9 @@ typedef struct {
* @blob_type: A #GTypelibBlobType
* @deprecated: Whether the blob is deprecated.
* @name: The name of the blob.
*
*
* The #CommonBlob is shared between #FunctionBlob,
* #CallbackBlob, #SignalBlob.
* #CallbackBlob, #SignalBlob.
*/
typedef struct {
guint16 blob_type; /* 1 */
@ -442,22 +442,22 @@ typedef struct {
/**
* FunctionBlob:
* @blob_Type: #BLOB_TYPE_FUNCTION
* @symbol: The symbol which can be used to obtain the function pointer with
* @symbol: The symbol which can be used to obtain the function pointer with
* dlsym().
* @deprecated: The function is deprecated.
* @setter: The function is a setter for a property. Language bindings may
* prefer to not bind individual setters and rely on the generic
* @setter: The function is a setter for a property. Language bindings may
* prefer to not bind individual setters and rely on the generic
* g_object_set().
* @getter: The function is a getter for a property. Language bindings may
* prefer to not bind individual getters and rely on the generic
* @getter: The function is a getter for a property. Language bindings may
* prefer to not bind individual getters and rely on the generic
* g_object_get().
* @constructor:The function acts as a constructor for the object it is contained
* @constructor:The function acts as a constructor for the object it is contained
* in.
* @wraps_vfunc: The function is a simple wrapper for a virtual function.
* @index: Index of the property that this function is a setter or getter of
* @index: Index of the property that this function is a setter or getter of
* in the array of properties of the containing interface, or index
* of the virtual function that this function wraps.
* @signature: Offset of the SignatureBlob describing the parameter types and the
* @signature: Offset of the SignatureBlob describing the parameter types and the
* return value type.
* @is_static: The function is a "static method"; in other words it's a pure
* function whose name is conceptually scoped to the object.
@ -487,7 +487,7 @@ typedef struct {
/**
* CallbackBlob:
* @signature: Offset of the #SignatureBlob describing the parameter types and the
* @signature: Offset of the #SignatureBlob describing the parameter types and the
* return value type.
*/
typedef struct {
@ -505,36 +505,36 @@ typedef struct {
* @pointer: Whether this type represents an indirection
* @tag: A #GITypeTag
* @interface: Index of the directory entry for the interface.
*
*
* If the interface is an enum of flags type, is_pointer is 0, otherwise it is 1.
*/
typedef struct {
guint8 pointer :1;
guint8 reserved :2;
guint8 tag :5;
guint8 tag :5;
guint8 reserved2;
guint16 interface;
guint16 interface;
} InterfaceTypeBlob;
/**
* ArrayTypeBlob:
* @zero_terminated: Indicates that the array must be terminated by a suitable #NULL
* value.
* @has_length: Indicates that length points to a parameter specifying the length
* of the array. If both has_length and zero_terminated are set, the
* convention is to pass -1 for the length if the array is
* zero-terminated.
* @length: The index of the parameter which is used to pass the length of the
* array. The parameter must be an integer type and have the same
* direction as this one.
* @zero_terminated: Indicates that the array must be terminated by a suitable #NULL
* value.
* @has_length: Indicates that length points to a parameter specifying the length
* of the array. If both has_length and zero_terminated are set, the
* convention is to pass -1 for the length if the array is
* zero-terminated.
* @length: The index of the parameter which is used to pass the length of the
* array. The parameter must be an integer type and have the same
* direction as this one.
* @type: The type of the array elements.
*
*
* Arrays are passed by reference, thus is_pointer is always 1.
*/
typedef struct {
guint16 pointer :1;
guint16 reserved :2;
guint16 tag :5;
guint16 tag :5;
guint16 zero_terminated :1;
guint16 has_length :1;
@ -553,12 +553,12 @@ typedef struct {
* ParamTypeBlob:
* @n_types: The number of parameter types to follow.
* @type: Describes the type of the list elements.
*
*
*/
typedef struct {
guint8 pointer :1;
guint8 reserved :2;
guint8 tag :5;
guint8 tag :5;
guint8 reserved2;
guint16 n_types;
@ -574,7 +574,7 @@ typedef struct {
typedef struct {
guint8 pointer :1;
guint8 reserved :2;
guint8 tag :5;
guint8 tag :5;
guint8 reserved2;
guint16 n_domains;
@ -584,7 +584,7 @@ typedef struct {
/**
* ErrorDomainBlob:
* @get_quark: The symbol name of the function which must be called to obtain the
* @get_quark: The symbol name of the function which must be called to obtain the
* GQuark for the error domain.
* @error_codes: Index of the InterfaceBlob describing the enumeration which lists
* the possible error codes.
@ -594,7 +594,7 @@ typedef struct {
guint16 deprecated : 1;
guint16 reserved :15;
guint32 name;
guint32 get_quark;
@ -607,7 +607,7 @@ typedef struct {
* @deprecated: Whether this value is deprecated
* @value: The numerical value
* @name: Name of blob
*
*
* Values commonly occur in enums and flags.
*/
typedef struct {
@ -633,7 +633,7 @@ typedef struct {
typedef struct {
guint32 name;
guint8 readable :1;
guint8 readable :1;
guint8 writable :1;
guint8 has_embedded_type :1;
guint8 reserved :5;
@ -652,11 +652,11 @@ typedef struct {
* @gtype_init: The symbol name of the get_type() function which registers the type.
*/
typedef struct {
guint16 blob_type;
guint16 deprecated : 1;
guint16 blob_type;
guint16 deprecated : 1;
guint16 unregistered : 1;
guint16 reserved :14;
guint32 name;
guint32 name;
guint32 gtype_name;
guint32 gtype_init;
@ -672,10 +672,10 @@ typedef struct {
* @size: The size of the struct in bytes.
* @gtype_name: String name of the associated #GType
* @gtype_init: String naming the symbol which gets the runtime #GType
* @n_fields:
* @n_fields:
* @n_functions: The lengths of the arrays.
* @fields: An array of n_fields FieldBlobs.
* @functions: An array of n_functions FunctionBlobs. The described functions
* @fields: An array of n_fields FieldBlobs.
* @functions: An array of n_functions FunctionBlobs. The described functions
* should be considered as methods of the struct.
*/
typedef struct {
@ -684,7 +684,7 @@ typedef struct {
guint16 deprecated : 1;
guint16 unregistered : 1;
guint16 is_gtype_struct : 1;
guint16 alignment : 6;
guint16 alignment : 6;
guint16 reserved : 7;
guint32 name;
@ -702,7 +702,7 @@ typedef struct {
#if 0
/* variable-length parts of the blob */
FieldBlob fields[];
FieldBlob fields[];
FunctionBlob methods[];
#endif
} StructBlob;
@ -720,12 +720,12 @@ typedef struct {
* discriminator of a discriminated union is located.
* The value 0xFFFF indicates that the discriminator offset
* is unknown.
* @discriminator_type: Type of the discriminator
* @discriminator_type: Type of the discriminator
* @discriminator_values: On discriminator value per field
* @fields: Array of FieldBlobs describing the alternative branches of the union
*/
typedef struct {
guint16 blob_type;
guint16 blob_type;
guint16 deprecated : 1;
guint16 unregistered : 1;
guint16 discriminated : 1;
@ -744,12 +744,12 @@ typedef struct {
guint32 reserved2;
guint32 reserved3;
gint32 discriminator_offset;
gint32 discriminator_offset;
SimpleTypeBlob discriminator_type;
#if 0
FieldBlob fields[];
FunctionBlob functions[];
FieldBlob fields[];
FunctionBlob functions[];
ConstantBlob discriminator_values[]
#endif
} UnionBlob;
@ -762,17 +762,17 @@ typedef struct {
* @gtype_name: String name of the associated #GType
* @gtype_init: String naming the symbol which gets the runtime #GType
* @n_values: The lengths of the values arrays.
* @values: Describes the enum values.
* @values: Describes the enum values.
*/
typedef struct {
guint16 blob_type;
guint16 deprecated : 1;
guint16 deprecated : 1;
guint16 unregistered : 1;
guint16 storage_type : 5;
guint16 reserved : 9;
guint32 name;
guint32 name;
guint32 gtype_name;
guint32 gtype_init;
@ -782,15 +782,15 @@ typedef struct {
guint32 reserved3;
ValueBlob values[];
ValueBlob values[];
} EnumBlob;
/**
* PropertyBlob:
* @name: The name of the property.
* @name: The name of the property.
* @readable:
* @writable:
* @construct:
* @writable:
* @construct:
* @construct_only: The ParamFlags used when registering the property.
* @type: Describes the type of the property.
*/
@ -823,7 +823,7 @@ typedef struct {
* @true_stops_emit: Whether the signal has true-stops-emit semantics
* @class_closure: The index of the class closure in the list of virtual functions
* of the object or interface on which the signal is defined.
* @signature: Offset of the SignatureBlob describing the parameter types and the
* @signature: Offset of the SignatureBlob describing the parameter types and the
* return value type.
*/
typedef struct {
@ -852,19 +852,19 @@ typedef struct {
* VFuncBlob:
* @name: The name of the virtual function.
* @must_chain_up: If set, every implementation of this virtual function must
* chain up to the implementation of the parent class.
* chain up to the implementation of the parent class.
* @must_be_implemented: If set, every derived class must override this virtual function.
* @must_not_be_implemented: If set, derived class must not override this virtual function.
* @class_closure: Set if this virtual function is the class closure of a signal.
* @signal: The index of the signal in the list of signals of the object or
* @signal: The index of the signal in the list of signals of the object or
* interface to which this virtual function belongs.
* @struct_offset: The offset of the function pointer in the class struct. The value
* 0xFFFF indicates that the struct offset is unknown.
* @invoker: If a method invoker for this virtual exists, this is the offset in the
* class structure of the method. If no method is known, this value will be 0x3ff.
* @signature:
* Offset of the SignatureBlob describing the parameter types and the
* return value type.
* @signature:
* Offset of the SignatureBlob describing the parameter types and the
* return value type.
*/
typedef struct {
guint32 name;
@ -889,19 +889,19 @@ typedef struct {
* @blob_type: #BLOB_TYPE_OBJECT
* @gtype_name: String name of the associated #GType
* @gtype_init: String naming the symbol which gets the runtime #GType
* @parent: The directory index of the parent type. This is only set for
* @parent: The directory index of the parent type. This is only set for
* objects. If an object does not have a parent, it is zero.
* @n_interfaces:
* @n_fields:
* @n_fields:
* @n_properties:
* @n_methods:
* @n_signals:
* @n_vfuncs:
* @n_constants: The lengths of the arrays.Up to 16bits of padding may be inserted
* @n_constants: The lengths of the arrays.Up to 16bits of padding may be inserted
* between the arrays to ensure that they start on a 32bit boundary.
* @interfaces: An array of indices of directory entries for the implemented
* @interfaces: An array of indices of directory entries for the implemented
* interfaces.
* @fields: Describes the fields.
* @fields: Describes the fields.
* @methods: Describes the methods, constructors, setters and getters.
* @properties: Describes the properties.
* @signals: Describes the signals.
@ -934,7 +934,7 @@ typedef struct {
guint32 reserved4;
guint16 interfaces[];
#if 0
/* variable-length parts of the blob */
FieldBlob fields[];
@ -965,10 +965,10 @@ typedef struct {
* @constants: Describes the constants.
*/
typedef struct {
guint16 blob_type;
guint16 blob_type;
guint16 deprecated : 1;
guint16 reserved :15;
guint32 name;
guint32 name;
guint32 gtype_name;
guint32 gtype_init;
@ -979,14 +979,14 @@ typedef struct {
guint16 n_methods;
guint16 n_signals;
guint16 n_vfuncs;
guint16 n_constants;
guint16 n_constants;
guint32 reserved2;
guint32 reserved3;
guint16 prerequisites[];
#if 0
#if 0
/* variable-length parts of the blob */
PropertyBlob properties[];
FunctionBlob methods[];
@ -1005,9 +1005,9 @@ typedef struct {
*/
typedef struct {
guint16 blob_type;
guint16 deprecated : 1;
guint16 deprecated : 1;
guint16 reserved :15;
guint32 name;
guint32 name;
SimpleTypeBlob type;