girepository: Replace tabs with spaces in indentation

We don't use tabs anywhere and the mixed setup just makes many editors
to cry. So let's just replace the tabs with 8 spaces.
This commit is contained in:
Marco Trevisan (Treviño) 2024-01-16 17:30:37 +01:00
parent 35fe0d0bba
commit 91fc45ea57
24 changed files with 3348 additions and 3348 deletions

View File

@ -143,9 +143,9 @@ invoke_get_type (GModule *self, const char *symbol, GError **error)
if (!g_module_symbol (self, symbol, (void**)&sym)) if (!g_module_symbol (self, symbol, (void**)&sym))
{ {
g_set_error (error, g_set_error (error,
G_FILE_ERROR, G_FILE_ERROR,
G_FILE_ERROR_FAILED, G_FILE_ERROR_FAILED,
"Failed to find symbol '%s'", symbol); "Failed to find symbol '%s'", symbol);
return G_TYPE_INVALID; return G_TYPE_INVALID;
} }
@ -153,9 +153,9 @@ invoke_get_type (GModule *self, const char *symbol, GError **error)
if (ret == G_TYPE_INVALID) if (ret == G_TYPE_INVALID)
{ {
g_set_error (error, g_set_error (error,
G_FILE_ERROR, G_FILE_ERROR,
G_FILE_ERROR_FAILED, G_FILE_ERROR_FAILED,
"Function '%s' returned G_TYPE_INVALID", symbol); "Function '%s' returned G_TYPE_INVALID", symbol);
} }
return ret; return ret;
} }
@ -168,9 +168,9 @@ invoke_error_quark (GModule *self, const char *symbol, GError **error)
if (!g_module_symbol (self, symbol, (void**)&sym)) if (!g_module_symbol (self, symbol, (void**)&sym))
{ {
g_set_error (error, g_set_error (error,
G_FILE_ERROR, G_FILE_ERROR,
G_FILE_ERROR_FAILED, G_FILE_ERROR_FAILED,
"Failed to find symbol '%s'", symbol); "Failed to find symbol '%s'", symbol);
return G_TYPE_INVALID; return G_TYPE_INVALID;
} }
@ -273,7 +273,7 @@ dump_properties (GType type, FILE *out)
prop = props[i]; prop = props[i];
if (prop->owner_type != type) if (prop->owner_type != type)
continue; continue;
const GValue *v = g_param_spec_get_default_value (prop); const GValue *v = g_param_spec_get_default_value (prop);
char *default_value = value_to_string (v); char *default_value = value_to_string (v);
@ -318,7 +318,7 @@ dump_signals (GType type, FILE *out)
g_signal_query (sigid, &query); g_signal_query (sigid, &query);
escaped_printf (out, " <signal name=\"%s\" return=\"%s\"", escaped_printf (out, " <signal name=\"%s\" return=\"%s\"",
query.signal_name, g_type_name (query.return_type)); query.signal_name, g_type_name (query.return_type));
if (query.signal_flags & G_SIGNAL_RUN_FIRST) if (query.signal_flags & G_SIGNAL_RUN_FIRST)
escaped_printf (out, " when=\"first\""); escaped_printf (out, " when=\"first\"");
@ -343,10 +343,10 @@ dump_signals (GType type, FILE *out)
goutput_write (out, ">\n"); goutput_write (out, ">\n");
for (j = 0; j < query.n_params; j++) for (j = 0; j < query.n_params; j++)
{ {
escaped_printf (out, " <param type=\"%s\"/>\n", escaped_printf (out, " <param type=\"%s\"/>\n",
g_type_name (query.param_types[j])); g_type_name (query.param_types[j]));
} }
goutput_write (out, " </signal>\n"); goutput_write (out, " </signal>\n");
} }
g_free (sig_ids); g_free (sig_ids);
@ -360,7 +360,7 @@ dump_object_type (GType type, const char *symbol, FILE *out)
GType *interfaces; GType *interfaces;
escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"", escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"",
g_type_name (type), symbol); g_type_name (type), symbol);
if (type != G_TYPE_OBJECT) if (type != G_TYPE_OBJECT)
{ {
GString *parent_str; GString *parent_str;
@ -397,7 +397,7 @@ dump_object_type (GType type, const char *symbol, FILE *out)
{ {
GType itype = interfaces[i]; GType itype = interfaces[i];
escaped_printf (out, " <implements name=\"%s\"/>\n", escaped_printf (out, " <implements name=\"%s\"/>\n",
g_type_name (itype)); g_type_name (itype));
} }
g_free (interfaces); g_free (interfaces);
@ -414,23 +414,23 @@ dump_interface_type (GType type, const char *symbol, FILE *out)
GType *interfaces; GType *interfaces;
escaped_printf (out, " <interface name=\"%s\" get-type=\"%s\">\n", escaped_printf (out, " <interface name=\"%s\" get-type=\"%s\">\n",
g_type_name (type), symbol); g_type_name (type), symbol);
interfaces = g_type_interface_prerequisites (type, &n_interfaces); interfaces = g_type_interface_prerequisites (type, &n_interfaces);
for (i = 0; i < n_interfaces; i++) for (i = 0; i < n_interfaces; i++)
{ {
GType itype = interfaces[i]; GType itype = interfaces[i];
if (itype == G_TYPE_OBJECT) if (itype == G_TYPE_OBJECT)
{ {
/* Treat this as implicit for now; in theory GInterfaces are /* Treat this as implicit for now; in theory GInterfaces are
* supported on things like GstMiniObject, but right now * supported on things like GstMiniObject, but right now
* the introspection system only supports GObject. * the introspection system only supports GObject.
* http://bugzilla.gnome.org/show_bug.cgi?id=559706 * http://bugzilla.gnome.org/show_bug.cgi?id=559706
*/ */
continue; continue;
} }
escaped_printf (out, " <prerequisite name=\"%s\"/>\n", escaped_printf (out, " <prerequisite name=\"%s\"/>\n",
g_type_name (itype)); g_type_name (itype));
} }
g_free (interfaces); g_free (interfaces);
@ -443,7 +443,7 @@ static void
dump_boxed_type (GType type, const char *symbol, FILE *out) dump_boxed_type (GType type, const char *symbol, FILE *out)
{ {
escaped_printf (out, " <boxed name=\"%s\" get-type=\"%s\"/>\n", escaped_printf (out, " <boxed name=\"%s\" get-type=\"%s\"/>\n",
g_type_name (type), symbol); g_type_name (type), symbol);
} }
static void static void
@ -454,14 +454,14 @@ dump_flags_type (GType type, const char *symbol, FILE *out)
klass = g_type_class_ref (type); klass = g_type_class_ref (type);
escaped_printf (out, " <flags name=\"%s\" get-type=\"%s\">\n", escaped_printf (out, " <flags name=\"%s\" get-type=\"%s\">\n",
g_type_name (type), symbol); g_type_name (type), symbol);
for (i = 0; i < klass->n_values; i++) for (i = 0; i < klass->n_values; i++)
{ {
GFlagsValue *value = &(klass->values[i]); GFlagsValue *value = &(klass->values[i]);
escaped_printf (out, " <member name=\"%s\" nick=\"%s\" value=\"%u\"/>\n", escaped_printf (out, " <member name=\"%s\" nick=\"%s\" value=\"%u\"/>\n",
value->value_name, value->value_nick, value->value); value->value_name, value->value_nick, value->value);
} }
goutput_write (out, " </flags>\n"); goutput_write (out, " </flags>\n");
} }
@ -474,14 +474,14 @@ dump_enum_type (GType type, const char *symbol, FILE *out)
klass = g_type_class_ref (type); klass = g_type_class_ref (type);
escaped_printf (out, " <enum name=\"%s\" get-type=\"%s\">\n", escaped_printf (out, " <enum name=\"%s\" get-type=\"%s\">\n",
g_type_name (type), symbol); g_type_name (type), symbol);
for (i = 0; i < klass->n_values; i++) for (i = 0; i < klass->n_values; i++)
{ {
GEnumValue *value = &(klass->values[i]); GEnumValue *value = &(klass->values[i]);
escaped_printf (out, " <member name=\"%s\" nick=\"%s\" value=\"%d\"/>\n", escaped_printf (out, " <member name=\"%s\" nick=\"%s\" value=\"%d\"/>\n",
value->value_name, value->value_nick, value->value); value->value_name, value->value_nick, value->value);
} }
goutput_write (out, " </enum>"); goutput_write (out, " </enum>");
} }
@ -498,7 +498,7 @@ dump_fundamental_type (GType type, const char *symbol, FILE *out)
escaped_printf (out, " <fundamental name=\"%s\" get-type=\"%s\"", escaped_printf (out, " <fundamental name=\"%s\" get-type=\"%s\"",
g_type_name (type), symbol); g_type_name (type), symbol);
if (G_TYPE_IS_ABSTRACT (type)) if (G_TYPE_IS_ABSTRACT (type))
escaped_printf (out, " abstract=\"1\""); escaped_printf (out, " abstract=\"1\"");
@ -534,7 +534,7 @@ dump_fundamental_type (GType type, const char *symbol, FILE *out)
{ {
GType itype = interfaces[i]; GType itype = interfaces[i];
escaped_printf (out, " <implements name=\"%s\"/>\n", escaped_printf (out, " <implements name=\"%s\"/>\n",
g_type_name (itype)); g_type_name (itype));
} }
g_free (interfaces); g_free (interfaces);
goutput_write (out, " </fundamental>\n"); goutput_write (out, " </fundamental>\n");
@ -573,7 +573,7 @@ static void
dump_error_quark (GQuark quark, const char *symbol, FILE *out) dump_error_quark (GQuark quark, const char *symbol, FILE *out)
{ {
escaped_printf (out, " <error-quark function=\"%s\" domain=\"%s\"/>\n", escaped_printf (out, " <error-quark function=\"%s\" domain=\"%s\"/>\n",
symbol, g_quark_to_string (quark)); symbol, g_quark_to_string (quark));
} }
/** /**
@ -622,10 +622,10 @@ gi_repository_dump (const char *input_filename,
if (!self) if (!self)
{ {
g_set_error (error, g_set_error (error,
G_FILE_ERROR, G_FILE_ERROR,
G_FILE_ERROR_FAILED, G_FILE_ERROR_FAILED,
"failed to open self: %s", "failed to open self: %s",
g_module_error ()); g_module_error ());
return FALSE; return FALSE;
} }

View File

@ -41,12 +41,12 @@ main (int argc,
type = invoke_get_type (self, argv[i], &error); type = invoke_get_type (self, argv[i], &error);
if (!type) if (!type)
{ {
g_printerr ("%s\n", error->message); g_printerr ("%s\n", error->message);
g_clear_error (&error); g_clear_error (&error);
} }
else else
dump_type (type, argv[i], stdout); dump_type (type, argv[i], stdout);
} }
return 0; return 0;

View File

@ -428,7 +428,7 @@ gi_info_from_entry (GIRepository *repository,
unresolved->namespace = namespace; unresolved->namespace = namespace;
return (GIBaseInfo *)unresolved; return (GIBaseInfo *)unresolved;
} }
return (GIBaseInfo *)result; return (GIBaseInfo *)result;
} }

View File

@ -50,7 +50,7 @@ typedef struct {
gpointer data4; gpointer data4;
} GIAttributeIter; } GIAttributeIter;
#define GI_TYPE_BASE_INFO (gi_base_info_get_type ()) #define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
GI_AVAILABLE_IN_ALL GI_AVAILABLE_IN_ALL

View File

@ -40,7 +40,7 @@ G_BEGIN_DECLS
* *
* Since: 2.80 * Since: 2.80
*/ */
#define GI_IS_CALLABLE_INFO(info) \ #define GI_IS_CALLABLE_INFO(info) \
((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FUNCTION) || \ ((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FUNCTION) || \
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK) || \ (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK) || \
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_SIGNAL) || \ (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_SIGNAL) || \

View File

@ -39,7 +39,7 @@ G_BEGIN_DECLS
* *
* Since: 2.80 * Since: 2.80
*/ */
#define GI_IS_CALLBACK_INFO(info) \ #define GI_IS_CALLBACK_INFO(info) \
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK) (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK)
G_END_DECLS G_END_DECLS

View File

@ -135,49 +135,49 @@ gi_constant_info_get_value (GIConstantInfo *info,
{ {
gsize blob_size = blob->size; gsize blob_size = blob->size;
value->v_pointer = g_memdup2 (&rinfo->typelib->data[blob->offset], blob_size); value->v_pointer = g_memdup2 (&rinfo->typelib->data[blob->offset], blob_size);
} }
else else
{ {
switch (blob->type.flags.tag) switch (blob->type.flags.tag)
{ {
case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_BOOLEAN:
value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset]; value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset];
break; break;
case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_INT8:
value->v_int8 = *(gint8*)&rinfo->typelib->data[blob->offset]; value->v_int8 = *(gint8*)&rinfo->typelib->data[blob->offset];
break; break;
case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_UINT8:
value->v_uint8 = *(guint8*)&rinfo->typelib->data[blob->offset]; value->v_uint8 = *(guint8*)&rinfo->typelib->data[blob->offset];
break; break;
case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_INT16:
value->v_int16 = *(gint16*)&rinfo->typelib->data[blob->offset]; value->v_int16 = *(gint16*)&rinfo->typelib->data[blob->offset];
break; break;
case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_UINT16:
value->v_uint16 = *(guint16*)&rinfo->typelib->data[blob->offset]; value->v_uint16 = *(guint16*)&rinfo->typelib->data[blob->offset];
break; break;
case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_INT32:
value->v_int32 = *(gint32*)&rinfo->typelib->data[blob->offset]; value->v_int32 = *(gint32*)&rinfo->typelib->data[blob->offset];
break; break;
case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_UINT32:
value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset]; value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset];
break; break;
case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_INT64:
DO_ALIGNED_COPY(&value->v_int64, &rinfo->typelib->data[blob->offset], gint64); DO_ALIGNED_COPY(&value->v_int64, &rinfo->typelib->data[blob->offset], gint64);
break; break;
case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_UINT64:
DO_ALIGNED_COPY(&value->v_uint64, &rinfo->typelib->data[blob->offset], guint64); DO_ALIGNED_COPY(&value->v_uint64, &rinfo->typelib->data[blob->offset], guint64);
break; break;
case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_FLOAT:
DO_ALIGNED_COPY(&value->v_float, &rinfo->typelib->data[blob->offset], gfloat); DO_ALIGNED_COPY(&value->v_float, &rinfo->typelib->data[blob->offset], gfloat);
break; break;
case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_DOUBLE:
DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble); DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble);
break; break;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
} }
} }
} }
return blob->size; return blob->size;

View File

@ -211,151 +211,151 @@ gi_field_info_get_field (GIFieldInfo *field_info,
else else
{ {
switch (gi_type_info_get_tag (type_info)) switch (gi_type_info_get_tag (type_info))
{ {
case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_VOID:
g_warning("Field %s: should not be have void type", g_warning("Field %s: should not be have void type",
gi_base_info_get_name ((GIBaseInfo *)field_info)); gi_base_info_get_name ((GIBaseInfo *)field_info));
break; break;
case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_BOOLEAN:
value->v_boolean = G_STRUCT_MEMBER (gboolean, mem, offset) != FALSE; value->v_boolean = G_STRUCT_MEMBER (gboolean, mem, offset) != FALSE;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_UINT8:
value->v_uint8 = G_STRUCT_MEMBER (guint8, mem, offset); value->v_uint8 = G_STRUCT_MEMBER (guint8, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_UINT16:
value->v_uint16 = G_STRUCT_MEMBER (guint16, mem, offset); value->v_uint16 = G_STRUCT_MEMBER (guint16, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_INT32:
case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_UINT32:
case GI_TYPE_TAG_UNICHAR: case GI_TYPE_TAG_UNICHAR:
value->v_uint32 = G_STRUCT_MEMBER (guint32, mem, offset); value->v_uint32 = G_STRUCT_MEMBER (guint32, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_INT64:
case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_UINT64:
value->v_uint64 = G_STRUCT_MEMBER (guint64, mem, offset); value->v_uint64 = G_STRUCT_MEMBER (guint64, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_GTYPE: case GI_TYPE_TAG_GTYPE:
value->v_size = G_STRUCT_MEMBER (gsize, mem, offset); value->v_size = G_STRUCT_MEMBER (gsize, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_FLOAT:
value->v_float = G_STRUCT_MEMBER (gfloat, mem, offset); value->v_float = G_STRUCT_MEMBER (gfloat, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_DOUBLE:
value->v_double = G_STRUCT_MEMBER (gdouble, mem, offset); value->v_double = G_STRUCT_MEMBER (gdouble, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_ARRAY:
/* We don't check the array type and that it is fixed-size, /* We don't check the array type and that it is fixed-size,
we trust g-ir-compiler to do the right thing */ we trust g-ir-compiler to do the right thing */
value->v_pointer = G_STRUCT_MEMBER_P (mem, offset); value->v_pointer = G_STRUCT_MEMBER_P (mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_FILENAME:
case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_GHASH:
g_warning("Field %s: type %s should have is_pointer set", g_warning("Field %s: type %s should have is_pointer set",
gi_base_info_get_name ((GIBaseInfo *)field_info), gi_base_info_get_name ((GIBaseInfo *)field_info),
gi_type_tag_to_string (gi_type_info_get_tag (type_info))); gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
break; break;
case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_ERROR:
/* Needs to be handled by the language binding directly */ /* Needs to be handled by the language binding directly */
break; break;
case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_INTERFACE:
{ {
GIBaseInfo *interface = gi_type_info_get_interface (type_info); GIBaseInfo *interface = gi_type_info_get_interface (type_info);
switch (gi_base_info_get_info_type (interface)) switch (gi_base_info_get_info_type (interface))
{ {
case GI_INFO_TYPE_STRUCT: case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_UNION: case GI_INFO_TYPE_UNION:
case GI_INFO_TYPE_BOXED: case GI_INFO_TYPE_BOXED:
/* Needs to be handled by the language binding directly */ /* Needs to be handled by the language binding directly */
break; break;
case GI_INFO_TYPE_OBJECT: case GI_INFO_TYPE_OBJECT:
break; break;
case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS: case GI_INFO_TYPE_FLAGS:
{ {
/* FIXME: there's a mismatch here between the value->v_int we use /* FIXME: there's a mismatch here between the value->v_int we use
* here and the gint64 result returned from gi_value_info_get_value(). * here and the gint64 result returned from gi_value_info_get_value().
* But to switch this to gint64, we'd have to make gi_function_info_invoke() * But to switch this to gint64, we'd have to make gi_function_info_invoke()
* translate value->v_int64 to the proper ABI for an enum function * translate value->v_int64 to the proper ABI for an enum function
* call parameter, which will usually be int, and then fix up language * call parameter, which will usually be int, and then fix up language
* bindings. * bindings.
*/ */
GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface); GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
switch (storage_type) switch (storage_type)
{ {
case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_UINT8:
value->v_int = (gint)G_STRUCT_MEMBER (guint8, mem, offset); value->v_int = (gint)G_STRUCT_MEMBER (guint8, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_UINT16:
value->v_int = (gint)G_STRUCT_MEMBER (guint16, mem, offset); value->v_int = (gint)G_STRUCT_MEMBER (guint16, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_INT32:
case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_UINT32:
value->v_int = (gint)G_STRUCT_MEMBER (guint32, mem, offset); value->v_int = (gint)G_STRUCT_MEMBER (guint32, mem, offset);
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_INT64:
case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_UINT64:
value->v_int = (gint)G_STRUCT_MEMBER (guint64, mem, offset); value->v_int = (gint)G_STRUCT_MEMBER (guint64, mem, offset);
result = TRUE; result = TRUE;
break; break;
default: default:
g_warning("Field %s: Unexpected enum storage type %s", g_warning("Field %s: Unexpected enum storage type %s",
gi_base_info_get_name ((GIBaseInfo *)field_info), gi_base_info_get_name ((GIBaseInfo *)field_info),
gi_type_tag_to_string (storage_type)); gi_type_tag_to_string (storage_type));
break; break;
} }
break; break;
} }
case GI_INFO_TYPE_VFUNC: case GI_INFO_TYPE_VFUNC:
case GI_INFO_TYPE_CALLBACK: case GI_INFO_TYPE_CALLBACK:
g_warning("Field %s: Interface type %d should have is_pointer set", g_warning("Field %s: Interface type %d should have is_pointer set",
gi_base_info_get_name ((GIBaseInfo *)field_info), gi_base_info_get_name ((GIBaseInfo *)field_info),
gi_base_info_get_info_type (interface)); gi_base_info_get_info_type (interface));
break; break;
case GI_INFO_TYPE_INVALID: case GI_INFO_TYPE_INVALID:
case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_FUNCTION: case GI_INFO_TYPE_FUNCTION:
case GI_INFO_TYPE_CONSTANT: case GI_INFO_TYPE_CONSTANT:
case GI_INFO_TYPE_VALUE: case GI_INFO_TYPE_VALUE:
case GI_INFO_TYPE_SIGNAL: case GI_INFO_TYPE_SIGNAL:
case GI_INFO_TYPE_PROPERTY: case GI_INFO_TYPE_PROPERTY:
case GI_INFO_TYPE_FIELD: case GI_INFO_TYPE_FIELD:
case GI_INFO_TYPE_ARG: case GI_INFO_TYPE_ARG:
case GI_INFO_TYPE_TYPE: case GI_INFO_TYPE_TYPE:
case GI_INFO_TYPE_UNRESOLVED: case GI_INFO_TYPE_UNRESOLVED:
g_warning("Field %s: Interface type %d not expected", g_warning("Field %s: Interface type %d not expected",
gi_base_info_get_name ((GIBaseInfo *)field_info), gi_base_info_get_name ((GIBaseInfo *)field_info),
gi_base_info_get_info_type (interface)); gi_base_info_get_info_type (interface));
break; break;
default: default:
break; break;
} }
gi_base_info_unref ((GIBaseInfo *)interface); gi_base_info_unref ((GIBaseInfo *)interface);
break; break;
} }
break; break;
default: default:
break; break;
} }
} }
gi_base_info_unref ((GIBaseInfo *)type_info); gi_base_info_unref ((GIBaseInfo *)type_info);
@ -402,163 +402,163 @@ gi_field_info_set_field (GIFieldInfo *field_info,
if (!gi_type_info_is_pointer (type_info)) if (!gi_type_info_is_pointer (type_info))
{ {
switch (gi_type_info_get_tag (type_info)) switch (gi_type_info_get_tag (type_info))
{ {
case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_VOID:
g_warning("Field %s: should not be have void type", g_warning("Field %s: should not be have void type",
gi_base_info_get_name ((GIBaseInfo *)field_info)); gi_base_info_get_name ((GIBaseInfo *)field_info));
break; break;
case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_BOOLEAN:
G_STRUCT_MEMBER (gboolean, mem, offset) = value->v_boolean != FALSE; G_STRUCT_MEMBER (gboolean, mem, offset) = value->v_boolean != FALSE;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_UINT8:
G_STRUCT_MEMBER (guint8, mem, offset) = value->v_uint8; G_STRUCT_MEMBER (guint8, mem, offset) = value->v_uint8;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_UINT16:
G_STRUCT_MEMBER (guint16, mem, offset) = value->v_uint16; G_STRUCT_MEMBER (guint16, mem, offset) = value->v_uint16;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_INT32:
case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_UINT32:
case GI_TYPE_TAG_UNICHAR: case GI_TYPE_TAG_UNICHAR:
G_STRUCT_MEMBER (guint32, mem, offset) = value->v_uint32; G_STRUCT_MEMBER (guint32, mem, offset) = value->v_uint32;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_INT64:
case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_UINT64:
G_STRUCT_MEMBER (guint64, mem, offset) = value->v_uint64; G_STRUCT_MEMBER (guint64, mem, offset) = value->v_uint64;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_GTYPE: case GI_TYPE_TAG_GTYPE:
G_STRUCT_MEMBER (gsize, mem, offset) = value->v_size; G_STRUCT_MEMBER (gsize, mem, offset) = value->v_size;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_FLOAT: case GI_TYPE_TAG_FLOAT:
G_STRUCT_MEMBER (gfloat, mem, offset) = value->v_float; G_STRUCT_MEMBER (gfloat, mem, offset) = value->v_float;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_DOUBLE: case GI_TYPE_TAG_DOUBLE:
G_STRUCT_MEMBER (gdouble, mem, offset)= value->v_double; G_STRUCT_MEMBER (gdouble, mem, offset)= value->v_double;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_FILENAME:
case GI_TYPE_TAG_ARRAY: case GI_TYPE_TAG_ARRAY:
case GI_TYPE_TAG_GLIST: case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST: case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH: case GI_TYPE_TAG_GHASH:
g_warning("Field %s: type %s should have is_pointer set", g_warning("Field %s: type %s should have is_pointer set",
gi_base_info_get_name ((GIBaseInfo *)field_info), gi_base_info_get_name ((GIBaseInfo *)field_info),
gi_type_tag_to_string (gi_type_info_get_tag (type_info))); gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
break; break;
case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_ERROR:
/* Needs to be handled by the language binding directly */ /* Needs to be handled by the language binding directly */
break; break;
case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_INTERFACE:
{ {
GIBaseInfo *interface = gi_type_info_get_interface (type_info); GIBaseInfo *interface = gi_type_info_get_interface (type_info);
switch (gi_base_info_get_info_type (interface)) switch (gi_base_info_get_info_type (interface))
{ {
case GI_INFO_TYPE_STRUCT: case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_UNION: case GI_INFO_TYPE_UNION:
case GI_INFO_TYPE_BOXED: case GI_INFO_TYPE_BOXED:
/* Needs to be handled by the language binding directly */ /* Needs to be handled by the language binding directly */
break; break;
case GI_INFO_TYPE_OBJECT: case GI_INFO_TYPE_OBJECT:
break; break;
case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS: case GI_INFO_TYPE_FLAGS:
{ {
/* See FIXME above /* See FIXME above
*/ */
GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface); GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
switch (storage_type) switch (storage_type)
{ {
case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_UINT8: case GI_TYPE_TAG_UINT8:
G_STRUCT_MEMBER (guint8, mem, offset) = (guint8)value->v_int; G_STRUCT_MEMBER (guint8, mem, offset) = (guint8)value->v_int;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_UINT16: case GI_TYPE_TAG_UINT16:
G_STRUCT_MEMBER (guint16, mem, offset) = (guint16)value->v_int; G_STRUCT_MEMBER (guint16, mem, offset) = (guint16)value->v_int;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_INT32:
case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_UINT32:
G_STRUCT_MEMBER (guint32, mem, offset) = (guint32)value->v_int; G_STRUCT_MEMBER (guint32, mem, offset) = (guint32)value->v_int;
result = TRUE; result = TRUE;
break; break;
case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_INT64:
case GI_TYPE_TAG_UINT64: case GI_TYPE_TAG_UINT64:
G_STRUCT_MEMBER (guint64, mem, offset) = (guint64)value->v_int; G_STRUCT_MEMBER (guint64, mem, offset) = (guint64)value->v_int;
result = TRUE; result = TRUE;
break; break;
default: default:
g_warning("Field %s: Unexpected enum storage type %s", g_warning("Field %s: Unexpected enum storage type %s",
gi_base_info_get_name ((GIBaseInfo *)field_info), gi_base_info_get_name ((GIBaseInfo *)field_info),
gi_type_tag_to_string (storage_type)); gi_type_tag_to_string (storage_type));
break; break;
} }
break; break;
} }
break; break;
case GI_INFO_TYPE_VFUNC: case GI_INFO_TYPE_VFUNC:
case GI_INFO_TYPE_CALLBACK: case GI_INFO_TYPE_CALLBACK:
g_warning("Field%s: Interface type %d should have is_pointer set", g_warning("Field%s: Interface type %d should have is_pointer set",
gi_base_info_get_name ((GIBaseInfo *)field_info), gi_base_info_get_name ((GIBaseInfo *)field_info),
gi_base_info_get_info_type (interface)); gi_base_info_get_info_type (interface));
break; break;
case GI_INFO_TYPE_INVALID: case GI_INFO_TYPE_INVALID:
case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_FUNCTION: case GI_INFO_TYPE_FUNCTION:
case GI_INFO_TYPE_CONSTANT: case GI_INFO_TYPE_CONSTANT:
case GI_INFO_TYPE_VALUE: case GI_INFO_TYPE_VALUE:
case GI_INFO_TYPE_SIGNAL: case GI_INFO_TYPE_SIGNAL:
case GI_INFO_TYPE_PROPERTY: case GI_INFO_TYPE_PROPERTY:
case GI_INFO_TYPE_FIELD: case GI_INFO_TYPE_FIELD:
case GI_INFO_TYPE_ARG: case GI_INFO_TYPE_ARG:
case GI_INFO_TYPE_TYPE: case GI_INFO_TYPE_TYPE:
case GI_INFO_TYPE_UNRESOLVED: case GI_INFO_TYPE_UNRESOLVED:
g_warning("Field %s: Interface type %d not expected", g_warning("Field %s: Interface type %d not expected",
gi_base_info_get_name ((GIBaseInfo *)field_info), gi_base_info_get_name ((GIBaseInfo *)field_info),
gi_base_info_get_info_type (interface)); gi_base_info_get_info_type (interface));
break; break;
default: default:
break; break;
} }
gi_base_info_unref ((GIBaseInfo *)interface); gi_base_info_unref ((GIBaseInfo *)interface);
break; break;
} }
break; break;
default: default:
break; break;
} }
} else { } else {
switch (gi_type_info_get_tag (type_info)) switch (gi_type_info_get_tag (type_info))
{ {
case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_INTERFACE:
{ {
GIBaseInfo *interface = gi_type_info_get_interface (type_info); GIBaseInfo *interface = gi_type_info_get_interface (type_info);
switch (gi_base_info_get_info_type (interface)) switch (gi_base_info_get_info_type (interface))
{ {
case GI_INFO_TYPE_OBJECT: case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_INTERFACE:
G_STRUCT_MEMBER (gpointer, mem, offset) = (gpointer)value->v_pointer; G_STRUCT_MEMBER (gpointer, mem, offset) = (gpointer)value->v_pointer;
result = TRUE; result = TRUE;
break; break;
default: default:
break; break;
} }
gi_base_info_unref ((GIBaseInfo *)interface); gi_base_info_unref ((GIBaseInfo *)interface);
} }
break; break;
default: default:
break; break;
} }
} }

View File

@ -121,8 +121,8 @@ value_to_ffi_type (const GValue *gvalue, gpointer *value)
*/ */
static ffi_type * static ffi_type *
g_value_to_ffi_return_type (const GValue *gvalue, g_value_to_ffi_return_type (const GValue *gvalue,
const GIArgument *ffi_value, const GIArgument *ffi_value,
gpointer *value) gpointer *value)
{ {
ffi_type *rettype = NULL; ffi_type *rettype = NULL;
GType type = g_type_fundamental (G_VALUE_TYPE (gvalue)); GType type = g_type_fundamental (G_VALUE_TYPE (gvalue));
@ -246,7 +246,7 @@ g_value_from_ffi_value (GValue *gvalue,
break; break;
default: default:
g_warning ("Unsupported fundamental type: %s", g_warning ("Unsupported fundamental type: %s",
g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue)))); g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))));
} }
} }
@ -288,7 +288,7 @@ gi_cclosure_marshal_generic (GClosure *closure,
if (return_gvalue && G_VALUE_TYPE (return_gvalue)) if (return_gvalue && G_VALUE_TYPE (return_gvalue))
{ {
rtype = g_value_to_ffi_return_type (return_gvalue, &return_ffi_value, rtype = g_value_to_ffi_return_type (return_gvalue, &return_ffi_value,
&rvalue); &rvalue);
} }
else else
{ {

View File

@ -528,20 +528,20 @@ gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
n_interfaces = gi_object_info_get_n_interfaces (info); n_interfaces = gi_object_info_get_n_interfaces (info);
for (i = 0; i < n_interfaces; ++i) for (i = 0; i < n_interfaces; ++i)
{ {
GIInterfaceInfo *iface_info; GIInterfaceInfo *iface_info;
iface_info = gi_object_info_get_interface (info, i); iface_info = gi_object_info_get_interface (info, i);
result = gi_interface_info_find_method (iface_info, name); result = gi_interface_info_find_method (iface_info, name);
if (result != NULL) if (result != NULL)
{ {
implementor_result = (GIObjectInfo *) iface_info; implementor_result = (GIObjectInfo *) iface_info;
break; break;
} }
gi_base_info_unref ((GIBaseInfo*) iface_info); gi_base_info_unref ((GIBaseInfo*) iface_info);
} }
} }
if (implementor) if (implementor)
*implementor = implementor_result; *implementor = implementor_result;
@ -637,10 +637,10 @@ gi_object_info_find_signal (GIObjectInfo *info,
GISignalInfo *siginfo = gi_object_info_get_signal (info, i); GISignalInfo *siginfo = gi_object_info_get_signal (info, i);
if (g_strcmp0 (gi_base_info_get_name ((GIBaseInfo *) siginfo), name) != 0) if (g_strcmp0 (gi_base_info_get_name ((GIBaseInfo *) siginfo), name) != 0)
{ {
gi_base_info_unref ((GIBaseInfo*)siginfo); gi_base_info_unref ((GIBaseInfo*)siginfo);
continue; continue;
} }
return siginfo; return siginfo;
} }
@ -801,20 +801,20 @@ gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
n_interfaces = gi_object_info_get_n_interfaces (info); n_interfaces = gi_object_info_get_n_interfaces (info);
for (i = 0; i < n_interfaces; ++i) for (i = 0; i < n_interfaces; ++i)
{ {
GIInterfaceInfo *iface_info; GIInterfaceInfo *iface_info;
iface_info = gi_object_info_get_interface (info, i); iface_info = gi_object_info_get_interface (info, i);
result = gi_interface_info_find_vfunc (iface_info, name); result = gi_interface_info_find_vfunc (iface_info, name);
if (result != NULL) if (result != NULL)
{ {
implementor_result = (GIObjectInfo *) iface_info; implementor_result = (GIObjectInfo *) iface_info;
break; break;
} }
gi_base_info_unref ((GIBaseInfo*) iface_info); gi_base_info_unref ((GIBaseInfo*) iface_info);
} }
} }
if (implementor) if (implementor)
*implementor = implementor_result; *implementor = implementor_result;

View File

@ -88,7 +88,7 @@ typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value);
GI_AVAILABLE_IN_ALL GI_AVAILABLE_IN_ALL
const gchar * gi_object_info_get_type_name (GIObjectInfo *info); const gchar * gi_object_info_get_type_name (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL GI_AVAILABLE_IN_ALL
const gchar * gi_object_info_get_type_init_function_name (GIObjectInfo *info); const gchar * gi_object_info_get_type_init_function_name (GIObjectInfo *info);
@ -135,7 +135,7 @@ GIFunctionInfo * gi_object_info_get_method (GIObjectInfo *info,
GI_AVAILABLE_IN_ALL GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_object_info_find_method (GIObjectInfo *info, GIFunctionInfo * gi_object_info_find_method (GIObjectInfo *info,
const gchar *name); const gchar *name);
GI_AVAILABLE_IN_ALL GI_AVAILABLE_IN_ALL

View File

@ -111,8 +111,8 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
BOOL WINAPI BOOL WINAPI
DllMain (HINSTANCE hinstDLL, DllMain (HINSTANCE hinstDLL,
DWORD fdwReason, DWORD fdwReason,
LPVOID lpvReserved) LPVOID lpvReserved)
{ {
if (fdwReason == DLL_PROCESS_ATTACH) if (fdwReason == DLL_PROCESS_ATTACH)
girepository_dll = hinstDLL; girepository_dll = hinstDLL;
@ -129,8 +129,8 @@ DllMain (HINSTANCE hinstDLL,
*/ */
#define GOBJECT_INTROSPECTION_LIBDIR \ #define GOBJECT_INTROSPECTION_LIBDIR \
g_build_filename (g_win32_get_package_installation_directory_of_module (girepository_dll), \ g_build_filename (g_win32_get_package_installation_directory_of_module (girepository_dll), \
"lib", \ "lib", \
NULL) NULL)
#endif #endif
@ -140,8 +140,8 @@ gi_repository_init (GIRepository *repository)
repository->priv = gi_repository_get_instance_private (repository); repository->priv = gi_repository_get_instance_private (repository);
repository->priv->typelibs repository->priv->typelibs
= g_hash_table_new_full (g_str_hash, g_str_equal, = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free, (GDestroyNotify) g_free,
(GDestroyNotify) gi_typelib_free); (GDestroyNotify) gi_typelib_free);
repository->priv->lazy_typelibs repository->priv->lazy_typelibs
= g_hash_table_new_full (g_str_hash, g_str_equal, = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free, (GDestroyNotify) g_free,
@ -324,9 +324,9 @@ get_repository (GIRepository *repository)
static GITypelib * static GITypelib *
check_version_conflict (GITypelib *typelib, check_version_conflict (GITypelib *typelib,
const gchar *namespace, const gchar *namespace,
const gchar *expected_version, const gchar *expected_version,
char **version_conflict) char **version_conflict)
{ {
Header *header; Header *header;
const char *loaded_version; const char *loaded_version;
@ -334,7 +334,7 @@ check_version_conflict (GITypelib *typelib,
if (expected_version == NULL) if (expected_version == NULL)
{ {
if (version_conflict) if (version_conflict)
*version_conflict = NULL; *version_conflict = NULL;
return typelib; return typelib;
} }
@ -345,7 +345,7 @@ check_version_conflict (GITypelib *typelib,
if (strcmp (expected_version, loaded_version) != 0) if (strcmp (expected_version, loaded_version) != 0)
{ {
if (version_conflict) if (version_conflict)
*version_conflict = (char*)loaded_version; *version_conflict = (char*)loaded_version;
return NULL; return NULL;
} }
if (version_conflict) if (version_conflict)
@ -355,11 +355,11 @@ check_version_conflict (GITypelib *typelib,
static GITypelib * static GITypelib *
get_registered_status (GIRepository *repository, get_registered_status (GIRepository *repository,
const char *namespace, const char *namespace,
const char *version, const char *version,
gboolean allow_lazy, gboolean allow_lazy,
gboolean *lazy_status, gboolean *lazy_status,
char **version_conflict) char **version_conflict)
{ {
GITypelib *typelib; GITypelib *typelib;
repository = get_repository (repository); repository = get_repository (repository);
@ -380,16 +380,16 @@ get_registered_status (GIRepository *repository,
static GITypelib * static GITypelib *
get_registered (GIRepository *repository, get_registered (GIRepository *repository,
const char *namespace, const char *namespace,
const char *version) const char *version)
{ {
return get_registered_status (repository, namespace, version, TRUE, NULL, NULL); return get_registered_status (repository, namespace, version, TRUE, NULL, NULL);
} }
static gboolean static gboolean
load_dependencies_recurse (GIRepository *repository, load_dependencies_recurse (GIRepository *repository,
GITypelib *typelib, GITypelib *typelib,
GError **error) GError **error)
{ {
char **dependencies; char **dependencies;
@ -400,25 +400,25 @@ load_dependencies_recurse (GIRepository *repository,
int i; int i;
for (i = 0; dependencies[i]; i++) for (i = 0; dependencies[i]; i++)
{ {
char *dependency = dependencies[i]; char *dependency = dependencies[i];
const char *last_dash; const char *last_dash;
char *dependency_namespace; char *dependency_namespace;
const char *dependency_version; const char *dependency_version;
last_dash = strrchr (dependency, '-'); last_dash = strrchr (dependency, '-');
dependency_namespace = g_strndup (dependency, last_dash - dependency); dependency_namespace = g_strndup (dependency, last_dash - dependency);
dependency_version = last_dash+1; dependency_version = last_dash+1;
if (!gi_repository_require (repository, dependency_namespace, dependency_version, if (!gi_repository_require (repository, dependency_namespace, dependency_version,
0, error)) 0, error))
{ {
g_free (dependency_namespace); g_free (dependency_namespace);
g_strfreev (dependencies); g_strfreev (dependencies);
return FALSE; return FALSE;
} }
g_free (dependency_namespace); g_free (dependency_namespace);
} }
g_strfreev (dependencies); g_strfreev (dependencies);
} }
return TRUE; return TRUE;
@ -426,10 +426,10 @@ load_dependencies_recurse (GIRepository *repository,
static const char * static const char *
register_internal (GIRepository *repository, register_internal (GIRepository *repository,
const char *source, const char *source,
gboolean lazy, gboolean lazy,
GITypelib *typelib, GITypelib *typelib,
GError **error) GError **error)
{ {
Header *header; Header *header;
const gchar *namespace; const gchar *namespace;
@ -445,9 +445,9 @@ register_internal (GIRepository *repository,
if (lazy) if (lazy)
{ {
g_assert (!g_hash_table_lookup (repository->priv->lazy_typelibs, g_assert (!g_hash_table_lookup (repository->priv->lazy_typelibs,
namespace)); namespace));
g_hash_table_insert (repository->priv->lazy_typelibs, g_hash_table_insert (repository->priv->lazy_typelibs,
build_typelib_key (namespace, source), (void *)typelib); build_typelib_key (namespace, source), (void *)typelib);
} }
else else
{ {
@ -456,15 +456,15 @@ register_internal (GIRepository *repository,
/* First, try loading all the dependencies */ /* First, try loading all the dependencies */
if (!load_dependencies_recurse (repository, typelib, error)) if (!load_dependencies_recurse (repository, typelib, error))
return NULL; return NULL;
/* Check if we are transitioning from lazily loaded state */ /* 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, namespace,
(gpointer)&key, &value)) (gpointer)&key, &value))
g_hash_table_remove (repository->priv->lazy_typelibs, key); g_hash_table_remove (repository->priv->lazy_typelibs, key);
else else
key = build_typelib_key (namespace, source); key = build_typelib_key (namespace, source);
g_hash_table_insert (repository->priv->typelibs, g_hash_table_insert (repository->priv->typelibs,
g_steal_pointer (&key), g_steal_pointer (&key),
@ -584,7 +584,7 @@ get_typelib_dependencies_transitive (GIRepository *repository,
*/ */
char ** char **
gi_repository_get_dependencies (GIRepository *repository, gi_repository_get_dependencies (GIRepository *repository,
const char *namespace) const char *namespace)
{ {
GITypelib *typelib; GITypelib *typelib;
GHashTable *transitive_dependencies; /* set of owned utf8 */ GHashTable *transitive_dependencies; /* set of owned utf8 */
@ -636,9 +636,9 @@ gi_repository_get_dependencies (GIRepository *repository,
*/ */
const char * const char *
gi_repository_load_typelib (GIRepository *repository, gi_repository_load_typelib (GIRepository *repository,
GITypelib *typelib, GITypelib *typelib,
GIRepositoryLoadFlags flags, GIRepositoryLoadFlags flags,
GError **error) GError **error)
{ {
Header *header; Header *header;
const char *namespace; const char *namespace;
@ -654,20 +654,20 @@ gi_repository_load_typelib (GIRepository *repository,
nsversion = gi_typelib_get_string (typelib, header->nsversion); nsversion = gi_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)) &is_lazy, &version_conflict))
{ {
if (version_conflict != NULL) if (version_conflict != NULL)
{ {
g_set_error (error, GI_REPOSITORY_ERROR, g_set_error (error, GI_REPOSITORY_ERROR,
GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT, GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
"Attempting to load namespace '%s', version '%s', but '%s' is already loaded", "Attempting to load namespace '%s', version '%s', but '%s' is already loaded",
namespace, nsversion, version_conflict); namespace, nsversion, version_conflict);
return NULL; return NULL;
} }
return namespace; return namespace;
} }
return register_internal (repository, "<builtin>", return register_internal (repository, "<builtin>",
allow_lazy, typelib, error); allow_lazy, typelib, error);
} }
/** /**
@ -691,8 +691,8 @@ gi_repository_load_typelib (GIRepository *repository,
*/ */
gboolean gboolean
gi_repository_is_registered (GIRepository *repository, gi_repository_is_registered (GIRepository *repository,
const gchar *namespace, const gchar *namespace,
const gchar *version) const gchar *version)
{ {
repository = get_repository (repository); repository = get_repository (repository);
return get_registered (repository, namespace, version) != NULL; return get_registered (repository, namespace, version) != NULL;
@ -755,7 +755,7 @@ gi_repository_new (void)
*/ */
guint guint
gi_repository_get_n_infos (GIRepository *repository, gi_repository_get_n_infos (GIRepository *repository,
const gchar *namespace) const gchar *namespace)
{ {
GITypelib *typelib; GITypelib *typelib;
guint n_interfaces = 0; guint n_interfaces = 0;
@ -793,8 +793,8 @@ gi_repository_get_n_infos (GIRepository *repository,
*/ */
GIBaseInfo * GIBaseInfo *
gi_repository_get_info (GIRepository *repository, gi_repository_get_info (GIRepository *repository,
const gchar *namespace, const gchar *namespace,
guint idx) guint idx)
{ {
GITypelib *typelib; GITypelib *typelib;
DirEntry *entry; DirEntry *entry;
@ -879,7 +879,7 @@ gi_repository_find_by_gtype (GIRepository *repository,
repository = get_repository (repository); repository = get_repository (repository);
cached = g_hash_table_lookup (repository->priv->info_by_gtype, cached = g_hash_table_lookup (repository->priv->info_by_gtype,
(gpointer)gtype); (gpointer)gtype);
if (cached != NULL) if (cached != NULL)
return gi_base_info_ref (cached); return gi_base_info_ref (cached);
@ -918,8 +918,8 @@ gi_repository_find_by_gtype (GIRepository *repository,
NULL, data.result_typelib, entry->offset); NULL, data.result_typelib, entry->offset);
g_hash_table_insert (repository->priv->info_by_gtype, g_hash_table_insert (repository->priv->info_by_gtype,
(gpointer) gtype, (gpointer) gtype,
gi_base_info_ref (cached)); gi_base_info_ref (cached));
return cached; return cached;
} }
else else
@ -948,8 +948,8 @@ gi_repository_find_by_gtype (GIRepository *repository,
*/ */
GIBaseInfo * GIBaseInfo *
gi_repository_find_by_name (GIRepository *repository, gi_repository_find_by_name (GIRepository *repository,
const gchar *namespace, const gchar *namespace,
const gchar *name) const gchar *name)
{ {
GITypelib *typelib; GITypelib *typelib;
DirEntry *entry; DirEntry *entry;
@ -978,8 +978,8 @@ typedef struct {
static void static void
find_by_error_domain_foreach (gpointer key, find_by_error_domain_foreach (gpointer key,
gpointer value, gpointer value,
gpointer datap) gpointer datap)
{ {
GITypelib *typelib = (GITypelib*)value; GITypelib *typelib = (GITypelib*)value;
FindByErrorDomainData *data = datap; FindByErrorDomainData *data = datap;
@ -1011,7 +1011,7 @@ find_by_error_domain_foreach (gpointer key,
*/ */
GIEnumInfo * GIEnumInfo *
gi_repository_find_by_error_domain (GIRepository *repository, gi_repository_find_by_error_domain (GIRepository *repository,
GQuark domain) GQuark domain)
{ {
FindByErrorDomainData data; FindByErrorDomainData data;
GIEnumInfo *cached; GIEnumInfo *cached;
@ -1019,7 +1019,7 @@ gi_repository_find_by_error_domain (GIRepository *repository,
repository = get_repository (repository); repository = get_repository (repository);
cached = g_hash_table_lookup (repository->priv->info_by_error_domain, cached = g_hash_table_lookup (repository->priv->info_by_error_domain,
GUINT_TO_POINTER (domain)); GUINT_TO_POINTER (domain));
if (cached != NULL) if (cached != NULL)
return (GIEnumInfo *) gi_base_info_ref ((GIBaseInfo *)cached); return (GIEnumInfo *) gi_base_info_ref ((GIBaseInfo *)cached);
@ -1040,8 +1040,8 @@ gi_repository_find_by_error_domain (GIRepository *repository,
NULL, data.result_typelib, data.result->offset); NULL, data.result_typelib, data.result->offset);
g_hash_table_insert (repository->priv->info_by_error_domain, g_hash_table_insert (repository->priv->info_by_error_domain,
GUINT_TO_POINTER (domain), GUINT_TO_POINTER (domain),
gi_base_info_ref ((GIBaseInfo *) cached)); gi_base_info_ref ((GIBaseInfo *) cached));
return cached; return cached;
} }
return NULL; return NULL;
@ -1130,8 +1130,8 @@ gi_repository_get_object_gtype_interfaces (GIRepository *repository,
static void static void
collect_namespaces (gpointer key, collect_namespaces (gpointer key,
gpointer value, gpointer value,
gpointer data) gpointer data)
{ {
GList **list = data; GList **list = data;
@ -1188,7 +1188,7 @@ gi_repository_get_loaded_namespaces (GIRepository *repository)
*/ */
const gchar * const gchar *
gi_repository_get_version (GIRepository *repository, gi_repository_get_version (GIRepository *repository,
const gchar *namespace) const gchar *namespace)
{ {
GITypelib *typelib; GITypelib *typelib;
Header *header; Header *header;
@ -1331,19 +1331,19 @@ gi_repository_get_c_prefix (GIRepository *repository,
*/ */
const gchar * const gchar *
gi_repository_get_typelib_path (GIRepository *repository, gi_repository_get_typelib_path (GIRepository *repository,
const gchar *namespace) const gchar *namespace)
{ {
gpointer orig_key, value; gpointer orig_key, value;
repository = get_repository (repository); repository = get_repository (repository);
if (!g_hash_table_lookup_extended (repository->priv->typelibs, namespace, if (!g_hash_table_lookup_extended (repository->priv->typelibs, namespace,
&orig_key, &value)) &orig_key, &value))
{ {
if (!g_hash_table_lookup_extended (repository->priv->lazy_typelibs, namespace, if (!g_hash_table_lookup_extended (repository->priv->lazy_typelibs, namespace,
&orig_key, &value)) &orig_key, &value))
return NULL; return NULL;
} }
return ((char*)orig_key) + strlen ((char *) orig_key) + 1; return ((char*)orig_key) + strlen ((char *) orig_key) + 1;
} }
@ -1379,11 +1379,11 @@ find_namespace_version (const char *namespace,
mfile = g_mapped_file_new (path, FALSE, &error); mfile = g_mapped_file_new (path, FALSE, &error);
if (error) if (error)
{ {
g_free (path); g_free (path);
g_clear_error (&error); g_clear_error (&error);
continue; continue;
} }
*path_ret = path; *path_ret = path;
break; break;
} }
@ -1393,8 +1393,8 @@ find_namespace_version (const char *namespace,
static gboolean static gboolean
parse_version (const char *version, parse_version (const char *version,
int *major, int *major,
int *minor) int *minor)
{ {
const char *dot; const char *dot;
char *end; char *end;
@ -1416,7 +1416,7 @@ parse_version (const char *version,
static int static int
compare_version (const char *v1, compare_version (const char *v1,
const char *v2) const char *v2)
{ {
gboolean success; gboolean success;
int v1_major, v1_minor; int v1_major, v1_minor;
@ -1452,7 +1452,7 @@ struct NamespaceVersionCandidadate
static int static int
compare_candidate_reverse (struct NamespaceVersionCandidadate *c1, compare_candidate_reverse (struct NamespaceVersionCandidadate *c1,
struct NamespaceVersionCandidadate *c2) struct NamespaceVersionCandidadate *c2)
{ {
int result = compare_version (c1->version, c2->version); int result = compare_version (c1->version, c2->version);
/* First, check the version */ /* First, check the version */
@ -1467,11 +1467,11 @@ compare_candidate_reverse (struct NamespaceVersionCandidadate *c1,
* pick the earlier one. * pick the earlier one.
*/ */
if (c1->path_index == c2->path_index) if (c1->path_index == c2->path_index)
return 0; return 0;
else if (c1->path_index > c2->path_index) else if (c1->path_index > c2->path_index)
return 1; return 1;
else else
return -1; return -1;
} }
} }
@ -1509,66 +1509,66 @@ enumerate_namespace_versions (const char *namespace,
dirname = search_paths[i]; dirname = search_paths[i];
dir = g_dir_open (dirname, 0, NULL); dir = g_dir_open (dirname, 0, NULL);
if (dir == NULL) if (dir == NULL)
continue; continue;
while ((entry = g_dir_read_name (dir)) != NULL) while ((entry = g_dir_read_name (dir)) != NULL)
{ {
GMappedFile *mfile; GMappedFile *mfile;
char *path, *version; char *path, *version;
struct NamespaceVersionCandidadate *candidate; struct NamespaceVersionCandidadate *candidate;
if (!g_str_has_suffix (entry, ".typelib")) if (!g_str_has_suffix (entry, ".typelib"))
continue; continue;
if (g_str_has_prefix (entry, namespace_dash)) if (g_str_has_prefix (entry, namespace_dash))
{ {
const char *last_dash; const char *last_dash;
const char *name_end; const char *name_end;
int major, minor; int major, minor;
if (g_str_equal (namespace, GIREPOSITORY_TYPELIB_NAME) && if (g_str_equal (namespace, GIREPOSITORY_TYPELIB_NAME) &&
!g_str_equal (entry, GIREPOSITORY_TYPELIB_FILENAME)) !g_str_equal (entry, GIREPOSITORY_TYPELIB_FILENAME))
{ {
g_debug ("Ignoring %s because this libgirepository " g_debug ("Ignoring %s because this libgirepository "
"corresponds to %s", "corresponds to %s",
entry, GIREPOSITORY_TYPELIB_FILENAME); entry, GIREPOSITORY_TYPELIB_FILENAME);
continue; continue;
} }
name_end = strrchr (entry, '.'); name_end = strrchr (entry, '.');
last_dash = strrchr (entry, '-'); last_dash = strrchr (entry, '-');
version = g_strndup (last_dash+1, name_end-(last_dash+1)); version = g_strndup (last_dash+1, name_end-(last_dash+1));
if (!parse_version (version, &major, &minor)) if (!parse_version (version, &major, &minor))
{ {
g_free (version); g_free (version);
continue; continue;
} }
} }
else else
continue; continue;
if (g_hash_table_lookup (found_versions, version) != NULL) if (g_hash_table_lookup (found_versions, version) != NULL)
{ {
g_free (version); g_free (version);
continue; continue;
} }
path = g_build_filename (dirname, entry, NULL); path = g_build_filename (dirname, entry, NULL);
mfile = g_mapped_file_new (path, FALSE, &error); mfile = g_mapped_file_new (path, FALSE, &error);
if (mfile == NULL) if (mfile == NULL)
{ {
g_free (path); g_free (path);
g_free (version); g_free (version);
g_clear_error (&error); g_clear_error (&error);
continue; continue;
} }
candidate = g_slice_new0 (struct NamespaceVersionCandidadate); candidate = g_slice_new0 (struct NamespaceVersionCandidadate);
candidate->mfile = mfile; candidate->mfile = mfile;
candidate->path_index = index; candidate->path_index = index;
candidate->path = path; candidate->path = path;
candidate->version = version; candidate->version = version;
candidates = g_slist_prepend (candidates, candidate); candidates = g_slist_prepend (candidates, candidate);
g_hash_table_add (found_versions, version); g_hash_table_add (found_versions, version);
} }
g_dir_close (dir); g_dir_close (dir);
index++; index++;
} }
@ -1708,9 +1708,9 @@ require_internal (GIRepository *repository,
if (version_conflict != NULL) if (version_conflict != NULL)
{ {
g_set_error (error, GI_REPOSITORY_ERROR, g_set_error (error, GI_REPOSITORY_ERROR,
GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT, GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
"Requiring namespace '%s' version '%s', but '%s' is already loaded", "Requiring namespace '%s' version '%s', but '%s' is already loaded",
namespace, version, version_conflict); namespace, version, version_conflict);
return NULL; return NULL;
} }
@ -1729,15 +1729,15 @@ require_internal (GIRepository *repository,
if (mfile == NULL) if (mfile == NULL)
{ {
if (version != NULL) if (version != NULL)
g_set_error (error, GI_REPOSITORY_ERROR, g_set_error (error, GI_REPOSITORY_ERROR,
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND, GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
"Typelib file for namespace '%s', version '%s' not found", "Typelib file for namespace '%s', version '%s' not found",
namespace, version); namespace, version);
else else
g_set_error (error, GI_REPOSITORY_ERROR, g_set_error (error, GI_REPOSITORY_ERROR,
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND, GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
"Typelib file for namespace '%s' (any version) not found", "Typelib file for namespace '%s' (any version) not found",
namespace); namespace);
goto out; goto out;
} }
@ -1746,12 +1746,12 @@ require_internal (GIRepository *repository,
typelib = gi_typelib_new_from_mapped_file (mfile, &temp_error); typelib = gi_typelib_new_from_mapped_file (mfile, &temp_error);
if (!typelib) if (!typelib)
{ {
g_set_error (error, GI_REPOSITORY_ERROR, g_set_error (error, GI_REPOSITORY_ERROR,
GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND, GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
"Failed to load typelib file '%s' for namespace '%s': %s", "Failed to load typelib file '%s' for namespace '%s': %s",
path, namespace, temp_error->message); path, namespace, temp_error->message);
g_clear_error (&temp_error); g_clear_error (&temp_error);
goto out; goto out;
} }
} }
header = (Header *) typelib->data; header = (Header *) typelib->data;
@ -1761,26 +1761,26 @@ require_internal (GIRepository *repository,
if (strcmp (typelib_namespace, namespace) != 0) if (strcmp (typelib_namespace, namespace) != 0)
{ {
g_set_error (error, GI_REPOSITORY_ERROR, g_set_error (error, GI_REPOSITORY_ERROR,
GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH, GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
"Typelib file %s for namespace '%s' contains " "Typelib file %s for namespace '%s' contains "
"namespace '%s' which doesn't match the file name", "namespace '%s' which doesn't match the file name",
path, namespace, typelib_namespace); path, namespace, typelib_namespace);
gi_typelib_free (typelib); gi_typelib_free (typelib);
goto out; goto out;
} }
if (version != NULL && strcmp (typelib_version, version) != 0) if (version != NULL && strcmp (typelib_version, version) != 0)
{ {
g_set_error (error, GI_REPOSITORY_ERROR, g_set_error (error, GI_REPOSITORY_ERROR,
GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH, GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
"Typelib file %s for namespace '%s' contains " "Typelib file %s for namespace '%s' contains "
"version '%s' which doesn't match the expected version '%s'", "version '%s' which doesn't match the expected version '%s'",
path, namespace, typelib_version, version); path, namespace, typelib_version, version);
gi_typelib_free (typelib); gi_typelib_free (typelib);
goto out; goto out;
} }
if (!register_internal (repository, path, allow_lazy, if (!register_internal (repository, path, allow_lazy,
typelib, error)) typelib, error))
{ {
gi_typelib_free (typelib); gi_typelib_free (typelib);
goto out; goto out;
@ -1814,10 +1814,10 @@ require_internal (GIRepository *repository,
*/ */
GITypelib * GITypelib *
gi_repository_require (GIRepository *repository, gi_repository_require (GIRepository *repository,
const gchar *namespace, const gchar *namespace,
const gchar *version, const gchar *version,
GIRepositoryLoadFlags flags, GIRepositoryLoadFlags flags,
GError **error) GError **error)
{ {
GITypelib *typelib; GITypelib *typelib;
@ -1853,11 +1853,11 @@ gi_repository_require (GIRepository *repository,
*/ */
GITypelib * GITypelib *
gi_repository_require_private (GIRepository *repository, gi_repository_require_private (GIRepository *repository,
const gchar *typelib_dir, const gchar *typelib_dir,
const gchar *namespace, const gchar *namespace,
const gchar *version, const gchar *version,
GIRepositoryLoadFlags flags, GIRepositoryLoadFlags flags,
GError **error) GError **error)
{ {
const char * const search_path[] = { typelib_dir, NULL }; const char * const search_path[] = { typelib_dir, NULL };
@ -1867,9 +1867,9 @@ gi_repository_require_private (GIRepository *repository,
static gboolean static gboolean
gi_repository_introspect_cb (const char *option_name, gi_repository_introspect_cb (const char *option_name,
const char *value, const char *value,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
GError *tmp_error = NULL; GError *tmp_error = NULL;
char **args; char **args;
@ -1879,7 +1879,7 @@ gi_repository_introspect_cb (const char *option_name,
if (!gi_repository_dump (args[0], args[1], &tmp_error)) if (!gi_repository_dump (args[0], args[1], &tmp_error))
{ {
g_error ("Failed to extract GType data: %s", g_error ("Failed to extract GType data: %s",
tmp_error->message); tmp_error->message);
exit (1); exit (1);
} }
exit (0); exit (0);

View File

@ -38,7 +38,7 @@
static ffi_type * static ffi_type *
gi_type_tag_get_ffi_type_internal (GITypeTag tag, gi_type_tag_get_ffi_type_internal (GITypeTag tag,
gboolean is_pointer, gboolean is_pointer,
gboolean is_enum) gboolean is_enum)
{ {
switch (tag) switch (tag)
{ {
@ -83,13 +83,13 @@ gi_type_tag_get_ffi_type_internal (GITypeTag tag,
return &ffi_type_pointer; return &ffi_type_pointer;
case GI_TYPE_TAG_INTERFACE: case GI_TYPE_TAG_INTERFACE:
{ {
/* We need to handle enums specially: /* We need to handle enums specially:
* https://bugzilla.gnome.org/show_bug.cgi?id=665150 * https://bugzilla.gnome.org/show_bug.cgi?id=665150
*/ */
if (!is_enum) if (!is_enum)
return &ffi_type_pointer; return &ffi_type_pointer;
else else
return &ffi_type_sint32; return &ffi_type_sint32;
} }
case GI_TYPE_TAG_VOID: case GI_TYPE_TAG_VOID:
if (is_pointer) if (is_pointer)
@ -118,7 +118,7 @@ gi_type_tag_get_ffi_type_internal (GITypeTag tag,
*/ */
ffi_type * ffi_type *
gi_type_tag_get_ffi_type (GITypeTag type_tag, gi_type_tag_get_ffi_type (GITypeTag type_tag,
gboolean is_pointer) gboolean is_pointer)
{ {
return gi_type_tag_get_ffi_type_internal (type_tag, is_pointer, FALSE); return gi_type_tag_get_ffi_type_internal (type_tag, is_pointer, FALSE);
} }

View File

@ -122,16 +122,16 @@ gi_ir_module_fatal (GIIrTypelibBuild *build,
GIIrNode *node = link->data; GIIrNode *node = link->data;
const char *name = node->name; const char *name = node->name;
if (name) if (name)
g_string_append (context, name); g_string_append (context, name);
if (link->prev) if (link->prev)
g_string_append (context, "."); g_string_append (context, ".");
} }
if (build->stack) if (build->stack)
g_string_append (context, ": "); g_string_append (context, ": ");
g_printerr ("%s-%s.gir:%serror: %s\n", build->module->name, g_printerr ("%s-%s.gir:%serror: %s\n", build->module->name,
build->module->version, build->module->version,
context->str, formatted); context->str, formatted);
g_string_free (context, TRUE); g_string_free (context, TRUE);
exit (1); exit (1);
@ -141,8 +141,8 @@ gi_ir_module_fatal (GIIrTypelibBuild *build,
static void static void
add_alias_foreach (gpointer key, add_alias_foreach (gpointer key,
gpointer value, gpointer value,
gpointer data) gpointer data)
{ {
GIIrModule *module = data; GIIrModule *module = data;
@ -161,8 +161,8 @@ add_pointer_structure_foreach (gpointer key,
static void static void
add_disguised_structure_foreach (gpointer key, add_disguised_structure_foreach (gpointer key,
gpointer value, gpointer value,
gpointer data) gpointer data)
{ {
GIIrModule *module = data; GIIrModule *module = data;
@ -174,18 +174,18 @@ gi_ir_module_add_include_module (GIIrModule *module,
GIIrModule *include_module) GIIrModule *include_module)
{ {
module->include_modules = g_list_prepend (module->include_modules, module->include_modules = g_list_prepend (module->include_modules,
include_module); include_module);
g_hash_table_foreach (include_module->aliases, g_hash_table_foreach (include_module->aliases,
add_alias_foreach, add_alias_foreach,
module); module);
g_hash_table_foreach (include_module->pointer_structures, g_hash_table_foreach (include_module->pointer_structures,
add_pointer_structure_foreach, add_pointer_structure_foreach,
module); module);
g_hash_table_foreach (include_module->disguised_structures, g_hash_table_foreach (include_module->disguised_structures,
add_disguised_structure_foreach, add_disguised_structure_foreach,
module); module);
} }
struct AttributeWriteData struct AttributeWriteData
@ -256,11 +256,11 @@ alloc_section (guint8 *data, SectionType section_id, guint32 offset)
for (i = 0; i < NUM_SECTIONS; i++) for (i = 0; i < NUM_SECTIONS; i++)
{ {
if (section_data->id == GI_SECTION_END) if (section_data->id == GI_SECTION_END)
{ {
section_data->id = section_id; section_data->id = section_id;
section_data->offset = offset; section_data->offset = offset;
return; return;
} }
section_data++; section_data++;
} }
g_assert_not_reached (); g_assert_not_reached ();
@ -346,18 +346,18 @@ gi_ir_module_build_typelib (GIIrModule *module)
GList *link; GList *link;
for (link = module->dependencies; link; link = link->next) for (link = module->dependencies; link; link = link->next)
{ {
const char *dependency = link->data; const char *dependency = link->data;
if (!strcmp (dependency, module->name)) if (!strcmp (dependency, module->name))
continue; continue;
g_string_append (dependencies_str, dependency); g_string_append (dependencies_str, dependency);
if (link->next) if (link->next)
g_string_append_c (dependencies_str, '|'); g_string_append_c (dependencies_str, '|');
} }
dependencies = g_string_free (dependencies_str, FALSE); dependencies = g_string_free (dependencies_str, FALSE);
if (!dependencies[0]) if (!dependencies[0])
{ {
g_free (dependencies); g_free (dependencies);
dependencies = NULL; dependencies = NULL;
} }
} }
@ -369,7 +369,7 @@ gi_ir_module_build_typelib (GIIrModule *module)
n_entries = g_list_length (module->entries); n_entries = g_list_length (module->entries);
g_message ("%d entries (%d local), %d dependencies", n_entries, n_local_entries, g_message ("%d entries (%d local), %d dependencies", n_entries, n_local_entries,
g_list_length (module->dependencies)); g_list_length (module->dependencies));
dir_size = n_entries * sizeof (DirEntry); dir_size = n_entries * sizeof (DirEntry);
size = header_size + dir_size; size = header_size + dir_size;
@ -398,7 +398,7 @@ gi_ir_module_build_typelib (GIIrModule *module)
size += sizeof (Section) * NUM_SECTIONS; size += sizeof (Section) * NUM_SECTIONS;
g_message ("allocating %d bytes (%d header, %d directory, %d entries)", g_message ("allocating %d bytes (%d header, %d directory, %d entries)",
size, header_size, dir_size, size - header_size - dir_size); size, header_size, dir_size, size - header_size - dir_size);
data = g_malloc0 (size); data = g_malloc0 (size);
@ -476,67 +476,67 @@ gi_ir_module_build_typelib (GIIrModule *module)
if (strchr (node->name, '.')) if (strchr (node->name, '.'))
{ {
g_error ("Names may not contain '.'"); g_error ("Names may not contain '.'");
} }
/* we picked up implicit xref nodes, start over */ /* we picked up implicit xref nodes, start over */
if (i == n_entries) if (i == n_entries)
{ {
GList *link; GList *link;
g_message ("Found implicit cross references, starting over"); g_message ("Found implicit cross references, starting over");
g_hash_table_destroy (strings); g_hash_table_destroy (strings);
g_hash_table_destroy (types); g_hash_table_destroy (types);
/* Reset the cached offsets */ /* Reset the cached offsets */
for (link = nodes_with_attributes; link; link = link->next) for (link = nodes_with_attributes; link; link = link->next)
((GIIrNode *) link->data)->offset = 0; ((GIIrNode *) link->data)->offset = 0;
g_list_free (nodes_with_attributes); g_list_free (nodes_with_attributes);
strings = NULL; strings = NULL;
g_free (data); g_free (data);
data = NULL; data = NULL;
goto restart; goto restart;
} }
offset = offset2; offset = offset2;
if (node->type == GI_IR_NODE_XREF) if (node->type == GI_IR_NODE_XREF)
{ {
const char *namespace = ((GIIrNodeXRef*)node)->namespace; const char *namespace = ((GIIrNodeXRef*)node)->namespace;
entry->blob_type = 0; entry->blob_type = 0;
entry->local = FALSE; entry->local = FALSE;
entry->offset = gi_ir_write_string (namespace, strings, data, &offset2); entry->offset = gi_ir_write_string (namespace, strings, data, &offset2);
entry->name = gi_ir_write_string (node->name, strings, data, &offset2); entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
} }
else else
{ {
old_offset = offset; old_offset = offset;
offset2 = offset + gi_ir_node_get_size (node); offset2 = offset + gi_ir_node_get_size (node);
entry->blob_type = node->type; entry->blob_type = node->type;
entry->local = TRUE; entry->local = TRUE;
entry->offset = offset; entry->offset = offset;
entry->name = gi_ir_write_string (node->name, strings, data, &offset2); entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
memset (&build, 0, sizeof (build)); memset (&build, 0, sizeof (build));
build.module = module; build.module = module;
build.strings = strings; build.strings = strings;
build.types = types; build.types = types;
build.nodes_with_attributes = nodes_with_attributes; build.nodes_with_attributes = nodes_with_attributes;
build.n_attributes = header->n_attributes; build.n_attributes = header->n_attributes;
build.data = data; build.data = data;
gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL); gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL);
nodes_with_attributes = build.nodes_with_attributes; nodes_with_attributes = build.nodes_with_attributes;
header->n_attributes = build.n_attributes; header->n_attributes = build.n_attributes;
if (offset2 > old_offset + gi_ir_node_get_full_size (node)) if (offset2 > old_offset + gi_ir_node_get_full_size (node))
g_error ("left a hole of %d bytes", offset2 - old_offset - gi_ir_node_get_full_size (node)); g_error ("left a hole of %d bytes", offset2 - old_offset - gi_ir_node_get_full_size (node));
} }
entry++; entry++;
} }
@ -572,7 +572,7 @@ gi_ir_module_build_typelib (GIIrModule *module)
if (!typelib) if (!typelib)
{ {
g_error ("error building typelib: %s", g_error ("error building typelib: %s",
error->message); error->message);
} }
g_hash_table_destroy (strings); g_hash_table_destroy (strings);

File diff suppressed because it is too large Load Diff

View File

@ -95,44 +95,44 @@ compute_enum_storage_type (GIIrNodeEnum *enum_node)
signed_type = TRUE; signed_type = TRUE;
if (min_value > -128 && max_value <= 127) if (min_value > -128 && max_value <= 127)
width = sizeof(Enum7); width = sizeof(Enum7);
else if (min_value >= G_MINSHORT && max_value <= G_MAXSHORT) else if (min_value >= G_MINSHORT && max_value <= G_MAXSHORT)
width = sizeof(Enum8); width = sizeof(Enum8);
else else
width = sizeof(Enum9); width = sizeof(Enum9);
} }
else else
{ {
if (max_value <= 127) if (max_value <= 127)
{ {
width = sizeof (Enum1); width = sizeof (Enum1);
signed_type = (gint64)(Enum1)(-1) < 0; signed_type = (gint64)(Enum1)(-1) < 0;
} }
else if (max_value <= 255) else if (max_value <= 255)
{ {
width = sizeof (Enum2); width = sizeof (Enum2);
signed_type = (gint64)(Enum2)(-1) < 0; signed_type = (gint64)(Enum2)(-1) < 0;
} }
else if (max_value <= G_MAXSHORT) else if (max_value <= G_MAXSHORT)
{ {
width = sizeof (Enum3); width = sizeof (Enum3);
signed_type = (gint64)(Enum3)(-1) < 0; signed_type = (gint64)(Enum3)(-1) < 0;
} }
else if (max_value <= G_MAXUSHORT) else if (max_value <= G_MAXUSHORT)
{ {
width = sizeof (Enum4); width = sizeof (Enum4);
signed_type = (gint64)(Enum4)(-1) < 0; signed_type = (gint64)(Enum4)(-1) < 0;
} }
else if (max_value <= G_MAXINT) else if (max_value <= G_MAXINT)
{ {
width = sizeof (Enum5); width = sizeof (Enum5);
signed_type = (gint64)(Enum5)(-1) < 0; signed_type = (gint64)(Enum5)(-1) < 0;
} }
else else
{ {
width = sizeof (Enum6); width = sizeof (Enum6);
signed_type = (gint64)(Enum6)(-1) < 0; signed_type = (gint64)(Enum6)(-1) < 0;
} }
} }
if (width == 1) if (width == 1)
@ -176,7 +176,7 @@ get_enum_size_alignment (GIIrNodeEnum *enum_node,
break; break;
default: default:
g_error ("Unexpected enum storage type %s", g_error ("Unexpected enum storage type %s",
gi_type_tag_to_string (enum_node->storage_type)); gi_type_tag_to_string (enum_node->storage_type));
} }
*size = type_ffi->size; *size = type_ffi->size;
@ -209,53 +209,53 @@ get_interface_size_alignment (GIIrTypelibBuild *build,
{ {
case GI_IR_NODE_BOXED: case GI_IR_NODE_BOXED:
{ {
GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)iface; GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)iface;
*size = boxed->size; *size = boxed->size;
*alignment = boxed->alignment; *alignment = boxed->alignment;
break; break;
} }
case GI_IR_NODE_STRUCT: case GI_IR_NODE_STRUCT:
{ {
GIIrNodeStruct *struct_ = (GIIrNodeStruct *)iface; GIIrNodeStruct *struct_ = (GIIrNodeStruct *)iface;
*size = struct_->size; *size = struct_->size;
*alignment = struct_->alignment; *alignment = struct_->alignment;
break; break;
} }
case GI_IR_NODE_OBJECT: case GI_IR_NODE_OBJECT:
case GI_IR_NODE_INTERFACE: case GI_IR_NODE_INTERFACE:
{ {
GIIrNodeInterface *interface = (GIIrNodeInterface *)iface; GIIrNodeInterface *interface = (GIIrNodeInterface *)iface;
*size = interface->size; *size = interface->size;
*alignment = interface->alignment; *alignment = interface->alignment;
break; break;
} }
case GI_IR_NODE_UNION: case GI_IR_NODE_UNION:
{ {
GIIrNodeUnion *union_ = (GIIrNodeUnion *)iface; GIIrNodeUnion *union_ = (GIIrNodeUnion *)iface;
*size = union_->size; *size = union_->size;
*alignment = union_->alignment; *alignment = union_->alignment;
break; break;
} }
case GI_IR_NODE_ENUM: case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS: case GI_IR_NODE_FLAGS:
{ {
return get_enum_size_alignment ((GIIrNodeEnum *)iface, return get_enum_size_alignment ((GIIrNodeEnum *)iface,
size, alignment); size, alignment);
} }
case GI_IR_NODE_CALLBACK: case GI_IR_NODE_CALLBACK:
{ {
*size = ffi_type_pointer.size; *size = ffi_type_pointer.size;
*alignment = ffi_type_pointer.alignment; *alignment = ffi_type_pointer.alignment;
break; break;
} }
default: default:
{ {
g_warning ("%s has is not a pointer and is of type %s", g_warning ("%s has is not a pointer and is of type %s",
who, who,
gi_ir_node_type_to_string (iface->type)); gi_ir_node_type_to_string (iface->type));
*size = -1; *size = -1;
*alignment = -1; *alignment = -1;
break; break;
} }
} }
@ -296,30 +296,30 @@ get_type_size_alignment (GIIrTypelibBuild *build,
else else
{ {
if (type->tag == GI_TYPE_TAG_INTERFACE) if (type->tag == GI_TYPE_TAG_INTERFACE)
{ {
return get_interface_size_alignment (build, type, size, alignment, who); return get_interface_size_alignment (build, type, size, alignment, who);
} }
else else
{ {
type_ffi = gi_type_tag_get_ffi_type (type->tag, type->is_pointer); type_ffi = gi_type_tag_get_ffi_type (type->tag, type->is_pointer);
if (type_ffi == &ffi_type_void) if (type_ffi == &ffi_type_void)
{ {
g_warning ("%s has void type", who); g_warning ("%s has void type", who);
*size = -1; *size = -1;
*alignment = -1; *alignment = -1;
return FALSE; return FALSE;
} }
else if (type_ffi == &ffi_type_pointer) else if (type_ffi == &ffi_type_pointer)
{ {
g_warning ("%s has is not a pointer and is of type %s", g_warning ("%s has is not a pointer and is of type %s",
who, who,
gi_type_tag_to_string (type->tag)); gi_type_tag_to_string (type->tag));
*size = -1; *size = -1;
*alignment = -1; *alignment = -1;
return FALSE; return FALSE;
} }
} }
} }
g_assert (type_ffi); g_assert (type_ffi);
@ -376,35 +376,35 @@ compute_struct_field_offsets (GIIrTypelibBuild *build,
GIIrNode *member = (GIIrNode *)l->data; GIIrNode *member = (GIIrNode *)l->data;
if (member->type == GI_IR_NODE_FIELD) if (member->type == GI_IR_NODE_FIELD)
{ {
GIIrNodeField *field = (GIIrNodeField *)member; GIIrNodeField *field = (GIIrNodeField *)member;
if (!have_error) if (!have_error)
{ {
int member_size; int member_size;
int member_alignment; int member_alignment;
if (get_field_size_alignment (build, field, node, if (get_field_size_alignment (build, field, node,
&member_size, &member_alignment)) &member_size, &member_alignment))
{ {
size = GI_ALIGN (size, member_alignment); size = GI_ALIGN (size, member_alignment);
alignment = MAX (alignment, member_alignment); alignment = MAX (alignment, member_alignment);
field->offset = size; field->offset = size;
size += member_size; size += member_size;
} }
else else
have_error = TRUE; have_error = TRUE;
} }
if (have_error) if (have_error)
field->offset = -1; field->offset = -1;
} }
else if (member->type == GI_IR_NODE_CALLBACK) else if (member->type == GI_IR_NODE_CALLBACK)
{ {
size = GI_ALIGN (size, ffi_type_pointer.alignment); size = GI_ALIGN (size, ffi_type_pointer.alignment);
alignment = MAX (alignment, ffi_type_pointer.alignment); alignment = MAX (alignment, ffi_type_pointer.alignment);
size += ffi_type_pointer.size; size += ffi_type_pointer.size;
} }
} }
/* Structs are tail-padded out to a multiple of their alignment */ /* Structs are tail-padded out to a multiple of their alignment */
@ -443,24 +443,24 @@ compute_union_field_offsets (GIIrTypelibBuild *build,
GIIrNode *member = (GIIrNode *)l->data; GIIrNode *member = (GIIrNode *)l->data;
if (member->type == GI_IR_NODE_FIELD) if (member->type == GI_IR_NODE_FIELD)
{ {
GIIrNodeField *field = (GIIrNodeField *)member; GIIrNodeField *field = (GIIrNodeField *)member;
if (!have_error) if (!have_error)
{ {
int member_size; int member_size;
int member_alignment; int member_alignment;
if (get_field_size_alignment (build,field, node, if (get_field_size_alignment (build,field, node,
&member_size, &member_alignment)) &member_size, &member_alignment))
{ {
size = MAX (size, member_size); size = MAX (size, member_size);
alignment = MAX (alignment, member_alignment); alignment = MAX (alignment, member_alignment);
} }
else else
have_error = TRUE; have_error = TRUE;
} }
} }
} }
/* Unions are tail-padded out to a multiple of their alignment */ /* Unions are tail-padded out to a multiple of their alignment */
@ -495,7 +495,7 @@ check_needs_computation (GIIrTypelibBuild *build,
if (alignment == -2) if (alignment == -2)
{ {
g_warning ("Recursion encountered when computing the size of %s.%s", g_warning ("Recursion encountered when computing the size of %s.%s",
module->name, node->name); module->name, node->name);
} }
return alignment == 0; return alignment == 0;
@ -529,60 +529,60 @@ gi_ir_node_compute_offsets (GIIrTypelibBuild *build,
{ {
case GI_IR_NODE_BOXED: case GI_IR_NODE_BOXED:
{ {
GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node; GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
if (!check_needs_computation (build, node, boxed->alignment)) if (!check_needs_computation (build, node, boxed->alignment))
return; return;
compute_struct_field_offsets (build, node, boxed->members, compute_struct_field_offsets (build, node, boxed->members,
&boxed->size, &boxed->alignment); &boxed->size, &boxed->alignment);
break; break;
} }
case GI_IR_NODE_STRUCT: case GI_IR_NODE_STRUCT:
{ {
GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node; GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
if (!check_needs_computation (build, node, struct_->alignment)) if (!check_needs_computation (build, node, struct_->alignment))
return; return;
compute_struct_field_offsets (build, node, struct_->members, compute_struct_field_offsets (build, node, struct_->members,
&struct_->size, &struct_->alignment); &struct_->size, &struct_->alignment);
break; break;
} }
case GI_IR_NODE_OBJECT: case GI_IR_NODE_OBJECT:
case GI_IR_NODE_INTERFACE: case GI_IR_NODE_INTERFACE:
{ {
GIIrNodeInterface *iface = (GIIrNodeInterface *)node; GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
if (!check_needs_computation (build, node, iface->alignment)) if (!check_needs_computation (build, node, iface->alignment))
return; return;
compute_struct_field_offsets (build, node, iface->members, compute_struct_field_offsets (build, node, iface->members,
&iface->size, &iface->alignment); &iface->size, &iface->alignment);
break; break;
} }
case GI_IR_NODE_UNION: case GI_IR_NODE_UNION:
{ {
GIIrNodeUnion *union_ = (GIIrNodeUnion *)node; GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
if (!check_needs_computation (build, node, union_->alignment)) if (!check_needs_computation (build, node, union_->alignment))
return; return;
compute_union_field_offsets (build, (GIIrNode*)union_, union_->members, compute_union_field_offsets (build, (GIIrNode*)union_, union_->members,
&union_->size, &union_->alignment); &union_->size, &union_->alignment);
break; break;
} }
case GI_IR_NODE_ENUM: case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS: case GI_IR_NODE_FLAGS:
{ {
GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node; GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
if (enum_->storage_type != GI_TYPE_TAG_VOID) /* already done */ if (enum_->storage_type != GI_TYPE_TAG_VOID) /* already done */
return; return;
compute_enum_storage_type (enum_); compute_enum_storage_type (enum_);
break; break;
} }
default: default:
break; break;

File diff suppressed because it is too large Load Diff

View File

@ -169,13 +169,13 @@ check_unresolved (GIBaseInfo *info)
return; return;
g_critical ("Found unresolved type '%s' '%s'", g_critical ("Found unresolved type '%s' '%s'",
gi_base_info_get_name (info), gi_base_info_get_namespace (info)); gi_base_info_get_name (info), gi_base_info_get_namespace (info));
} }
static void static void
write_type_name (const gchar *ns, write_type_name (const gchar *ns,
GIBaseInfo *info, GIBaseInfo *info,
Xml *file) Xml *file)
{ {
if (strcmp (ns, gi_base_info_get_namespace (info)) != 0) if (strcmp (ns, gi_base_info_get_namespace (info)) != 0)
xml_printf (file, "%s.", gi_base_info_get_namespace (info)); xml_printf (file, "%s.", gi_base_info_get_namespace (info));
@ -185,9 +185,9 @@ write_type_name (const gchar *ns,
static void static void
write_type_name_attribute (const gchar *ns, write_type_name_attribute (const gchar *ns,
GIBaseInfo *info, GIBaseInfo *info,
const char *attr_name, const char *attr_name,
Xml *file) Xml *file)
{ {
xml_printf (file, " %s=\"", attr_name); xml_printf (file, " %s=\"", attr_name);
write_type_name (ns, info, file); write_type_name (ns, info, file);
@ -216,8 +216,8 @@ write_ownership_transfer (GITransfer transfer,
static void static void
write_type_info (const gchar *ns, write_type_info (const gchar *ns,
GITypeInfo *info, GITypeInfo *info,
Xml *file) Xml *file)
{ {
gint tag; gint tag;
GITypeInfo *type; GITypeInfo *type;
@ -280,7 +280,7 @@ write_type_info (const gchar *ns,
xml_printf (file, " fixed-size=\"%" G_GSSIZE_FORMAT "\"", size); xml_printf (file, " fixed-size=\"%" G_GSSIZE_FORMAT "\"", size);
if (gi_type_info_is_zero_terminated (info)) if (gi_type_info_is_zero_terminated (info))
xml_printf (file, " zero-terminated=\"1\""); xml_printf (file, " zero-terminated=\"1\"");
write_type_info (ns, type, file); write_type_info (ns, type, file);
@ -302,10 +302,10 @@ write_type_info (const gchar *ns,
xml_printf (file, " name=\"GLib.List\""); xml_printf (file, " name=\"GLib.List\"");
type = gi_type_info_get_param_type (info, 0); type = gi_type_info_get_param_type (info, 0);
if (type) if (type)
{ {
write_type_info (ns, type, file); write_type_info (ns, type, file);
gi_base_info_unref ((GIBaseInfo *)type); gi_base_info_unref ((GIBaseInfo *)type);
} }
xml_end_element (file, "type"); xml_end_element (file, "type");
} }
else if (tag == GI_TYPE_TAG_GSLIST) else if (tag == GI_TYPE_TAG_GSLIST)
@ -314,10 +314,10 @@ write_type_info (const gchar *ns,
xml_printf (file, " name=\"GLib.SList\""); xml_printf (file, " name=\"GLib.SList\"");
type = gi_type_info_get_param_type (info, 0); type = gi_type_info_get_param_type (info, 0);
if (type) if (type)
{ {
write_type_info (ns, type, file); write_type_info (ns, type, file);
gi_base_info_unref ((GIBaseInfo *)type); gi_base_info_unref ((GIBaseInfo *)type);
} }
xml_end_element (file, "type"); xml_end_element (file, "type");
} }
else if (tag == GI_TYPE_TAG_GHASH) else if (tag == GI_TYPE_TAG_GHASH)
@ -326,13 +326,13 @@ write_type_info (const gchar *ns,
xml_printf (file, " name=\"GLib.HashTable\""); xml_printf (file, " name=\"GLib.HashTable\"");
type = gi_type_info_get_param_type (info, 0); type = gi_type_info_get_param_type (info, 0);
if (type) if (type)
{ {
write_type_info (ns, type, file); write_type_info (ns, type, file);
gi_base_info_unref ((GIBaseInfo *)type); gi_base_info_unref ((GIBaseInfo *)type);
type = gi_type_info_get_param_type (info, 1); type = gi_type_info_get_param_type (info, 1);
write_type_info (ns, type, file); write_type_info (ns, type, file);
gi_base_info_unref ((GIBaseInfo *)type); gi_base_info_unref ((GIBaseInfo *)type);
} }
xml_end_element (file, "type"); xml_end_element (file, "type");
} }
else if (tag == GI_TYPE_TAG_ERROR) else if (tag == GI_TYPE_TAG_ERROR)
@ -380,20 +380,20 @@ write_return_value_attributes (Xml *file,
static void static void
write_constant_value (const gchar *ns, write_constant_value (const gchar *ns,
GITypeInfo *info, GITypeInfo *info,
GIArgument *argument, GIArgument *argument,
Xml *file); Xml *file);
static void static void
write_callback_info (const gchar *ns, write_callback_info (const gchar *ns,
GICallbackInfo *info, GICallbackInfo *info,
Xml *file); Xml *file);
static void static void
write_field_info (const gchar *ns, write_field_info (const gchar *ns,
GIFieldInfo *info, GIFieldInfo *info,
GIConstantInfo *branch, GIConstantInfo *branch,
Xml *file) Xml *file)
{ {
const gchar *name; const gchar *name;
GIFieldInfoFlags flags; GIFieldInfoFlags flags;
@ -458,8 +458,8 @@ write_field_info (const gchar *ns,
static void static void
write_callable_info (const gchar *ns, write_callable_info (const gchar *ns,
GICallableInfo *info, GICallableInfo *info,
Xml *file) Xml *file)
{ {
GITypeInfo *type; GITypeInfo *type;
@ -501,28 +501,28 @@ write_callable_info (const gchar *ns,
write_ownership_transfer (gi_arg_info_get_ownership_transfer (arg), file); write_ownership_transfer (gi_arg_info_get_ownership_transfer (arg), file);
switch (gi_arg_info_get_direction (arg)) switch (gi_arg_info_get_direction (arg))
{ {
case GI_DIRECTION_IN: case GI_DIRECTION_IN:
break; break;
case GI_DIRECTION_OUT: case GI_DIRECTION_OUT:
xml_printf (file, " direction=\"out\" caller-allocates=\"%s\"", xml_printf (file, " direction=\"out\" caller-allocates=\"%s\"",
gi_arg_info_is_caller_allocates (arg) ? "1" : "0"); gi_arg_info_is_caller_allocates (arg) ? "1" : "0");
break; break;
case GI_DIRECTION_INOUT: case GI_DIRECTION_INOUT:
xml_printf (file, " direction=\"inout\""); xml_printf (file, " direction=\"inout\"");
break; break;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
} }
if (gi_arg_info_may_be_null (arg)) if (gi_arg_info_may_be_null (arg))
xml_printf (file, " allow-none=\"1\""); xml_printf (file, " allow-none=\"1\"");
if (gi_arg_info_is_return_value (arg)) if (gi_arg_info_is_return_value (arg))
xml_printf (file, " retval=\"1\""); xml_printf (file, " retval=\"1\"");
if (gi_arg_info_is_optional (arg)) if (gi_arg_info_is_optional (arg))
xml_printf (file, " optional=\"1\""); xml_printf (file, " optional=\"1\"");
switch (gi_arg_info_get_scope (arg)) switch (gi_arg_info_get_scope (arg))
{ {
@ -569,8 +569,8 @@ write_callable_info (const gchar *ns,
static void static void
write_function_info (const gchar *ns, write_function_info (const gchar *ns,
GIFunctionInfo *info, GIFunctionInfo *info,
Xml *file) Xml *file)
{ {
GIFunctionInfoFlags flags; GIFunctionInfoFlags flags;
const gchar *tag; const gchar *tag;
@ -620,8 +620,8 @@ write_function_info (const gchar *ns,
static void static void
write_callback_info (const gchar *ns, write_callback_info (const gchar *ns,
GICallbackInfo *info, GICallbackInfo *info,
Xml *file) Xml *file)
{ {
const gchar *name; const gchar *name;
gboolean deprecated; gboolean deprecated;
@ -641,8 +641,8 @@ write_callback_info (const gchar *ns,
static void static void
write_struct_info (const gchar *ns, write_struct_info (const gchar *ns,
GIStructInfo *info, GIStructInfo *info,
Xml *file) Xml *file)
{ {
const gchar *name; const gchar *name;
const gchar *type_name; const gchar *type_name;
@ -703,18 +703,18 @@ write_struct_info (const gchar *ns,
if (n_elts > 0) if (n_elts > 0)
{ {
for (guint i = 0; i < gi_struct_info_get_n_fields (info); i++) for (guint i = 0; i < gi_struct_info_get_n_fields (info); i++)
{ {
GIFieldInfo *field = gi_struct_info_get_field (info, i); GIFieldInfo *field = gi_struct_info_get_field (info, i);
write_field_info (ns, field, NULL, file); write_field_info (ns, field, NULL, file);
gi_base_info_unref ((GIBaseInfo *)field); gi_base_info_unref ((GIBaseInfo *)field);
} }
for (guint i = 0; i < gi_struct_info_get_n_methods (info); i++) for (guint i = 0; i < gi_struct_info_get_n_methods (info); i++)
{ {
GIFunctionInfo *function = gi_struct_info_get_method (info, i); GIFunctionInfo *function = gi_struct_info_get_method (info, i);
write_function_info (ns, function, file); write_function_info (ns, function, file);
gi_base_info_unref ((GIBaseInfo *)function); gi_base_info_unref ((GIBaseInfo *)function);
} }
} }
@ -723,8 +723,8 @@ write_struct_info (const gchar *ns,
static void static void
write_value_info (const gchar *ns, write_value_info (const gchar *ns,
GIValueInfo *info, GIValueInfo *info,
Xml *file) Xml *file)
{ {
const gchar *name; const gchar *name;
gint64 value; gint64 value;
@ -750,9 +750,9 @@ write_value_info (const gchar *ns,
static void static void
write_constant_value (const gchar *ns, write_constant_value (const gchar *ns,
GITypeInfo *type, GITypeInfo *type,
GIArgument *value, GIArgument *value,
Xml *file) Xml *file)
{ {
switch (gi_type_info_get_tag (type)) switch (gi_type_info_get_tag (type))
{ {
@ -800,8 +800,8 @@ write_constant_value (const gchar *ns,
static void static void
write_constant_info (const gchar *ns, write_constant_info (const gchar *ns,
GIConstantInfo *info, GIConstantInfo *info,
Xml *file) Xml *file)
{ {
GITypeInfo *type; GITypeInfo *type;
const gchar *name; const gchar *name;
@ -831,8 +831,8 @@ write_constant_info (const gchar *ns,
static void static void
write_enum_info (const gchar *ns, write_enum_info (const gchar *ns,
GIEnumInfo *info, GIEnumInfo *info,
Xml *file) Xml *file)
{ {
const gchar *name; const gchar *name;
const gchar *type_name; const gchar *type_name;
@ -875,8 +875,8 @@ write_enum_info (const gchar *ns,
static void static void
write_signal_info (const gchar *ns, write_signal_info (const gchar *ns,
GISignalInfo *info, GISignalInfo *info,
Xml *file) Xml *file)
{ {
GSignalFlags flags; GSignalFlags flags;
const gchar *name; const gchar *name;
@ -918,8 +918,8 @@ write_signal_info (const gchar *ns,
static void static void
write_vfunc_info (const gchar *ns, write_vfunc_info (const gchar *ns,
GIVFuncInfo *info, GIVFuncInfo *info,
Xml *file) Xml *file)
{ {
GIVFuncInfoFlags flags; GIVFuncInfoFlags flags;
const gchar *name; const gchar *name;
@ -962,8 +962,8 @@ write_vfunc_info (const gchar *ns,
static void static void
write_property_info (const gchar *ns, write_property_info (const gchar *ns,
GIPropertyInfo *info, GIPropertyInfo *info,
Xml *file) Xml *file)
{ {
GParamFlags flags; GParamFlags flags;
const gchar *name; const gchar *name;
@ -1027,8 +1027,8 @@ write_property_info (const gchar *ns,
static void static void
write_object_info (const gchar *ns, write_object_info (const gchar *ns,
GIObjectInfo *info, GIObjectInfo *info,
Xml *file) Xml *file)
{ {
const gchar *name; const gchar *name;
const gchar *type_name; const gchar *type_name;
@ -1101,13 +1101,13 @@ write_object_info (const gchar *ns,
if (gi_object_info_get_n_interfaces (info) > 0) if (gi_object_info_get_n_interfaces (info) > 0)
{ {
for (guint i = 0; i < gi_object_info_get_n_interfaces (info); i++) for (guint i = 0; i < gi_object_info_get_n_interfaces (info); i++)
{ {
GIInterfaceInfo *imp = gi_object_info_get_interface (info, i); GIInterfaceInfo *imp = gi_object_info_get_interface (info, i);
xml_start_element (file, "implements"); xml_start_element (file, "implements");
write_type_name_attribute (ns, (GIBaseInfo *)imp, "name", file); write_type_name_attribute (ns, (GIBaseInfo *)imp, "name", file);
xml_end_element (file, "implements"); xml_end_element (file, "implements");
gi_base_info_unref ((GIBaseInfo*)imp); gi_base_info_unref ((GIBaseInfo*)imp);
} }
} }
for (guint i = 0; i < gi_object_info_get_n_fields (info); i++) for (guint i = 0; i < gi_object_info_get_n_fields (info); i++)
@ -1157,8 +1157,8 @@ write_object_info (const gchar *ns,
static void static void
write_interface_info (const gchar *ns, write_interface_info (const gchar *ns,
GIInterfaceInfo *info, GIInterfaceInfo *info,
Xml *file) Xml *file)
{ {
const gchar *name; const gchar *name;
const gchar *type_name; const gchar *type_name;
@ -1173,7 +1173,7 @@ write_interface_info (const gchar *ns,
type_init = gi_registered_type_info_get_type_init_function_name ((GIRegisteredTypeInfo*)info); type_init = gi_registered_type_info_get_type_init_function_name ((GIRegisteredTypeInfo*)info);
xml_start_element (file, "interface"); xml_start_element (file, "interface");
xml_printf (file, " name=\"%s\" glib:type-name=\"%s\" glib:get-type=\"%s\"", xml_printf (file, " name=\"%s\" glib:type-name=\"%s\" glib:get-type=\"%s\"",
name, type_name, type_init); name, type_name, type_init);
class_struct = gi_interface_info_get_iface_struct (info); class_struct = gi_interface_info_get_iface_struct (info);
if (class_struct) if (class_struct)
@ -1190,15 +1190,15 @@ write_interface_info (const gchar *ns,
if (gi_interface_info_get_n_prerequisites (info) > 0) if (gi_interface_info_get_n_prerequisites (info) > 0)
{ {
for (guint i = 0; i < gi_interface_info_get_n_prerequisites (info); i++) for (guint i = 0; i < gi_interface_info_get_n_prerequisites (info); i++)
{ {
GIBaseInfo *req = gi_interface_info_get_prerequisite (info, i); GIBaseInfo *req = gi_interface_info_get_prerequisite (info, i);
xml_start_element (file, "prerequisite"); xml_start_element (file, "prerequisite");
write_type_name_attribute (ns, req, "name", file); write_type_name_attribute (ns, req, "name", file);
xml_end_element_unchecked (file); xml_end_element_unchecked (file);
gi_base_info_unref (req); gi_base_info_unref (req);
} }
} }
for (guint i = 0; i < gi_interface_info_get_n_methods (info); i++) for (guint i = 0; i < gi_interface_info_get_n_methods (info); i++)
@ -1241,8 +1241,8 @@ write_interface_info (const gchar *ns,
static void static void
write_union_info (const gchar *ns, write_union_info (const gchar *ns,
GIUnionInfo *info, GIUnionInfo *info,
Xml *file) Xml *file)
{ {
const gchar *name; const gchar *name;
const gchar *type_name; const gchar *type_name;
@ -1302,7 +1302,7 @@ write_union_info (const gchar *ns,
write_field_info (ns, field, constant, file); write_field_info (ns, field, constant, file);
gi_base_info_unref ((GIBaseInfo *)field); gi_base_info_unref ((GIBaseInfo *)field);
if (constant) if (constant)
gi_base_info_unref ((GIBaseInfo *)constant); gi_base_info_unref ((GIBaseInfo *)constant);
} }
for (guint i = 0; i < gi_union_info_get_n_methods (info); i++) for (guint i = 0; i < gi_union_info_get_n_methods (info); i++)
@ -1349,19 +1349,19 @@ gi_ir_writer_write (const char *filename,
gchar *full_filename; gchar *full_filename;
if (needs_prefix) if (needs_prefix)
full_filename = g_strdup_printf ("%s-%s", ns, filename); full_filename = g_strdup_printf ("%s-%s", ns, filename);
else else
full_filename = g_strdup (filename); full_filename = g_strdup (filename);
ofile = g_fopen (filename, "w"); ofile = g_fopen (filename, "w");
if (ofile == NULL) if (ofile == NULL)
{ {
g_fprintf (stderr, "failed to open '%s': %s\n", g_fprintf (stderr, "failed to open '%s': %s\n",
full_filename, g_strerror (errno)); full_filename, g_strerror (errno));
g_free (full_filename); g_free (full_filename);
return; return;
} }
g_free (full_filename); g_free (full_filename);
} }
@ -1371,21 +1371,21 @@ gi_ir_writer_write (const char *filename,
xml_printf (xml, "<?xml version=\"1.0\"?>\n"); xml_printf (xml, "<?xml version=\"1.0\"?>\n");
xml_start_element (xml, "repository"); xml_start_element (xml, "repository");
xml_printf (xml, " version=\"1.0\"\n" xml_printf (xml, " version=\"1.0\"\n"
" xmlns=\"http://www.gtk.org/introspection/core/1.0\"\n" " xmlns=\"http://www.gtk.org/introspection/core/1.0\"\n"
" xmlns:c=\"http://www.gtk.org/introspection/c/1.0\"\n" " xmlns:c=\"http://www.gtk.org/introspection/c/1.0\"\n"
" xmlns:glib=\"http://www.gtk.org/introspection/glib/1.0\""); " xmlns:glib=\"http://www.gtk.org/introspection/glib/1.0\"");
dependencies = gi_repository_get_immediate_dependencies (repository, ns); dependencies = gi_repository_get_immediate_dependencies (repository, ns);
if (dependencies != NULL) if (dependencies != NULL)
{ {
for (i = 0; dependencies[i]; i++) for (i = 0; dependencies[i]; i++)
{ {
char **parts = g_strsplit (dependencies[i], "-", 2); char **parts = g_strsplit (dependencies[i], "-", 2);
xml_start_element (xml, "include"); xml_start_element (xml, "include");
xml_printf (xml, " name=\"%s\" version=\"%s\"", parts[0], parts[1]); xml_printf (xml, " name=\"%s\" version=\"%s\"", parts[0], parts[1]);
xml_end_element (xml, "include"); xml_end_element (xml, "include");
g_strfreev (parts); g_strfreev (parts);
} }
} }
if (TRUE) if (TRUE)
@ -1413,50 +1413,50 @@ gi_ir_writer_write (const char *filename,
n_infos = gi_repository_get_n_infos (repository, cur_ns); n_infos = gi_repository_get_n_infos (repository, cur_ns);
for (j = 0; j < n_infos; j++) for (j = 0; j < n_infos; j++)
{ {
GIBaseInfo *info = gi_repository_get_info (repository, cur_ns, j); GIBaseInfo *info = gi_repository_get_info (repository, cur_ns, j);
switch (gi_base_info_get_info_type (info)) switch (gi_base_info_get_info_type (info))
{ {
case GI_INFO_TYPE_FUNCTION: case GI_INFO_TYPE_FUNCTION:
write_function_info (ns, (GIFunctionInfo *)info, xml); write_function_info (ns, (GIFunctionInfo *)info, xml);
break; break;
case GI_INFO_TYPE_CALLBACK: case GI_INFO_TYPE_CALLBACK:
write_callback_info (ns, (GICallbackInfo *)info, xml); write_callback_info (ns, (GICallbackInfo *)info, xml);
break; break;
case GI_INFO_TYPE_STRUCT: case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_BOXED: case GI_INFO_TYPE_BOXED:
write_struct_info (ns, (GIStructInfo *)info, xml); write_struct_info (ns, (GIStructInfo *)info, xml);
break; break;
case GI_INFO_TYPE_UNION: case GI_INFO_TYPE_UNION:
write_union_info (ns, (GIUnionInfo *)info, xml); write_union_info (ns, (GIUnionInfo *)info, xml);
break; break;
case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS: case GI_INFO_TYPE_FLAGS:
write_enum_info (ns, (GIEnumInfo *)info, xml); write_enum_info (ns, (GIEnumInfo *)info, xml);
break; break;
case GI_INFO_TYPE_CONSTANT: case GI_INFO_TYPE_CONSTANT:
write_constant_info (ns, (GIConstantInfo *)info, xml); write_constant_info (ns, (GIConstantInfo *)info, xml);
break; break;
case GI_INFO_TYPE_OBJECT: case GI_INFO_TYPE_OBJECT:
write_object_info (ns, (GIObjectInfo *)info, xml); write_object_info (ns, (GIObjectInfo *)info, xml);
break; break;
case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_INTERFACE:
write_interface_info (ns, (GIInterfaceInfo *)info, xml); write_interface_info (ns, (GIInterfaceInfo *)info, xml);
break; break;
default: default:
g_error ("unknown info type %d", gi_base_info_get_info_type (info)); g_error ("unknown info type %d", gi_base_info_get_info_type (info));
} }
gi_base_info_unref (info); gi_base_info_unref (info);
} }
xml_end_element (xml, "namespace"); xml_end_element (xml, "namespace");
} }

View File

@ -257,10 +257,10 @@ gi_type_info_get_array_length_index (GITypeInfo *info)
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset]; ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->tag == GI_TYPE_TAG_ARRAY) if (blob->tag == GI_TYPE_TAG_ARRAY)
{ {
if (blob->has_length) if (blob->has_length)
return blob->dimensions.length; return blob->dimensions.length;
} }
} }
return -1; return -1;
@ -293,10 +293,10 @@ gi_type_info_get_array_fixed_size (GITypeInfo *info)
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset]; ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->tag == GI_TYPE_TAG_ARRAY) if (blob->tag == GI_TYPE_TAG_ARRAY)
{ {
if (blob->has_size) if (blob->has_size)
return blob->dimensions.size; return blob->dimensions.size;
} }
} }
return -1; return -1;
@ -329,7 +329,7 @@ gi_type_info_is_zero_terminated (GITypeInfo *info)
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset]; ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->tag == GI_TYPE_TAG_ARRAY) if (blob->tag == GI_TYPE_TAG_ARRAY)
return blob->zero_terminated; return blob->zero_terminated;
} }
return FALSE; return FALSE;

View File

@ -735,12 +735,12 @@ typedef struct {
* Since: 2.80 * Since: 2.80
*/ */
typedef struct { typedef struct {
guint8 pointer :1; guint8 pointer :1;
guint8 reserved :2; guint8 reserved :2;
guint8 tag :5; guint8 tag :5;
guint8 reserved2; guint8 reserved2;
guint16 n_types; guint16 n_types;
SimpleTypeBlob type[]; SimpleTypeBlob type[];
} ParamTypeBlob; } ParamTypeBlob;

File diff suppressed because it is too large Load Diff

View File

@ -213,9 +213,9 @@ gi_union_info_get_discriminator (GIUnionInfo *info,
gint offset; gint offset;
offset = rinfo->offset + header->union_blob_size offset = rinfo->offset + header->union_blob_size
+ blob->n_fields * header->field_blob_size + blob->n_fields * header->field_blob_size
+ blob->n_functions * header->function_blob_size + blob->n_functions * header->function_blob_size
+ n * header->constant_blob_size; + n * header->constant_blob_size;
return (GIConstantInfo *) gi_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info, return (GIConstantInfo *) gi_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);

View File

@ -72,7 +72,7 @@ GIConstantInfo * gi_union_info_get_discriminator (GIUnionInfo *info,
GI_AVAILABLE_IN_ALL GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_union_info_find_method (GIUnionInfo *info, GIFunctionInfo * gi_union_info_find_method (GIUnionInfo *info,
const gchar *name); const gchar *name);
GI_AVAILABLE_IN_ALL GI_AVAILABLE_IN_ALL
gsize gi_union_info_get_size (GIUnionInfo *info); gsize gi_union_info_get_size (GIUnionInfo *info);

View File

@ -39,7 +39,7 @@ G_BEGIN_DECLS
* *
* Since: 2.80 * Since: 2.80
*/ */
#define GI_IS_UNRESOLVED_INFO(info) \ #define GI_IS_UNRESOLVED_INFO(info) \
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNRESOLVED) (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNRESOLVED)
G_END_DECLS G_END_DECLS