mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-02 05:43:07 +02:00
Merge branch 'gir-standard-types' into 'main'
girepository: Use standard types instead of glib specific See merge request GNOME/glib!3780
This commit is contained in:
commit
bb37da24a6
@ -1,19 +1,20 @@
|
|||||||
|
#include <stdint.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#ifndef __CMPH_TYPES_H__
|
#ifndef __CMPH_TYPES_H__
|
||||||
#define __CMPH_TYPES_H__
|
#define __CMPH_TYPES_H__
|
||||||
|
|
||||||
typedef gint8 cmph_int8;
|
typedef int8_t cmph_int8;
|
||||||
typedef guint8 cmph_uint8;
|
typedef uint8_t cmph_uint8;
|
||||||
|
|
||||||
typedef gint16 cmph_int16;
|
typedef int16_t cmph_int16;
|
||||||
typedef guint16 cmph_uint16;
|
typedef uint16_t cmph_uint16;
|
||||||
|
|
||||||
typedef gint32 cmph_int32;
|
typedef int32_t cmph_int32;
|
||||||
typedef guint32 cmph_uint32;
|
typedef uint32_t cmph_uint32;
|
||||||
|
|
||||||
typedef gint64 cmph_int64;
|
typedef int64_t cmph_int64;
|
||||||
typedef guint64 cmph_uint64;
|
typedef uint64_t cmph_uint64;
|
||||||
|
|
||||||
typedef enum { CMPH_HASH_JENKINS, CMPH_HASH_COUNT } CMPH_HASH;
|
typedef enum { CMPH_HASH_JENKINS, CMPH_HASH_COUNT } CMPH_HASH;
|
||||||
extern const char *cmph_hash_names[];
|
extern const char *cmph_hash_names[];
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -43,8 +44,8 @@
|
|||||||
static gboolean
|
static gboolean
|
||||||
write_all (FILE *out,
|
write_all (FILE *out,
|
||||||
const void *buffer,
|
const void *buffer,
|
||||||
gsize count,
|
size_t count,
|
||||||
gsize *bytes_written,
|
size_t *bytes_written,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret;
|
||||||
@ -70,12 +71,12 @@ read_line (FILE *input,
|
|||||||
size_t *len_out)
|
size_t *len_out)
|
||||||
{
|
{
|
||||||
GByteArray *buffer = g_byte_array_new ();
|
GByteArray *buffer = g_byte_array_new ();
|
||||||
const guint8 nul = '\0';
|
const uint8_t nul = '\0';
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret;
|
||||||
guint8 byte;
|
uint8_t byte;
|
||||||
|
|
||||||
ret = fread (&byte, 1, 1, input);
|
ret = fread (&byte, 1, 1, input);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
@ -103,7 +104,7 @@ escaped_printf (FILE *out, const char *fmt, ...)
|
|||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
va_list args;
|
va_list args;
|
||||||
gsize written;
|
size_t written;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
va_start (args, fmt);
|
va_start (args, fmt);
|
||||||
@ -122,7 +123,7 @@ escaped_printf (FILE *out, const char *fmt, ...)
|
|||||||
static void
|
static void
|
||||||
goutput_write (FILE *out, const char *str)
|
goutput_write (FILE *out, const char *str)
|
||||||
{
|
{
|
||||||
gsize written;
|
size_t written;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
if (!write_all (out, str, strlen (str), &written, &error))
|
if (!write_all (out, str, strlen (str), &written, &error))
|
||||||
{
|
{
|
||||||
@ -250,8 +251,8 @@ value_to_string (const GValue *value)
|
|||||||
static void
|
static void
|
||||||
dump_properties (GType type, FILE *out)
|
dump_properties (GType type, FILE *out)
|
||||||
{
|
{
|
||||||
guint i;
|
unsigned int i;
|
||||||
guint n_properties = 0;
|
unsigned int n_properties = 0;
|
||||||
GParamSpec **props;
|
GParamSpec **props;
|
||||||
|
|
||||||
if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
|
if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
|
||||||
@ -303,16 +304,16 @@ dump_properties (GType type, FILE *out)
|
|||||||
static void
|
static void
|
||||||
dump_signals (GType type, FILE *out)
|
dump_signals (GType type, FILE *out)
|
||||||
{
|
{
|
||||||
guint i;
|
unsigned int i;
|
||||||
guint n_sigs;
|
unsigned int n_sigs;
|
||||||
guint *sig_ids;
|
unsigned int *sig_ids;
|
||||||
|
|
||||||
sig_ids = g_signal_list_ids (type, &n_sigs);
|
sig_ids = g_signal_list_ids (type, &n_sigs);
|
||||||
for (i = 0; i < n_sigs; i++)
|
for (i = 0; i < n_sigs; i++)
|
||||||
{
|
{
|
||||||
guint sigid;
|
unsigned int sigid;
|
||||||
GSignalQuery query;
|
GSignalQuery query;
|
||||||
guint j;
|
unsigned int j;
|
||||||
|
|
||||||
sigid = sig_ids[i];
|
sigid = sig_ids[i];
|
||||||
g_signal_query (sigid, &query);
|
g_signal_query (sigid, &query);
|
||||||
@ -355,8 +356,8 @@ dump_signals (GType type, FILE *out)
|
|||||||
static void
|
static void
|
||||||
dump_object_type (GType type, const char *symbol, FILE *out)
|
dump_object_type (GType type, const char *symbol, FILE *out)
|
||||||
{
|
{
|
||||||
guint n_interfaces;
|
unsigned int n_interfaces;
|
||||||
guint i;
|
unsigned int i;
|
||||||
GType *interfaces;
|
GType *interfaces;
|
||||||
|
|
||||||
escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"",
|
escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"",
|
||||||
@ -409,8 +410,8 @@ dump_object_type (GType type, const char *symbol, FILE *out)
|
|||||||
static void
|
static void
|
||||||
dump_interface_type (GType type, const char *symbol, FILE *out)
|
dump_interface_type (GType type, const char *symbol, FILE *out)
|
||||||
{
|
{
|
||||||
guint n_interfaces;
|
unsigned int n_interfaces;
|
||||||
guint i;
|
unsigned int i;
|
||||||
GType *interfaces;
|
GType *interfaces;
|
||||||
|
|
||||||
escaped_printf (out, " <interface name=\"%s\" get-type=\"%s\">\n",
|
escaped_printf (out, " <interface name=\"%s\" get-type=\"%s\">\n",
|
||||||
@ -449,7 +450,7 @@ dump_boxed_type (GType type, const char *symbol, FILE *out)
|
|||||||
static void
|
static void
|
||||||
dump_flags_type (GType type, const char *symbol, FILE *out)
|
dump_flags_type (GType type, const char *symbol, FILE *out)
|
||||||
{
|
{
|
||||||
guint i;
|
unsigned int i;
|
||||||
GFlagsClass *klass;
|
GFlagsClass *klass;
|
||||||
|
|
||||||
klass = g_type_class_ref (type);
|
klass = g_type_class_ref (type);
|
||||||
@ -469,7 +470,7 @@ dump_flags_type (GType type, const char *symbol, FILE *out)
|
|||||||
static void
|
static void
|
||||||
dump_enum_type (GType type, const char *symbol, FILE *out)
|
dump_enum_type (GType type, const char *symbol, FILE *out)
|
||||||
{
|
{
|
||||||
guint i;
|
unsigned int i;
|
||||||
GEnumClass *klass;
|
GEnumClass *klass;
|
||||||
|
|
||||||
klass = g_type_class_ref (type);
|
klass = g_type_class_ref (type);
|
||||||
@ -489,8 +490,8 @@ dump_enum_type (GType type, const char *symbol, FILE *out)
|
|||||||
static void
|
static void
|
||||||
dump_fundamental_type (GType type, const char *symbol, FILE *out)
|
dump_fundamental_type (GType type, const char *symbol, FILE *out)
|
||||||
{
|
{
|
||||||
guint n_interfaces;
|
unsigned int n_interfaces;
|
||||||
guint i;
|
unsigned int i;
|
||||||
GType *interfaces;
|
GType *interfaces;
|
||||||
GString *parent_str;
|
GString *parent_str;
|
||||||
GType parent;
|
GType parent;
|
||||||
@ -661,7 +662,7 @@ gi_repository_dump (const char *input_filename,
|
|||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
gsize len;
|
size_t len;
|
||||||
char *line = read_line (input, &len);
|
char *line = read_line (input, &len);
|
||||||
const char *function;
|
const char *function;
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ gi_arg_info_get_scope (GIArgInfo *info)
|
|||||||
* Returns: Index of the user data argument or `-1` if there is none
|
* Returns: Index of the user data argument or `-1` if there is none
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gint
|
gssize
|
||||||
gi_arg_info_get_closure_index (GIArgInfo *info)
|
gi_arg_info_get_closure_index (GIArgInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -294,7 +294,7 @@ gi_arg_info_get_closure_index (GIArgInfo *info)
|
|||||||
* none
|
* none
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gint
|
gssize
|
||||||
gi_arg_info_get_destroy_index (GIArgInfo *info)
|
gi_arg_info_get_destroy_index (GIArgInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
@ -69,10 +69,10 @@ GI_AVAILABLE_IN_ALL
|
|||||||
GIScopeType gi_arg_info_get_scope (GIArgInfo *info);
|
GIScopeType gi_arg_info_get_scope (GIArgInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gint gi_arg_info_get_closure_index (GIArgInfo *info);
|
gssize gi_arg_info_get_closure_index (GIArgInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gint gi_arg_info_get_destroy_index (GIArgInfo *info);
|
gssize gi_arg_info_get_destroy_index (GIArgInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypeInfo * gi_arg_info_get_type_info (GIArgInfo *info);
|
GITypeInfo * gi_arg_info_get_type_info (GIArgInfo *info);
|
||||||
|
@ -45,7 +45,7 @@ struct _GIBaseInfoClass
|
|||||||
void gi_base_info_init_types (void);
|
void gi_base_info_init_types (void);
|
||||||
|
|
||||||
GType gi_base_info_type_register_static (const char *type_name,
|
GType gi_base_info_type_register_static (const char *type_name,
|
||||||
gsize instance_size,
|
size_t instance_size,
|
||||||
GClassInitFunc class_init);
|
GClassInitFunc class_init);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -64,7 +64,7 @@ value_base_info_copy_value (const GValue *src,
|
|||||||
dst->data[0].v_pointer = NULL;
|
dst->data[0].v_pointer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static void *
|
||||||
value_base_info_peek_pointer (const GValue *value)
|
value_base_info_peek_pointer (const GValue *value)
|
||||||
{
|
{
|
||||||
return value->data[0].v_pointer;
|
return value->data[0].v_pointer;
|
||||||
@ -96,7 +96,7 @@ value_base_info_collect_value (GValue *value,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static char *
|
||||||
value_base_info_lcopy_value (const GValue *value,
|
value_base_info_lcopy_value (const GValue *value,
|
||||||
guint n_collect_values,
|
guint n_collect_values,
|
||||||
GTypeCValue *collect_values,
|
GTypeCValue *collect_values,
|
||||||
@ -213,7 +213,7 @@ gi_base_info_get_type (void)
|
|||||||
*/
|
*/
|
||||||
GType
|
GType
|
||||||
gi_base_info_type_register_static (const char *type_name,
|
gi_base_info_type_register_static (const char *type_name,
|
||||||
gsize instance_size,
|
size_t instance_size,
|
||||||
GClassInitFunc class_init)
|
GClassInitFunc class_init)
|
||||||
{
|
{
|
||||||
GTypeInfo info;
|
GTypeInfo info;
|
||||||
@ -264,7 +264,7 @@ GI_DEFINE_BASE_INFO_TYPE (gi_unresolved_info, GI_INFO_TYPE_UNRESOLVED)
|
|||||||
void
|
void
|
||||||
gi_base_info_init_types (void)
|
gi_base_info_init_types (void)
|
||||||
{
|
{
|
||||||
static gsize register_types_once = 0;
|
static size_t register_types_once = 0;
|
||||||
|
|
||||||
if (g_once_init_enter (®ister_types_once))
|
if (g_once_init_enter (®ister_types_once))
|
||||||
{
|
{
|
||||||
@ -272,7 +272,7 @@ gi_base_info_init_types (void)
|
|||||||
{
|
{
|
||||||
GIInfoType info_type;
|
GIInfoType info_type;
|
||||||
const char *type_name;
|
const char *type_name;
|
||||||
gsize instance_size;
|
size_t instance_size;
|
||||||
GClassInitFunc class_init;
|
GClassInitFunc class_init;
|
||||||
}
|
}
|
||||||
types[] =
|
types[] =
|
||||||
@ -297,7 +297,7 @@ gi_base_info_init_types (void)
|
|||||||
{ GI_INFO_TYPE_UNRESOLVED, "GIUnresolvedInfo", sizeof (GIUnresolvedInfo), gi_unresolved_info_class_init },
|
{ GI_INFO_TYPE_UNRESOLVED, "GIUnresolvedInfo", sizeof (GIUnresolvedInfo), gi_unresolved_info_class_init },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (gsize i = 0; i < G_N_ELEMENTS (types); i++)
|
for (size_t i = 0; i < G_N_ELEMENTS (types); i++)
|
||||||
{
|
{
|
||||||
GType registered_type = gi_base_info_type_register_static (g_intern_static_string (types[i].type_name),
|
GType registered_type = gi_base_info_type_register_static (g_intern_static_string (types[i].type_name),
|
||||||
types[i].instance_size,
|
types[i].instance_size,
|
||||||
@ -315,12 +315,13 @@ gi_info_new_full (GIInfoType type,
|
|||||||
GIRepository *repository,
|
GIRepository *repository,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset)
|
uint32_t offset)
|
||||||
{
|
{
|
||||||
GIRealInfo *info;
|
GIRealInfo *info;
|
||||||
|
|
||||||
g_return_val_if_fail (container != NULL || repository != NULL, NULL);
|
g_return_val_if_fail (container != NULL || repository != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_REPOSITORY (repository), NULL);
|
g_return_val_if_fail (GI_IS_REPOSITORY (repository), NULL);
|
||||||
|
g_return_val_if_fail (offset <= G_MAXUINT32, NULL);
|
||||||
|
|
||||||
gi_base_info_init_types ();
|
gi_base_info_init_types ();
|
||||||
g_assert (gi_base_info_types[type] != G_TYPE_INVALID);
|
g_assert (gi_base_info_types[type] != G_TYPE_INVALID);
|
||||||
@ -357,7 +358,7 @@ GIBaseInfo *
|
|||||||
gi_info_new (GIInfoType type,
|
gi_info_new (GIInfoType type,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset)
|
size_t offset)
|
||||||
{
|
{
|
||||||
return gi_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
|
return gi_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
|
||||||
}
|
}
|
||||||
@ -382,7 +383,7 @@ gi_info_init (GIRealInfo *info,
|
|||||||
GIRepository *repository,
|
GIRepository *repository,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset)
|
uint32_t offset)
|
||||||
{
|
{
|
||||||
memset (info, 0, sizeof (GIRealInfo));
|
memset (info, 0, sizeof (GIRealInfo));
|
||||||
|
|
||||||
@ -401,7 +402,7 @@ gi_info_init (GIRealInfo *info,
|
|||||||
GIBaseInfo *
|
GIBaseInfo *
|
||||||
gi_info_from_entry (GIRepository *repository,
|
gi_info_from_entry (GIRepository *repository,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint16 index)
|
uint16_t index)
|
||||||
{
|
{
|
||||||
GIBaseInfo *result;
|
GIBaseInfo *result;
|
||||||
DirEntry *entry = gi_typelib_get_dir_entry (typelib, index);
|
DirEntry *entry = gi_typelib_get_dir_entry (typelib, index);
|
||||||
@ -410,8 +411,8 @@ gi_info_from_entry (GIRepository *repository,
|
|||||||
result = gi_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset);
|
result = gi_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const gchar *namespace = gi_typelib_get_string (typelib, entry->offset);
|
const char *namespace = gi_typelib_get_string (typelib, entry->offset);
|
||||||
const gchar *name = gi_typelib_get_string (typelib, entry->name);
|
const char *name = gi_typelib_get_string (typelib, entry->name);
|
||||||
|
|
||||||
result = gi_repository_find_by_name (repository, namespace, name);
|
result = gi_repository_find_by_name (repository, namespace, name);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
@ -438,7 +439,7 @@ gi_info_from_entry (GIRepository *repository,
|
|||||||
GITypeInfo *
|
GITypeInfo *
|
||||||
gi_type_info_new (GIBaseInfo *container,
|
gi_type_info_new (GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset)
|
uint32_t offset)
|
||||||
{
|
{
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
||||||
|
|
||||||
@ -450,7 +451,7 @@ void
|
|||||||
gi_type_info_init (GIBaseInfo *info,
|
gi_type_info_init (GIBaseInfo *info,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset)
|
uint32_t offset)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)container;
|
GIRealInfo *rinfo = (GIRealInfo*)container;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
||||||
@ -564,7 +565,7 @@ gi_base_info_get_info_type (GIBaseInfo *info)
|
|||||||
* Returns: (nullable): the name of @info or `NULL` if it lacks a name.
|
* Returns: (nullable): the name of @info or `NULL` if it lacks a name.
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_base_info_get_name (GIBaseInfo *info)
|
gi_base_info_get_name (GIBaseInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)info;
|
GIRealInfo *rinfo = (GIRealInfo*)info;
|
||||||
@ -661,7 +662,7 @@ gi_base_info_get_name (GIBaseInfo *info)
|
|||||||
* Returns: the namespace
|
* Returns: the namespace
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_base_info_get_namespace (GIBaseInfo *info)
|
gi_base_info_get_namespace (GIBaseInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo*) info;
|
GIRealInfo *rinfo = (GIRealInfo*) info;
|
||||||
@ -757,16 +758,16 @@ gi_base_info_is_deprecated (GIBaseInfo *info)
|
|||||||
* attribute exists
|
* attribute exists
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_base_info_get_attribute (GIBaseInfo *info,
|
gi_base_info_get_attribute (GIBaseInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
GIAttributeIter iter = { 0, };
|
GIAttributeIter iter = { 0, };
|
||||||
const char *curname, *curvalue;
|
const char *curname, *curvalue;
|
||||||
while (gi_base_info_iterate_attributes (info, &iter, &curname, &curvalue))
|
while (gi_base_info_iterate_attributes (info, &iter, &curname, &curvalue))
|
||||||
{
|
{
|
||||||
if (strcmp (name, curname) == 0)
|
if (strcmp (name, curname) == 0)
|
||||||
return (const gchar*) curvalue;
|
return (const char *) curvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -800,7 +801,7 @@ cmp_attribute (const void *av,
|
|||||||
*/
|
*/
|
||||||
AttributeBlob *
|
AttributeBlob *
|
||||||
_attribute_blob_find_first (GIBaseInfo *info,
|
_attribute_blob_find_first (GIBaseInfo *info,
|
||||||
guint32 blob_offset)
|
uint32_t blob_offset)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *) info;
|
GIRealInfo *rinfo = (GIRealInfo *) info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
@ -865,8 +866,8 @@ _attribute_blob_find_first (GIBaseInfo *info,
|
|||||||
gboolean
|
gboolean
|
||||||
gi_base_info_iterate_attributes (GIBaseInfo *info,
|
gi_base_info_iterate_attributes (GIBaseInfo *info,
|
||||||
GIAttributeIter *iterator,
|
GIAttributeIter *iterator,
|
||||||
const gchar **name,
|
const char **name,
|
||||||
const gchar **value)
|
const char **value)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
|
@ -44,10 +44,8 @@ G_BEGIN_DECLS
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer data;
|
void *data;
|
||||||
gpointer data2;
|
void *_dummy[4];
|
||||||
gpointer data3;
|
|
||||||
gpointer data4;
|
|
||||||
} GIAttributeIter;
|
} GIAttributeIter;
|
||||||
|
|
||||||
#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
|
#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
|
||||||
@ -66,17 +64,17 @@ GI_AVAILABLE_IN_ALL
|
|||||||
GIInfoType gi_base_info_get_info_type (GIBaseInfo *info);
|
GIInfoType gi_base_info_get_info_type (GIBaseInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_base_info_get_name (GIBaseInfo *info);
|
const char * gi_base_info_get_name (GIBaseInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_base_info_get_namespace (GIBaseInfo *info);
|
const char * gi_base_info_get_namespace (GIBaseInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_base_info_is_deprecated (GIBaseInfo *info);
|
gboolean gi_base_info_is_deprecated (GIBaseInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_base_info_get_attribute (GIBaseInfo *info,
|
const char * gi_base_info_get_attribute (GIBaseInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_base_info_iterate_attributes (GIBaseInfo *info,
|
gboolean gi_base_info_iterate_attributes (GIBaseInfo *info,
|
||||||
@ -98,6 +96,6 @@ GI_AVAILABLE_IN_ALL
|
|||||||
GIBaseInfo * gi_info_new (GIInfoType type,
|
GIBaseInfo * gi_info_new (GIInfoType type,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset);
|
size_t offset);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static guint32
|
static uint32_t
|
||||||
signature_offset (GICallableInfo *info)
|
signature_offset (GICallableInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)info;
|
GIRealInfo *rinfo = (GIRealInfo*)info;
|
||||||
@ -78,7 +78,7 @@ signature_offset (GICallableInfo *info)
|
|||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
if (sigoff >= 0)
|
if (sigoff >= 0)
|
||||||
return *(guint32 *)&rinfo->typelib->data[rinfo->offset + sigoff];
|
return *(uint32_t *)&rinfo->typelib->data[rinfo->offset + sigoff];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ GITypeInfo *
|
|||||||
gi_callable_info_get_return_type (GICallableInfo *info)
|
gi_callable_info_get_return_type (GICallableInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
|
||||||
@ -208,7 +208,7 @@ gi_callable_info_load_return_type (GICallableInfo *info,
|
|||||||
GITypeInfo *type)
|
GITypeInfo *type)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
|
|
||||||
g_return_if_fail (info != NULL);
|
g_return_if_fail (info != NULL);
|
||||||
g_return_if_fail (GI_IS_CALLABLE_INFO (info));
|
g_return_if_fail (GI_IS_CALLABLE_INFO (info));
|
||||||
@ -331,11 +331,11 @@ gi_callable_info_get_instance_ownership_transfer (GICallableInfo *info)
|
|||||||
* Returns: The number of arguments this callable expects.
|
* Returns: The number of arguments this callable expects.
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_callable_info_get_n_args (GICallableInfo *info)
|
gi_callable_info_get_n_args (GICallableInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
gint offset;
|
uint32_t offset;
|
||||||
SignatureBlob *blob;
|
SignatureBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, -1);
|
g_return_val_if_fail (info != NULL, -1);
|
||||||
@ -360,14 +360,15 @@ gi_callable_info_get_n_args (GICallableInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIArgInfo *
|
GIArgInfo *
|
||||||
gi_callable_info_get_arg (GICallableInfo *info,
|
gi_callable_info_get_arg (GICallableInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
gint offset;
|
uint32_t offset;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
offset = signature_offset (info);
|
offset = signature_offset (info);
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
@ -392,15 +393,16 @@ gi_callable_info_get_arg (GICallableInfo *info,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gi_callable_info_load_arg (GICallableInfo *info,
|
gi_callable_info_load_arg (GICallableInfo *info,
|
||||||
guint n,
|
unsigned int n,
|
||||||
GIArgInfo *arg)
|
GIArgInfo *arg)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
gint offset;
|
uint32_t offset;
|
||||||
|
|
||||||
g_return_if_fail (info != NULL);
|
g_return_if_fail (info != NULL);
|
||||||
g_return_if_fail (GI_IS_CALLABLE_INFO (info));
|
g_return_if_fail (GI_IS_CALLABLE_INFO (info));
|
||||||
|
g_return_if_fail (n <= G_MAXUINT16);
|
||||||
|
|
||||||
offset = signature_offset (info);
|
offset = signature_offset (info);
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
@ -420,16 +422,16 @@ gi_callable_info_load_arg (GICallableInfo *info,
|
|||||||
* attribute exists
|
* attribute exists
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_callable_info_get_return_attribute (GICallableInfo *info,
|
gi_callable_info_get_return_attribute (GICallableInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
GIAttributeIter iter = { 0, };
|
GIAttributeIter iter = { 0, };
|
||||||
const char *curname, *curvalue;
|
const char *curname, *curvalue;
|
||||||
while (gi_callable_info_iterate_return_attributes (info, &iter, &curname, &curvalue))
|
while (gi_callable_info_iterate_return_attributes (info, &iter, &curname, &curvalue))
|
||||||
{
|
{
|
||||||
if (g_strcmp0 (name, curname) == 0)
|
if (g_strcmp0 (name, curname) == 0)
|
||||||
return (const gchar*) curvalue;
|
return (const char*) curvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -466,7 +468,7 @@ gi_callable_info_iterate_return_attributes (GICallableInfo *info,
|
|||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
AttributeBlob *next, *after;
|
AttributeBlob *next, *after;
|
||||||
guint32 blob_offset;
|
uint32_t blob_offset;
|
||||||
|
|
||||||
after = (AttributeBlob *) &rinfo->typelib->data[header->attributes +
|
after = (AttributeBlob *) &rinfo->typelib->data[header->attributes +
|
||||||
header->n_attributes * header->attribute_blob_size];
|
header->n_attributes * header->attribute_blob_size];
|
||||||
@ -518,30 +520,30 @@ gi_type_tag_extract_ffi_return_value (GITypeTag return_tag,
|
|||||||
{
|
{
|
||||||
switch (return_tag) {
|
switch (return_tag) {
|
||||||
case GI_TYPE_TAG_INT8:
|
case GI_TYPE_TAG_INT8:
|
||||||
arg->v_int8 = (gint8) ffi_value->v_long;
|
arg->v_int8 = (int8_t) ffi_value->v_long;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT8:
|
case GI_TYPE_TAG_UINT8:
|
||||||
arg->v_uint8 = (guint8) ffi_value->v_ulong;
|
arg->v_uint8 = (uint8_t) ffi_value->v_ulong;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT16:
|
case GI_TYPE_TAG_INT16:
|
||||||
arg->v_int16 = (gint16) ffi_value->v_long;
|
arg->v_int16 = (int16_t) ffi_value->v_long;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT16:
|
case GI_TYPE_TAG_UINT16:
|
||||||
arg->v_uint16 = (guint16) ffi_value->v_ulong;
|
arg->v_uint16 = (uint16_t) ffi_value->v_ulong;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT32:
|
case GI_TYPE_TAG_INT32:
|
||||||
arg->v_int32 = (gint32) ffi_value->v_long;
|
arg->v_int32 = (int32_t) ffi_value->v_long;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT32:
|
case GI_TYPE_TAG_UINT32:
|
||||||
case GI_TYPE_TAG_BOOLEAN:
|
case GI_TYPE_TAG_BOOLEAN:
|
||||||
case GI_TYPE_TAG_UNICHAR:
|
case GI_TYPE_TAG_UNICHAR:
|
||||||
arg->v_uint32 = (guint32) ffi_value->v_ulong;
|
arg->v_uint32 = (uint32_t) ffi_value->v_ulong;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT64:
|
case GI_TYPE_TAG_INT64:
|
||||||
arg->v_int64 = (gint64) ffi_value->v_int64;
|
arg->v_int64 = (int64_t) ffi_value->v_int64;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT64:
|
case GI_TYPE_TAG_UINT64:
|
||||||
arg->v_uint64 = (guint64) ffi_value->v_uint64;
|
arg->v_uint64 = (uint64_t) ffi_value->v_uint64;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_FLOAT:
|
case GI_TYPE_TAG_FLOAT:
|
||||||
arg->v_float = ffi_value->v_float;
|
arg->v_float = ffi_value->v_float;
|
||||||
@ -553,15 +555,15 @@ gi_type_tag_extract_ffi_return_value (GITypeTag return_tag,
|
|||||||
switch(interface_type) {
|
switch(interface_type) {
|
||||||
case GI_INFO_TYPE_ENUM:
|
case GI_INFO_TYPE_ENUM:
|
||||||
case GI_INFO_TYPE_FLAGS:
|
case GI_INFO_TYPE_FLAGS:
|
||||||
arg->v_int32 = (gint32) ffi_value->v_long;
|
arg->v_int32 = (int32_t) ffi_value->v_long;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
arg->v_pointer = (gpointer) ffi_value->v_pointer;
|
arg->v_pointer = (void *) ffi_value->v_pointer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
arg->v_pointer = (gpointer) ffi_value->v_pointer;
|
arg->v_pointer = (void *) ffi_value->v_pointer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -629,11 +631,11 @@ gi_type_info_extract_ffi_return_value (GITypeInfo *return_info,
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gi_callable_info_invoke (GICallableInfo *info,
|
gi_callable_info_invoke (GICallableInfo *info,
|
||||||
gpointer function,
|
void *function,
|
||||||
const GIArgument *in_args,
|
const GIArgument *in_args,
|
||||||
gsize n_in_args,
|
size_t n_in_args,
|
||||||
GIArgument *out_args,
|
GIArgument *out_args,
|
||||||
gsize n_out_args,
|
size_t n_out_args,
|
||||||
GIArgument *return_value,
|
GIArgument *return_value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -644,13 +646,13 @@ gi_callable_info_invoke (GICallableInfo *info,
|
|||||||
GITypeInfo *rinfo;
|
GITypeInfo *rinfo;
|
||||||
GITypeTag rtag;
|
GITypeTag rtag;
|
||||||
GIArgInfo *ainfo;
|
GIArgInfo *ainfo;
|
||||||
gsize n_args, n_invoke_args, in_pos, out_pos, i;
|
size_t n_args, n_invoke_args, in_pos, out_pos, i;
|
||||||
gpointer *args;
|
void **args;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
GError *local_error = NULL;
|
GError *local_error = NULL;
|
||||||
gpointer error_address = &local_error;
|
void *error_address = &local_error;
|
||||||
GIFFIReturnValue ffi_return_value;
|
GIFFIReturnValue ffi_return_value;
|
||||||
gpointer return_value_p; /* Will point inside the union return_value */
|
void *return_value_p; /* Will point inside the union return_value */
|
||||||
gboolean is_method, throws;
|
gboolean is_method, throws;
|
||||||
|
|
||||||
rinfo = gi_callable_info_get_return_type ((GICallableInfo *)info);
|
rinfo = gi_callable_info_get_return_type ((GICallableInfo *)info);
|
||||||
@ -684,12 +686,12 @@ gi_callable_info_invoke (GICallableInfo *info,
|
|||||||
n_invoke_args ++;
|
n_invoke_args ++;
|
||||||
|
|
||||||
atypes = g_alloca (sizeof (ffi_type*) * n_invoke_args);
|
atypes = g_alloca (sizeof (ffi_type*) * n_invoke_args);
|
||||||
args = g_alloca (sizeof (gpointer) * n_invoke_args);
|
args = g_alloca (sizeof (void *) * n_invoke_args);
|
||||||
|
|
||||||
if (is_method)
|
if (is_method)
|
||||||
{
|
{
|
||||||
atypes[0] = &ffi_type_pointer;
|
atypes[0] = &ffi_type_pointer;
|
||||||
args[0] = (gpointer) &in_args[0];
|
args[0] = (void *) &in_args[0];
|
||||||
}
|
}
|
||||||
for (i = 0; i < n_args; i++)
|
for (i = 0; i < n_args; i++)
|
||||||
{
|
{
|
||||||
@ -712,7 +714,7 @@ gi_callable_info_invoke (GICallableInfo *info,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
args[i+offset] = (gpointer)&in_args[in_pos];
|
args[i+offset] = (void *)&in_args[in_pos];
|
||||||
in_pos++;
|
in_pos++;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -729,7 +731,7 @@ gi_callable_info_invoke (GICallableInfo *info,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
args[i+offset] = (gpointer)&out_args[out_pos];
|
args[i+offset] = (void *)&out_args[out_pos];
|
||||||
out_pos++;
|
out_pos++;
|
||||||
break;
|
break;
|
||||||
case GI_DIRECTION_INOUT:
|
case GI_DIRECTION_INOUT:
|
||||||
@ -754,7 +756,7 @@ gi_callable_info_invoke (GICallableInfo *info,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
args[i+offset] = (gpointer)&in_args[in_pos];
|
args[i+offset] = (void *)&in_args[in_pos];
|
||||||
in_pos++;
|
in_pos++;
|
||||||
out_pos++;
|
out_pos++;
|
||||||
break;
|
break;
|
||||||
|
@ -61,8 +61,8 @@ void gi_callable_info_load_return_type (GICallableInfo *info,
|
|||||||
GITypeInfo *type);
|
GITypeInfo *type);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_callable_info_get_return_attribute (GICallableInfo *info,
|
const char * gi_callable_info_get_return_attribute (GICallableInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_callable_info_iterate_return_attributes (GICallableInfo *info,
|
gboolean gi_callable_info_iterate_return_attributes (GICallableInfo *info,
|
||||||
@ -80,24 +80,24 @@ GI_AVAILABLE_IN_ALL
|
|||||||
gboolean gi_callable_info_skip_return (GICallableInfo *info);
|
gboolean gi_callable_info_skip_return (GICallableInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_callable_info_get_n_args (GICallableInfo *info);
|
unsigned int gi_callable_info_get_n_args (GICallableInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIArgInfo * gi_callable_info_get_arg (GICallableInfo *info,
|
GIArgInfo * gi_callable_info_get_arg (GICallableInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
void gi_callable_info_load_arg (GICallableInfo *info,
|
void gi_callable_info_load_arg (GICallableInfo *info,
|
||||||
guint n,
|
unsigned int n,
|
||||||
GIArgInfo *arg);
|
GIArgInfo *arg);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_callable_info_invoke (GICallableInfo *info,
|
gboolean gi_callable_info_invoke (GICallableInfo *info,
|
||||||
gpointer function,
|
void *function,
|
||||||
const GIArgument *in_args,
|
const GIArgument *in_args,
|
||||||
gsize n_in_args,
|
size_t n_in_args,
|
||||||
GIArgument *out_args,
|
GIArgument *out_args,
|
||||||
gsize n_out_args,
|
size_t n_out_args,
|
||||||
GIArgument *return_value,
|
GIArgument *return_value,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ gi_constant_info_free_value (GIConstantInfo *info,
|
|||||||
* Returns: size of the constant, in bytes
|
* Returns: size of the constant, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gsize
|
size_t
|
||||||
gi_constant_info_get_value (GIConstantInfo *info,
|
gi_constant_info_get_value (GIConstantInfo *info,
|
||||||
GIArgument *value)
|
GIArgument *value)
|
||||||
{
|
{
|
||||||
@ -133,7 +133,7 @@ gi_constant_info_get_value (GIConstantInfo *info,
|
|||||||
{
|
{
|
||||||
if (blob->type.flags.pointer)
|
if (blob->type.flags.pointer)
|
||||||
{
|
{
|
||||||
gsize blob_size = blob->size;
|
size_t 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);
|
||||||
}
|
}
|
||||||
@ -145,34 +145,34 @@ gi_constant_info_get_value (GIConstantInfo *info,
|
|||||||
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 = *(int8_t*)&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 = *(uint8_t*)&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 = *(int16_t*)&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 = *(uint16_t*)&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 = *(int32_t*)&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 = *(uint32_t*)&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], int64_t);
|
||||||
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], uint64_t);
|
||||||
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], float);
|
||||||
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], double);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
@ -52,6 +52,6 @@ void gi_constant_info_free_value (GIConstantInfo *info,
|
|||||||
GIArgument *value);
|
GIArgument *value);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gsize gi_constant_info_get_value (GIConstantInfo *info,
|
size_t gi_constant_info_get_value (GIConstantInfo *info,
|
||||||
GIArgument *value);
|
GIArgument *value);
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
* Returns: the number of enumeration values
|
* Returns: the number of enumeration values
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_enum_info_get_n_values (GIEnumInfo *info)
|
gi_enum_info_get_n_values (GIEnumInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -80,7 +80,7 @@ gi_enum_info_get_n_values (GIEnumInfo *info)
|
|||||||
* associated with this enum, or `NULL`.
|
* associated with this enum, or `NULL`.
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_enum_info_get_error_domain (GIEnumInfo *info)
|
gi_enum_info_get_error_domain (GIEnumInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -110,14 +110,15 @@ gi_enum_info_get_error_domain (GIEnumInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIValueInfo *
|
GIValueInfo *
|
||||||
gi_enum_info_get_value (GIEnumInfo *info,
|
gi_enum_info_get_value (GIEnumInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
gint offset;
|
size_t offset;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_ENUM_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_ENUM_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
offset = rinfo->offset + header->enum_blob_size
|
offset = rinfo->offset + header->enum_blob_size
|
||||||
@ -135,7 +136,7 @@ gi_enum_info_get_value (GIEnumInfo *info,
|
|||||||
* Returns: number of methods
|
* Returns: number of methods
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_enum_info_get_n_methods (GIEnumInfo *info)
|
gi_enum_info_get_n_methods (GIEnumInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -162,15 +163,16 @@ gi_enum_info_get_n_methods (GIEnumInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_enum_info_get_method (GIEnumInfo *info,
|
gi_enum_info_get_method (GIEnumInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
EnumBlob *blob;
|
EnumBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_ENUM_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_ENUM_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (EnumBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (EnumBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -238,11 +240,11 @@ gi_enum_info_class_init (gpointer g_class,
|
|||||||
* Obtain the enumeration value of the `GIValueInfo`.
|
* Obtain the enumeration value of the `GIValueInfo`.
|
||||||
*
|
*
|
||||||
* Returns: the enumeration value. This will always be representable
|
* Returns: the enumeration value. This will always be representable
|
||||||
* as a 32-bit signed or unsigned value. The use of `gint64` as the
|
* as a 32-bit signed or unsigned value. The use of `int64_t` as the
|
||||||
* return type is to allow both.
|
* return type is to allow both.
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gint64
|
int64_t
|
||||||
gi_value_info_get_value (GIValueInfo *info)
|
gi_value_info_get_value (GIValueInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -254,9 +256,9 @@ gi_value_info_get_value (GIValueInfo *info)
|
|||||||
blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
if (blob->unsigned_value)
|
if (blob->unsigned_value)
|
||||||
return (gint64)(guint32)blob->value;
|
return (int64_t)(uint32_t)blob->value;
|
||||||
else
|
else
|
||||||
return (gint64)blob->value;
|
return (int64_t)blob->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -57,27 +57,27 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_enum_info_get_n_values (GIEnumInfo *info);
|
unsigned int gi_enum_info_get_n_values (GIEnumInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIValueInfo * gi_enum_info_get_value (GIEnumInfo *info,
|
GIValueInfo * gi_enum_info_get_value (GIEnumInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_enum_info_get_n_methods (GIEnumInfo *info);
|
unsigned int gi_enum_info_get_n_methods (GIEnumInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfo * gi_enum_info_get_method (GIEnumInfo *info,
|
GIFunctionInfo * gi_enum_info_get_method (GIEnumInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypeTag gi_enum_info_get_storage_type (GIEnumInfo *info);
|
GITypeTag gi_enum_info_get_storage_type (GIEnumInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_enum_info_get_error_domain (GIEnumInfo *info);
|
const char * gi_enum_info_get_error_domain (GIEnumInfo *info);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gint64 gi_value_info_get_value (GIValueInfo *info);
|
int64_t gi_value_info_get_value (GIValueInfo *info);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -95,7 +95,7 @@ gi_field_info_get_flags (GIFieldInfo *info)
|
|||||||
* Returns: the field size, in bits
|
* Returns: the field size, in bits
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gsize
|
size_t
|
||||||
gi_field_info_get_size (GIFieldInfo *info)
|
gi_field_info_get_size (GIFieldInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -119,7 +119,7 @@ gi_field_info_get_size (GIFieldInfo *info)
|
|||||||
* Returns: the field offset, in bytes
|
* Returns: the field offset, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gsize
|
size_t
|
||||||
gi_field_info_get_offset (GIFieldInfo *info)
|
gi_field_info_get_offset (GIFieldInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -187,7 +187,7 @@ gi_field_info_get_type_info (GIFieldInfo *info)
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gi_field_info_get_field (GIFieldInfo *field_info,
|
gi_field_info_get_field (GIFieldInfo *field_info,
|
||||||
gpointer mem,
|
void *mem,
|
||||||
GIArgument *value)
|
GIArgument *value)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
@ -205,7 +205,7 @@ gi_field_info_get_field (GIFieldInfo *field_info,
|
|||||||
|
|
||||||
if (gi_type_info_is_pointer (type_info))
|
if (gi_type_info_is_pointer (type_info))
|
||||||
{
|
{
|
||||||
value->v_pointer = G_STRUCT_MEMBER (gpointer, mem, offset);
|
value->v_pointer = G_STRUCT_MEMBER (void *, mem, offset);
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -222,35 +222,35 @@ gi_field_info_get_field (GIFieldInfo *field_info,
|
|||||||
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 (uint8_t, 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 (uint16_t, 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 (uint32_t, 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 (uint64_t, 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 (size_t, 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 (float, 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 (double, mem, offset);
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_ARRAY:
|
case GI_TYPE_TAG_ARRAY:
|
||||||
@ -287,8 +287,8 @@ gi_field_info_get_field (GIFieldInfo *field_info,
|
|||||||
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 int64_t 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 int64_t, 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.
|
||||||
@ -298,22 +298,22 @@ gi_field_info_get_field (GIFieldInfo *field_info,
|
|||||||
{
|
{
|
||||||
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 = (int)G_STRUCT_MEMBER (uint8_t, 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 = (int)G_STRUCT_MEMBER (uint16_t, 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 = (int)G_STRUCT_MEMBER (uint32_t, 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 = (int)G_STRUCT_MEMBER (uint64_t, mem, offset);
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -383,7 +383,7 @@ gi_field_info_get_field (GIFieldInfo *field_info,
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gi_field_info_set_field (GIFieldInfo *field_info,
|
gi_field_info_set_field (GIFieldInfo *field_info,
|
||||||
gpointer mem,
|
void *mem,
|
||||||
const GIArgument *value)
|
const GIArgument *value)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
@ -413,35 +413,35 @@ gi_field_info_set_field (GIFieldInfo *field_info,
|
|||||||
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 (uint8_t, 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 (uint16_t, 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 (uint32_t, 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 (uint64_t, 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 (size_t, 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 (float, 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 (double, mem, offset)= value->v_double;
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UTF8:
|
case GI_TYPE_TAG_UTF8:
|
||||||
@ -479,22 +479,22 @@ gi_field_info_set_field (GIFieldInfo *field_info,
|
|||||||
{
|
{
|
||||||
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 (uint8_t, mem, offset) = (uint8_t)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 (uint16_t, mem, offset) = (uint16_t)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 (uint32_t, mem, offset) = (uint32_t)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 (uint64_t, mem, offset) = (uint64_t)value->v_int;
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -548,7 +548,7 @@ gi_field_info_set_field (GIFieldInfo *field_info,
|
|||||||
{
|
{
|
||||||
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 (void *, mem, offset) = (void *)value->v_pointer;
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -48,22 +48,22 @@ GI_AVAILABLE_IN_ALL
|
|||||||
GIFieldInfoFlags gi_field_info_get_flags (GIFieldInfo *info);
|
GIFieldInfoFlags gi_field_info_get_flags (GIFieldInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gsize gi_field_info_get_size (GIFieldInfo *info);
|
size_t gi_field_info_get_size (GIFieldInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gsize gi_field_info_get_offset (GIFieldInfo *info);
|
size_t gi_field_info_get_offset (GIFieldInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypeInfo * gi_field_info_get_type_info (GIFieldInfo *info);
|
GITypeInfo * gi_field_info_get_type_info (GIFieldInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_field_info_get_field (GIFieldInfo *field_info,
|
gboolean gi_field_info_get_field (GIFieldInfo *field_info,
|
||||||
gpointer mem,
|
void *mem,
|
||||||
GIArgument *value);
|
GIArgument *value);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_field_info_set_field (GIFieldInfo *field_info,
|
gboolean gi_field_info_set_field (GIFieldInfo *field_info,
|
||||||
gpointer mem,
|
void *mem,
|
||||||
const GIArgument *value);
|
const GIArgument *value);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -50,18 +50,18 @@
|
|||||||
|
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_base_info_find_method (GIBaseInfo *base,
|
gi_base_info_find_method (GIBaseInfo *base,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint n_methods,
|
uint16_t n_methods,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
/* FIXME hash */
|
/* FIXME hash */
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)base;
|
GIRealInfo *rinfo = (GIRealInfo*)base;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
|
|
||||||
for (guint i = 0; i < n_methods; i++)
|
for (uint16_t i = 0; i < n_methods; i++)
|
||||||
{
|
{
|
||||||
FunctionBlob *fblob = (FunctionBlob *)&rinfo->typelib->data[offset];
|
FunctionBlob *fblob = (FunctionBlob *)&rinfo->typelib->data[offset];
|
||||||
const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
|
const char *fname = (const char *)&rinfo->typelib->data[fblob->name];
|
||||||
|
|
||||||
if (strcmp (name, fname) == 0)
|
if (strcmp (name, fname) == 0)
|
||||||
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, base,
|
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, base,
|
||||||
@ -85,7 +85,7 @@ gi_base_info_find_method (GIBaseInfo *base,
|
|||||||
* Returns: the symbol
|
* Returns: the symbol
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_function_info_get_symbol (GIFunctionInfo *info)
|
gi_function_info_get_symbol (GIFunctionInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo;
|
GIRealInfo *rinfo;
|
||||||
@ -266,14 +266,14 @@ gi_invoke_error_quark (void)
|
|||||||
gboolean
|
gboolean
|
||||||
gi_function_info_invoke (GIFunctionInfo *info,
|
gi_function_info_invoke (GIFunctionInfo *info,
|
||||||
const GIArgument *in_args,
|
const GIArgument *in_args,
|
||||||
gsize n_in_args,
|
size_t n_in_args,
|
||||||
GIArgument *out_args,
|
GIArgument *out_args,
|
||||||
gsize n_out_args,
|
size_t n_out_args,
|
||||||
GIArgument *return_value,
|
GIArgument *return_value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *symbol;
|
const char *symbol;
|
||||||
gpointer func;
|
void *func;
|
||||||
|
|
||||||
symbol = gi_function_info_get_symbol (info);
|
symbol = gi_function_info_get_symbol (info);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_function_info_get_symbol (GIFunctionInfo *info);
|
const char * gi_function_info_get_symbol (GIFunctionInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfoFlags gi_function_info_get_flags (GIFunctionInfo *info);
|
GIFunctionInfoFlags gi_function_info_get_flags (GIFunctionInfo *info);
|
||||||
@ -92,9 +92,9 @@ typedef enum
|
|||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_function_info_invoke (GIFunctionInfo *info,
|
gboolean gi_function_info_invoke (GIFunctionInfo *info,
|
||||||
const GIArgument *in_args,
|
const GIArgument *in_args,
|
||||||
gsize n_in_args,
|
size_t n_in_args,
|
||||||
GIArgument *out_args,
|
GIArgument *out_args,
|
||||||
gsize n_out_args,
|
size_t n_out_args,
|
||||||
GIArgument *return_value,
|
GIArgument *return_value,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
* Returns: number of prerequisites
|
* Returns: number of prerequisites
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info)
|
gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -82,13 +82,14 @@ gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIBaseInfo *
|
GIBaseInfo *
|
||||||
gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
|
gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
|
|||||||
* Returns: number of properties
|
* Returns: number of properties
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_interface_info_get_n_properties (GIInterfaceInfo *info)
|
gi_interface_info_get_n_properties (GIInterfaceInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -133,15 +134,16 @@ gi_interface_info_get_n_properties (GIInterfaceInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIPropertyInfo *
|
GIPropertyInfo *
|
||||||
gi_interface_info_get_property (GIInterfaceInfo *info,
|
gi_interface_info_get_property (GIInterfaceInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -163,7 +165,7 @@ gi_interface_info_get_property (GIInterfaceInfo *info,
|
|||||||
* Returns: number of methods
|
* Returns: number of methods
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_interface_info_get_n_methods (GIInterfaceInfo *info)
|
gi_interface_info_get_n_methods (GIInterfaceInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -190,15 +192,16 @@ gi_interface_info_get_n_methods (GIInterfaceInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_interface_info_get_method (GIInterfaceInfo *info,
|
gi_interface_info_get_method (GIInterfaceInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -228,9 +231,9 @@ gi_interface_info_get_method (GIInterfaceInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_interface_info_find_method (GIInterfaceInfo *info,
|
gi_interface_info_find_method (GIInterfaceInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -251,7 +254,7 @@ gi_interface_info_find_method (GIInterfaceInfo *info,
|
|||||||
* Returns: number of signals
|
* Returns: number of signals
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_interface_info_get_n_signals (GIInterfaceInfo *info)
|
gi_interface_info_get_n_signals (GIInterfaceInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -278,15 +281,16 @@ gi_interface_info_get_n_signals (GIInterfaceInfo *info)
|
|||||||
*/
|
*/
|
||||||
GISignalInfo *
|
GISignalInfo *
|
||||||
gi_interface_info_get_signal (GIInterfaceInfo *info,
|
gi_interface_info_get_signal (GIInterfaceInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -317,12 +321,12 @@ gi_interface_info_get_signal (GIInterfaceInfo *info,
|
|||||||
*/
|
*/
|
||||||
GISignalInfo *
|
GISignalInfo *
|
||||||
gi_interface_info_find_signal (GIInterfaceInfo *info,
|
gi_interface_info_find_signal (GIInterfaceInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
guint n_signals;
|
uint32_t n_signals;
|
||||||
|
|
||||||
n_signals = gi_interface_info_get_n_signals (info);
|
n_signals = gi_interface_info_get_n_signals (info);
|
||||||
for (guint i = 0; i < n_signals; i++)
|
for (uint32_t i = 0; i < n_signals; i++)
|
||||||
{
|
{
|
||||||
GISignalInfo *siginfo = gi_interface_info_get_signal (info, i);
|
GISignalInfo *siginfo = gi_interface_info_get_signal (info, i);
|
||||||
|
|
||||||
@ -346,7 +350,7 @@ gi_interface_info_find_signal (GIInterfaceInfo *info,
|
|||||||
* Returns: number of virtual functions
|
* Returns: number of virtual functions
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info)
|
gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -373,15 +377,16 @@ gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIVFuncInfo *
|
GIVFuncInfo *
|
||||||
gi_interface_info_get_vfunc (GIInterfaceInfo *info,
|
gi_interface_info_get_vfunc (GIInterfaceInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -414,9 +419,9 @@ gi_interface_info_get_vfunc (GIInterfaceInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIVFuncInfo *
|
GIVFuncInfo *
|
||||||
gi_interface_info_find_vfunc (GIInterfaceInfo *info,
|
gi_interface_info_find_vfunc (GIInterfaceInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
@ -445,7 +450,7 @@ gi_interface_info_find_vfunc (GIInterfaceInfo *info,
|
|||||||
* Returns: number of constants
|
* Returns: number of constants
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_interface_info_get_n_constants (GIInterfaceInfo *info)
|
gi_interface_info_get_n_constants (GIInterfaceInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -472,15 +477,16 @@ gi_interface_info_get_n_constants (GIInterfaceInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIConstantInfo *
|
GIConstantInfo *
|
||||||
gi_interface_info_get_constant (GIInterfaceInfo *info,
|
gi_interface_info_get_constant (GIInterfaceInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
@ -45,58 +45,58 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
|
unsigned int gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIBaseInfo * gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
|
GIBaseInfo * gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_interface_info_get_n_properties (GIInterfaceInfo *info);
|
unsigned int gi_interface_info_get_n_properties (GIInterfaceInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIPropertyInfo * gi_interface_info_get_property (GIInterfaceInfo *info,
|
GIPropertyInfo * gi_interface_info_get_property (GIInterfaceInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_interface_info_get_n_methods (GIInterfaceInfo *info);
|
unsigned int gi_interface_info_get_n_methods (GIInterfaceInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfo * gi_interface_info_get_method (GIInterfaceInfo *info,
|
GIFunctionInfo * gi_interface_info_get_method (GIInterfaceInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfo * gi_interface_info_find_method (GIInterfaceInfo *info,
|
GIFunctionInfo * gi_interface_info_find_method (GIInterfaceInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_interface_info_get_n_signals (GIInterfaceInfo *info);
|
unsigned int gi_interface_info_get_n_signals (GIInterfaceInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GISignalInfo * gi_interface_info_get_signal (GIInterfaceInfo *info,
|
GISignalInfo * gi_interface_info_get_signal (GIInterfaceInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GISignalInfo * gi_interface_info_find_signal (GIInterfaceInfo *info,
|
GISignalInfo * gi_interface_info_find_signal (GIInterfaceInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info);
|
unsigned int gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIVFuncInfo * gi_interface_info_get_vfunc (GIInterfaceInfo *info,
|
GIVFuncInfo * gi_interface_info_get_vfunc (GIInterfaceInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIVFuncInfo * gi_interface_info_find_vfunc (GIInterfaceInfo *info,
|
GIVFuncInfo * gi_interface_info_find_vfunc (GIInterfaceInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_interface_info_get_n_constants (GIInterfaceInfo *info);
|
unsigned int gi_interface_info_get_n_constants (GIInterfaceInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIConstantInfo * gi_interface_info_get_constant (GIInterfaceInfo *info,
|
GIConstantInfo * gi_interface_info_get_constant (GIInterfaceInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
static ffi_type *
|
static ffi_type *
|
||||||
value_to_ffi_type (const GValue *gvalue, gpointer *value)
|
value_to_ffi_type (const GValue *gvalue, void **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));
|
||||||
@ -56,12 +56,12 @@ value_to_ffi_type (const GValue *gvalue, gpointer *value)
|
|||||||
case G_TYPE_CHAR:
|
case G_TYPE_CHAR:
|
||||||
case G_TYPE_INT:
|
case G_TYPE_INT:
|
||||||
rettype = &ffi_type_sint;
|
rettype = &ffi_type_sint;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_int);
|
*value = (void *) &(gvalue->data[0].v_int);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_UCHAR:
|
case G_TYPE_UCHAR:
|
||||||
case G_TYPE_UINT:
|
case G_TYPE_UINT:
|
||||||
rettype = &ffi_type_uint;
|
rettype = &ffi_type_uint;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_uint);
|
*value = (void *) &(gvalue->data[0].v_uint);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_STRING:
|
case G_TYPE_STRING:
|
||||||
case G_TYPE_OBJECT:
|
case G_TYPE_OBJECT:
|
||||||
@ -69,31 +69,31 @@ value_to_ffi_type (const GValue *gvalue, gpointer *value)
|
|||||||
case G_TYPE_POINTER:
|
case G_TYPE_POINTER:
|
||||||
case G_TYPE_PARAM:
|
case G_TYPE_PARAM:
|
||||||
rettype = &ffi_type_pointer;
|
rettype = &ffi_type_pointer;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_pointer);
|
*value = (void *) &(gvalue->data[0].v_pointer);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_FLOAT:
|
case G_TYPE_FLOAT:
|
||||||
rettype = &ffi_type_float;
|
rettype = &ffi_type_float;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_float);
|
*value = (void *) &(gvalue->data[0].v_float);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_DOUBLE:
|
case G_TYPE_DOUBLE:
|
||||||
rettype = &ffi_type_double;
|
rettype = &ffi_type_double;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_double);
|
*value = (void *) &(gvalue->data[0].v_double);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_LONG:
|
case G_TYPE_LONG:
|
||||||
rettype = &ffi_type_slong;
|
rettype = &ffi_type_slong;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_long);
|
*value = (void *) &(gvalue->data[0].v_long);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_ULONG:
|
case G_TYPE_ULONG:
|
||||||
rettype = &ffi_type_ulong;
|
rettype = &ffi_type_ulong;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_ulong);
|
*value = (void *) &(gvalue->data[0].v_ulong);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_INT64:
|
case G_TYPE_INT64:
|
||||||
rettype = &ffi_type_sint64;
|
rettype = &ffi_type_sint64;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_int64);
|
*value = (void *) &(gvalue->data[0].v_int64);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_UINT64:
|
case G_TYPE_UINT64:
|
||||||
rettype = &ffi_type_uint64;
|
rettype = &ffi_type_uint64;
|
||||||
*value = (gpointer)&(gvalue->data[0].v_uint64);
|
*value = (void *) &(gvalue->data[0].v_uint64);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rettype = &ffi_type_pointer;
|
rettype = &ffi_type_pointer;
|
||||||
@ -122,13 +122,13 @@ 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)
|
void **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));
|
||||||
g_assert (type != G_TYPE_INVALID);
|
g_assert (type != G_TYPE_INVALID);
|
||||||
|
|
||||||
*value = (gpointer)&(ffi_value->v_long);
|
*value = (void *) &(ffi_value->v_long);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case G_TYPE_CHAR:
|
case G_TYPE_CHAR:
|
||||||
@ -153,11 +153,11 @@ g_value_to_ffi_return_type (const GValue *gvalue,
|
|||||||
break;
|
break;
|
||||||
case G_TYPE_FLOAT:
|
case G_TYPE_FLOAT:
|
||||||
rettype = &ffi_type_float;
|
rettype = &ffi_type_float;
|
||||||
*value = (gpointer)&(ffi_value->v_float);
|
*value = (void *) &(ffi_value->v_float);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_DOUBLE:
|
case G_TYPE_DOUBLE:
|
||||||
rettype = &ffi_type_double;
|
rettype = &ffi_type_double;
|
||||||
*value = (gpointer)&(ffi_value->v_double);
|
*value = (void *) &(ffi_value->v_double);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_LONG:
|
case G_TYPE_LONG:
|
||||||
rettype = &ffi_type_slong;
|
rettype = &ffi_type_slong;
|
||||||
@ -167,11 +167,11 @@ g_value_to_ffi_return_type (const GValue *gvalue,
|
|||||||
break;
|
break;
|
||||||
case G_TYPE_INT64:
|
case G_TYPE_INT64:
|
||||||
rettype = &ffi_type_sint64;
|
rettype = &ffi_type_sint64;
|
||||||
*value = (gpointer)&(ffi_value->v_int64);
|
*value = (void *) &(ffi_value->v_int64);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_UINT64:
|
case G_TYPE_UINT64:
|
||||||
rettype = &ffi_type_uint64;
|
rettype = &ffi_type_uint64;
|
||||||
*value = (gpointer)&(ffi_value->v_uint64);
|
*value = (void *) &(ffi_value->v_uint64);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rettype = &ffi_type_pointer;
|
rettype = &ffi_type_pointer;
|
||||||
@ -212,10 +212,10 @@ g_value_from_ffi_value (GValue *gvalue,
|
|||||||
g_value_set_boolean (gvalue, (gboolean)value->v_long);
|
g_value_set_boolean (gvalue, (gboolean)value->v_long);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_STRING:
|
case G_TYPE_STRING:
|
||||||
g_value_set_string (gvalue, (gchar*)value->v_pointer);
|
g_value_set_string (gvalue, (char*)value->v_pointer);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_CHAR:
|
case G_TYPE_CHAR:
|
||||||
g_value_set_schar (gvalue, (gchar)value->v_long);
|
g_value_set_schar (gvalue, (char)value->v_long);
|
||||||
break;
|
break;
|
||||||
case G_TYPE_UCHAR:
|
case G_TYPE_UCHAR:
|
||||||
g_value_set_uchar (gvalue, (guchar)value->v_ulong);
|
g_value_set_uchar (gvalue, (guchar)value->v_ulong);
|
||||||
@ -270,10 +270,10 @@ g_value_from_ffi_value (GValue *gvalue,
|
|||||||
void
|
void
|
||||||
gi_cclosure_marshal_generic (GClosure *closure,
|
gi_cclosure_marshal_generic (GClosure *closure,
|
||||||
GValue *return_gvalue,
|
GValue *return_gvalue,
|
||||||
guint n_param_values,
|
unsigned int n_param_values,
|
||||||
const GValue *param_values,
|
const GValue *param_values,
|
||||||
gpointer invocation_hint,
|
void *invocation_hint,
|
||||||
gpointer marshal_data)
|
void *marshal_data)
|
||||||
{
|
{
|
||||||
GIArgument return_ffi_value = { 0, };
|
GIArgument return_ffi_value = { 0, };
|
||||||
ffi_type *rtype;
|
ffi_type *rtype;
|
||||||
@ -298,7 +298,7 @@ gi_cclosure_marshal_generic (GClosure *closure,
|
|||||||
|
|
||||||
n_args = n_param_values + 1;
|
n_args = n_param_values + 1;
|
||||||
atypes = g_alloca (sizeof (ffi_type *) * n_args);
|
atypes = g_alloca (sizeof (ffi_type *) * n_args);
|
||||||
args = g_alloca (sizeof (gpointer) * n_args);
|
args = g_alloca (sizeof (void *) * n_args);
|
||||||
|
|
||||||
if (n_param_values > 0)
|
if (n_param_values > 0)
|
||||||
{
|
{
|
||||||
|
@ -59,20 +59,20 @@
|
|||||||
* Returns: field offset, in bytes
|
* Returns: field offset, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
static gint32
|
static size_t
|
||||||
gi_object_info_get_field_offset (GIObjectInfo *info,
|
gi_object_info_get_field_offset (GIObjectInfo *info,
|
||||||
guint n)
|
size_t n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
FieldBlob *field_blob;
|
FieldBlob *field_blob;
|
||||||
|
|
||||||
offset = rinfo->offset + header->object_blob_size
|
offset = rinfo->offset + header->object_blob_size
|
||||||
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2;
|
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2;
|
||||||
|
|
||||||
for (guint i = 0; i < n; i++)
|
for (size_t i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
||||||
offset += header->field_blob_size;
|
offset += header->field_blob_size;
|
||||||
@ -194,7 +194,7 @@ gi_object_info_get_fundamental (GIObjectInfo *info)
|
|||||||
* Returns: name of the object’s type
|
* Returns: name of the object’s type
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_object_info_get_type_name (GIObjectInfo *info)
|
gi_object_info_get_type_name (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -218,7 +218,7 @@ gi_object_info_get_type_name (GIObjectInfo *info)
|
|||||||
* Returns: the type init function name
|
* Returns: the type init function name
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_object_info_get_type_init_function_name (GIObjectInfo *info)
|
gi_object_info_get_type_init_function_name (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -241,7 +241,7 @@ gi_object_info_get_type_init_function_name (GIObjectInfo *info)
|
|||||||
* Returns: number of interfaces
|
* Returns: number of interfaces
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_object_info_get_n_interfaces (GIObjectInfo *info)
|
gi_object_info_get_n_interfaces (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -268,13 +268,14 @@ gi_object_info_get_n_interfaces (GIObjectInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIInterfaceInfo *
|
GIInterfaceInfo *
|
||||||
gi_object_info_get_interface (GIObjectInfo *info,
|
gi_object_info_get_interface (GIObjectInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
@ -291,7 +292,7 @@ gi_object_info_get_interface (GIObjectInfo *info,
|
|||||||
* Returns: number of fields
|
* Returns: number of fields
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_object_info_get_n_fields (GIObjectInfo *info)
|
gi_object_info_get_n_fields (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -318,13 +319,14 @@ gi_object_info_get_n_fields (GIObjectInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIFieldInfo *
|
GIFieldInfo *
|
||||||
gi_object_info_get_field (GIObjectInfo *info,
|
gi_object_info_get_field (GIObjectInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
offset = gi_object_info_get_field_offset(info, n);
|
offset = gi_object_info_get_field_offset(info, n);
|
||||||
|
|
||||||
@ -340,7 +342,7 @@ gi_object_info_get_field (GIObjectInfo *info,
|
|||||||
* Returns: number of properties
|
* Returns: number of properties
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_object_info_get_n_properties (GIObjectInfo *info)
|
gi_object_info_get_n_properties (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -366,15 +368,16 @@ gi_object_info_get_n_properties (GIObjectInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIPropertyInfo *
|
GIPropertyInfo *
|
||||||
gi_object_info_get_property (GIObjectInfo *info,
|
gi_object_info_get_property (GIObjectInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -398,7 +401,7 @@ gi_object_info_get_property (GIObjectInfo *info,
|
|||||||
* Returns: number of methods
|
* Returns: number of methods
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_object_info_get_n_methods (GIObjectInfo *info)
|
gi_object_info_get_n_methods (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -425,15 +428,16 @@ gi_object_info_get_n_methods (GIObjectInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_object_info_get_method (GIObjectInfo *info,
|
gi_object_info_get_method (GIObjectInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -466,9 +470,9 @@ gi_object_info_get_method (GIObjectInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_object_info_find_method (GIObjectInfo *info,
|
gi_object_info_find_method (GIObjectInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
@ -511,7 +515,7 @@ gi_object_info_find_method (GIObjectInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
|
gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
|
||||||
const gchar *name,
|
const char *name,
|
||||||
GIObjectInfo **implementor)
|
GIObjectInfo **implementor)
|
||||||
{
|
{
|
||||||
GIFunctionInfo *result = NULL;
|
GIFunctionInfo *result = NULL;
|
||||||
@ -559,7 +563,7 @@ gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
|
|||||||
* Returns: number of signals
|
* Returns: number of signals
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_object_info_get_n_signals (GIObjectInfo *info)
|
gi_object_info_get_n_signals (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -586,15 +590,16 @@ gi_object_info_get_n_signals (GIObjectInfo *info)
|
|||||||
*/
|
*/
|
||||||
GISignalInfo *
|
GISignalInfo *
|
||||||
gi_object_info_get_signal (GIObjectInfo *info,
|
gi_object_info_get_signal (GIObjectInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -627,12 +632,12 @@ gi_object_info_get_signal (GIObjectInfo *info,
|
|||||||
*/
|
*/
|
||||||
GISignalInfo *
|
GISignalInfo *
|
||||||
gi_object_info_find_signal (GIObjectInfo *info,
|
gi_object_info_find_signal (GIObjectInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
guint n_signals;
|
size_t n_signals;
|
||||||
|
|
||||||
n_signals = gi_object_info_get_n_signals (info);
|
n_signals = gi_object_info_get_n_signals (info);
|
||||||
for (guint i = 0; i < n_signals; i++)
|
for (size_t i = 0; i < n_signals; i++)
|
||||||
{
|
{
|
||||||
GISignalInfo *siginfo = gi_object_info_get_signal (info, i);
|
GISignalInfo *siginfo = gi_object_info_get_signal (info, i);
|
||||||
|
|
||||||
@ -657,7 +662,7 @@ gi_object_info_find_signal (GIObjectInfo *info,
|
|||||||
* Returns: number of virtual functions
|
* Returns: number of virtual functions
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_object_info_get_n_vfuncs (GIObjectInfo *info)
|
gi_object_info_get_n_vfuncs (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -684,15 +689,16 @@ gi_object_info_get_n_vfuncs (GIObjectInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIVFuncInfo *
|
GIVFuncInfo *
|
||||||
gi_object_info_get_vfunc (GIObjectInfo *info,
|
gi_object_info_get_vfunc (GIObjectInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -732,9 +738,9 @@ gi_object_info_get_vfunc (GIObjectInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIVFuncInfo *
|
GIVFuncInfo *
|
||||||
gi_object_info_find_vfunc (GIObjectInfo *info,
|
gi_object_info_find_vfunc (GIObjectInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
@ -784,7 +790,7 @@ gi_object_info_find_vfunc (GIObjectInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIVFuncInfo *
|
GIVFuncInfo *
|
||||||
gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
|
gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
|
||||||
const gchar *name,
|
const char *name,
|
||||||
GIObjectInfo **implementor)
|
GIObjectInfo **implementor)
|
||||||
{
|
{
|
||||||
GIVFuncInfo *result = NULL;
|
GIVFuncInfo *result = NULL;
|
||||||
@ -832,7 +838,7 @@ gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
|
|||||||
* Returns: number of constants
|
* Returns: number of constants
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_object_info_get_n_constants (GIObjectInfo *info)
|
gi_object_info_get_n_constants (GIObjectInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -859,15 +865,16 @@ gi_object_info_get_n_constants (GIObjectInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIConstantInfo *
|
GIConstantInfo *
|
||||||
gi_object_info_get_constant (GIObjectInfo *info,
|
gi_object_info_get_constant (GIObjectInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header;
|
Header *header;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
header = (Header *)rinfo->typelib->data;
|
header = (Header *)rinfo->typelib->data;
|
||||||
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -925,7 +932,7 @@ _get_func(GIObjectInfo *info,
|
|||||||
const char* symbol;
|
const char* symbol;
|
||||||
GSList *parents = NULL, *l;
|
GSList *parents = NULL, *l;
|
||||||
GIObjectInfo *parent_info;
|
GIObjectInfo *parent_info;
|
||||||
gpointer func = NULL;
|
void *func = NULL;
|
||||||
|
|
||||||
parent_info = (GIObjectInfo *) gi_base_info_ref ((GIBaseInfo *) info);
|
parent_info = (GIObjectInfo *) gi_base_info_ref ((GIBaseInfo *) info);
|
||||||
while (parent_info != NULL)
|
while (parent_info != NULL)
|
||||||
|
@ -88,10 +88,10 @@ 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 char * 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 char * gi_object_info_get_type_init_function_name (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_object_info_get_abstract (GIObjectInfo *info);
|
gboolean gi_object_info_get_abstract (GIObjectInfo *info);
|
||||||
@ -106,79 +106,79 @@ GI_AVAILABLE_IN_ALL
|
|||||||
GIObjectInfo * gi_object_info_get_parent (GIObjectInfo *info);
|
GIObjectInfo * gi_object_info_get_parent (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_object_info_get_n_interfaces (GIObjectInfo *info);
|
unsigned int gi_object_info_get_n_interfaces (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIInterfaceInfo * gi_object_info_get_interface (GIObjectInfo *info,
|
GIInterfaceInfo * gi_object_info_get_interface (GIObjectInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_object_info_get_n_fields (GIObjectInfo *info);
|
unsigned int gi_object_info_get_n_fields (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFieldInfo * gi_object_info_get_field (GIObjectInfo *info,
|
GIFieldInfo * gi_object_info_get_field (GIObjectInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_object_info_get_n_properties (GIObjectInfo *info);
|
unsigned int gi_object_info_get_n_properties (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIPropertyInfo * gi_object_info_get_property (GIObjectInfo *info,
|
GIPropertyInfo * gi_object_info_get_property (GIObjectInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_object_info_get_n_methods (GIObjectInfo *info);
|
unsigned int gi_object_info_get_n_methods (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfo * gi_object_info_get_method (GIObjectInfo *info,
|
GIFunctionInfo * gi_object_info_get_method (GIObjectInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
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 char *name);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfo * gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
|
GIFunctionInfo * gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
|
||||||
const gchar *name,
|
const char *name,
|
||||||
GIObjectInfo **implementor);
|
GIObjectInfo **implementor);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_object_info_get_n_signals (GIObjectInfo *info);
|
unsigned int gi_object_info_get_n_signals (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GISignalInfo * gi_object_info_get_signal (GIObjectInfo *info,
|
GISignalInfo * gi_object_info_get_signal (GIObjectInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GISignalInfo * gi_object_info_find_signal (GIObjectInfo *info,
|
GISignalInfo * gi_object_info_find_signal (GIObjectInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_object_info_get_n_vfuncs (GIObjectInfo *info);
|
unsigned int gi_object_info_get_n_vfuncs (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIVFuncInfo * gi_object_info_get_vfunc (GIObjectInfo *info,
|
GIVFuncInfo * gi_object_info_get_vfunc (GIObjectInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIVFuncInfo * gi_object_info_find_vfunc (GIObjectInfo *info,
|
GIVFuncInfo * gi_object_info_find_vfunc (GIObjectInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIVFuncInfo * gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
|
GIVFuncInfo * gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
|
||||||
const gchar *name,
|
const char *name,
|
||||||
GIObjectInfo **implementor);
|
GIObjectInfo **implementor);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_object_info_get_n_constants (GIObjectInfo *info);
|
unsigned int gi_object_info_get_n_constants (GIObjectInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIConstantInfo * gi_object_info_get_constant (GIObjectInfo *info,
|
GIConstantInfo * gi_object_info_get_constant (GIObjectInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIStructInfo * gi_object_info_get_class_struct (GIObjectInfo *info);
|
GIStructInfo * gi_object_info_get_class_struct (GIObjectInfo *info);
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
* Returns: (nullable): the type name, or `NULL` if unknown
|
* Returns: (nullable): the type name, or `NULL` if unknown
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
|
gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -97,7 +97,7 @@ gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
|
|||||||
* passing into [method@GModule.Module.symbol], or `NULL` if unknown
|
* passing into [method@GModule.Module.symbol], or `NULL` if unknown
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_registered_type_info_get_type_init_function_name (GIRegisteredTypeInfo *info)
|
gi_registered_type_info_get_type_init_function_name (GIRegisteredTypeInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
@ -53,10 +53,10 @@ G_BEGIN_DECLS
|
|||||||
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_BOXED))
|
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_BOXED))
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info);
|
const char * gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_registered_type_info_get_type_init_function_name (GIRegisteredTypeInfo *info);
|
const char * gi_registered_type_info_get_type_init_function_name (GIRegisteredTypeInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GType gi_registered_type_info_get_g_type (GIRegisteredTypeInfo *info);
|
GType gi_registered_type_info_get_g_type (GIRegisteredTypeInfo *info);
|
||||||
|
@ -36,11 +36,6 @@
|
|||||||
* be removed. */
|
* be removed. */
|
||||||
typedef struct _GIBaseInfo GIRealInfo;
|
typedef struct _GIBaseInfo GIRealInfo;
|
||||||
|
|
||||||
/* We changed a gint32 -> gint in the structure below, which should be
|
|
||||||
* valid everywhere we care about.
|
|
||||||
*/
|
|
||||||
G_STATIC_ASSERT (sizeof (int) == sizeof (gint32));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We just use one structure for all of the info object
|
* We just use one structure for all of the info object
|
||||||
* types; in general, we should be reading data directly
|
* types; in general, we should be reading data directly
|
||||||
@ -57,9 +52,9 @@ struct _GIBaseInfo
|
|||||||
GIBaseInfo *container;
|
GIBaseInfo *container;
|
||||||
|
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
|
|
||||||
guint32 type_is_embedded : 1; /* Used by GITypeInfo */
|
uint32_t type_is_embedded : 1; /* Used by GITypeInfo */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Subtypes */
|
/* Subtypes */
|
||||||
@ -203,8 +198,8 @@ struct _GIUnresolvedInfo
|
|||||||
{
|
{
|
||||||
GIBaseInfo parent;
|
GIBaseInfo parent;
|
||||||
|
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *namespace;
|
const char *namespace;
|
||||||
};
|
};
|
||||||
|
|
||||||
void gi_unresolved_info_class_init (gpointer g_class,
|
void gi_unresolved_info_class_init (gpointer g_class,
|
||||||
@ -215,33 +210,33 @@ void gi_info_init (GIRealInfo *info,
|
|||||||
GIRepository *repository,
|
GIRepository *repository,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset);
|
uint32_t offset);
|
||||||
|
|
||||||
GIBaseInfo * gi_info_from_entry (GIRepository *repository,
|
GIBaseInfo * gi_info_from_entry (GIRepository *repository,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint16 index);
|
uint16_t index);
|
||||||
|
|
||||||
GIBaseInfo * gi_info_new_full (GIInfoType type,
|
GIBaseInfo * gi_info_new_full (GIInfoType type,
|
||||||
GIRepository *repository,
|
GIRepository *repository,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset);
|
uint32_t offset);
|
||||||
|
|
||||||
GITypeInfo * gi_type_info_new (GIBaseInfo *container,
|
GITypeInfo * gi_type_info_new (GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset);
|
uint32_t offset);
|
||||||
|
|
||||||
void gi_type_info_init (GIBaseInfo *info,
|
void gi_type_info_init (GIBaseInfo *info,
|
||||||
GIBaseInfo *container,
|
GIBaseInfo *container,
|
||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
guint32 offset);
|
uint32_t offset);
|
||||||
|
|
||||||
GIFunctionInfo * gi_base_info_find_method (GIBaseInfo *base,
|
GIFunctionInfo * gi_base_info_find_method (GIBaseInfo *base,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint n_methods,
|
uint16_t n_methods,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GIVFuncInfo * gi_base_info_find_vfunc (GIRealInfo *rinfo,
|
GIVFuncInfo * gi_base_info_find_vfunc (GIRealInfo *rinfo,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint n_vfuncs,
|
uint16_t n_vfuncs,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
@ -69,7 +69,7 @@ static GIRepository *default_repository = NULL;
|
|||||||
static GPtrArray *typelib_search_path = NULL;
|
static GPtrArray *typelib_search_path = NULL;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint n_interfaces;
|
size_t n_interfaces;
|
||||||
GIBaseInfo *interfaces[];
|
GIBaseInfo *interfaces[];
|
||||||
} GTypeInterfaceCache;
|
} GTypeInterfaceCache;
|
||||||
|
|
||||||
@ -77,9 +77,8 @@ static void
|
|||||||
gtype_interface_cache_free (gpointer data)
|
gtype_interface_cache_free (gpointer data)
|
||||||
{
|
{
|
||||||
GTypeInterfaceCache *cache = data;
|
GTypeInterfaceCache *cache = data;
|
||||||
guint i;
|
|
||||||
|
|
||||||
for (i = 0; i < cache->n_interfaces; i++)
|
for (size_t i = 0; i < cache->n_interfaces; i++)
|
||||||
gi_base_info_unref ((GIBaseInfo*) cache->interfaces[i]);
|
gi_base_info_unref ((GIBaseInfo*) cache->interfaces[i]);
|
||||||
g_free (cache);
|
g_free (cache);
|
||||||
}
|
}
|
||||||
@ -203,7 +202,7 @@ init_globals (void)
|
|||||||
{
|
{
|
||||||
const char *libdir;
|
const char *libdir;
|
||||||
char *typelib_dir;
|
char *typelib_dir;
|
||||||
const gchar *type_lib_path_env;
|
const char *type_lib_path_env;
|
||||||
|
|
||||||
/* This variable is intended to take precedence over both:
|
/* This variable is intended to take precedence over both:
|
||||||
* - the default search path;
|
* - the default search path;
|
||||||
@ -213,7 +212,7 @@ init_globals (void)
|
|||||||
|
|
||||||
if (type_lib_path_env)
|
if (type_lib_path_env)
|
||||||
{
|
{
|
||||||
gchar **custom_dirs;
|
char **custom_dirs;
|
||||||
|
|
||||||
custom_dirs = g_strsplit (type_lib_path_env, G_SEARCHPATH_SEPARATOR_S, 0);
|
custom_dirs = g_strsplit (type_lib_path_env, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||||
typelib_search_path =
|
typelib_search_path =
|
||||||
@ -324,8 +323,8 @@ get_repository (GIRepository *repository)
|
|||||||
|
|
||||||
static GITypelib *
|
static GITypelib *
|
||||||
check_version_conflict (GITypelib *typelib,
|
check_version_conflict (GITypelib *typelib,
|
||||||
const gchar *namespace,
|
const char *namespace,
|
||||||
const gchar *expected_version,
|
const char *expected_version,
|
||||||
char **version_conflict)
|
char **version_conflict)
|
||||||
{
|
{
|
||||||
Header *header;
|
Header *header;
|
||||||
@ -432,7 +431,7 @@ register_internal (GIRepository *repository,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
Header *header;
|
Header *header;
|
||||||
const gchar *namespace;
|
const char *namespace;
|
||||||
|
|
||||||
g_return_val_if_fail (typelib != NULL, FALSE);
|
g_return_val_if_fail (typelib != NULL, FALSE);
|
||||||
|
|
||||||
@ -502,7 +501,7 @@ gi_repository_get_immediate_dependencies (GIRepository *repository,
|
|||||||
const char *namespace)
|
const char *namespace)
|
||||||
{
|
{
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
gchar **deps;
|
char **deps;
|
||||||
|
|
||||||
g_return_val_if_fail (namespace != NULL, NULL);
|
g_return_val_if_fail (namespace != NULL, NULL);
|
||||||
|
|
||||||
@ -528,16 +527,15 @@ get_typelib_dependencies_transitive (GIRepository *repository,
|
|||||||
GITypelib *typelib,
|
GITypelib *typelib,
|
||||||
GHashTable *transitive_dependencies)
|
GHashTable *transitive_dependencies)
|
||||||
{
|
{
|
||||||
gchar **immediate_dependencies;
|
char **immediate_dependencies;
|
||||||
guint i;
|
|
||||||
|
|
||||||
immediate_dependencies = get_typelib_dependencies (typelib);
|
immediate_dependencies = get_typelib_dependencies (typelib);
|
||||||
|
|
||||||
for (i = 0; immediate_dependencies != NULL && immediate_dependencies[i]; i++)
|
for (size_t i = 0; immediate_dependencies != NULL && immediate_dependencies[i]; i++)
|
||||||
{
|
{
|
||||||
gchar *dependency;
|
char *dependency;
|
||||||
const gchar *last_dash;
|
const char *last_dash;
|
||||||
gchar *dependency_namespace;
|
char *dependency_namespace;
|
||||||
|
|
||||||
dependency = immediate_dependencies[i];
|
dependency = immediate_dependencies[i];
|
||||||
|
|
||||||
@ -589,7 +587,7 @@ gi_repository_get_dependencies (GIRepository *repository,
|
|||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
GHashTable *transitive_dependencies; /* set of owned utf8 */
|
GHashTable *transitive_dependencies; /* set of owned utf8 */
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
gchar *dependency;
|
char *dependency;
|
||||||
GPtrArray *out; /* owned utf8 elements */
|
GPtrArray *out; /* owned utf8 elements */
|
||||||
|
|
||||||
g_return_val_if_fail (namespace != NULL, NULL);
|
g_return_val_if_fail (namespace != NULL, NULL);
|
||||||
@ -618,7 +616,7 @@ gi_repository_get_dependencies (GIRepository *repository,
|
|||||||
|
|
||||||
g_hash_table_unref (transitive_dependencies);
|
g_hash_table_unref (transitive_dependencies);
|
||||||
|
|
||||||
return (gchar **) g_ptr_array_free (out, FALSE);
|
return (char **) g_ptr_array_free (out, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -691,8 +689,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 char *namespace,
|
||||||
const gchar *version)
|
const char *version)
|
||||||
{
|
{
|
||||||
repository = get_repository (repository);
|
repository = get_repository (repository);
|
||||||
return get_registered (repository, namespace, version) != NULL;
|
return get_registered (repository, namespace, version) != NULL;
|
||||||
@ -753,12 +751,12 @@ gi_repository_new (void)
|
|||||||
* Returns: number of metadata entries
|
* Returns: number of metadata entries
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_repository_get_n_infos (GIRepository *repository,
|
gi_repository_get_n_infos (GIRepository *repository,
|
||||||
const gchar *namespace)
|
const char *namespace)
|
||||||
{
|
{
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
guint n_interfaces = 0;
|
unsigned int n_interfaces = 0;
|
||||||
|
|
||||||
g_return_val_if_fail (namespace != NULL, -1);
|
g_return_val_if_fail (namespace != NULL, -1);
|
||||||
|
|
||||||
@ -793,13 +791,14 @@ 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 char *namespace,
|
||||||
guint idx)
|
unsigned int idx)
|
||||||
{
|
{
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
|
|
||||||
g_return_val_if_fail (namespace != NULL, NULL);
|
g_return_val_if_fail (namespace != NULL, NULL);
|
||||||
|
g_return_val_if_fail (idx < G_MAXUINT16, NULL);
|
||||||
|
|
||||||
repository = get_repository (repository);
|
repository = get_repository (repository);
|
||||||
|
|
||||||
@ -816,7 +815,7 @@ gi_repository_get_info (GIRepository *repository,
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const gchar *gtype_name;
|
const char *gtype_name;
|
||||||
GITypelib *result_typelib;
|
GITypelib *result_typelib;
|
||||||
} FindByGTypeData;
|
} FindByGTypeData;
|
||||||
|
|
||||||
@ -948,8 +947,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 char *namespace,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
@ -1073,7 +1072,7 @@ gi_repository_find_by_error_domain (GIRepository *repository,
|
|||||||
void
|
void
|
||||||
gi_repository_get_object_gtype_interfaces (GIRepository *repository,
|
gi_repository_get_object_gtype_interfaces (GIRepository *repository,
|
||||||
GType gtype,
|
GType gtype,
|
||||||
gsize *n_interfaces_out,
|
size_t *n_interfaces_out,
|
||||||
GIInterfaceInfo ***interfaces_out)
|
GIInterfaceInfo ***interfaces_out)
|
||||||
{
|
{
|
||||||
GTypeInterfaceCache *cache;
|
GTypeInterfaceCache *cache;
|
||||||
@ -1083,12 +1082,12 @@ gi_repository_get_object_gtype_interfaces (GIRepository *repository,
|
|||||||
repository = get_repository (repository);
|
repository = get_repository (repository);
|
||||||
|
|
||||||
cache = g_hash_table_lookup (repository->priv->interfaces_for_gtype,
|
cache = g_hash_table_lookup (repository->priv->interfaces_for_gtype,
|
||||||
(gpointer) gtype);
|
(void *) gtype);
|
||||||
if (cache == NULL)
|
if (cache == NULL)
|
||||||
{
|
{
|
||||||
GType *interfaces;
|
GType *interfaces;
|
||||||
guint n_interfaces;
|
unsigned int i;
|
||||||
guint i;
|
unsigned int n_interfaces;
|
||||||
GList *interface_infos = NULL, *iter;
|
GList *interface_infos = NULL, *iter;
|
||||||
|
|
||||||
interfaces = g_type_interfaces (gtype, &n_interfaces);
|
interfaces = g_type_interfaces (gtype, &n_interfaces);
|
||||||
@ -1149,19 +1148,19 @@ collect_namespaces (gpointer key,
|
|||||||
* list of namespaces
|
* list of namespaces
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gchar **
|
char **
|
||||||
gi_repository_get_loaded_namespaces (GIRepository *repository)
|
gi_repository_get_loaded_namespaces (GIRepository *repository)
|
||||||
{
|
{
|
||||||
GList *l, *list = NULL;
|
GList *l, *list = NULL;
|
||||||
gchar **names;
|
char **names;
|
||||||
gint i;
|
size_t i;
|
||||||
|
|
||||||
repository = get_repository (repository);
|
repository = get_repository (repository);
|
||||||
|
|
||||||
g_hash_table_foreach (repository->priv->typelibs, collect_namespaces, &list);
|
g_hash_table_foreach (repository->priv->typelibs, collect_namespaces, &list);
|
||||||
g_hash_table_foreach (repository->priv->lazy_typelibs, collect_namespaces, &list);
|
g_hash_table_foreach (repository->priv->lazy_typelibs, collect_namespaces, &list);
|
||||||
|
|
||||||
names = g_malloc0 (sizeof (gchar *) * (g_list_length (list) + 1));
|
names = g_malloc0 (sizeof (char *) * (g_list_length (list) + 1));
|
||||||
i = 0;
|
i = 0;
|
||||||
for (l = list; l; l = l->next)
|
for (l = list; l; l = l->next)
|
||||||
names[i++] = g_strdup (l->data);
|
names[i++] = g_strdup (l->data);
|
||||||
@ -1186,9 +1185,9 @@ gi_repository_get_loaded_namespaces (GIRepository *repository)
|
|||||||
* Returns: Loaded version
|
* Returns: Loaded version
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_repository_get_version (GIRepository *repository,
|
gi_repository_get_version (GIRepository *repository,
|
||||||
const gchar *namespace)
|
const char *namespace)
|
||||||
{
|
{
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
Header *header;
|
Header *header;
|
||||||
@ -1232,7 +1231,7 @@ gi_repository_get_version (GIRepository *repository,
|
|||||||
*/
|
*/
|
||||||
const char * const *
|
const char * const *
|
||||||
gi_repository_get_shared_libraries (GIRepository *repository,
|
gi_repository_get_shared_libraries (GIRepository *repository,
|
||||||
const gchar *namespace,
|
const char *namespace,
|
||||||
size_t *out_n_elements)
|
size_t *out_n_elements)
|
||||||
{
|
{
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
@ -1291,9 +1290,9 @@ gi_repository_get_shared_libraries (GIRepository *repository,
|
|||||||
* Returns: (nullable): C namespace prefix, or `NULL` if none associated
|
* Returns: (nullable): C namespace prefix, or `NULL` if none associated
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_repository_get_c_prefix (GIRepository *repository,
|
gi_repository_get_c_prefix (GIRepository *repository,
|
||||||
const gchar *namespace_)
|
const char *namespace_)
|
||||||
{
|
{
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
Header *header;
|
Header *header;
|
||||||
@ -1329,9 +1328,9 @@ gi_repository_get_c_prefix (GIRepository *repository,
|
|||||||
* successful, `NULL` if namespace is not loaded
|
* successful, `NULL` if namespace is not loaded
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_repository_get_typelib_path (GIRepository *repository,
|
gi_repository_get_typelib_path (GIRepository *repository,
|
||||||
const gchar *namespace)
|
const char *namespace)
|
||||||
{
|
{
|
||||||
gpointer orig_key, value;
|
gpointer orig_key, value;
|
||||||
|
|
||||||
@ -1629,12 +1628,12 @@ find_namespace_latest (const char *namespace,
|
|||||||
*/
|
*/
|
||||||
char **
|
char **
|
||||||
gi_repository_enumerate_versions (GIRepository *repository,
|
gi_repository_enumerate_versions (GIRepository *repository,
|
||||||
const gchar *namespace_,
|
const char *namespace_,
|
||||||
size_t *n_versions_out)
|
size_t *n_versions_out)
|
||||||
{
|
{
|
||||||
GPtrArray *versions;
|
GPtrArray *versions;
|
||||||
GSList *candidates, *link;
|
GSList *candidates, *link;
|
||||||
const gchar *loaded_version;
|
const char *loaded_version;
|
||||||
char **ret;
|
char **ret;
|
||||||
|
|
||||||
init_globals ();
|
init_globals ();
|
||||||
@ -1689,7 +1688,7 @@ require_internal (GIRepository *repository,
|
|||||||
GITypelib *ret = NULL;
|
GITypelib *ret = NULL;
|
||||||
Header *header;
|
Header *header;
|
||||||
GITypelib *typelib = NULL;
|
GITypelib *typelib = NULL;
|
||||||
const gchar *typelib_namespace, *typelib_version;
|
const char *typelib_namespace, *typelib_version;
|
||||||
gboolean allow_lazy = (flags & GI_REPOSITORY_LOAD_FLAG_LAZY) > 0;
|
gboolean allow_lazy = (flags & GI_REPOSITORY_LOAD_FLAG_LAZY) > 0;
|
||||||
gboolean is_lazy;
|
gboolean is_lazy;
|
||||||
char *version_conflict = NULL;
|
char *version_conflict = NULL;
|
||||||
@ -1814,8 +1813,8 @@ require_internal (GIRepository *repository,
|
|||||||
*/
|
*/
|
||||||
GITypelib *
|
GITypelib *
|
||||||
gi_repository_require (GIRepository *repository,
|
gi_repository_require (GIRepository *repository,
|
||||||
const gchar *namespace,
|
const char *namespace,
|
||||||
const gchar *version,
|
const char *version,
|
||||||
GIRepositoryLoadFlags flags,
|
GIRepositoryLoadFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -1853,9 +1852,9 @@ gi_repository_require (GIRepository *repository,
|
|||||||
*/
|
*/
|
||||||
GITypelib *
|
GITypelib *
|
||||||
gi_repository_require_private (GIRepository *repository,
|
gi_repository_require_private (GIRepository *repository,
|
||||||
const gchar *typelib_dir,
|
const char *typelib_dir,
|
||||||
const gchar *namespace,
|
const char *namespace,
|
||||||
const gchar *version,
|
const char *version,
|
||||||
GIRepositoryLoadFlags flags,
|
GIRepositoryLoadFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -1931,7 +1930,7 @@ gi_repository_error_quark (void)
|
|||||||
* Returns: the string
|
* Returns: the string
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar*
|
const char *
|
||||||
gi_type_tag_to_string (GITypeTag type)
|
gi_type_tag_to_string (GITypeTag type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
@ -1994,7 +1993,7 @@ gi_type_tag_to_string (GITypeTag type)
|
|||||||
* Returns: the string
|
* Returns: the string
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar*
|
const char *
|
||||||
gi_info_type_to_string (GIInfoType type)
|
gi_info_type_to_string (GIInfoType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -119,44 +119,44 @@ const char * gi_repository_load_typelib (GIRepository *repository,
|
|||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_repository_is_registered (GIRepository *repository,
|
gboolean gi_repository_is_registered (GIRepository *repository,
|
||||||
const gchar *namespace_,
|
const char *namespace_,
|
||||||
const gchar *version);
|
const char *version);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIBaseInfo * gi_repository_find_by_name (GIRepository *repository,
|
GIBaseInfo * gi_repository_find_by_name (GIRepository *repository,
|
||||||
const gchar *namespace_,
|
const char *namespace_,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
char ** gi_repository_enumerate_versions (GIRepository *repository,
|
char ** gi_repository_enumerate_versions (GIRepository *repository,
|
||||||
const gchar *namespace_,
|
const char *namespace_,
|
||||||
size_t *n_versions_out);
|
size_t *n_versions_out);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypelib * gi_repository_require (GIRepository *repository,
|
GITypelib * gi_repository_require (GIRepository *repository,
|
||||||
const gchar *namespace_,
|
const char *namespace_,
|
||||||
const gchar *version,
|
const char *version,
|
||||||
GIRepositoryLoadFlags flags,
|
GIRepositoryLoadFlags flags,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypelib * gi_repository_require_private (GIRepository *repository,
|
GITypelib * gi_repository_require_private (GIRepository *repository,
|
||||||
const gchar *typelib_dir,
|
const char *typelib_dir,
|
||||||
const gchar *namespace_,
|
const char *namespace_,
|
||||||
const gchar *version,
|
const char *version,
|
||||||
GIRepositoryLoadFlags flags,
|
GIRepositoryLoadFlags flags,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gchar ** gi_repository_get_immediate_dependencies (GIRepository *repository,
|
char ** gi_repository_get_immediate_dependencies (GIRepository *repository,
|
||||||
const gchar *namespace_);
|
const char *namespace_);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gchar ** gi_repository_get_dependencies (GIRepository *repository,
|
char ** gi_repository_get_dependencies (GIRepository *repository,
|
||||||
const gchar *namespace_);
|
const char *namespace_);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gchar ** gi_repository_get_loaded_namespaces (GIRepository *repository);
|
char ** gi_repository_get_loaded_namespaces (GIRepository *repository);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIBaseInfo * gi_repository_find_by_gtype (GIRepository *repository,
|
GIBaseInfo * gi_repository_find_by_gtype (GIRepository *repository,
|
||||||
@ -165,35 +165,35 @@ GIBaseInfo * gi_repository_find_by_gtype (GIRepository *repository,
|
|||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
void gi_repository_get_object_gtype_interfaces (GIRepository *repository,
|
void gi_repository_get_object_gtype_interfaces (GIRepository *repository,
|
||||||
GType gtype,
|
GType gtype,
|
||||||
gsize *n_interfaces_out,
|
size_t *n_interfaces_out,
|
||||||
GIInterfaceInfo ***interfaces_out);
|
GIInterfaceInfo ***interfaces_out);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_repository_get_n_infos (GIRepository *repository,
|
unsigned int gi_repository_get_n_infos (GIRepository *repository,
|
||||||
const gchar *namespace_);
|
const char *namespace_);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIBaseInfo * gi_repository_get_info (GIRepository *repository,
|
GIBaseInfo * gi_repository_get_info (GIRepository *repository,
|
||||||
const gchar *namespace_,
|
const char *namespace_,
|
||||||
guint idx);
|
unsigned int idx);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIEnumInfo * gi_repository_find_by_error_domain (GIRepository *repository,
|
GIEnumInfo * gi_repository_find_by_error_domain (GIRepository *repository,
|
||||||
GQuark domain);
|
GQuark domain);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_repository_get_typelib_path (GIRepository *repository,
|
const char * gi_repository_get_typelib_path (GIRepository *repository,
|
||||||
const gchar *namespace_);
|
const char *namespace_);
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * const *gi_repository_get_shared_libraries (GIRepository *repository,
|
const char * const *gi_repository_get_shared_libraries (GIRepository *repository,
|
||||||
const gchar *namespace_,
|
const char *namespace_,
|
||||||
size_t *out_n_elements);
|
size_t *out_n_elements);
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_repository_get_c_prefix (GIRepository *repository,
|
const char * gi_repository_get_c_prefix (GIRepository *repository,
|
||||||
const gchar *namespace_);
|
const char *namespace_);
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_repository_get_version (GIRepository *repository,
|
const char * gi_repository_get_version (GIRepository *repository,
|
||||||
const gchar *namespace_);
|
const char *namespace_);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
@ -249,9 +249,9 @@ GQuark gi_repository_error_quark (void);
|
|||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
void gi_cclosure_marshal_generic (GClosure *closure,
|
void gi_cclosure_marshal_generic (GClosure *closure,
|
||||||
GValue *return_gvalue,
|
GValue *return_gvalue,
|
||||||
guint n_param_values,
|
unsigned int n_param_values,
|
||||||
const GValue *param_values,
|
const GValue *param_values,
|
||||||
gpointer invocation_hint,
|
void *invocation_hint,
|
||||||
gpointer marshal_data);
|
void *marshal_data);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -175,8 +175,7 @@ gi_callable_info_get_ffi_arg_types (GICallableInfo *callable_info,
|
|||||||
{
|
{
|
||||||
ffi_type **arg_types;
|
ffi_type **arg_types;
|
||||||
gboolean is_method, throws;
|
gboolean is_method, throws;
|
||||||
size_t n_invoke_args;
|
size_t n_args, n_invoke_args, i, offset;
|
||||||
guint n_args, i, offset;
|
|
||||||
|
|
||||||
g_return_val_if_fail (callable_info != NULL, NULL);
|
g_return_val_if_fail (callable_info != NULL, NULL);
|
||||||
|
|
||||||
@ -276,7 +275,7 @@ gi_function_info_prep_invoker (GIFunctionInfo *info,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const char *symbol;
|
const char *symbol;
|
||||||
gpointer addr;
|
void *addr;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, FALSE);
|
g_return_val_if_fail (info != NULL, FALSE);
|
||||||
g_return_val_if_fail (invoker != NULL, FALSE);
|
g_return_val_if_fail (invoker != NULL, FALSE);
|
||||||
@ -316,7 +315,7 @@ gi_function_info_prep_invoker (GIFunctionInfo *info,
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gi_function_invoker_new_for_address (gpointer addr,
|
gi_function_invoker_new_for_address (void *addr,
|
||||||
GICallableInfo *info,
|
GICallableInfo *info,
|
||||||
GIFunctionInvoker *invoker,
|
GIFunctionInvoker *invoker,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -355,8 +354,8 @@ gi_function_invoker_destroy (GIFunctionInvoker *invoker)
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ffi_closure ffi_closure;
|
ffi_closure ffi_closure;
|
||||||
gpointer writable_self;
|
void *writable_self;
|
||||||
gpointer native_address;
|
void *native_address;
|
||||||
} GIClosureWrapper;
|
} GIClosureWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -377,9 +376,9 @@ ffi_closure *
|
|||||||
gi_callable_info_create_closure (GICallableInfo *callable_info,
|
gi_callable_info_create_closure (GICallableInfo *callable_info,
|
||||||
ffi_cif *cif,
|
ffi_cif *cif,
|
||||||
GIFFIClosureCallback callback,
|
GIFFIClosureCallback callback,
|
||||||
gpointer user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
gpointer exec_ptr;
|
void *exec_ptr;
|
||||||
size_t n_args;
|
size_t n_args;
|
||||||
ffi_type **atypes;
|
ffi_type **atypes;
|
||||||
GIClosureWrapper *closure;
|
GIClosureWrapper *closure;
|
||||||
@ -432,7 +431,7 @@ gi_callable_info_create_closure (GICallableInfo *callable_info,
|
|||||||
* Returns: (transfer none): native address
|
* Returns: (transfer none): native address
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gpointer *
|
void **
|
||||||
gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
|
gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
|
||||||
ffi_closure *closure)
|
ffi_closure *closure)
|
||||||
{
|
{
|
||||||
|
@ -65,9 +65,9 @@ typedef void (*GIFFIClosureCallback) (ffi_cif *cif,
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ffi_cif cif;
|
ffi_cif cif;
|
||||||
gpointer native_address;
|
void *native_address;
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer padding[3];
|
void *padding[3];
|
||||||
} GIFunctionInvoker;
|
} GIFunctionInvoker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,7 +102,7 @@ gboolean gi_function_info_prep_invoker (GIFunctionInfo *info,
|
|||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_function_invoker_new_for_address (gpointer addr,
|
gboolean gi_function_invoker_new_for_address (void *addr,
|
||||||
GICallableInfo *info,
|
GICallableInfo *info,
|
||||||
GIFunctionInvoker *invoker,
|
GIFunctionInvoker *invoker,
|
||||||
GError **error);
|
GError **error);
|
||||||
@ -115,10 +115,10 @@ GI_AVAILABLE_IN_ALL
|
|||||||
ffi_closure * gi_callable_info_create_closure (GICallableInfo *callable_info,
|
ffi_closure * gi_callable_info_create_closure (GICallableInfo *callable_info,
|
||||||
ffi_cif *cif,
|
ffi_cif *cif,
|
||||||
GIFFIClosureCallback callback,
|
GIFFIClosureCallback callback,
|
||||||
gpointer user_data);
|
void *user_data);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gpointer * gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
|
void ** gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
|
||||||
ffi_closure *closure);
|
ffi_closure *closure);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
|
@ -36,17 +36,17 @@ struct _GIIrTypelibBuild {
|
|||||||
GHashTable *strings;
|
GHashTable *strings;
|
||||||
GHashTable *types;
|
GHashTable *types;
|
||||||
GList *nodes_with_attributes;
|
GList *nodes_with_attributes;
|
||||||
guint32 n_attributes;
|
uint32_t n_attributes;
|
||||||
guchar *data;
|
uint8_t *data;
|
||||||
GList *stack;
|
GList *stack;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIIrModule
|
struct _GIIrModule
|
||||||
{
|
{
|
||||||
gchar *name;
|
char *name;
|
||||||
gchar *version;
|
char *version;
|
||||||
gchar *shared_library;
|
char *shared_library;
|
||||||
gchar *c_prefix;
|
char *c_prefix;
|
||||||
GList *dependencies;
|
GList *dependencies;
|
||||||
GList *entries;
|
GList *entries;
|
||||||
|
|
||||||
@ -66,10 +66,10 @@ struct _GIIrModule
|
|||||||
GHashTable *disguised_structures;
|
GHashTable *disguised_structures;
|
||||||
};
|
};
|
||||||
|
|
||||||
GIIrModule *gi_ir_module_new (const gchar *name,
|
GIIrModule *gi_ir_module_new (const char *name,
|
||||||
const gchar *nsversion,
|
const char *nsversion,
|
||||||
const gchar *module_filename,
|
const char *module_filename,
|
||||||
const gchar *c_prefix);
|
const char *c_prefix);
|
||||||
void gi_ir_module_free (GIIrModule *module);
|
void gi_ir_module_free (GIIrModule *module);
|
||||||
|
|
||||||
void gi_ir_module_add_include_module (GIIrModule *module,
|
void gi_ir_module_add_include_module (GIIrModule *module,
|
||||||
@ -77,7 +77,10 @@ void gi_ir_module_add_include_module (GIIrModule *module,
|
|||||||
|
|
||||||
GITypelib * gi_ir_module_build_typelib (GIIrModule *module);
|
GITypelib * gi_ir_module_build_typelib (GIIrModule *module);
|
||||||
|
|
||||||
void gi_ir_module_fatal (GIIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;
|
void gi_ir_module_fatal (GIIrTypelibBuild *build,
|
||||||
|
unsigned int line,
|
||||||
|
const char *msg,
|
||||||
|
...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;
|
||||||
|
|
||||||
void gi_ir_node_init_stats (void);
|
void gi_ir_node_init_stats (void);
|
||||||
void gi_ir_node_dump_stats (void);
|
void gi_ir_node_dump_stats (void);
|
||||||
|
@ -38,10 +38,10 @@
|
|||||||
#define NUM_SECTIONS 2
|
#define NUM_SECTIONS 2
|
||||||
|
|
||||||
GIIrModule *
|
GIIrModule *
|
||||||
gi_ir_module_new (const gchar *name,
|
gi_ir_module_new (const char *name,
|
||||||
const gchar *version,
|
const char *version,
|
||||||
const gchar *shared_library,
|
const char *shared_library,
|
||||||
const gchar *c_prefix)
|
const char *c_prefix)
|
||||||
{
|
{
|
||||||
GIIrModule *module;
|
GIIrModule *module;
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ gi_ir_module_free (GIIrModule *module)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gi_ir_module_fatal (GIIrTypelibBuild *build,
|
gi_ir_module_fatal (GIIrTypelibBuild *build,
|
||||||
guint line,
|
unsigned int line,
|
||||||
const char *msg,
|
const char *msg,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
@ -114,7 +114,7 @@ gi_ir_module_fatal (GIIrTypelibBuild *build,
|
|||||||
|
|
||||||
context = g_string_new ("");
|
context = g_string_new ("");
|
||||||
if (line > 0)
|
if (line > 0)
|
||||||
g_string_append_printf (context, "%d: ", line);
|
g_string_append_printf (context, "%u: ", line);
|
||||||
if (build->stack)
|
if (build->stack)
|
||||||
g_string_append (context, "In ");
|
g_string_append (context, "In ");
|
||||||
for (link = g_list_last (build->stack); link; link = link->prev)
|
for (link = g_list_last (build->stack); link; link = link->prev)
|
||||||
@ -190,19 +190,19 @@ gi_ir_module_add_include_module (GIIrModule *module,
|
|||||||
|
|
||||||
struct AttributeWriteData
|
struct AttributeWriteData
|
||||||
{
|
{
|
||||||
guint count;
|
unsigned int count;
|
||||||
guchar *databuf;
|
uint8_t *databuf;
|
||||||
GIIrNode *node;
|
GIIrNode *node;
|
||||||
GHashTable *strings;
|
GHashTable *strings;
|
||||||
guint32 *offset;
|
uint32_t *offset;
|
||||||
guint32 *offset2;
|
uint32_t *offset2;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_attribute (gpointer key, gpointer value, gpointer datap)
|
write_attribute (gpointer key, gpointer value, gpointer datap)
|
||||||
{
|
{
|
||||||
struct AttributeWriteData *data = datap;
|
struct AttributeWriteData *data = datap;
|
||||||
guint32 old_offset = *(data->offset);
|
uint32_t old_offset = *(data->offset);
|
||||||
AttributeBlob *blob = (AttributeBlob*)&(data->databuf[old_offset]);
|
AttributeBlob *blob = (AttributeBlob*)&(data->databuf[old_offset]);
|
||||||
|
|
||||||
*(data->offset) += sizeof (AttributeBlob);
|
*(data->offset) += sizeof (AttributeBlob);
|
||||||
@ -214,13 +214,13 @@ write_attribute (gpointer key, gpointer value, gpointer datap)
|
|||||||
data->count++;
|
data->count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
static unsigned
|
||||||
write_attributes (GIIrModule *module,
|
write_attributes (GIIrModule *module,
|
||||||
GIIrNode *node,
|
GIIrNode *node,
|
||||||
GHashTable *strings,
|
GHashTable *strings,
|
||||||
guchar *data,
|
uint8_t *data,
|
||||||
guint32 *offset,
|
uint32_t *offset,
|
||||||
guint32 *offset2)
|
uint32_t *offset2)
|
||||||
{
|
{
|
||||||
struct AttributeWriteData wdata;
|
struct AttributeWriteData wdata;
|
||||||
wdata.count = 0;
|
wdata.count = 0;
|
||||||
@ -235,9 +235,9 @@ write_attributes (GIIrModule *module,
|
|||||||
return wdata.count;
|
return wdata.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static int
|
||||||
node_cmp_offset_func (gconstpointer a,
|
node_cmp_offset_func (const void *a,
|
||||||
gconstpointer b)
|
const void *b)
|
||||||
{
|
{
|
||||||
const GIIrNode *na = a;
|
const GIIrNode *na = a;
|
||||||
const GIIrNode *nb = b;
|
const GIIrNode *nb = b;
|
||||||
@ -245,7 +245,7 @@ node_cmp_offset_func (gconstpointer a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alloc_section (guint8 *data, SectionType section_id, guint32 offset)
|
alloc_section (uint8_t *data, SectionType section_id, uint32_t offset)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Header *header = (Header*)data;
|
Header *header = (Header*)data;
|
||||||
@ -266,21 +266,21 @@ alloc_section (guint8 *data, SectionType section_id, guint32 offset)
|
|||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint8*
|
static uint8_t *
|
||||||
add_directory_index_section (guint8 *data, GIIrModule *module, guint32 *offset2)
|
add_directory_index_section (uint8_t *data, GIIrModule *module, uint32_t *offset2)
|
||||||
{
|
{
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
Header *header = (Header*)data;
|
Header *header = (Header*)data;
|
||||||
GITypelibHashBuilder *dirindex_builder;
|
GITypelibHashBuilder *dirindex_builder;
|
||||||
guint i, n_interfaces;
|
uint16_t n_interfaces;
|
||||||
guint16 required_size;
|
uint16_t required_size;
|
||||||
guint32 new_offset;
|
uint32_t new_offset;
|
||||||
|
|
||||||
dirindex_builder = gi_typelib_hash_builder_new ();
|
dirindex_builder = gi_typelib_hash_builder_new ();
|
||||||
|
|
||||||
n_interfaces = ((Header *)data)->n_local_entries;
|
n_interfaces = ((Header *)data)->n_local_entries;
|
||||||
|
|
||||||
for (i = 0; i < n_interfaces; i++)
|
for (uint16_t i = 0; i < n_interfaces; i++)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
entry = (DirEntry *)&data[header->directory + (i * header->entry_blob_size)];
|
entry = (DirEntry *)&data[header->directory + (i * header->entry_blob_size)];
|
||||||
@ -306,7 +306,7 @@ add_directory_index_section (guint8 *data, GIIrModule *module, guint32 *offset2)
|
|||||||
|
|
||||||
data = g_realloc (data, new_offset);
|
data = g_realloc (data, new_offset);
|
||||||
|
|
||||||
gi_typelib_hash_builder_pack (dirindex_builder, ((guint8*)data) + *offset2, required_size);
|
gi_typelib_hash_builder_pack (dirindex_builder, ((uint8_t*)data) + *offset2, required_size);
|
||||||
|
|
||||||
*offset2 = new_offset;
|
*offset2 = new_offset;
|
||||||
|
|
||||||
@ -319,21 +319,21 @@ gi_ir_module_build_typelib (GIIrModule *module)
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GITypelib *typelib;
|
GITypelib *typelib;
|
||||||
gsize length;
|
size_t length;
|
||||||
guint i;
|
size_t i;
|
||||||
GList *e;
|
GList *e;
|
||||||
Header *header;
|
Header *header;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
guint32 header_size;
|
uint32_t header_size;
|
||||||
guint32 dir_size;
|
uint32_t dir_size;
|
||||||
guint32 n_entries;
|
uint32_t n_entries;
|
||||||
guint32 n_local_entries;
|
uint32_t n_local_entries;
|
||||||
guint32 size, offset, offset2, old_offset;
|
uint32_t size, offset, offset2, old_offset;
|
||||||
GHashTable *strings;
|
GHashTable *strings;
|
||||||
GHashTable *types;
|
GHashTable *types;
|
||||||
GList *nodes_with_attributes;
|
GList *nodes_with_attributes;
|
||||||
char *dependencies;
|
char *dependencies;
|
||||||
guchar *data;
|
uint8_t *data;
|
||||||
Section *section;
|
Section *section;
|
||||||
|
|
||||||
header_size = ALIGN_VALUE (sizeof (Header), 4);
|
header_size = ALIGN_VALUE (sizeof (Header), 4);
|
||||||
|
@ -73,10 +73,10 @@ typedef enum
|
|||||||
struct _GIIrNode
|
struct _GIIrNode
|
||||||
{
|
{
|
||||||
GIIrNodeTypeId type;
|
GIIrNodeTypeId type;
|
||||||
gchar *name;
|
char *name;
|
||||||
GIIrModule *module;
|
GIIrModule *module;
|
||||||
|
|
||||||
guint32 offset; /* Assigned as we build the typelib */
|
uint32_t offset; /* Assigned as we build the typelib */
|
||||||
|
|
||||||
GHashTable *attributes;
|
GHashTable *attributes;
|
||||||
};
|
};
|
||||||
@ -85,25 +85,25 @@ struct _GIIrNodeXRef
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gchar *namespace;
|
char *namespace;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIIrNodeFunction
|
struct _GIIrNodeFunction
|
||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
gboolean is_varargs; /* Not in typelib yet */
|
uint8_t is_varargs : 1; /* Not in typelib yet */
|
||||||
|
|
||||||
gboolean is_method;
|
uint8_t is_method : 1;
|
||||||
gboolean is_setter;
|
uint8_t is_setter : 1;
|
||||||
gboolean is_getter;
|
uint8_t is_getter : 1;
|
||||||
gboolean is_constructor;
|
uint8_t is_constructor : 1;
|
||||||
gboolean wraps_vfunc;
|
uint8_t wraps_vfunc : 1;
|
||||||
gboolean throws;
|
uint8_t throws : 1;
|
||||||
gboolean instance_transfer_full;
|
uint8_t instance_transfer_full : 1;
|
||||||
|
|
||||||
gchar *symbol;
|
char *symbol;
|
||||||
char *property;
|
char *property;
|
||||||
|
|
||||||
GIIrNodeParam *result;
|
GIIrNodeParam *result;
|
||||||
@ -114,49 +114,49 @@ struct _GIIrNodeType
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean is_pointer;
|
uint8_t is_pointer : 1;
|
||||||
gboolean is_basic;
|
uint8_t is_basic : 1;
|
||||||
gboolean is_array;
|
uint8_t is_array : 1;
|
||||||
gboolean is_glist;
|
uint8_t is_glist : 1;
|
||||||
gboolean is_gslist;
|
uint8_t is_gslist : 1;
|
||||||
gboolean is_ghashtable;
|
uint8_t is_ghashtable : 1;
|
||||||
gboolean is_interface;
|
uint8_t is_interface : 1;
|
||||||
gboolean is_error;
|
uint8_t is_error : 1;
|
||||||
gint tag;
|
int tag;
|
||||||
|
|
||||||
gchar *unparsed;
|
char *unparsed;
|
||||||
|
|
||||||
gboolean zero_terminated;
|
uint8_t zero_terminated : 1;
|
||||||
gboolean has_length;
|
uint8_t has_length : 1;
|
||||||
gint length;
|
int length;
|
||||||
gboolean has_size;
|
uint8_t has_size : 1;
|
||||||
gint size;
|
int size;
|
||||||
gint array_type;
|
int array_type;
|
||||||
|
|
||||||
GIIrNodeType *parameter_type1;
|
GIIrNodeType *parameter_type1;
|
||||||
GIIrNodeType *parameter_type2;
|
GIIrNodeType *parameter_type2;
|
||||||
|
|
||||||
gchar *giinterface;
|
char *giinterface;
|
||||||
gchar **errors;
|
char **errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIIrNodeParam
|
struct _GIIrNodeParam
|
||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean in;
|
uint8_t in : 1;
|
||||||
gboolean out;
|
uint8_t out : 1;
|
||||||
gboolean caller_allocates;
|
uint8_t caller_allocates : 1;
|
||||||
gboolean optional;
|
uint8_t optional : 1;
|
||||||
gboolean retval;
|
uint8_t retval : 1;
|
||||||
gboolean nullable;
|
uint8_t nullable : 1;
|
||||||
gboolean skip;
|
uint8_t skip : 1;
|
||||||
gboolean transfer;
|
uint8_t transfer : 1;
|
||||||
gboolean shallow_transfer;
|
uint8_t shallow_transfer : 1;
|
||||||
GIScopeType scope;
|
GIScopeType scope : 3;
|
||||||
|
|
||||||
gint8 closure;
|
int8_t closure;
|
||||||
gint8 destroy;
|
int8_t destroy;
|
||||||
|
|
||||||
GIIrNodeType *type;
|
GIIrNodeType *type;
|
||||||
};
|
};
|
||||||
@ -165,15 +165,15 @@ struct _GIIrNodeProperty
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
|
|
||||||
gchar *name;
|
char *name;
|
||||||
gboolean readable;
|
uint8_t readable : 1;
|
||||||
gboolean writable;
|
uint8_t writable : 1;
|
||||||
gboolean construct;
|
uint8_t construct : 1;
|
||||||
gboolean construct_only;
|
uint8_t construct_only : 1;
|
||||||
gboolean transfer;
|
uint8_t transfer : 1;
|
||||||
gboolean shallow_transfer;
|
uint8_t shallow_transfer : 1;
|
||||||
|
|
||||||
char *setter;
|
char *setter;
|
||||||
char *getter;
|
char *getter;
|
||||||
@ -185,21 +185,21 @@ struct _GIIrNodeSignal
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
|
|
||||||
gboolean run_first;
|
uint8_t run_first : 1;
|
||||||
gboolean run_last;
|
uint8_t run_last : 1;
|
||||||
gboolean run_cleanup;
|
uint8_t run_cleanup : 1;
|
||||||
gboolean no_recurse;
|
uint8_t no_recurse : 1;
|
||||||
gboolean detailed;
|
uint8_t detailed : 1;
|
||||||
gboolean action;
|
uint8_t action : 1;
|
||||||
gboolean no_hooks;
|
uint8_t no_hooks : 1;
|
||||||
gboolean instance_transfer_full;
|
uint8_t instance_transfer_full : 1;
|
||||||
|
|
||||||
gboolean has_class_closure;
|
uint8_t has_class_closure : 1;
|
||||||
gboolean true_stops_emit;
|
uint8_t true_stops_emit : 1;
|
||||||
|
|
||||||
gint class_closure;
|
int class_closure;
|
||||||
|
|
||||||
GList *parameters;
|
GList *parameters;
|
||||||
GIIrNodeParam *result;
|
GIIrNodeParam *result;
|
||||||
@ -209,30 +209,30 @@ struct _GIIrNodeVFunc
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean is_varargs; /* Not in typelib yet */
|
uint8_t is_varargs : 1; /* Not in typelib yet */
|
||||||
gboolean must_chain_up;
|
uint8_t must_chain_up : 1;
|
||||||
gboolean must_be_implemented;
|
uint8_t must_be_implemented : 1;
|
||||||
gboolean must_not_be_implemented;
|
uint8_t must_not_be_implemented : 1;
|
||||||
gboolean is_class_closure;
|
uint8_t is_class_closure : 1;
|
||||||
gboolean throws;
|
uint8_t throws : 1;
|
||||||
gboolean instance_transfer_full;
|
uint8_t instance_transfer_full : 1;
|
||||||
|
|
||||||
char *invoker;
|
char *invoker;
|
||||||
|
|
||||||
GList *parameters;
|
GList *parameters;
|
||||||
GIIrNodeParam *result;
|
GIIrNodeParam *result;
|
||||||
|
|
||||||
gint offset;
|
int offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIIrNodeField
|
struct _GIIrNodeField
|
||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean readable;
|
uint8_t readable : 1;
|
||||||
gboolean writable;
|
uint8_t writable : 1;
|
||||||
gint bits;
|
int bits;
|
||||||
gint offset;
|
int offset;
|
||||||
GIIrNodeFunction *callback;
|
GIIrNodeFunction *callback;
|
||||||
|
|
||||||
GIIrNodeType *type;
|
GIIrNodeType *type;
|
||||||
@ -242,27 +242,27 @@ struct _GIIrNodeInterface
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean abstract;
|
uint8_t abstract : 1;
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
gboolean fundamental;
|
uint8_t fundamental : 1;
|
||||||
gboolean final_;
|
uint8_t final_ : 1;
|
||||||
|
|
||||||
gchar *gtype_name;
|
char *gtype_name;
|
||||||
gchar *gtype_init;
|
char *gtype_init;
|
||||||
|
|
||||||
gchar *ref_func;
|
char *ref_func;
|
||||||
gchar *unref_func;
|
char *unref_func;
|
||||||
gchar *set_value_func;
|
char *set_value_func;
|
||||||
gchar *get_value_func;
|
char *get_value_func;
|
||||||
|
|
||||||
gchar *parent;
|
char *parent;
|
||||||
gchar *glib_type_struct;
|
char *glib_type_struct;
|
||||||
|
|
||||||
GList *interfaces;
|
GList *interfaces;
|
||||||
GList *prerequisites;
|
GList *prerequisites;
|
||||||
|
|
||||||
gint alignment;
|
gssize alignment;
|
||||||
gint size;
|
size_t size;
|
||||||
|
|
||||||
GList *members;
|
GList *members;
|
||||||
};
|
};
|
||||||
@ -271,32 +271,32 @@ struct _GIIrNodeValue
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
|
|
||||||
gint64 value;
|
int64_t value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIIrNodeConstant
|
struct _GIIrNodeConstant
|
||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
|
|
||||||
GIIrNodeType *type;
|
GIIrNodeType *type;
|
||||||
|
|
||||||
gchar *value;
|
char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GIIrNodeEnum
|
struct _GIIrNodeEnum
|
||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
gint storage_type;
|
int storage_type;
|
||||||
|
|
||||||
gchar *gtype_name;
|
char *gtype_name;
|
||||||
gchar *gtype_init;
|
char *gtype_init;
|
||||||
gchar *error_domain;
|
char *error_domain;
|
||||||
|
|
||||||
GList *values;
|
GList *values;
|
||||||
GList *methods;
|
GList *methods;
|
||||||
@ -306,13 +306,13 @@ struct _GIIrNodeBoxed
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
|
|
||||||
gchar *gtype_name;
|
char *gtype_name;
|
||||||
gchar *gtype_init;
|
char *gtype_init;
|
||||||
|
|
||||||
gint alignment;
|
gssize alignment;
|
||||||
gint size;
|
size_t size;
|
||||||
|
|
||||||
GList *members;
|
GList *members;
|
||||||
};
|
};
|
||||||
@ -321,21 +321,21 @@ struct _GIIrNodeStruct
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
gboolean disguised;
|
uint8_t disguised : 1;
|
||||||
gboolean opaque;
|
uint8_t opaque : 1;
|
||||||
gboolean pointer;
|
uint8_t pointer : 1;
|
||||||
gboolean is_gtype_struct;
|
uint8_t is_gtype_struct : 1;
|
||||||
gboolean foreign;
|
uint8_t foreign : 1;
|
||||||
|
|
||||||
gchar *gtype_name;
|
char *gtype_name;
|
||||||
gchar *gtype_init;
|
char *gtype_init;
|
||||||
|
|
||||||
gchar *copy_func;
|
char *copy_func;
|
||||||
gchar *free_func;
|
char *free_func;
|
||||||
|
|
||||||
gint alignment;
|
gssize alignment;
|
||||||
gint size;
|
size_t size;
|
||||||
|
|
||||||
GList *members;
|
GList *members;
|
||||||
};
|
};
|
||||||
@ -344,21 +344,21 @@ struct _GIIrNodeUnion
|
|||||||
{
|
{
|
||||||
GIIrNode node;
|
GIIrNode node;
|
||||||
|
|
||||||
gboolean deprecated;
|
uint8_t deprecated : 1;
|
||||||
|
|
||||||
GList *members;
|
GList *members;
|
||||||
GList *discriminators;
|
GList *discriminators;
|
||||||
|
|
||||||
gchar *gtype_name;
|
char *gtype_name;
|
||||||
gchar *gtype_init;
|
char *gtype_init;
|
||||||
|
|
||||||
gchar *copy_func;
|
char *copy_func;
|
||||||
gchar *free_func;
|
char *free_func;
|
||||||
|
|
||||||
gint alignment;
|
gssize alignment;
|
||||||
gint size;
|
size_t size;
|
||||||
|
|
||||||
gint discriminator_offset;
|
int discriminator_offset;
|
||||||
GIIrNodeType *discriminator_type;
|
GIIrNodeType *discriminator_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -366,26 +366,26 @@ struct _GIIrNodeUnion
|
|||||||
GIIrNode *gi_ir_node_new (GIIrNodeTypeId type,
|
GIIrNode *gi_ir_node_new (GIIrNodeTypeId type,
|
||||||
GIIrModule *module);
|
GIIrModule *module);
|
||||||
void gi_ir_node_free (GIIrNode *node);
|
void gi_ir_node_free (GIIrNode *node);
|
||||||
guint32 gi_ir_node_get_size (GIIrNode *node);
|
uint32_t gi_ir_node_get_size (GIIrNode *node);
|
||||||
guint32 gi_ir_node_get_full_size (GIIrNode *node);
|
uint32_t gi_ir_node_get_full_size (GIIrNode *node);
|
||||||
void gi_ir_node_build_typelib (GIIrNode *node,
|
void gi_ir_node_build_typelib (GIIrNode *node,
|
||||||
GIIrNode *parent,
|
GIIrNode *parent,
|
||||||
GIIrTypelibBuild *build,
|
GIIrTypelibBuild *build,
|
||||||
guint32 *offset,
|
uint32_t *offset,
|
||||||
guint32 *offset2,
|
uint32_t *offset2,
|
||||||
guint16 *count2);
|
uint16_t *count2);
|
||||||
int gi_ir_node_cmp (GIIrNode *node,
|
int gi_ir_node_cmp (GIIrNode *node,
|
||||||
GIIrNode *other);
|
GIIrNode *other);
|
||||||
gboolean gi_ir_node_can_have_member (GIIrNode *node);
|
gboolean gi_ir_node_can_have_member (GIIrNode *node);
|
||||||
void gi_ir_node_add_member (GIIrNode *node,
|
void gi_ir_node_add_member (GIIrNode *node,
|
||||||
GIIrNodeFunction *member);
|
GIIrNodeFunction *member);
|
||||||
guint32 gi_ir_write_string (const gchar *str,
|
uint32_t gi_ir_write_string (const char *str,
|
||||||
GHashTable *strings,
|
GHashTable *strings,
|
||||||
guchar *data,
|
uint8_t *data,
|
||||||
guint32 *offset);
|
uint32_t *offset);
|
||||||
|
|
||||||
const gchar * gi_ir_node_param_direction_string (GIIrNodeParam * node);
|
const char * gi_ir_node_param_direction_string (GIIrNodeParam * node);
|
||||||
const gchar * gi_ir_node_type_to_string (GIIrNodeTypeId type);
|
const char * gi_ir_node_type_to_string (GIIrNodeTypeId type);
|
||||||
|
|
||||||
GIIrNode *gi_ir_find_node (GIIrTypelibBuild *build,
|
GIIrNode *gi_ir_find_node (GIIrTypelibBuild *build,
|
||||||
GIIrModule *module,
|
GIIrModule *module,
|
||||||
|
@ -74,7 +74,7 @@ do { \
|
|||||||
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
|
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
|
||||||
|
|
||||||
|
|
||||||
const gchar *
|
const char *
|
||||||
gi_ir_node_type_to_string (GIIrNodeTypeId type)
|
gi_ir_node_type_to_string (GIIrNodeTypeId type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
@ -431,11 +431,11 @@ gi_ir_node_free (GIIrNode *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* returns the fixed size of the blob */
|
/* returns the fixed size of the blob */
|
||||||
guint32
|
uint32_t
|
||||||
gi_ir_node_get_size (GIIrNode *node)
|
gi_ir_node_get_size (GIIrNode *node)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
gint size, n;
|
size_t size, n;
|
||||||
|
|
||||||
switch (node->type)
|
switch (node->type)
|
||||||
{
|
{
|
||||||
@ -564,18 +564,20 @@ gi_ir_node_get_size (GIIrNode *node)
|
|||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug ("node %p type '%s' size %d", node,
|
g_debug ("node %p type '%s' size %zu", node,
|
||||||
gi_ir_node_type_to_string (node->type), size);
|
gi_ir_node_type_to_string (node->type), size);
|
||||||
|
|
||||||
|
g_assert (size <= G_MAXUINT32);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_attribute_size (gpointer key, gpointer value, gpointer data)
|
add_attribute_size (gpointer key, gpointer value, gpointer data)
|
||||||
{
|
{
|
||||||
const gchar *key_str = key;
|
const char *key_str = key;
|
||||||
const gchar *value_str = value;
|
const char *value_str = value;
|
||||||
gint *size_p = data;
|
size_t *size_p = data;
|
||||||
|
|
||||||
*size_p += sizeof (AttributeBlob);
|
*size_p += sizeof (AttributeBlob);
|
||||||
*size_p += ALIGN_VALUE (strlen (key_str) + 1, 4);
|
*size_p += ALIGN_VALUE (strlen (key_str) + 1, 4);
|
||||||
@ -583,12 +585,12 @@ add_attribute_size (gpointer key, gpointer value, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* returns the full size of the blob including variable-size parts (including attributes) */
|
/* returns the full size of the blob including variable-size parts (including attributes) */
|
||||||
static guint32
|
static uint32_t
|
||||||
gi_ir_node_get_full_size_internal (GIIrNode *parent,
|
gi_ir_node_get_full_size_internal (GIIrNode *parent,
|
||||||
GIIrNode *node)
|
GIIrNode *node)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
gint size, n;
|
size_t size, n;
|
||||||
|
|
||||||
if (node == NULL && parent != NULL)
|
if (node == NULL && parent != NULL)
|
||||||
g_error ("Caught NULL node, parent=%s", parent->name);
|
g_error ("Caught NULL node, parent=%s", parent->name);
|
||||||
@ -882,7 +884,7 @@ gi_ir_node_get_full_size_internal (GIIrNode *parent,
|
|||||||
size = 0;
|
size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug ("node %s%s%s%p type '%s' full size %d",
|
g_debug ("node %s%s%s%p type '%s' full size %zu",
|
||||||
node->name ? "'" : "",
|
node->name ? "'" : "",
|
||||||
node->name ? node->name : "",
|
node->name ? node->name : "",
|
||||||
node->name ? "' " : "",
|
node->name ? "' " : "",
|
||||||
@ -890,10 +892,12 @@ gi_ir_node_get_full_size_internal (GIIrNode *parent,
|
|||||||
|
|
||||||
g_hash_table_foreach (node->attributes, add_attribute_size, &size);
|
g_hash_table_foreach (node->attributes, add_attribute_size, &size);
|
||||||
|
|
||||||
|
g_assert (size <= G_MAXUINT32);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint32
|
uint32_t
|
||||||
gi_ir_node_get_full_size (GIIrNode *node)
|
gi_ir_node_get_full_size (GIIrNode *node)
|
||||||
{
|
{
|
||||||
return gi_ir_node_get_full_size_internal (NULL, node);
|
return gi_ir_node_get_full_size_internal (NULL, node);
|
||||||
@ -996,7 +1000,7 @@ gi_ir_node_add_member (GIIrNode *node,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *
|
const char *
|
||||||
gi_ir_node_param_direction_string (GIIrNodeParam * node)
|
gi_ir_node_param_direction_string (GIIrNodeParam * node)
|
||||||
{
|
{
|
||||||
if (node->out)
|
if (node->out)
|
||||||
@ -1009,26 +1013,26 @@ gi_ir_node_param_direction_string (GIIrNodeParam * node)
|
|||||||
return "in";
|
return "in";
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint64
|
static int64_t
|
||||||
parse_int_value (const gchar *str)
|
parse_int_value (const char *str)
|
||||||
{
|
{
|
||||||
return g_ascii_strtoll (str, NULL, 0);
|
return g_ascii_strtoll (str, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint64
|
static uint64_t
|
||||||
parse_uint_value (const gchar *str)
|
parse_uint_value (const char *str)
|
||||||
{
|
{
|
||||||
return g_ascii_strtoull (str, NULL, 0);
|
return g_ascii_strtoull (str, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gdouble
|
static double
|
||||||
parse_float_value (const gchar *str)
|
parse_float_value (const char *str)
|
||||||
{
|
{
|
||||||
return g_ascii_strtod (str, NULL);
|
return g_ascii_strtod (str, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
parse_boolean_value (const gchar *str)
|
parse_boolean_value (const char *str)
|
||||||
{
|
{
|
||||||
if (g_ascii_strcasecmp (str, "TRUE") == 0)
|
if (g_ascii_strcasecmp (str, "TRUE") == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1041,15 +1045,15 @@ parse_boolean_value (const gchar *str)
|
|||||||
|
|
||||||
static GIIrNode *
|
static GIIrNode *
|
||||||
find_entry_node (GIIrTypelibBuild *build,
|
find_entry_node (GIIrTypelibBuild *build,
|
||||||
const gchar *name,
|
const char *name,
|
||||||
guint16 *idx)
|
uint16_t *idx)
|
||||||
|
|
||||||
{
|
{
|
||||||
GIIrModule *module = build->module;
|
GIIrModule *module = build->module;
|
||||||
GList *l;
|
GList *l;
|
||||||
gint i;
|
size_t i;
|
||||||
gchar **names;
|
unsigned int n_names;
|
||||||
gint n_names;
|
char **names;
|
||||||
GIIrNode *result = NULL;
|
GIIrNode *result = NULL;
|
||||||
|
|
||||||
g_assert (name != NULL);
|
g_assert (name != NULL);
|
||||||
@ -1104,7 +1108,7 @@ find_entry_node (GIIrTypelibBuild *build,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gi_ir_module_fatal (build, -1, "type reference '%s' not found", name);
|
gi_ir_module_fatal (build, 0, "type reference '%s' not found", name);
|
||||||
out:
|
out:
|
||||||
|
|
||||||
g_strfreev (names);
|
g_strfreev (names);
|
||||||
@ -1112,11 +1116,11 @@ find_entry_node (GIIrTypelibBuild *build,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint16
|
static uint16_t
|
||||||
find_entry (GIIrTypelibBuild *build,
|
find_entry (GIIrTypelibBuild *build,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
guint16 idx = 0;
|
uint16_t idx = 0;
|
||||||
|
|
||||||
find_entry_node (build, name, &idx);
|
find_entry_node (build, name, &idx);
|
||||||
|
|
||||||
@ -1155,7 +1159,7 @@ gi_ir_find_node (GIIrTypelibBuild *build,
|
|||||||
GList *l;
|
GList *l;
|
||||||
GIIrNode *return_node = NULL;
|
GIIrNode *return_node = NULL;
|
||||||
char **names = g_strsplit (name, ".", 0);
|
char **names = g_strsplit (name, ".", 0);
|
||||||
gint n_names = g_strv_length (names);
|
unsigned n_names = g_strv_length (names);
|
||||||
const char *target_name;
|
const char *target_name;
|
||||||
GIIrModule *target_module;
|
GIIrModule *target_module;
|
||||||
|
|
||||||
@ -1196,7 +1200,7 @@ get_index_of_member_type (GIIrNodeInterface *node,
|
|||||||
GIIrNodeTypeId type,
|
GIIrNodeTypeId type,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
guint index = -1;
|
int index = -1;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
for (l = node->members; l; l = l->next)
|
for (l = node->members; l; l = l->next)
|
||||||
@ -1220,7 +1224,7 @@ serialize_type (GIIrTypelibBuild *build,
|
|||||||
GIIrNodeType *node,
|
GIIrNodeType *node,
|
||||||
GString *str)
|
GString *str)
|
||||||
{
|
{
|
||||||
gint i;
|
size_t i;
|
||||||
|
|
||||||
if (GI_TYPE_TAG_IS_BASIC (node->tag))
|
if (GI_TYPE_TAG_IS_BASIC (node->tag))
|
||||||
{
|
{
|
||||||
@ -1271,7 +1275,7 @@ serialize_type (GIIrTypelibBuild *build,
|
|||||||
else if (node->tag == GI_TYPE_TAG_INTERFACE)
|
else if (node->tag == GI_TYPE_TAG_INTERFACE)
|
||||||
{
|
{
|
||||||
GIIrNode *iface;
|
GIIrNode *iface;
|
||||||
gchar *name;
|
char *name;
|
||||||
|
|
||||||
iface = find_entry_node (build, node->giinterface, NULL);
|
iface = find_entry_node (build, node->giinterface, NULL);
|
||||||
if (iface)
|
if (iface)
|
||||||
@ -1341,12 +1345,12 @@ serialize_type (GIIrTypelibBuild *build,
|
|||||||
static void
|
static void
|
||||||
gi_ir_node_build_members (GList **members,
|
gi_ir_node_build_members (GList **members,
|
||||||
GIIrNodeTypeId type,
|
GIIrNodeTypeId type,
|
||||||
guint16 *count,
|
uint16_t *count,
|
||||||
GIIrNode *parent,
|
GIIrNode *parent,
|
||||||
GIIrTypelibBuild *build,
|
GIIrTypelibBuild *build,
|
||||||
guint32 *offset,
|
uint32_t *offset,
|
||||||
guint32 *offset2,
|
uint32_t *offset2,
|
||||||
guint16 *count2)
|
uint16_t *count2)
|
||||||
{
|
{
|
||||||
GList *l = *members;
|
GList *l = *members;
|
||||||
|
|
||||||
@ -1398,17 +1402,17 @@ void
|
|||||||
gi_ir_node_build_typelib (GIIrNode *node,
|
gi_ir_node_build_typelib (GIIrNode *node,
|
||||||
GIIrNode *parent,
|
GIIrNode *parent,
|
||||||
GIIrTypelibBuild *build,
|
GIIrTypelibBuild *build,
|
||||||
guint32 *offset,
|
uint32_t *offset,
|
||||||
guint32 *offset2,
|
uint32_t *offset2,
|
||||||
guint16 *count2)
|
uint16_t *count2)
|
||||||
{
|
{
|
||||||
gboolean appended_stack;
|
gboolean appended_stack;
|
||||||
GHashTable *strings = build->strings;
|
GHashTable *strings = build->strings;
|
||||||
GHashTable *types = build->types;
|
GHashTable *types = build->types;
|
||||||
guchar *data = build->data;
|
uint8_t *data = build->data;
|
||||||
GList *l;
|
GList *l;
|
||||||
guint32 old_offset = *offset;
|
uint32_t old_offset = *offset;
|
||||||
guint32 old_offset2 = *offset2;
|
uint32_t old_offset2 = *offset2;
|
||||||
|
|
||||||
g_assert (node != NULL);
|
g_assert (node != NULL);
|
||||||
|
|
||||||
@ -1455,7 +1459,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GString *str;
|
GString *str;
|
||||||
gchar *s;
|
char *s;
|
||||||
gpointer value;
|
gpointer value;
|
||||||
|
|
||||||
str = g_string_new (0);
|
str = g_string_new (0);
|
||||||
@ -1480,7 +1484,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
case GI_TYPE_TAG_ARRAY:
|
case GI_TYPE_TAG_ARRAY:
|
||||||
{
|
{
|
||||||
ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
|
ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
|
||||||
guint32 pos;
|
uint32_t pos;
|
||||||
|
|
||||||
array->pointer = type->is_pointer;
|
array->pointer = type->is_pointer;
|
||||||
array->reserved = 0;
|
array->reserved = 0;
|
||||||
@ -1523,7 +1527,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
case GI_TYPE_TAG_GSLIST:
|
case GI_TYPE_TAG_GSLIST:
|
||||||
{
|
{
|
||||||
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
|
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
|
||||||
guint32 pos;
|
uint32_t pos;
|
||||||
|
|
||||||
param->pointer = 1;
|
param->pointer = 1;
|
||||||
param->reserved = 0;
|
param->reserved = 0;
|
||||||
@ -1542,7 +1546,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
case GI_TYPE_TAG_GHASH:
|
case GI_TYPE_TAG_GHASH:
|
||||||
{
|
{
|
||||||
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
|
ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
|
||||||
guint32 pos;
|
uint32_t pos;
|
||||||
|
|
||||||
param->pointer = 1;
|
param->pointer = 1;
|
||||||
param->reserved = 0;
|
param->reserved = 0;
|
||||||
@ -1653,7 +1657,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
g_error ("Unknown setter %s for property %s:%s", prop->setter, parent->name, node->name);
|
g_error ("Unknown setter %s for property %s:%s", prop->setter, parent->name, node->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
blob->setter = (guint) index;
|
blob->setter = (uint16_t) index;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
blob->setter = ACCESSOR_SENTINEL;
|
blob->setter = ACCESSOR_SENTINEL;
|
||||||
@ -1668,7 +1672,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
g_error ("Unknown getter %s for property %s:%s", prop->getter, parent->name, node->name);
|
g_error ("Unknown getter %s for property %s:%s", prop->getter, parent->name, node->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
blob->getter = (guint) index;
|
blob->getter = (uint16_t) index;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
blob->getter = ACCESSOR_SENTINEL;
|
blob->getter = ACCESSOR_SENTINEL;
|
||||||
@ -1683,8 +1687,8 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
FunctionBlob *blob = (FunctionBlob *)&data[*offset];
|
FunctionBlob *blob = (FunctionBlob *)&data[*offset];
|
||||||
SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
|
SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
|
||||||
GIIrNodeFunction *function = (GIIrNodeFunction *)node;
|
GIIrNodeFunction *function = (GIIrNodeFunction *)node;
|
||||||
guint32 signature;
|
uint32_t signature;
|
||||||
gint n;
|
unsigned int n;
|
||||||
|
|
||||||
signature = *offset2;
|
signature = *offset2;
|
||||||
n = g_list_length (function->parameters);
|
n = g_list_length (function->parameters);
|
||||||
@ -1717,7 +1721,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
|
|
||||||
blob->setter = function->is_setter;
|
blob->setter = function->is_setter;
|
||||||
blob->getter = function->is_getter;
|
blob->getter = function->is_getter;
|
||||||
blob->index = (guint) index;
|
blob->index = (uint16_t) index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function->result is special since it doesn't appear in the serialized format but
|
/* function->result is special since it doesn't appear in the serialized format but
|
||||||
@ -1759,8 +1763,8 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
CallbackBlob *blob = (CallbackBlob *)&data[*offset];
|
CallbackBlob *blob = (CallbackBlob *)&data[*offset];
|
||||||
SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
|
SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
|
||||||
GIIrNodeFunction *function = (GIIrNodeFunction *)node;
|
GIIrNodeFunction *function = (GIIrNodeFunction *)node;
|
||||||
guint32 signature;
|
uint32_t signature;
|
||||||
gint n;
|
unsigned int n;
|
||||||
|
|
||||||
signature = *offset2;
|
signature = *offset2;
|
||||||
n = g_list_length (function->parameters);
|
n = g_list_length (function->parameters);
|
||||||
@ -1800,8 +1804,8 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
SignalBlob *blob = (SignalBlob *)&data[*offset];
|
SignalBlob *blob = (SignalBlob *)&data[*offset];
|
||||||
SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
|
SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
|
||||||
GIIrNodeSignal *signal = (GIIrNodeSignal *)node;
|
GIIrNodeSignal *signal = (GIIrNodeSignal *)node;
|
||||||
guint32 signature;
|
uint32_t signature;
|
||||||
gint n;
|
unsigned int n;
|
||||||
|
|
||||||
signature = *offset2;
|
signature = *offset2;
|
||||||
n = g_list_length (signal->parameters);
|
n = g_list_length (signal->parameters);
|
||||||
@ -1858,8 +1862,8 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
VFuncBlob *blob = (VFuncBlob *)&data[*offset];
|
VFuncBlob *blob = (VFuncBlob *)&data[*offset];
|
||||||
SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
|
SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
|
||||||
GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node;
|
GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node;
|
||||||
guint32 signature;
|
uint32_t signature;
|
||||||
gint n;
|
unsigned int n;
|
||||||
|
|
||||||
signature = *offset2;
|
signature = *offset2;
|
||||||
n = g_list_length (vfunc->parameters);
|
n = g_list_length (vfunc->parameters);
|
||||||
@ -1882,7 +1886,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
{
|
{
|
||||||
g_error ("Unknown member function %s for vfunc %s", vfunc->invoker, node->name);
|
g_error ("Unknown member function %s for vfunc %s", vfunc->invoker, node->name);
|
||||||
}
|
}
|
||||||
blob->invoker = (guint) index;
|
blob->invoker = (uint16_t) index;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
blob->invoker = 0x3ff; /* max of 10 bits */
|
blob->invoker = 0x3ff; /* max of 10 bits */
|
||||||
@ -2204,7 +2208,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
for (l = object->interfaces; l; l = l->next)
|
for (l = object->interfaces; l; l = l->next)
|
||||||
{
|
{
|
||||||
blob->n_interfaces++;
|
blob->n_interfaces++;
|
||||||
*(guint16*)&data[*offset] = find_entry (build, (gchar *)l->data);
|
*(uint16_t *)&data[*offset] = find_entry (build, (char *)l->data);
|
||||||
*offset += 2;
|
*offset += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2267,7 +2271,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
for (l = iface->prerequisites; l; l = l->next)
|
for (l = iface->prerequisites; l; l = l->next)
|
||||||
{
|
{
|
||||||
blob->n_prerequisites++;
|
blob->n_prerequisites++;
|
||||||
*(guint16*)&data[*offset] = find_entry (build, (gchar *)l->data);
|
*(uint16_t *)&data[*offset] = find_entry (build, (char *)l->data);
|
||||||
*offset += 2;
|
*offset += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2310,7 +2314,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
blob->reserved = 0;
|
blob->reserved = 0;
|
||||||
blob->unsigned_value = value->value >= 0 ? 1 : 0;
|
blob->unsigned_value = value->value >= 0 ? 1 : 0;
|
||||||
blob->name = gi_ir_write_string (node->name, strings, data, offset2);
|
blob->name = gi_ir_write_string (node->name, strings, data, offset2);
|
||||||
blob->value = (gint32)value->value;
|
blob->value = (int32_t) value->value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2318,7 +2322,7 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
{
|
{
|
||||||
GIIrNodeConstant *constant = (GIIrNodeConstant *)node;
|
GIIrNodeConstant *constant = (GIIrNodeConstant *)node;
|
||||||
ConstantBlob *blob = (ConstantBlob *)&data[*offset];
|
ConstantBlob *blob = (ConstantBlob *)&data[*offset];
|
||||||
guint32 pos;
|
uint32_t pos;
|
||||||
|
|
||||||
pos = *offset + G_STRUCT_OFFSET (ConstantBlob, type);
|
pos = *offset + G_STRUCT_OFFSET (ConstantBlob, type);
|
||||||
*offset += sizeof (ConstantBlob);
|
*offset += sizeof (ConstantBlob);
|
||||||
@ -2337,43 +2341,43 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT8:
|
case GI_TYPE_TAG_INT8:
|
||||||
blob->size = 1;
|
blob->size = 1;
|
||||||
*(gint8*)&data[blob->offset] = (gint8) parse_int_value (constant->value);
|
*(int8_t *)&data[blob->offset] = (int8_t) parse_int_value (constant->value);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT8:
|
case GI_TYPE_TAG_UINT8:
|
||||||
blob->size = 1;
|
blob->size = 1;
|
||||||
*(guint8*)&data[blob->offset] = (guint8) parse_uint_value (constant->value);
|
*(uint8_t *)&data[blob->offset] = (uint8_t) parse_uint_value (constant->value);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT16:
|
case GI_TYPE_TAG_INT16:
|
||||||
blob->size = 2;
|
blob->size = 2;
|
||||||
*(gint16*)&data[blob->offset] = (gint16) parse_int_value (constant->value);
|
*(int16_t *)&data[blob->offset] = (int16_t) parse_int_value (constant->value);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT16:
|
case GI_TYPE_TAG_UINT16:
|
||||||
blob->size = 2;
|
blob->size = 2;
|
||||||
*(guint16*)&data[blob->offset] = (guint16) parse_uint_value (constant->value);
|
*(uint16_t *)&data[blob->offset] = (uint16_t) parse_uint_value (constant->value);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT32:
|
case GI_TYPE_TAG_INT32:
|
||||||
blob->size = 4;
|
blob->size = 4;
|
||||||
*(gint32*)&data[blob->offset] = (gint32) parse_int_value (constant->value);
|
*(int32_t *)&data[blob->offset] = (int32_t) parse_int_value (constant->value);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT32:
|
case GI_TYPE_TAG_UINT32:
|
||||||
blob->size = 4;
|
blob->size = 4;
|
||||||
*(guint32*)&data[blob->offset] = (guint32) parse_uint_value (constant->value);
|
*(uint32_t*)&data[blob->offset] = (uint32_t) parse_uint_value (constant->value);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT64:
|
case GI_TYPE_TAG_INT64:
|
||||||
blob->size = 8;
|
blob->size = 8;
|
||||||
DO_ALIGNED_COPY(&data[blob->offset], parse_int_value (constant->value), gint64);
|
DO_ALIGNED_COPY (&data[blob->offset], parse_int_value (constant->value), int64_t);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT64:
|
case GI_TYPE_TAG_UINT64:
|
||||||
blob->size = 8;
|
blob->size = 8;
|
||||||
DO_ALIGNED_COPY(&data[blob->offset], parse_uint_value (constant->value), guint64);
|
DO_ALIGNED_COPY (&data[blob->offset], parse_uint_value (constant->value), uint64_t);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_FLOAT:
|
case GI_TYPE_TAG_FLOAT:
|
||||||
blob->size = sizeof (gfloat);
|
blob->size = sizeof (float);
|
||||||
DO_ALIGNED_COPY(&data[blob->offset], parse_float_value (constant->value), gfloat);
|
DO_ALIGNED_COPY (&data[blob->offset], parse_float_value (constant->value), float);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_DOUBLE:
|
case GI_TYPE_TAG_DOUBLE:
|
||||||
blob->size = sizeof (gdouble);
|
blob->size = sizeof (double);
|
||||||
DO_ALIGNED_COPY(&data[blob->offset], parse_float_value (constant->value), gdouble);
|
DO_ALIGNED_COPY (&data[blob->offset], parse_float_value (constant->value), double);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UTF8:
|
case GI_TYPE_TAG_UTF8:
|
||||||
case GI_TYPE_TAG_FILENAME:
|
case GI_TYPE_TAG_FILENAME:
|
||||||
@ -2411,14 +2415,14 @@ gi_ir_node_build_typelib (GIIrNode *node,
|
|||||||
* to the typelib at offset, put it in the pool and update offset. If the
|
* to the typelib at offset, put it in the pool and update offset. If the
|
||||||
* typelib is not large enough to hold the string, reallocate it.
|
* typelib is not large enough to hold the string, reallocate it.
|
||||||
*/
|
*/
|
||||||
guint32
|
uint32_t
|
||||||
gi_ir_write_string (const gchar *str,
|
gi_ir_write_string (const char *str,
|
||||||
GHashTable *strings,
|
GHashTable *strings,
|
||||||
guchar *data,
|
uint8_t *data,
|
||||||
guint32 *offset)
|
uint32_t *offset)
|
||||||
{
|
{
|
||||||
gpointer value;
|
uint32_t start;
|
||||||
guint32 start;
|
void *value;
|
||||||
|
|
||||||
string_count += 1;
|
string_count += 1;
|
||||||
string_size += strlen (str);
|
string_size += strlen (str);
|
||||||
@ -2431,12 +2435,12 @@ gi_ir_write_string (const gchar *str,
|
|||||||
unique_string_count += 1;
|
unique_string_count += 1;
|
||||||
unique_string_size += strlen (str);
|
unique_string_size += strlen (str);
|
||||||
|
|
||||||
g_hash_table_insert (strings, (gpointer)str, GUINT_TO_POINTER (*offset));
|
g_hash_table_insert (strings, (void *)str, GUINT_TO_POINTER (*offset));
|
||||||
|
|
||||||
start = *offset;
|
start = *offset;
|
||||||
*offset = ALIGN_VALUE (start + strlen (str) + 1, 4);
|
*offset = ALIGN_VALUE (start + strlen (str) + 1, 4);
|
||||||
|
|
||||||
strcpy ((gchar*)&data[start], str);
|
strcpy ((char *)&data[start], str);
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ typedef enum {
|
|||||||
} Enum5;
|
} Enum5;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ENUM_6 = ((guint)G_MAXINT) + 1 /* compiler could use uint32 */
|
ENUM_6 = ((unsigned int)G_MAXINT) + 1 /* compiler could use uint32 */
|
||||||
} Enum6;
|
} Enum6;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -73,8 +73,8 @@ static void
|
|||||||
compute_enum_storage_type (GIIrNodeEnum *enum_node)
|
compute_enum_storage_type (GIIrNodeEnum *enum_node)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
gint64 max_value = 0;
|
int64_t max_value = 0;
|
||||||
gint64 min_value = 0;
|
int64_t min_value = 0;
|
||||||
int width;
|
int width;
|
||||||
gboolean signed_type;
|
gboolean signed_type;
|
||||||
|
|
||||||
@ -106,32 +106,32 @@ compute_enum_storage_type (GIIrNodeEnum *enum_node)
|
|||||||
if (max_value <= 127)
|
if (max_value <= 127)
|
||||||
{
|
{
|
||||||
width = sizeof (Enum1);
|
width = sizeof (Enum1);
|
||||||
signed_type = (gint64)(Enum1)(-1) < 0;
|
signed_type = (int64_t)(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 = (int64_t)(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 = (int64_t)(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 = (int64_t)(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 = (int64_t)(Enum5)(-1) < 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
width = sizeof (Enum6);
|
width = sizeof (Enum6);
|
||||||
signed_type = (gint64)(Enum6)(-1) < 0;
|
signed_type = (int64_t)(Enum6)(-1) < 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,8 +149,8 @@ compute_enum_storage_type (GIIrNodeEnum *enum_node)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
get_enum_size_alignment (GIIrNodeEnum *enum_node,
|
get_enum_size_alignment (GIIrNodeEnum *enum_node,
|
||||||
gint *size,
|
size_t *size,
|
||||||
gint *alignment)
|
gssize *alignment)
|
||||||
{
|
{
|
||||||
ffi_type *type_ffi;
|
ffi_type *type_ffi;
|
||||||
|
|
||||||
@ -188,8 +188,8 @@ get_enum_size_alignment (GIIrNodeEnum *enum_node,
|
|||||||
static gboolean
|
static gboolean
|
||||||
get_interface_size_alignment (GIIrTypelibBuild *build,
|
get_interface_size_alignment (GIIrTypelibBuild *build,
|
||||||
GIIrNodeType *type,
|
GIIrNodeType *type,
|
||||||
gint *size,
|
size_t *size,
|
||||||
gint *alignment,
|
gssize *alignment,
|
||||||
const char *who)
|
const char *who)
|
||||||
{
|
{
|
||||||
GIIrNode *iface;
|
GIIrNode *iface;
|
||||||
@ -265,8 +265,8 @@ get_interface_size_alignment (GIIrTypelibBuild *build,
|
|||||||
static gboolean
|
static gboolean
|
||||||
get_type_size_alignment (GIIrTypelibBuild *build,
|
get_type_size_alignment (GIIrTypelibBuild *build,
|
||||||
GIIrNodeType *type,
|
GIIrNodeType *type,
|
||||||
gint *size,
|
size_t *size,
|
||||||
gint *alignment,
|
gssize *alignment,
|
||||||
const char *who)
|
const char *who)
|
||||||
{
|
{
|
||||||
ffi_type *type_ffi;
|
ffi_type *type_ffi;
|
||||||
@ -277,7 +277,8 @@ get_type_size_alignment (GIIrTypelibBuild *build,
|
|||||||
}
|
}
|
||||||
else if (type->tag == GI_TYPE_TAG_ARRAY)
|
else if (type->tag == GI_TYPE_TAG_ARRAY)
|
||||||
{
|
{
|
||||||
gint elt_size, elt_alignment;
|
size_t elt_size;
|
||||||
|
gssize elt_alignment;
|
||||||
|
|
||||||
if (!type->has_size
|
if (!type->has_size
|
||||||
|| !get_type_size_alignment(build, type->parameter_type1,
|
|| !get_type_size_alignment(build, type->parameter_type1,
|
||||||
@ -333,11 +334,11 @@ static gboolean
|
|||||||
get_field_size_alignment (GIIrTypelibBuild *build,
|
get_field_size_alignment (GIIrTypelibBuild *build,
|
||||||
GIIrNodeField *field,
|
GIIrNodeField *field,
|
||||||
GIIrNode *parent_node,
|
GIIrNode *parent_node,
|
||||||
gint *size,
|
size_t *size,
|
||||||
gint *alignment)
|
gssize *alignment)
|
||||||
{
|
{
|
||||||
GIIrModule *module = build->module;
|
GIIrModule *module = build->module;
|
||||||
gchar *who;
|
char *who;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
who = g_strdup_printf ("field %s.%s.%s", module->name, parent_node->name, ((GIIrNode *)field)->name);
|
who = g_strdup_printf ("field %s.%s.%s", module->name, parent_node->name, ((GIIrNode *)field)->name);
|
||||||
@ -361,8 +362,8 @@ static gboolean
|
|||||||
compute_struct_field_offsets (GIIrTypelibBuild *build,
|
compute_struct_field_offsets (GIIrTypelibBuild *build,
|
||||||
GIIrNode *node,
|
GIIrNode *node,
|
||||||
GList *members,
|
GList *members,
|
||||||
gint *size_out,
|
size_t *size_out,
|
||||||
gint *alignment_out)
|
gssize *alignment_out)
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
int alignment = 1;
|
int alignment = 1;
|
||||||
@ -381,8 +382,8 @@ compute_struct_field_offsets (GIIrTypelibBuild *build,
|
|||||||
|
|
||||||
if (!have_error)
|
if (!have_error)
|
||||||
{
|
{
|
||||||
int member_size;
|
size_t member_size;
|
||||||
int member_alignment;
|
gssize 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))
|
||||||
@ -428,10 +429,10 @@ static gboolean
|
|||||||
compute_union_field_offsets (GIIrTypelibBuild *build,
|
compute_union_field_offsets (GIIrTypelibBuild *build,
|
||||||
GIIrNode *node,
|
GIIrNode *node,
|
||||||
GList *members,
|
GList *members,
|
||||||
gint *size_out,
|
size_t *size_out,
|
||||||
gint *alignment_out)
|
gssize *alignment_out)
|
||||||
{
|
{
|
||||||
int size = 0;
|
size_t size = 0;
|
||||||
int alignment = 1;
|
int alignment = 1;
|
||||||
GList *l;
|
GList *l;
|
||||||
gboolean have_error = FALSE;
|
gboolean have_error = FALSE;
|
||||||
@ -448,8 +449,8 @@ compute_union_field_offsets (GIIrTypelibBuild *build,
|
|||||||
|
|
||||||
if (!have_error)
|
if (!have_error)
|
||||||
{
|
{
|
||||||
int member_size;
|
size_t member_size;
|
||||||
int member_alignment;
|
gssize 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))
|
||||||
@ -483,7 +484,7 @@ compute_union_field_offsets (GIIrTypelibBuild *build,
|
|||||||
static gboolean
|
static gboolean
|
||||||
check_needs_computation (GIIrTypelibBuild *build,
|
check_needs_computation (GIIrTypelibBuild *build,
|
||||||
GIIrNode *node,
|
GIIrNode *node,
|
||||||
gint alignment)
|
int alignment)
|
||||||
{
|
{
|
||||||
GIIrModule *module = build->module;
|
GIIrModule *module = build->module;
|
||||||
/*
|
/*
|
||||||
|
@ -34,16 +34,16 @@ typedef struct _GIIrParser GIIrParser;
|
|||||||
GIIrParser *gi_ir_parser_new (void);
|
GIIrParser *gi_ir_parser_new (void);
|
||||||
void gi_ir_parser_free (GIIrParser *parser);
|
void gi_ir_parser_free (GIIrParser *parser);
|
||||||
void gi_ir_parser_set_includes (GIIrParser *parser,
|
void gi_ir_parser_set_includes (GIIrParser *parser,
|
||||||
const gchar *const *includes);
|
const char *const *includes);
|
||||||
|
|
||||||
GIIrModule *gi_ir_parser_parse_string (GIIrParser *parser,
|
GIIrModule *gi_ir_parser_parse_string (GIIrParser *parser,
|
||||||
const gchar *namespace,
|
const char *namespace,
|
||||||
const gchar *filename,
|
const char *filename,
|
||||||
const gchar *buffer,
|
const char *buffer,
|
||||||
gssize length,
|
gssize length,
|
||||||
GError **error);
|
GError **error);
|
||||||
GIIrModule *gi_ir_parser_parse_file (GIIrParser *parser,
|
GIIrModule *gi_ir_parser_parse_file (GIIrParser *parser,
|
||||||
const gchar *filename,
|
const char *filename,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -58,8 +58,8 @@
|
|||||||
|
|
||||||
struct _GIIrParser
|
struct _GIIrParser
|
||||||
{
|
{
|
||||||
gchar **includes;
|
char **includes;
|
||||||
gchar **gi_gir_path;
|
char **gi_gir_path;
|
||||||
GList *parsed_modules; /* All previously parsed modules */
|
GList *parsed_modules; /* All previously parsed modules */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -133,23 +133,23 @@ struct _ParseContext
|
|||||||
#define CURRENT_NODE(ctx) ((GIIrNode *)((ctx)->node_stack->data))
|
#define CURRENT_NODE(ctx) ((GIIrNode *)((ctx)->node_stack->data))
|
||||||
|
|
||||||
static void start_element_handler (GMarkupParseContext *context,
|
static void start_element_handler (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
gpointer user_data,
|
void *user_data,
|
||||||
GError **error);
|
GError **error);
|
||||||
static void end_element_handler (GMarkupParseContext *context,
|
static void end_element_handler (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
gpointer user_data,
|
void *user_data,
|
||||||
GError **error);
|
GError **error);
|
||||||
static void text_handler (GMarkupParseContext *context,
|
static void text_handler (GMarkupParseContext *context,
|
||||||
const gchar *text,
|
const char *text,
|
||||||
gsize text_len,
|
gsize text_len,
|
||||||
gpointer user_data,
|
void *user_data,
|
||||||
GError **error);
|
GError **error);
|
||||||
static void cleanup (GMarkupParseContext *context,
|
static void cleanup (GMarkupParseContext *context,
|
||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data);
|
void *user_data);
|
||||||
static void state_switch (ParseContext *ctx, ParseState newstate);
|
static void state_switch (ParseContext *ctx, ParseState newstate);
|
||||||
|
|
||||||
|
|
||||||
@ -164,22 +164,22 @@ static GMarkupParser markup_parser =
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_alias (GMarkupParseContext *context,
|
start_alias (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error);
|
GError **error);
|
||||||
static gboolean
|
static gboolean
|
||||||
start_type (GMarkupParseContext *context,
|
start_type (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
static const gchar *find_attribute (const gchar *name,
|
static const char *find_attribute (const char *name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values);
|
const char **attribute_values);
|
||||||
|
|
||||||
|
|
||||||
GIIrParser *
|
GIIrParser *
|
||||||
@ -210,7 +210,7 @@ gi_ir_parser_free (GIIrParser *parser)
|
|||||||
|
|
||||||
void
|
void
|
||||||
gi_ir_parser_set_includes (GIIrParser *parser,
|
gi_ir_parser_set_includes (GIIrParser *parser,
|
||||||
const gchar *const *includes)
|
const char *const *includes)
|
||||||
{
|
{
|
||||||
g_strfreev (parser->includes);
|
g_strfreev (parser->includes);
|
||||||
|
|
||||||
@ -219,10 +219,10 @@ gi_ir_parser_set_includes (GIIrParser *parser,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
firstpass_start_element_handler (GMarkupParseContext *context,
|
firstpass_start_element_handler (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
gpointer user_data,
|
void *user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ParseContext *ctx = user_data;
|
ParseContext *ctx = user_data;
|
||||||
@ -239,9 +239,9 @@ firstpass_start_element_handler (GMarkupParseContext *context,
|
|||||||
}
|
}
|
||||||
else if (strcmp (element_name, "record") == 0)
|
else if (strcmp (element_name, "record") == 0)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *disguised;
|
const char *disguised;
|
||||||
const gchar *pointer;
|
const char *pointer;
|
||||||
|
|
||||||
name = find_attribute ("name", attribute_names, attribute_values);
|
name = find_attribute ("name", attribute_names, attribute_values);
|
||||||
disguised = find_attribute ("disguised", attribute_names, attribute_values);
|
disguised = find_attribute ("disguised", attribute_names, attribute_values);
|
||||||
@ -266,7 +266,7 @@ firstpass_start_element_handler (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
firstpass_end_element_handler (GMarkupParseContext *context,
|
firstpass_end_element_handler (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -294,8 +294,8 @@ static char *
|
|||||||
locate_gir (GIIrParser *parser,
|
locate_gir (GIIrParser *parser,
|
||||||
const char *girname)
|
const char *girname)
|
||||||
{
|
{
|
||||||
const gchar *const *datadirs;
|
const char *const *datadirs;
|
||||||
const gchar *const *dir;
|
const char *const *dir;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
|
|
||||||
g_debug ("Looking for %s", girname);
|
g_debug ("Looking for %s", girname);
|
||||||
@ -303,7 +303,7 @@ locate_gir (GIIrParser *parser,
|
|||||||
|
|
||||||
if (parser->includes != NULL)
|
if (parser->includes != NULL)
|
||||||
{
|
{
|
||||||
for (dir = (const gchar *const *)parser->includes; *dir; dir++)
|
for (dir = (const char *const *)parser->includes; *dir; dir++)
|
||||||
{
|
{
|
||||||
path = g_build_filename (*dir, girname, NULL);
|
path = g_build_filename (*dir, girname, NULL);
|
||||||
g_debug ("Trying %s from includes", path);
|
g_debug ("Trying %s from includes", path);
|
||||||
@ -315,7 +315,7 @@ locate_gir (GIIrParser *parser,
|
|||||||
|
|
||||||
if (parser->gi_gir_path != NULL)
|
if (parser->gi_gir_path != NULL)
|
||||||
{
|
{
|
||||||
for (dir = (const gchar *const *) parser->gi_gir_path; *dir; dir++)
|
for (dir = (const char *const *) parser->gi_gir_path; *dir; dir++)
|
||||||
{
|
{
|
||||||
if (**dir == '\0')
|
if (**dir == '\0')
|
||||||
continue;
|
continue;
|
||||||
@ -378,12 +378,12 @@ locate_gir (GIIrParser *parser,
|
|||||||
line_number, char_number, attribute, element); \
|
line_number, char_number, attribute, element); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static const gchar *
|
static const char *
|
||||||
find_attribute (const gchar *name,
|
find_attribute (const char *name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values)
|
const char **attribute_values)
|
||||||
{
|
{
|
||||||
gint i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; attribute_names[i] != NULL; i++)
|
for (i = 0; attribute_names[i] != NULL; i++)
|
||||||
if (strcmp (attribute_names[i], name) == 0)
|
if (strcmp (attribute_names[i], name) == 0)
|
||||||
@ -428,13 +428,15 @@ push_node (ParseContext *ctx, GIIrNode *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GIIrNodeType * parse_type_internal (GIIrModule *module,
|
static GIIrNodeType * parse_type_internal (GIIrModule *module,
|
||||||
const gchar *str, gchar **next, gboolean in_glib,
|
const char *str,
|
||||||
|
char **next,
|
||||||
|
gboolean in_glib,
|
||||||
gboolean in_gobject);
|
gboolean in_gobject);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const gchar *str;
|
const char *str;
|
||||||
guint size;
|
size_t size;
|
||||||
guint is_signed : 1;
|
unsigned int is_signed : 1;
|
||||||
} IntegerAliasInfo;
|
} IntegerAliasInfo;
|
||||||
|
|
||||||
static IntegerAliasInfo integer_aliases[] = {
|
static IntegerAliasInfo integer_aliases[] = {
|
||||||
@ -453,8 +455,8 @@ static IntegerAliasInfo integer_aliases[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const gchar *str;
|
const char *str;
|
||||||
gint tag;
|
int tag;
|
||||||
gboolean pointer;
|
gboolean pointer;
|
||||||
} BasicTypeInfo;
|
} BasicTypeInfo;
|
||||||
|
|
||||||
@ -484,8 +486,8 @@ static BasicTypeInfo basic_types[] = {
|
|||||||
static const BasicTypeInfo *
|
static const BasicTypeInfo *
|
||||||
parse_basic (const char *str)
|
parse_basic (const char *str)
|
||||||
{
|
{
|
||||||
guint i;
|
size_t i;
|
||||||
guint n_basic = G_N_ELEMENTS (basic_types);
|
size_t n_basic = G_N_ELEMENTS (basic_types);
|
||||||
|
|
||||||
for (i = 0; i < n_basic; i++)
|
for (i = 0; i < n_basic; i++)
|
||||||
{
|
{
|
||||||
@ -498,25 +500,25 @@ parse_basic (const char *str)
|
|||||||
{
|
{
|
||||||
switch (integer_aliases[i].size)
|
switch (integer_aliases[i].size)
|
||||||
{
|
{
|
||||||
case sizeof(guint8):
|
case sizeof (uint8_t):
|
||||||
if (integer_aliases[i].is_signed)
|
if (integer_aliases[i].is_signed)
|
||||||
return &basic_types[BASIC_TYPE_FIXED_OFFSET];
|
return &basic_types[BASIC_TYPE_FIXED_OFFSET];
|
||||||
else
|
else
|
||||||
return &basic_types[BASIC_TYPE_FIXED_OFFSET+1];
|
return &basic_types[BASIC_TYPE_FIXED_OFFSET+1];
|
||||||
break;
|
break;
|
||||||
case sizeof(guint16):
|
case sizeof (uint16_t):
|
||||||
if (integer_aliases[i].is_signed)
|
if (integer_aliases[i].is_signed)
|
||||||
return &basic_types[BASIC_TYPE_FIXED_OFFSET+2];
|
return &basic_types[BASIC_TYPE_FIXED_OFFSET+2];
|
||||||
else
|
else
|
||||||
return &basic_types[BASIC_TYPE_FIXED_OFFSET+3];
|
return &basic_types[BASIC_TYPE_FIXED_OFFSET+3];
|
||||||
break;
|
break;
|
||||||
case sizeof(guint32):
|
case sizeof (uint32_t):
|
||||||
if (integer_aliases[i].is_signed)
|
if (integer_aliases[i].is_signed)
|
||||||
return &basic_types[BASIC_TYPE_FIXED_OFFSET+4];
|
return &basic_types[BASIC_TYPE_FIXED_OFFSET+4];
|
||||||
else
|
else
|
||||||
return &basic_types[BASIC_TYPE_FIXED_OFFSET+5];
|
return &basic_types[BASIC_TYPE_FIXED_OFFSET+5];
|
||||||
break;
|
break;
|
||||||
case sizeof(guint64):
|
case sizeof (uint64_t):
|
||||||
if (integer_aliases[i].is_signed)
|
if (integer_aliases[i].is_signed)
|
||||||
return &basic_types[BASIC_TYPE_FIXED_OFFSET+6];
|
return &basic_types[BASIC_TYPE_FIXED_OFFSET+6];
|
||||||
else
|
else
|
||||||
@ -532,7 +534,7 @@ parse_basic (const char *str)
|
|||||||
|
|
||||||
static GIIrNodeType *
|
static GIIrNodeType *
|
||||||
parse_type_internal (GIIrModule *module,
|
parse_type_internal (GIIrModule *module,
|
||||||
const gchar *str,
|
const char *str,
|
||||||
char **next,
|
char **next,
|
||||||
gboolean in_glib,
|
gboolean in_glib,
|
||||||
gboolean in_gobject)
|
gboolean in_gobject)
|
||||||
@ -676,13 +678,13 @@ parse_type_internal (GIIrModule *module,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
resolve_aliases (ParseContext *ctx, const gchar *type)
|
resolve_aliases (ParseContext *ctx, const char *type)
|
||||||
{
|
{
|
||||||
gpointer orig;
|
void *orig;
|
||||||
gpointer value;
|
void *value;
|
||||||
GSList *seen_values = NULL;
|
GSList *seen_values = NULL;
|
||||||
const gchar *lookup;
|
const char *lookup;
|
||||||
gchar *prefixed;
|
char *prefixed;
|
||||||
|
|
||||||
if (strchr (type, '.') == NULL)
|
if (strchr (type, '.') == NULL)
|
||||||
{
|
{
|
||||||
@ -703,7 +705,7 @@ resolve_aliases (ParseContext *ctx, const gchar *type)
|
|||||||
if (g_slist_find_custom (seen_values, lookup,
|
if (g_slist_find_custom (seen_values, lookup,
|
||||||
(GCompareFunc)strcmp) != NULL)
|
(GCompareFunc)strcmp) != NULL)
|
||||||
break;
|
break;
|
||||||
seen_values = g_slist_prepend (seen_values, (gchar*)lookup);
|
seen_values = g_slist_prepend (seen_values, (char*) lookup);
|
||||||
}
|
}
|
||||||
g_slist_free (seen_values);
|
g_slist_free (seen_values);
|
||||||
|
|
||||||
@ -717,12 +719,12 @@ resolve_aliases (ParseContext *ctx, const gchar *type)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
is_pointer_or_disguised_structure (ParseContext *ctx,
|
is_pointer_or_disguised_structure (ParseContext *ctx,
|
||||||
const gchar *type,
|
const char *type,
|
||||||
gboolean *is_pointer,
|
gboolean *is_pointer,
|
||||||
gboolean *is_disguised)
|
gboolean *is_disguised)
|
||||||
{
|
{
|
||||||
const gchar *lookup;
|
const char *lookup;
|
||||||
gchar *prefixed;
|
char *prefixed;
|
||||||
|
|
||||||
if (strchr (type, '.') == NULL)
|
if (strchr (type, '.') == NULL)
|
||||||
{
|
{
|
||||||
@ -744,7 +746,7 @@ is_pointer_or_disguised_structure (ParseContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GIIrNodeType *
|
static GIIrNodeType *
|
||||||
parse_type (ParseContext *ctx, const gchar *type)
|
parse_type (ParseContext *ctx, const char *type)
|
||||||
{
|
{
|
||||||
GIIrNodeType *node;
|
GIIrNodeType *node;
|
||||||
const BasicTypeInfo *basic;
|
const BasicTypeInfo *basic;
|
||||||
@ -769,13 +771,13 @@ parse_type (ParseContext *ctx, const gchar *type)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
introspectable_prelude (GMarkupParseContext *context,
|
introspectable_prelude (GMarkupParseContext *context,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
ParseState new_state)
|
ParseState new_state)
|
||||||
{
|
{
|
||||||
const gchar *introspectable_arg;
|
const char *introspectable_arg;
|
||||||
const gchar *shadowed_by;
|
const char *shadowed_by;
|
||||||
gboolean introspectable;
|
gboolean introspectable;
|
||||||
|
|
||||||
g_assert (ctx->state != STATE_PASSTHROUGH);
|
g_assert (ctx->state != STATE_PASSTHROUGH);
|
||||||
@ -795,16 +797,16 @@ introspectable_prelude (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_glib_boxed (GMarkupParseContext *context,
|
start_glib_boxed (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *typename;
|
const char *typename;
|
||||||
const gchar *typeinit;
|
const char *typeinit;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
GIIrNodeBoxed *boxed;
|
GIIrNodeBoxed *boxed;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "glib:boxed") == 0 &&
|
if (!(strcmp (element_name, "glib:boxed") == 0 &&
|
||||||
@ -855,19 +857,19 @@ start_glib_boxed (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_function (GMarkupParseContext *context,
|
start_function (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *shadows;
|
const char *shadows;
|
||||||
const gchar *symbol;
|
const char *symbol;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
const gchar *throws;
|
const char *throws;
|
||||||
const gchar *set_property;
|
const char *set_property;
|
||||||
const gchar *get_property;
|
const char *get_property;
|
||||||
GIIrNodeFunction *function;
|
GIIrNodeFunction *function;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
ParseState in_embedded_state = STATE_NONE;
|
ParseState in_embedded_state = STATE_NONE;
|
||||||
@ -1055,7 +1057,7 @@ start_function (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
parse_property_transfer (GIIrNodeProperty *property,
|
parse_property_transfer (GIIrNodeProperty *property,
|
||||||
const gchar *transfer,
|
const char *transfer,
|
||||||
ParseContext *ctx)
|
ParseContext *ctx)
|
||||||
{
|
{
|
||||||
if (transfer == NULL)
|
if (transfer == NULL)
|
||||||
@ -1095,7 +1097,7 @@ parse_property_transfer (GIIrNodeProperty *property,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
parse_param_transfer (GIIrNodeParam *param, const gchar *transfer, const gchar *name,
|
parse_param_transfer (GIIrNodeParam *param, const char *transfer, const char *name,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
if (transfer == NULL)
|
if (transfer == NULL)
|
||||||
@ -1132,13 +1134,13 @@ parse_param_transfer (GIIrNodeParam *param, const gchar *transfer, const gchar *
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_instance_parameter (GMarkupParseContext *context,
|
start_instance_parameter (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *transfer;
|
const char *transfer;
|
||||||
gboolean transfer_full;
|
gboolean transfer_full;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "instance-parameter") == 0 &&
|
if (!(strcmp (element_name, "instance-parameter") == 0 &&
|
||||||
@ -1197,24 +1199,24 @@ start_instance_parameter (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_parameter (GMarkupParseContext *context,
|
start_parameter (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *direction;
|
const char *direction;
|
||||||
const gchar *retval;
|
const char *retval;
|
||||||
const gchar *optional;
|
const char *optional;
|
||||||
const gchar *caller_allocates;
|
const char *caller_allocates;
|
||||||
const gchar *allow_none;
|
const char *allow_none;
|
||||||
const gchar *transfer;
|
const char *transfer;
|
||||||
const gchar *scope;
|
const char *scope;
|
||||||
const gchar *closure;
|
const char *closure;
|
||||||
const gchar *destroy;
|
const char *destroy;
|
||||||
const gchar *skip;
|
const char *skip;
|
||||||
const gchar *nullable;
|
const char *nullable;
|
||||||
GIIrNodeParam *param;
|
GIIrNodeParam *param;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "parameter") == 0 &&
|
if (!(strcmp (element_name, "parameter") == 0 &&
|
||||||
@ -1350,17 +1352,17 @@ start_parameter (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_field (GMarkupParseContext *context,
|
start_field (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *readable;
|
const char *readable;
|
||||||
const gchar *writable;
|
const char *writable;
|
||||||
const gchar *bits;
|
const char *bits;
|
||||||
const gchar *branch;
|
const char *branch;
|
||||||
GIIrNodeField *field;
|
GIIrNodeField *field;
|
||||||
ParseState target_state;
|
ParseState target_state;
|
||||||
gboolean introspectable;
|
gboolean introspectable;
|
||||||
@ -1495,13 +1497,13 @@ start_field (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_alias (GMarkupParseContext *context,
|
start_alias (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
|
|
||||||
name = find_attribute ("name", attribute_names, attribute_values);
|
name = find_attribute ("name", attribute_names, attribute_values);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
@ -1518,17 +1520,17 @@ start_alias (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_enum (GMarkupParseContext *context,
|
start_enum (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *typename;
|
const char *typename;
|
||||||
const gchar *typeinit;
|
const char *typeinit;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
const gchar *error_domain;
|
const char *error_domain;
|
||||||
GIIrNodeEnum *enum_;
|
GIIrNodeEnum *enum_;
|
||||||
|
|
||||||
if (!((strcmp (element_name, "enumeration") == 0 && ctx->state == STATE_NAMESPACE) ||
|
if (!((strcmp (element_name, "enumeration") == 0 && ctx->state == STATE_NAMESPACE) ||
|
||||||
@ -1575,21 +1577,21 @@ start_enum (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_property (GMarkupParseContext *context,
|
start_property (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ParseState target_state;
|
ParseState target_state;
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *readable;
|
const char *readable;
|
||||||
const gchar *writable;
|
const char *writable;
|
||||||
const gchar *construct;
|
const char *construct;
|
||||||
const gchar *construct_only;
|
const char *construct_only;
|
||||||
const gchar *transfer;
|
const char *transfer;
|
||||||
const gchar *setter;
|
const char *setter;
|
||||||
const gchar *getter;
|
const char *getter;
|
||||||
GIIrNodeProperty *property;
|
GIIrNodeProperty *property;
|
||||||
GIIrNodeInterface *iface;
|
GIIrNodeInterface *iface;
|
||||||
|
|
||||||
@ -1659,17 +1661,17 @@ start_property (GMarkupParseContext *context,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint64
|
static int64_t
|
||||||
parse_value (const gchar *str)
|
parse_value (const char *str)
|
||||||
{
|
{
|
||||||
gchar *shift_op;
|
char *shift_op;
|
||||||
|
|
||||||
/* FIXME just a quick hack */
|
/* FIXME just a quick hack */
|
||||||
shift_op = strstr (str, "<<");
|
shift_op = strstr (str, "<<");
|
||||||
|
|
||||||
if (shift_op)
|
if (shift_op)
|
||||||
{
|
{
|
||||||
gint64 base, shift;
|
int64_t base, shift;
|
||||||
|
|
||||||
base = g_ascii_strtoll (str, NULL, 10);
|
base = g_ascii_strtoll (str, NULL, 10);
|
||||||
shift = g_ascii_strtoll (shift_op + 3, NULL, 10);
|
shift = g_ascii_strtoll (shift_op + 3, NULL, 10);
|
||||||
@ -1684,16 +1686,16 @@ parse_value (const gchar *str)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_member (GMarkupParseContext *context,
|
start_member (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *value;
|
const char *value;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
const gchar *c_identifier;
|
const char *c_identifier;
|
||||||
GIIrNodeEnum *enum_;
|
GIIrNodeEnum *enum_;
|
||||||
GIIrNodeValue *value_;
|
GIIrNodeValue *value_;
|
||||||
|
|
||||||
@ -1736,17 +1738,17 @@ start_member (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_constant (GMarkupParseContext *context,
|
start_constant (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ParseState prev_state;
|
ParseState prev_state;
|
||||||
ParseState target_state;
|
ParseState target_state;
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *value;
|
const char *value;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
GIIrNodeConstant *constant;
|
GIIrNodeConstant *constant;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "constant") == 0 &&
|
if (!(strcmp (element_name, "constant") == 0 &&
|
||||||
@ -1822,17 +1824,17 @@ start_constant (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_interface (GMarkupParseContext *context,
|
start_interface (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *typename;
|
const char *typename;
|
||||||
const gchar *typeinit;
|
const char *typeinit;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
const gchar *glib_type_struct;
|
const char *glib_type_struct;
|
||||||
GIIrNodeInterface *iface;
|
GIIrNodeInterface *iface;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "interface") == 0 &&
|
if (!(strcmp (element_name, "interface") == 0 &&
|
||||||
@ -1884,25 +1886,25 @@ start_interface (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_class (GMarkupParseContext *context,
|
start_class (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *parent;
|
const char *parent;
|
||||||
const gchar *glib_type_struct;
|
const char *glib_type_struct;
|
||||||
const gchar *typename;
|
const char *typename;
|
||||||
const gchar *typeinit;
|
const char *typeinit;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
const gchar *abstract;
|
const char *abstract;
|
||||||
const gchar *fundamental;
|
const char *fundamental;
|
||||||
const gchar *final;
|
const char *final;
|
||||||
const gchar *ref_func;
|
const char *ref_func;
|
||||||
const gchar *unref_func;
|
const char *unref_func;
|
||||||
const gchar *set_value_func;
|
const char *set_value_func;
|
||||||
const gchar *get_value_func;
|
const char *get_value_func;
|
||||||
GIIrNodeInterface *iface;
|
GIIrNodeInterface *iface;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "class") == 0 &&
|
if (!(strcmp (element_name, "class") == 0 &&
|
||||||
@ -1977,14 +1979,14 @@ start_class (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_type (GMarkupParseContext *context,
|
start_type (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *ctype;
|
const char *ctype;
|
||||||
gboolean in_alias = FALSE;
|
gboolean in_alias = FALSE;
|
||||||
gboolean is_array;
|
gboolean is_array;
|
||||||
gboolean is_varargs;
|
gboolean is_varargs;
|
||||||
@ -2299,14 +2301,14 @@ end_type (ParseContext *ctx)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_attribute (GMarkupParseContext *context,
|
start_attribute (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *value;
|
const char *value;
|
||||||
GIIrNode *curnode;
|
GIIrNode *curnode;
|
||||||
|
|
||||||
if (strcmp (element_name, "attribute") != 0 || ctx->node_stack == NULL)
|
if (strcmp (element_name, "attribute") != 0 || ctx->node_stack == NULL)
|
||||||
@ -2344,16 +2346,16 @@ start_attribute (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_return_value (GMarkupParseContext *context,
|
start_return_value (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GIIrNodeParam *param;
|
GIIrNodeParam *param;
|
||||||
const gchar *transfer;
|
const char *transfer;
|
||||||
const gchar *skip;
|
const char *skip;
|
||||||
const gchar *nullable;
|
const char *nullable;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "return-value") == 0 &&
|
if (!(strcmp (element_name, "return-value") == 0 &&
|
||||||
ctx->state == STATE_FUNCTION))
|
ctx->state == STATE_FUNCTION))
|
||||||
@ -2413,9 +2415,9 @@ start_return_value (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_implements (GMarkupParseContext *context,
|
start_implements (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -2443,19 +2445,19 @@ start_implements (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_glib_signal (GMarkupParseContext *context,
|
start_glib_signal (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *when;
|
const char *when;
|
||||||
const gchar *no_recurse;
|
const char *no_recurse;
|
||||||
const gchar *detailed;
|
const char *detailed;
|
||||||
const gchar *action;
|
const char *action;
|
||||||
const gchar *no_hooks;
|
const char *no_hooks;
|
||||||
const gchar *has_class_closure;
|
const char *has_class_closure;
|
||||||
GIIrNodeInterface *iface;
|
GIIrNodeInterface *iface;
|
||||||
GIIrNodeSignal *signal;
|
GIIrNodeSignal *signal;
|
||||||
|
|
||||||
@ -2526,19 +2528,19 @@ start_glib_signal (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_vfunc (GMarkupParseContext *context,
|
start_vfunc (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *must_chain_up;
|
const char *must_chain_up;
|
||||||
const gchar *override;
|
const char *override;
|
||||||
const gchar *is_class_closure;
|
const char *is_class_closure;
|
||||||
const gchar *offset;
|
const char *offset;
|
||||||
const gchar *invoker;
|
const char *invoker;
|
||||||
const gchar *throws;
|
const char *throws;
|
||||||
GIIrNodeInterface *iface;
|
GIIrNodeInterface *iface;
|
||||||
GIIrNodeVFunc *vfunc;
|
GIIrNodeVFunc *vfunc;
|
||||||
|
|
||||||
@ -2617,23 +2619,23 @@ start_vfunc (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_struct (GMarkupParseContext *context,
|
start_struct (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
const gchar *disguised;
|
const char *disguised;
|
||||||
const gchar *opaque;
|
const char *opaque;
|
||||||
const gchar *pointer;
|
const char *pointer;
|
||||||
const gchar *gtype_name;
|
const char *gtype_name;
|
||||||
const gchar *gtype_init;
|
const char *gtype_init;
|
||||||
const gchar *gtype_struct;
|
const char *gtype_struct;
|
||||||
const gchar *foreign;
|
const char *foreign;
|
||||||
const gchar *copy_func;
|
const char *copy_func;
|
||||||
const gchar *free_func;
|
const char *free_func;
|
||||||
GIIrNodeStruct *struct_;
|
GIIrNodeStruct *struct_;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "record") == 0 &&
|
if (!(strcmp (element_name, "record") == 0 &&
|
||||||
@ -2711,18 +2713,18 @@ start_struct (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_union (GMarkupParseContext *context,
|
start_union (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *deprecated;
|
const char *deprecated;
|
||||||
const gchar *typename;
|
const char *typename;
|
||||||
const gchar *typeinit;
|
const char *typeinit;
|
||||||
const gchar *copy_func;
|
const char *copy_func;
|
||||||
const gchar *free_func;
|
const char *free_func;
|
||||||
GIIrNodeUnion *union_;
|
GIIrNodeUnion *union_;
|
||||||
|
|
||||||
if (!(strcmp (element_name, "union") == 0 &&
|
if (!(strcmp (element_name, "union") == 0 &&
|
||||||
@ -2770,14 +2772,14 @@ start_union (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_discriminator (GMarkupParseContext *context,
|
start_discriminator (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *type;
|
const char *type;
|
||||||
const gchar *offset;
|
const char *offset;
|
||||||
if (!(strcmp (element_name, "discriminator") == 0 &&
|
if (!(strcmp (element_name, "discriminator") == 0 &&
|
||||||
ctx->state == STATE_UNION))
|
ctx->state == STATE_UNION))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2810,9 +2812,9 @@ parse_include (GMarkupParseContext *context,
|
|||||||
const char *version)
|
const char *version)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar *buffer;
|
char *buffer;
|
||||||
gsize length;
|
gsize length;
|
||||||
gchar *girpath, *girname;
|
char *girpath, *girname;
|
||||||
GIIrModule *module;
|
GIIrModule *module;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
@ -2882,9 +2884,9 @@ extern GLogLevelFlags logged_levels;
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
start_element_handler (GMarkupParseContext *context,
|
start_element_handler (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
const gchar **attribute_names,
|
const char **attribute_names,
|
||||||
const gchar **attribute_values,
|
const char **attribute_values,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -3004,8 +3006,8 @@ start_element_handler (GMarkupParseContext *context,
|
|||||||
if (strcmp (element_name, "include") == 0 &&
|
if (strcmp (element_name, "include") == 0 &&
|
||||||
ctx->state == STATE_REPOSITORY)
|
ctx->state == STATE_REPOSITORY)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *version;
|
const char *version;
|
||||||
|
|
||||||
name = find_attribute ("name", attribute_names, attribute_values);
|
name = find_attribute ("name", attribute_names, attribute_values);
|
||||||
version = find_attribute ("version", attribute_names, attribute_values);
|
version = find_attribute ("version", attribute_names, attribute_values);
|
||||||
@ -3072,7 +3074,7 @@ start_element_handler (GMarkupParseContext *context,
|
|||||||
case 'n':
|
case 'n':
|
||||||
if (strcmp (element_name, "namespace") == 0 && ctx->state == STATE_REPOSITORY)
|
if (strcmp (element_name, "namespace") == 0 && ctx->state == STATE_REPOSITORY)
|
||||||
{
|
{
|
||||||
const gchar *name, *version, *shared_library, *cprefix;
|
const char *name, *version, *shared_library, *cprefix;
|
||||||
|
|
||||||
if (ctx->current_module != NULL)
|
if (ctx->current_module != NULL)
|
||||||
{
|
{
|
||||||
@ -3149,7 +3151,7 @@ start_element_handler (GMarkupParseContext *context,
|
|||||||
else if (strcmp (element_name, "prerequisite") == 0 &&
|
else if (strcmp (element_name, "prerequisite") == 0 &&
|
||||||
ctx->state == STATE_INTERFACE)
|
ctx->state == STATE_INTERFACE)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
|
|
||||||
name = find_attribute ("name", attribute_names, attribute_values);
|
name = find_attribute ("name", attribute_names, attribute_values);
|
||||||
|
|
||||||
@ -3177,7 +3179,7 @@ start_element_handler (GMarkupParseContext *context,
|
|||||||
case 'r':
|
case 'r':
|
||||||
if (strcmp (element_name, "repository") == 0 && ctx->state == STATE_START)
|
if (strcmp (element_name, "repository") == 0 && ctx->state == STATE_START)
|
||||||
{
|
{
|
||||||
const gchar *version;
|
const char *version;
|
||||||
|
|
||||||
version = find_attribute ("version", attribute_names, attribute_values);
|
version = find_attribute ("version", attribute_names, attribute_values);
|
||||||
|
|
||||||
@ -3241,7 +3243,7 @@ start_element_handler (GMarkupParseContext *context,
|
|||||||
|
|
||||||
if (*error == NULL && ctx->state != STATE_PASSTHROUGH)
|
if (*error == NULL && ctx->state != STATE_PASSTHROUGH)
|
||||||
{
|
{
|
||||||
gint line_number, char_number;
|
int line_number, char_number;
|
||||||
g_markup_parse_context_get_position (context, &line_number, &char_number);
|
g_markup_parse_context_get_position (context, &line_number, &char_number);
|
||||||
if (!g_str_has_prefix (element_name, "c:"))
|
if (!g_str_has_prefix (element_name, "c:"))
|
||||||
g_printerr ("%s:%d:%d: warning: element %s from state %d is unknown, ignoring\n",
|
g_printerr ("%s:%d:%d: warning: element %s from state %d is unknown, ignoring\n",
|
||||||
@ -3253,7 +3255,7 @@ start_element_handler (GMarkupParseContext *context,
|
|||||||
out:
|
out:
|
||||||
if (*error)
|
if (*error)
|
||||||
{
|
{
|
||||||
gint line_number, char_number;
|
int line_number, char_number;
|
||||||
g_markup_parse_context_get_position (context, &line_number, &char_number);
|
g_markup_parse_context_get_position (context, &line_number, &char_number);
|
||||||
|
|
||||||
g_printerr ("%s:%d:%d: error: %s\n", ctx->file_path, line_number, char_number, (*error)->message);
|
g_printerr ("%s:%d:%d: error: %s\n", ctx->file_path, line_number, char_number, (*error)->message);
|
||||||
@ -3301,7 +3303,7 @@ require_one_of_end_elements (GMarkupParseContext *context,
|
|||||||
static gboolean
|
static gboolean
|
||||||
state_switch_end_struct_or_union (GMarkupParseContext *context,
|
state_switch_end_struct_or_union (GMarkupParseContext *context,
|
||||||
ParseContext *ctx,
|
ParseContext *ctx,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
pop_node (ctx);
|
pop_node (ctx);
|
||||||
@ -3345,7 +3347,7 @@ require_end_element (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
end_element_handler (GMarkupParseContext *context,
|
end_element_handler (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const char *element_name,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -3646,7 +3648,7 @@ end_element_handler (GMarkupParseContext *context,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
text_handler (GMarkupParseContext *context,
|
text_handler (GMarkupParseContext *context,
|
||||||
const gchar *text,
|
const char *text,
|
||||||
gsize text_len,
|
gsize text_len,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -3657,7 +3659,7 @@ text_handler (GMarkupParseContext *context,
|
|||||||
static void
|
static void
|
||||||
cleanup (GMarkupParseContext *context,
|
cleanup (GMarkupParseContext *context,
|
||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
ParseContext *ctx = user_data;
|
ParseContext *ctx = user_data;
|
||||||
GList *m;
|
GList *m;
|
||||||
@ -3688,9 +3690,9 @@ cleanup (GMarkupParseContext *context,
|
|||||||
*/
|
*/
|
||||||
GIIrModule *
|
GIIrModule *
|
||||||
gi_ir_parser_parse_string (GIIrParser *parser,
|
gi_ir_parser_parse_string (GIIrParser *parser,
|
||||||
const gchar *namespace,
|
const char *namespace,
|
||||||
const gchar *filename,
|
const char *filename,
|
||||||
const gchar *buffer,
|
const char *buffer,
|
||||||
gssize length,
|
gssize length,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -3773,10 +3775,10 @@ gi_ir_parser_parse_string (GIIrParser *parser,
|
|||||||
*/
|
*/
|
||||||
GIIrModule *
|
GIIrModule *
|
||||||
gi_ir_parser_parse_file (GIIrParser *parser,
|
gi_ir_parser_parse_file (GIIrParser *parser,
|
||||||
const gchar *filename,
|
const char *filename,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gchar *buffer;
|
char *buffer;
|
||||||
gsize length;
|
gsize length;
|
||||||
GIIrModule *module;
|
GIIrModule *module;
|
||||||
char *dash;
|
char *dash;
|
||||||
|
@ -45,7 +45,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
guint has_children : 1;
|
unsigned has_children : 1;
|
||||||
} XmlElement;
|
} XmlElement;
|
||||||
|
|
||||||
static XmlElement *
|
static XmlElement *
|
||||||
@ -173,7 +173,7 @@ check_unresolved (GIBaseInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_type_name (const gchar *ns,
|
write_type_name (const char *ns,
|
||||||
GIBaseInfo *info,
|
GIBaseInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
@ -184,7 +184,7 @@ write_type_name (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_type_name_attribute (const gchar *ns,
|
write_type_name_attribute (const char *ns,
|
||||||
GIBaseInfo *info,
|
GIBaseInfo *info,
|
||||||
const char *attr_name,
|
const char *attr_name,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
@ -215,11 +215,11 @@ write_ownership_transfer (GITransfer transfer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_type_info (const gchar *ns,
|
write_type_info (const char *ns,
|
||||||
GITypeInfo *info,
|
GITypeInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
gint tag;
|
int tag;
|
||||||
GITypeInfo *type;
|
GITypeInfo *type;
|
||||||
gboolean is_pointer;
|
gboolean is_pointer;
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ write_type_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
else if (tag == GI_TYPE_TAG_ARRAY)
|
else if (tag == GI_TYPE_TAG_ARRAY)
|
||||||
{
|
{
|
||||||
gint length;
|
gssize length;
|
||||||
gssize size;
|
gssize size;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ write_type_info (const gchar *ns,
|
|||||||
|
|
||||||
length = gi_type_info_get_array_length_index (info);
|
length = gi_type_info_get_array_length_index (info);
|
||||||
if (length >= 0)
|
if (length >= 0)
|
||||||
xml_printf (file, " length=\"%d\"", length);
|
xml_printf (file, " length=\"%" G_GSSIZE_FORMAT "\"", length);
|
||||||
|
|
||||||
size = gi_type_info_get_array_fixed_size (info);
|
size = gi_type_info_get_array_fixed_size (info);
|
||||||
if (size >= 0)
|
if (size >= 0)
|
||||||
@ -379,26 +379,26 @@ write_return_value_attributes (Xml *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_constant_value (const gchar *ns,
|
write_constant_value (const char *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 char *ns,
|
||||||
GICallbackInfo *info,
|
GICallbackInfo *info,
|
||||||
Xml *file);
|
Xml *file);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_field_info (const gchar *ns,
|
write_field_info (const char *ns,
|
||||||
GIFieldInfo *info,
|
GIFieldInfo *info,
|
||||||
GIConstantInfo *branch,
|
GIConstantInfo *branch,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
GIFieldInfoFlags flags;
|
GIFieldInfoFlags flags;
|
||||||
gint size;
|
size_t size;
|
||||||
gint offset;
|
size_t offset;
|
||||||
GITypeInfo *type;
|
GITypeInfo *type;
|
||||||
GIBaseInfo *interface;
|
GIBaseInfo *interface;
|
||||||
GIArgument value;
|
GIArgument value;
|
||||||
@ -420,7 +420,7 @@ write_field_info (const gchar *ns,
|
|||||||
xml_printf (file, " writable=\"1\"");
|
xml_printf (file, " writable=\"1\"");
|
||||||
|
|
||||||
if (size)
|
if (size)
|
||||||
xml_printf (file, " bits=\"%d\"", size);
|
xml_printf (file, " bits=\"%zu\"", size);
|
||||||
|
|
||||||
write_attributes (file, (GIBaseInfo*) info);
|
write_attributes (file, (GIBaseInfo*) info);
|
||||||
|
|
||||||
@ -438,8 +438,7 @@ write_field_info (const gchar *ns,
|
|||||||
|
|
||||||
if (file->show_all)
|
if (file->show_all)
|
||||||
{
|
{
|
||||||
if (offset >= 0)
|
xml_printf (file, "offset=\"%zu\"", offset);
|
||||||
xml_printf (file, "offset=\"%d\"", offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface = gi_type_info_get_interface (type);
|
interface = gi_type_info_get_interface (type);
|
||||||
@ -457,7 +456,7 @@ write_field_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_callable_info (const gchar *ns,
|
write_callable_info (const char *ns,
|
||||||
GICallableInfo *info,
|
GICallableInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
@ -490,7 +489,7 @@ write_callable_info (const gchar *ns,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
xml_start_element (file, "parameters");
|
xml_start_element (file, "parameters");
|
||||||
for (guint i = 0; i < gi_callable_info_get_n_args (info); i++)
|
for (unsigned int i = 0; i < gi_callable_info_get_n_args (info); i++)
|
||||||
{
|
{
|
||||||
GIArgInfo *arg = gi_callable_info_get_arg (info, i);
|
GIArgInfo *arg = gi_callable_info_get_arg (info, i);
|
||||||
|
|
||||||
@ -545,10 +544,12 @@ write_callable_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gi_arg_info_get_closure_index (arg) >= 0)
|
if (gi_arg_info_get_closure_index (arg) >= 0)
|
||||||
xml_printf (file, " closure=\"%d\"", gi_arg_info_get_closure_index (arg));
|
xml_printf (file, " closure=\"%" G_GSSIZE_FORMAT "\"",
|
||||||
|
gi_arg_info_get_closure_index (arg));
|
||||||
|
|
||||||
if (gi_arg_info_get_destroy_index (arg) >= 0)
|
if (gi_arg_info_get_destroy_index (arg) >= 0)
|
||||||
xml_printf (file, " destroy=\"%d\"", gi_arg_info_get_destroy_index (arg));
|
xml_printf (file, " destroy=\"%" G_GSSIZE_FORMAT "\"",
|
||||||
|
gi_arg_info_get_destroy_index (arg));
|
||||||
|
|
||||||
if (gi_arg_info_is_skip (arg))
|
if (gi_arg_info_is_skip (arg))
|
||||||
xml_printf (file, " skip=\"1\"");
|
xml_printf (file, " skip=\"1\"");
|
||||||
@ -568,14 +569,14 @@ write_callable_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_function_info (const gchar *ns,
|
write_function_info (const char *ns,
|
||||||
GIFunctionInfo *info,
|
GIFunctionInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
GIFunctionInfoFlags flags;
|
GIFunctionInfoFlags flags;
|
||||||
const gchar *tag;
|
const char *tag;
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *symbol;
|
const char *symbol;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
flags = gi_function_info_get_flags (info);
|
flags = gi_function_info_get_flags (info);
|
||||||
@ -619,11 +620,11 @@ write_function_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_callback_info (const gchar *ns,
|
write_callback_info (const char *ns,
|
||||||
GICallbackInfo *info,
|
GICallbackInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
||||||
@ -640,19 +641,19 @@ write_callback_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_struct_info (const gchar *ns,
|
write_struct_info (const char *ns,
|
||||||
GIStructInfo *info,
|
GIStructInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *type_name;
|
const char *type_name;
|
||||||
const gchar *type_init;
|
const char *type_init;
|
||||||
const gchar *func;
|
const char *func;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
gboolean is_gtype_struct;
|
gboolean is_gtype_struct;
|
||||||
gboolean foreign;
|
gboolean foreign;
|
||||||
gint size;
|
size_t size;
|
||||||
guint n_elts;
|
unsigned int n_elts;
|
||||||
|
|
||||||
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
||||||
deprecated = gi_base_info_is_deprecated ((GIBaseInfo *)info);
|
deprecated = gi_base_info_is_deprecated ((GIBaseInfo *)info);
|
||||||
@ -692,8 +693,8 @@ write_struct_info (const gchar *ns,
|
|||||||
write_attributes (file, (GIBaseInfo*) info);
|
write_attributes (file, (GIBaseInfo*) info);
|
||||||
|
|
||||||
size = gi_struct_info_get_size (info);
|
size = gi_struct_info_get_size (info);
|
||||||
if (file->show_all && size >= 0)
|
if (file->show_all)
|
||||||
xml_printf (file, " size=\"%d\"", size);
|
xml_printf (file, " size=\"%zu\"", size);
|
||||||
|
|
||||||
foreign = gi_struct_info_is_foreign (info);
|
foreign = gi_struct_info_is_foreign (info);
|
||||||
if (foreign)
|
if (foreign)
|
||||||
@ -702,14 +703,14 @@ write_struct_info (const gchar *ns,
|
|||||||
n_elts = gi_struct_info_get_n_fields (info) + gi_struct_info_get_n_methods (info);
|
n_elts = gi_struct_info_get_n_fields (info) + gi_struct_info_get_n_methods (info);
|
||||||
if (n_elts > 0)
|
if (n_elts > 0)
|
||||||
{
|
{
|
||||||
for (guint i = 0; i < gi_struct_info_get_n_fields (info); i++)
|
for (unsigned int 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 (unsigned int 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);
|
||||||
@ -722,13 +723,13 @@ write_struct_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_value_info (const gchar *ns,
|
write_value_info (const char *ns,
|
||||||
GIValueInfo *info,
|
GIValueInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
gint64 value;
|
int64_t value;
|
||||||
gchar *value_str;
|
char *value_str;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
||||||
@ -749,7 +750,7 @@ write_value_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_constant_value (const gchar *ns,
|
write_constant_value (const char *ns,
|
||||||
GITypeInfo *type,
|
GITypeInfo *type,
|
||||||
GIArgument *value,
|
GIArgument *value,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
@ -799,12 +800,12 @@ write_constant_value (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_constant_info (const gchar *ns,
|
write_constant_info (const char *ns,
|
||||||
GIConstantInfo *info,
|
GIConstantInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
GITypeInfo *type;
|
GITypeInfo *type;
|
||||||
const gchar *name;
|
const char *name;
|
||||||
GIArgument value;
|
GIArgument value;
|
||||||
|
|
||||||
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
||||||
@ -830,14 +831,14 @@ write_constant_info (const gchar *ns,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_enum_info (const gchar *ns,
|
write_enum_info (const char *ns,
|
||||||
GIEnumInfo *info,
|
GIEnumInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *type_name;
|
const char *type_name;
|
||||||
const gchar *type_init;
|
const char *type_init;
|
||||||
const gchar *error_domain;
|
const char *error_domain;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
||||||
@ -863,7 +864,7 @@ write_enum_info (const gchar *ns,
|
|||||||
|
|
||||||
write_attributes (file, (GIBaseInfo*) info);
|
write_attributes (file, (GIBaseInfo*) info);
|
||||||
|
|
||||||
for (guint i = 0; i < gi_enum_info_get_n_values (info); i++)
|
for (unsigned int i = 0; i < gi_enum_info_get_n_values (info); i++)
|
||||||
{
|
{
|
||||||
GIValueInfo *value = gi_enum_info_get_value (info, i);
|
GIValueInfo *value = gi_enum_info_get_value (info, i);
|
||||||
write_value_info (ns, value, file);
|
write_value_info (ns, value, file);
|
||||||
@ -874,12 +875,12 @@ write_enum_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_signal_info (const gchar *ns,
|
write_signal_info (const char *ns,
|
||||||
GISignalInfo *info,
|
GISignalInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
GSignalFlags flags;
|
GSignalFlags flags;
|
||||||
const gchar *name;
|
const char *name;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
||||||
@ -917,15 +918,15 @@ write_signal_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_vfunc_info (const gchar *ns,
|
write_vfunc_info (const char *ns,
|
||||||
GIVFuncInfo *info,
|
GIVFuncInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
GIVFuncInfoFlags flags;
|
GIVFuncInfoFlags flags;
|
||||||
const gchar *name;
|
const char *name;
|
||||||
GIFunctionInfo *invoker;
|
GIFunctionInfo *invoker;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
gint offset;
|
size_t offset;
|
||||||
|
|
||||||
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
||||||
flags = gi_vfunc_info_get_flags (info);
|
flags = gi_vfunc_info_get_flags (info);
|
||||||
@ -947,7 +948,7 @@ write_vfunc_info (const gchar *ns,
|
|||||||
else if (flags & GI_VFUNC_MUST_NOT_OVERRIDE)
|
else if (flags & GI_VFUNC_MUST_NOT_OVERRIDE)
|
||||||
xml_printf (file, " override=\"never\"");
|
xml_printf (file, " override=\"never\"");
|
||||||
|
|
||||||
xml_printf (file, " offset=\"%d\"", offset);
|
xml_printf (file, " offset=\"%zu\"", offset);
|
||||||
|
|
||||||
if (invoker)
|
if (invoker)
|
||||||
{
|
{
|
||||||
@ -961,12 +962,12 @@ write_vfunc_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_property_info (const gchar *ns,
|
write_property_info (const char *ns,
|
||||||
GIPropertyInfo *info,
|
GIPropertyInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
GParamFlags flags;
|
GParamFlags flags;
|
||||||
const gchar *name;
|
const char *name;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
GITypeInfo *type;
|
GITypeInfo *type;
|
||||||
|
|
||||||
@ -1026,14 +1027,14 @@ write_property_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_object_info (const gchar *ns,
|
write_object_info (const char *ns,
|
||||||
GIObjectInfo *info,
|
GIObjectInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *type_name;
|
const char *type_name;
|
||||||
const gchar *type_init;
|
const char *type_init;
|
||||||
const gchar *func;
|
const char *func;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
gboolean is_abstract;
|
gboolean is_abstract;
|
||||||
gboolean is_fundamental;
|
gboolean is_fundamental;
|
||||||
@ -1100,7 +1101,7 @@ 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 (unsigned int 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");
|
||||||
@ -1110,42 +1111,42 @@ write_object_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_object_info_get_n_fields (info); i++)
|
for (unsigned int i = 0; i < gi_object_info_get_n_fields (info); i++)
|
||||||
{
|
{
|
||||||
GIFieldInfo *field = gi_object_info_get_field (info, i);
|
GIFieldInfo *field = gi_object_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_object_info_get_n_methods (info); i++)
|
for (unsigned int i = 0; i < gi_object_info_get_n_methods (info); i++)
|
||||||
{
|
{
|
||||||
GIFunctionInfo *function = gi_object_info_get_method (info, i);
|
GIFunctionInfo *function = gi_object_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_object_info_get_n_properties (info); i++)
|
for (unsigned int i = 0; i < gi_object_info_get_n_properties (info); i++)
|
||||||
{
|
{
|
||||||
GIPropertyInfo *prop = gi_object_info_get_property (info, i);
|
GIPropertyInfo *prop = gi_object_info_get_property (info, i);
|
||||||
write_property_info (ns, prop, file);
|
write_property_info (ns, prop, file);
|
||||||
gi_base_info_unref ((GIBaseInfo *)prop);
|
gi_base_info_unref ((GIBaseInfo *)prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_object_info_get_n_signals (info); i++)
|
for (unsigned int i = 0; i < gi_object_info_get_n_signals (info); i++)
|
||||||
{
|
{
|
||||||
GISignalInfo *signal = gi_object_info_get_signal (info, i);
|
GISignalInfo *signal = gi_object_info_get_signal (info, i);
|
||||||
write_signal_info (ns, signal, file);
|
write_signal_info (ns, signal, file);
|
||||||
gi_base_info_unref ((GIBaseInfo *)signal);
|
gi_base_info_unref ((GIBaseInfo *)signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_object_info_get_n_vfuncs (info); i++)
|
for (unsigned int i = 0; i < gi_object_info_get_n_vfuncs (info); i++)
|
||||||
{
|
{
|
||||||
GIVFuncInfo *vfunc = gi_object_info_get_vfunc (info, i);
|
GIVFuncInfo *vfunc = gi_object_info_get_vfunc (info, i);
|
||||||
write_vfunc_info (ns, vfunc, file);
|
write_vfunc_info (ns, vfunc, file);
|
||||||
gi_base_info_unref ((GIBaseInfo *)vfunc);
|
gi_base_info_unref ((GIBaseInfo *)vfunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_object_info_get_n_constants (info); i++)
|
for (unsigned int i = 0; i < gi_object_info_get_n_constants (info); i++)
|
||||||
{
|
{
|
||||||
GIConstantInfo *constant = gi_object_info_get_constant (info, i);
|
GIConstantInfo *constant = gi_object_info_get_constant (info, i);
|
||||||
write_constant_info (ns, constant, file);
|
write_constant_info (ns, constant, file);
|
||||||
@ -1156,13 +1157,13 @@ write_object_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_interface_info (const gchar *ns,
|
write_interface_info (const char *ns,
|
||||||
GIInterfaceInfo *info,
|
GIInterfaceInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *type_name;
|
const char *type_name;
|
||||||
const gchar *type_init;
|
const char *type_init;
|
||||||
GIStructInfo *class_struct;
|
GIStructInfo *class_struct;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
|
|
||||||
@ -1189,7 +1190,7 @@ 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 (unsigned int 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);
|
||||||
|
|
||||||
@ -1201,35 +1202,35 @@ write_interface_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_interface_info_get_n_methods (info); i++)
|
for (unsigned int i = 0; i < gi_interface_info_get_n_methods (info); i++)
|
||||||
{
|
{
|
||||||
GIFunctionInfo *function = gi_interface_info_get_method (info, i);
|
GIFunctionInfo *function = gi_interface_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_interface_info_get_n_properties (info); i++)
|
for (unsigned int i = 0; i < gi_interface_info_get_n_properties (info); i++)
|
||||||
{
|
{
|
||||||
GIPropertyInfo *prop = gi_interface_info_get_property (info, i);
|
GIPropertyInfo *prop = gi_interface_info_get_property (info, i);
|
||||||
write_property_info (ns, prop, file);
|
write_property_info (ns, prop, file);
|
||||||
gi_base_info_unref ((GIBaseInfo *)prop);
|
gi_base_info_unref ((GIBaseInfo *)prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_interface_info_get_n_signals (info); i++)
|
for (unsigned int i = 0; i < gi_interface_info_get_n_signals (info); i++)
|
||||||
{
|
{
|
||||||
GISignalInfo *signal = gi_interface_info_get_signal (info, i);
|
GISignalInfo *signal = gi_interface_info_get_signal (info, i);
|
||||||
write_signal_info (ns, signal, file);
|
write_signal_info (ns, signal, file);
|
||||||
gi_base_info_unref ((GIBaseInfo *)signal);
|
gi_base_info_unref ((GIBaseInfo *)signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_interface_info_get_n_vfuncs (info); i++)
|
for (unsigned int i = 0; i < gi_interface_info_get_n_vfuncs (info); i++)
|
||||||
{
|
{
|
||||||
GIVFuncInfo *vfunc = gi_interface_info_get_vfunc (info, i);
|
GIVFuncInfo *vfunc = gi_interface_info_get_vfunc (info, i);
|
||||||
write_vfunc_info (ns, vfunc, file);
|
write_vfunc_info (ns, vfunc, file);
|
||||||
gi_base_info_unref ((GIBaseInfo *)vfunc);
|
gi_base_info_unref ((GIBaseInfo *)vfunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_interface_info_get_n_constants (info); i++)
|
for (unsigned int i = 0; i < gi_interface_info_get_n_constants (info); i++)
|
||||||
{
|
{
|
||||||
GIConstantInfo *constant = gi_interface_info_get_constant (info, i);
|
GIConstantInfo *constant = gi_interface_info_get_constant (info, i);
|
||||||
write_constant_info (ns, constant, file);
|
write_constant_info (ns, constant, file);
|
||||||
@ -1240,16 +1241,16 @@ write_interface_info (const gchar *ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_union_info (const gchar *ns,
|
write_union_info (const char *ns,
|
||||||
GIUnionInfo *info,
|
GIUnionInfo *info,
|
||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const char *name;
|
||||||
const gchar *type_name;
|
const char *type_name;
|
||||||
const gchar *type_init;
|
const char *type_init;
|
||||||
const gchar *func;
|
const char *func;
|
||||||
gboolean deprecated;
|
gboolean deprecated;
|
||||||
gsize size;
|
size_t size;
|
||||||
|
|
||||||
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
name = gi_base_info_get_name ((GIBaseInfo *)info);
|
||||||
deprecated = gi_base_info_is_deprecated ((GIBaseInfo *)info);
|
deprecated = gi_base_info_is_deprecated ((GIBaseInfo *)info);
|
||||||
@ -1282,20 +1283,20 @@ write_union_info (const gchar *ns,
|
|||||||
|
|
||||||
if (gi_union_info_is_discriminated (info))
|
if (gi_union_info_is_discriminated (info))
|
||||||
{
|
{
|
||||||
guint offset;
|
size_t offset;
|
||||||
GITypeInfo *type;
|
GITypeInfo *type;
|
||||||
|
|
||||||
offset = gi_union_info_get_discriminator_offset (info);
|
offset = gi_union_info_get_discriminator_offset (info);
|
||||||
type = gi_union_info_get_discriminator_type (info);
|
type = gi_union_info_get_discriminator_type (info);
|
||||||
|
|
||||||
xml_start_element (file, "discriminator");
|
xml_start_element (file, "discriminator");
|
||||||
xml_printf (file, " offset=\"%d\" type=\"", offset);
|
xml_printf (file, " offset=\"%zu\" type=\"", offset);
|
||||||
write_type_info (ns, type, file);
|
write_type_info (ns, type, file);
|
||||||
xml_end_element (file, "discriminator");
|
xml_end_element (file, "discriminator");
|
||||||
gi_base_info_unref ((GIBaseInfo *)type);
|
gi_base_info_unref ((GIBaseInfo *)type);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (guint i = 0; i < gi_union_info_get_n_fields (info); i++)
|
for (unsigned int i = 0; i < gi_union_info_get_n_fields (info); i++)
|
||||||
{
|
{
|
||||||
GIFieldInfo *field = gi_union_info_get_field (info, i);
|
GIFieldInfo *field = gi_union_info_get_field (info, i);
|
||||||
GIConstantInfo *constant = gi_union_info_get_discriminator (info, i);
|
GIConstantInfo *constant = gi_union_info_get_discriminator (info, i);
|
||||||
@ -1305,7 +1306,7 @@ write_union_info (const gchar *ns,
|
|||||||
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 (unsigned int i = 0; i < gi_union_info_get_n_methods (info); i++)
|
||||||
{
|
{
|
||||||
GIFunctionInfo *function = gi_union_info_get_method (info, i);
|
GIFunctionInfo *function = gi_union_info_get_method (info, i);
|
||||||
write_function_info (ns, function, file);
|
write_function_info (ns, function, file);
|
||||||
@ -1335,7 +1336,7 @@ gi_ir_writer_write (const char *filename,
|
|||||||
gboolean show_all)
|
gboolean show_all)
|
||||||
{
|
{
|
||||||
FILE *ofile;
|
FILE *ofile;
|
||||||
gint i, j;
|
size_t i, j;
|
||||||
char **dependencies;
|
char **dependencies;
|
||||||
GIRepository *repository;
|
GIRepository *repository;
|
||||||
Xml *xml;
|
Xml *xml;
|
||||||
@ -1346,7 +1347,7 @@ gi_ir_writer_write (const char *filename,
|
|||||||
ofile = stdout;
|
ofile = stdout;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gchar *full_filename;
|
char *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);
|
||||||
@ -1391,10 +1392,10 @@ gi_ir_writer_write (const char *filename,
|
|||||||
if (TRUE)
|
if (TRUE)
|
||||||
{
|
{
|
||||||
const char * const *shared_libraries;
|
const char * const *shared_libraries;
|
||||||
const gchar *c_prefix;
|
const char *c_prefix;
|
||||||
const char *cur_ns = ns;
|
const char *cur_ns = ns;
|
||||||
const char *cur_version;
|
const char *cur_version;
|
||||||
gint n_infos;
|
unsigned int n_infos;
|
||||||
|
|
||||||
cur_version = gi_repository_get_version (repository, cur_ns);
|
cur_version = gi_repository_get_version (repository, cur_ns);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
* Returns: number of fields
|
* Returns: number of fields
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_struct_info_get_n_fields (GIStructInfo *info)
|
gi_struct_info_get_n_fields (GIStructInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -72,16 +72,16 @@ gi_struct_info_get_n_fields (GIStructInfo *info)
|
|||||||
* Returns: field offset, in bytes
|
* Returns: field offset, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
static gint32
|
static size_t
|
||||||
gi_struct_get_field_offset (GIStructInfo *info,
|
gi_struct_get_field_offset (GIStructInfo *info,
|
||||||
guint n)
|
uint16_t n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
guint32 offset = rinfo->offset + header->struct_blob_size;
|
size_t offset = rinfo->offset + header->struct_blob_size;
|
||||||
FieldBlob *field_blob;
|
FieldBlob *field_blob;
|
||||||
|
|
||||||
for (guint i = 0; i < n; i++)
|
for (uint16_t i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
||||||
offset += header->field_blob_size;
|
offset += header->field_blob_size;
|
||||||
@ -105,10 +105,12 @@ gi_struct_get_field_offset (GIStructInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIFieldInfo *
|
GIFieldInfo *
|
||||||
gi_struct_info_get_field (GIStructInfo *info,
|
gi_struct_info_get_field (GIStructInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
|
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
|
||||||
gi_struct_get_field_offset (info, n));
|
gi_struct_get_field_offset (info, n));
|
||||||
}
|
}
|
||||||
@ -127,18 +129,17 @@ gi_struct_info_get_field (GIStructInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIFieldInfo *
|
GIFieldInfo *
|
||||||
gi_struct_info_find_field (GIStructInfo *info,
|
gi_struct_info_find_field (GIStructInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
guint32 offset = rinfo->offset + header->struct_blob_size;
|
size_t offset = rinfo->offset + header->struct_blob_size;
|
||||||
gint i;
|
|
||||||
|
|
||||||
for (i = 0; i < blob->n_fields; i++)
|
for (size_t i = 0; i < blob->n_fields; i++)
|
||||||
{
|
{
|
||||||
FieldBlob *field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
FieldBlob *field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
||||||
const gchar *fname = (const gchar *)&rinfo->typelib->data[field_blob->name];
|
const char *fname = (const char *)&rinfo->typelib->data[field_blob->name];
|
||||||
|
|
||||||
if (strcmp (name, fname) == 0)
|
if (strcmp (name, fname) == 0)
|
||||||
{
|
{
|
||||||
@ -165,7 +166,7 @@ gi_struct_info_find_field (GIStructInfo *info,
|
|||||||
* Returns: number of methods
|
* Returns: number of methods
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_struct_info_get_n_methods (GIStructInfo *info)
|
gi_struct_info_get_n_methods (GIStructInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -187,12 +188,14 @@ gi_struct_info_get_n_methods (GIStructInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_struct_info_get_method (GIStructInfo *info,
|
gi_struct_info_get_method (GIStructInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
gint offset;
|
size_t offset;
|
||||||
|
|
||||||
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
||||||
|
|
||||||
offset = gi_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
|
offset = gi_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
|
||||||
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
|
||||||
@ -213,9 +216,9 @@ gi_struct_info_get_method (GIStructInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_struct_info_find_method (GIStructInfo *info,
|
gi_struct_info_find_method (GIStructInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
@ -232,7 +235,7 @@ gi_struct_info_find_method (GIStructInfo *info,
|
|||||||
* Returns: size of the structure, in bytes
|
* Returns: size of the structure, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gsize
|
size_t
|
||||||
gi_struct_info_get_size (GIStructInfo *info)
|
gi_struct_info_get_size (GIStructInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -250,7 +253,7 @@ gi_struct_info_get_size (GIStructInfo *info)
|
|||||||
* Returns: required alignment, in bytes
|
* Returns: required alignment, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gsize
|
size_t
|
||||||
gi_struct_info_get_alignment (GIStructInfo *info)
|
gi_struct_info_get_alignment (GIStructInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
@ -45,32 +45,32 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_struct_info_get_n_fields (GIStructInfo *info);
|
unsigned int gi_struct_info_get_n_fields (GIStructInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFieldInfo * gi_struct_info_get_field (GIStructInfo *info,
|
GIFieldInfo * gi_struct_info_get_field (GIStructInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFieldInfo * gi_struct_info_find_field (GIStructInfo *info,
|
GIFieldInfo * gi_struct_info_find_field (GIStructInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_struct_info_get_n_methods (GIStructInfo *info);
|
unsigned int gi_struct_info_get_n_methods (GIStructInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfo * gi_struct_info_get_method (GIStructInfo *info,
|
GIFunctionInfo * gi_struct_info_get_method (GIStructInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfo * gi_struct_info_find_method (GIStructInfo *info,
|
GIFunctionInfo * gi_struct_info_find_method (GIStructInfo *info,
|
||||||
const gchar *name);
|
const char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gsize gi_struct_info_get_size (GIStructInfo *info);
|
size_t gi_struct_info_get_size (GIStructInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gsize gi_struct_info_get_alignment (GIStructInfo *info);
|
size_t gi_struct_info_get_alignment (GIStructInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_struct_info_is_gtype_struct (GIStructInfo *info);
|
gboolean gi_struct_info_is_gtype_struct (GIStructInfo *info);
|
||||||
|
@ -136,7 +136,7 @@ gi_type_info_get_tag (GITypeInfo *info)
|
|||||||
*/
|
*/
|
||||||
GITypeInfo *
|
GITypeInfo *
|
||||||
gi_type_info_get_param_type (GITypeInfo *info,
|
gi_type_info_get_param_type (GITypeInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
SimpleTypeBlob *type;
|
SimpleTypeBlob *type;
|
||||||
@ -241,7 +241,7 @@ gi_type_info_get_interface (GITypeInfo *info)
|
|||||||
* or it has no length argument
|
* or it has no length argument
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gint
|
gssize
|
||||||
gi_type_info_get_array_length_index (GITypeInfo *info)
|
gi_type_info_get_array_length_index (GITypeInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -426,7 +426,7 @@ gi_type_info_get_storage_type (GITypeInfo *info)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
|
gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
|
||||||
gpointer hash_pointer,
|
void *hash_pointer,
|
||||||
GIArgument *arg)
|
GIArgument *arg)
|
||||||
{
|
{
|
||||||
switch (storage_type)
|
switch (storage_type)
|
||||||
@ -435,23 +435,23 @@ gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
|
|||||||
arg->v_boolean = !!GPOINTER_TO_INT (hash_pointer);
|
arg->v_boolean = !!GPOINTER_TO_INT (hash_pointer);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT8:
|
case GI_TYPE_TAG_INT8:
|
||||||
arg->v_int8 = (gint8)GPOINTER_TO_INT (hash_pointer);
|
arg->v_int8 = (int8_t) GPOINTER_TO_INT (hash_pointer);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT8:
|
case GI_TYPE_TAG_UINT8:
|
||||||
arg->v_uint8 = (guint8)GPOINTER_TO_UINT (hash_pointer);
|
arg->v_uint8 = (uint8_t) GPOINTER_TO_UINT (hash_pointer);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT16:
|
case GI_TYPE_TAG_INT16:
|
||||||
arg->v_int16 = (gint16)GPOINTER_TO_INT (hash_pointer);
|
arg->v_int16 = (int16_t) GPOINTER_TO_INT (hash_pointer);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT16:
|
case GI_TYPE_TAG_UINT16:
|
||||||
arg->v_uint16 = (guint16)GPOINTER_TO_UINT (hash_pointer);
|
arg->v_uint16 = (uint16_t) GPOINTER_TO_UINT (hash_pointer);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_INT32:
|
case GI_TYPE_TAG_INT32:
|
||||||
arg->v_int32 = (gint32)GPOINTER_TO_INT (hash_pointer);
|
arg->v_int32 = (int32_t) GPOINTER_TO_INT (hash_pointer);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_UINT32:
|
case GI_TYPE_TAG_UINT32:
|
||||||
case GI_TYPE_TAG_UNICHAR:
|
case GI_TYPE_TAG_UNICHAR:
|
||||||
arg->v_uint32 = (guint32)GPOINTER_TO_UINT (hash_pointer);
|
arg->v_uint32 = (uint32_t) GPOINTER_TO_UINT (hash_pointer);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_GTYPE:
|
case GI_TYPE_TAG_GTYPE:
|
||||||
arg->v_size = GPOINTER_TO_SIZE (hash_pointer);
|
arg->v_size = GPOINTER_TO_SIZE (hash_pointer);
|
||||||
@ -503,7 +503,7 @@ gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
|
gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
|
||||||
gpointer hash_pointer,
|
void *hash_pointer,
|
||||||
GIArgument *arg)
|
GIArgument *arg)
|
||||||
{
|
{
|
||||||
GITypeTag storage_type = gi_type_info_get_storage_type (info);
|
GITypeTag storage_type = gi_type_info_get_storage_type (info);
|
||||||
@ -537,7 +537,7 @@ gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
|
|||||||
* for example
|
* for example
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gpointer
|
void *
|
||||||
gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
|
gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
|
||||||
GIArgument *arg)
|
GIArgument *arg)
|
||||||
{
|
{
|
||||||
@ -605,7 +605,7 @@ gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
|
|||||||
* for example
|
* for example
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gpointer
|
void *
|
||||||
gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
|
gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
|
||||||
GIArgument *arg)
|
GIArgument *arg)
|
||||||
{
|
{
|
||||||
|
@ -76,10 +76,10 @@ G_BEGIN_DECLS
|
|||||||
((tag) >= GI_TYPE_TAG_GLIST && (tag) <= GI_TYPE_TAG_GHASH))
|
((tag) >= GI_TYPE_TAG_GLIST && (tag) <= GI_TYPE_TAG_GHASH))
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar* gi_type_tag_to_string (GITypeTag type);
|
const char * gi_type_tag_to_string (GITypeTag type);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar* gi_info_type_to_string (GIInfoType type);
|
const char * gi_info_type_to_string (GIInfoType type);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
@ -90,13 +90,13 @@ GITypeTag gi_type_info_get_tag (GITypeInfo *info);
|
|||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info,
|
GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIBaseInfo * gi_type_info_get_interface (GITypeInfo *info);
|
GIBaseInfo * gi_type_info_get_interface (GITypeInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gint gi_type_info_get_array_length_index (GITypeInfo *info);
|
gssize gi_type_info_get_array_length_index (GITypeInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gssize gi_type_info_get_array_fixed_size (GITypeInfo *info);
|
gssize gi_type_info_get_array_fixed_size (GITypeInfo *info);
|
||||||
@ -112,20 +112,20 @@ GITypeTag gi_type_info_get_storage_type (GITypeInfo *info);
|
|||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
void gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
|
void gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
|
||||||
gpointer hash_pointer,
|
void *hash_pointer,
|
||||||
GIArgument *arg);
|
GIArgument *arg);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gpointer gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
|
void * gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
|
||||||
GIArgument *arg);
|
GIArgument *arg);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
void gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
|
void gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
|
||||||
gpointer hash_pointer,
|
void *hash_pointer,
|
||||||
GIArgument *arg);
|
GIArgument *arg);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gpointer gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
|
void * gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
|
||||||
GIArgument *arg);
|
GIArgument *arg);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -287,47 +287,47 @@ _blob_is_registered_type (GITypelibBlobType blob_type)
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gchar magic[16];
|
char magic[16];
|
||||||
guint8 major_version;
|
uint8_t major_version;
|
||||||
guint8 minor_version;
|
uint8_t minor_version;
|
||||||
guint16 reserved;
|
uint16_t reserved;
|
||||||
guint16 n_entries;
|
uint16_t n_entries;
|
||||||
guint16 n_local_entries;
|
uint16_t n_local_entries;
|
||||||
guint32 directory;
|
uint32_t directory;
|
||||||
guint32 n_attributes;
|
uint32_t n_attributes;
|
||||||
guint32 attributes;
|
uint32_t attributes;
|
||||||
|
|
||||||
guint32 dependencies;
|
uint32_t dependencies;
|
||||||
|
|
||||||
guint32 size;
|
uint32_t size;
|
||||||
guint32 namespace;
|
uint32_t namespace;
|
||||||
guint32 nsversion;
|
uint32_t nsversion;
|
||||||
guint32 shared_library;
|
uint32_t shared_library;
|
||||||
guint32 c_prefix;
|
uint32_t c_prefix;
|
||||||
|
|
||||||
guint16 entry_blob_size;
|
uint16_t entry_blob_size;
|
||||||
guint16 function_blob_size;
|
uint16_t function_blob_size;
|
||||||
guint16 callback_blob_size;
|
uint16_t callback_blob_size;
|
||||||
guint16 signal_blob_size;
|
uint16_t signal_blob_size;
|
||||||
guint16 vfunc_blob_size;
|
uint16_t vfunc_blob_size;
|
||||||
guint16 arg_blob_size;
|
uint16_t arg_blob_size;
|
||||||
guint16 property_blob_size;
|
uint16_t property_blob_size;
|
||||||
guint16 field_blob_size;
|
uint16_t field_blob_size;
|
||||||
guint16 value_blob_size;
|
uint16_t value_blob_size;
|
||||||
guint16 attribute_blob_size;
|
uint16_t attribute_blob_size;
|
||||||
guint16 constant_blob_size;
|
uint16_t constant_blob_size;
|
||||||
guint16 error_domain_blob_size;
|
uint16_t error_domain_blob_size;
|
||||||
|
|
||||||
guint16 signature_blob_size;
|
uint16_t signature_blob_size;
|
||||||
guint16 enum_blob_size;
|
uint16_t enum_blob_size;
|
||||||
guint16 struct_blob_size;
|
uint16_t struct_blob_size;
|
||||||
guint16 object_blob_size;
|
uint16_t object_blob_size;
|
||||||
guint16 interface_blob_size;
|
uint16_t interface_blob_size;
|
||||||
guint16 union_blob_size;
|
uint16_t union_blob_size;
|
||||||
|
|
||||||
guint32 sections;
|
uint32_t sections;
|
||||||
|
|
||||||
guint16 padding[6];
|
uint16_t padding[6];
|
||||||
} Header;
|
} Header;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -357,8 +357,8 @@ typedef enum {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 id;
|
uint32_t id;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
} Section;
|
} Section;
|
||||||
|
|
||||||
|
|
||||||
@ -380,12 +380,12 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
uint16_t blob_type;
|
||||||
|
|
||||||
guint16 local : 1;
|
uint16_t local : 1;
|
||||||
guint16 reserved :15;
|
uint16_t reserved :15;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
} DirEntry;
|
} DirEntry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -401,17 +401,17 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint reserved : 8;
|
unsigned reserved : 8;
|
||||||
guint reserved2 :16;
|
unsigned reserved2 :16;
|
||||||
guint pointer : 1;
|
unsigned pointer : 1;
|
||||||
guint reserved3 : 2;
|
unsigned reserved3 : 2;
|
||||||
guint tag : 5;
|
unsigned tag : 5;
|
||||||
} SimpleTypeBlobFlags;
|
} SimpleTypeBlobFlags;
|
||||||
|
|
||||||
union _SimpleTypeBlob
|
union _SimpleTypeBlob
|
||||||
{
|
{
|
||||||
SimpleTypeBlobFlags flags;
|
SimpleTypeBlobFlags flags;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -489,23 +489,23 @@ typedef union _SimpleTypeBlob SimpleTypeBlob;
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint in : 1;
|
unsigned in : 1;
|
||||||
guint out : 1;
|
unsigned out : 1;
|
||||||
guint caller_allocates : 1;
|
unsigned caller_allocates : 1;
|
||||||
guint nullable : 1;
|
unsigned nullable : 1;
|
||||||
guint optional : 1;
|
unsigned optional : 1;
|
||||||
guint transfer_ownership : 1;
|
unsigned transfer_ownership : 1;
|
||||||
guint transfer_container_ownership : 1;
|
unsigned transfer_container_ownership : 1;
|
||||||
guint return_value : 1;
|
unsigned return_value : 1;
|
||||||
guint scope : 3;
|
unsigned scope : 3;
|
||||||
guint skip : 1;
|
unsigned skip : 1;
|
||||||
guint reserved :20;
|
unsigned reserved :20;
|
||||||
gint8 closure;
|
int8_t closure;
|
||||||
gint8 destroy;
|
int8_t destroy;
|
||||||
|
|
||||||
guint16 padding;
|
uint16_t padding;
|
||||||
|
|
||||||
SimpleTypeBlob arg_type;
|
SimpleTypeBlob arg_type;
|
||||||
} ArgBlob;
|
} ArgBlob;
|
||||||
@ -538,15 +538,15 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
SimpleTypeBlob return_type;
|
SimpleTypeBlob return_type;
|
||||||
|
|
||||||
guint16 may_return_null : 1;
|
uint16_t may_return_null : 1;
|
||||||
guint16 caller_owns_return_value : 1;
|
uint16_t caller_owns_return_value : 1;
|
||||||
guint16 caller_owns_return_container : 1;
|
uint16_t caller_owns_return_container : 1;
|
||||||
guint16 skip_return : 1;
|
uint16_t skip_return : 1;
|
||||||
guint16 instance_transfer_ownership : 1;
|
uint16_t instance_transfer_ownership : 1;
|
||||||
guint16 throws : 1;
|
uint16_t throws : 1;
|
||||||
guint16 reserved :10;
|
uint16_t reserved :10;
|
||||||
|
|
||||||
guint16 n_arguments;
|
uint16_t n_arguments;
|
||||||
|
|
||||||
ArgBlob arguments[];
|
ArgBlob arguments[];
|
||||||
} SignatureBlob;
|
} SignatureBlob;
|
||||||
@ -566,11 +566,11 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type; /* 1 */
|
uint16_t blob_type; /* 1 */
|
||||||
|
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 reserved :15;
|
uint16_t reserved :15;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
} CommonBlob;
|
} CommonBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -605,26 +605,26 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type; /* 1 */
|
uint16_t blob_type; /* 1 */
|
||||||
|
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 setter : 1;
|
uint16_t setter : 1;
|
||||||
guint16 getter : 1;
|
uint16_t getter : 1;
|
||||||
guint16 constructor : 1;
|
uint16_t constructor : 1;
|
||||||
guint16 wraps_vfunc : 1;
|
uint16_t wraps_vfunc : 1;
|
||||||
guint16 throws : 1;
|
uint16_t throws : 1;
|
||||||
guint16 index :10;
|
uint16_t index :10;
|
||||||
/* Note the bits above need to match CommonBlob
|
/* Note the bits above need to match CommonBlob
|
||||||
* and are thus exhausted, extend things using
|
* and are thus exhausted, extend things using
|
||||||
* the reserved block below. */
|
* the reserved block below. */
|
||||||
|
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
guint32 symbol;
|
uint32_t symbol;
|
||||||
guint32 signature;
|
uint32_t signature;
|
||||||
|
|
||||||
guint16 is_static : 1;
|
uint16_t is_static : 1;
|
||||||
guint16 reserved : 15;
|
uint16_t reserved : 15;
|
||||||
guint16 reserved2 : 16;
|
uint16_t reserved2 : 16;
|
||||||
} FunctionBlob;
|
} FunctionBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -641,12 +641,12 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type; /* 2 */
|
uint16_t blob_type; /* 2 */
|
||||||
|
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 reserved :15;
|
uint16_t reserved :15;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
guint32 signature;
|
uint32_t signature;
|
||||||
} CallbackBlob;
|
} CallbackBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -662,11 +662,11 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint8 pointer :1;
|
uint8_t pointer :1;
|
||||||
guint8 reserved :2;
|
uint8_t reserved :2;
|
||||||
guint8 tag :5;
|
uint8_t tag :5;
|
||||||
guint8 reserved2;
|
uint8_t reserved2;
|
||||||
guint16 interface;
|
uint16_t interface;
|
||||||
} InterfaceTypeBlob;
|
} InterfaceTypeBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -679,8 +679,8 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef union {
|
typedef union {
|
||||||
guint16 length;
|
uint16_t length;
|
||||||
guint16 size;
|
uint16_t size;
|
||||||
} ArrayTypeDimension;
|
} ArrayTypeDimension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -706,15 +706,15 @@ typedef union {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 pointer :1;
|
uint16_t pointer :1;
|
||||||
guint16 reserved :2;
|
uint16_t reserved :2;
|
||||||
guint16 tag :5;
|
uint16_t tag :5;
|
||||||
|
|
||||||
guint16 zero_terminated :1;
|
uint16_t zero_terminated :1;
|
||||||
guint16 has_length :1;
|
uint16_t has_length :1;
|
||||||
guint16 has_size :1;
|
uint16_t has_size :1;
|
||||||
guint16 array_type :2;
|
uint16_t array_type :2;
|
||||||
guint16 reserved2 :3;
|
uint16_t reserved2 :3;
|
||||||
|
|
||||||
ArrayTypeDimension dimensions;
|
ArrayTypeDimension dimensions;
|
||||||
|
|
||||||
@ -735,12 +735,12 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint8 pointer :1;
|
uint8_t pointer :1;
|
||||||
guint8 reserved :2;
|
uint8_t reserved :2;
|
||||||
guint8 tag :5;
|
uint8_t tag :5;
|
||||||
|
|
||||||
guint8 reserved2;
|
uint8_t reserved2;
|
||||||
guint16 n_types;
|
uint16_t n_types;
|
||||||
|
|
||||||
SimpleTypeBlob type[];
|
SimpleTypeBlob type[];
|
||||||
} ParamTypeBlob;
|
} ParamTypeBlob;
|
||||||
@ -759,20 +759,20 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint8 pointer :1;
|
uint8_t pointer :1;
|
||||||
guint8 reserved :2;
|
uint8_t reserved :2;
|
||||||
guint8 tag :5;
|
uint8_t tag :5;
|
||||||
|
|
||||||
guint8 reserved2;
|
uint8_t reserved2;
|
||||||
|
|
||||||
guint16 n_domains; /* Must be 0 */
|
uint16_t n_domains; /* Must be 0 */
|
||||||
guint16 domains[];
|
uint16_t domains[];
|
||||||
} ErrorTypeBlob;
|
} ErrorTypeBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ValueBlob:
|
* ValueBlob:
|
||||||
* @deprecated: Whether this value is deprecated
|
* @deprecated: Whether this value is deprecated
|
||||||
* @unsigned_value: if set, value is a 32-bit unsigned integer cast to gint32
|
* @unsigned_value: if set, value is a 32-bit unsigned integer cast to int32_t
|
||||||
* @reserved: Reserved for future use.
|
* @reserved: Reserved for future use.
|
||||||
* @name: Name of blob
|
* @name: Name of blob
|
||||||
* @value: The numerical value
|
* @value: The numerical value
|
||||||
@ -782,11 +782,11 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 deprecated : 1;
|
uint32_t deprecated : 1;
|
||||||
guint32 unsigned_value : 1;
|
uint32_t unsigned_value : 1;
|
||||||
guint32 reserved :30;
|
uint32_t reserved :30;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
gint32 value;
|
int32_t value;
|
||||||
} ValueBlob;
|
} ValueBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -808,17 +808,17 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint8 readable :1;
|
uint8_t readable :1;
|
||||||
guint8 writable :1;
|
uint8_t writable :1;
|
||||||
guint8 has_embedded_type :1;
|
uint8_t has_embedded_type :1;
|
||||||
guint8 reserved :5;
|
uint8_t reserved :5;
|
||||||
guint8 bits;
|
uint8_t bits;
|
||||||
|
|
||||||
guint16 struct_offset;
|
uint16_t struct_offset;
|
||||||
|
|
||||||
guint32 reserved2;
|
uint32_t reserved2;
|
||||||
|
|
||||||
SimpleTypeBlob type;
|
SimpleTypeBlob type;
|
||||||
} FieldBlob;
|
} FieldBlob;
|
||||||
@ -839,14 +839,14 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
uint16_t blob_type;
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 unregistered : 1;
|
uint16_t unregistered : 1;
|
||||||
guint16 reserved :14;
|
uint16_t reserved :14;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
uint32_t gtype_name;
|
||||||
guint32 gtype_init;
|
uint32_t gtype_init;
|
||||||
} RegisteredTypeBlob;
|
} RegisteredTypeBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -876,27 +876,27 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
uint16_t blob_type;
|
||||||
|
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 unregistered : 1;
|
uint16_t unregistered : 1;
|
||||||
guint16 is_gtype_struct : 1;
|
uint16_t is_gtype_struct : 1;
|
||||||
guint16 alignment : 6;
|
uint16_t alignment : 6;
|
||||||
guint16 foreign : 1;
|
uint16_t foreign : 1;
|
||||||
guint16 reserved : 6;
|
uint16_t reserved : 6;
|
||||||
|
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
uint32_t gtype_name;
|
||||||
guint32 gtype_init;
|
uint32_t gtype_init;
|
||||||
|
|
||||||
guint32 size;
|
uint32_t size;
|
||||||
|
|
||||||
guint16 n_fields;
|
uint16_t n_fields;
|
||||||
guint16 n_methods;
|
uint16_t n_methods;
|
||||||
|
|
||||||
guint32 copy_func;
|
uint32_t copy_func;
|
||||||
guint32 free_func;
|
uint32_t free_func;
|
||||||
} StructBlob;
|
} StructBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -927,26 +927,26 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
uint16_t blob_type;
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 unregistered : 1;
|
uint16_t unregistered : 1;
|
||||||
guint16 discriminated : 1;
|
uint16_t discriminated : 1;
|
||||||
guint16 alignment : 6;
|
uint16_t alignment : 6;
|
||||||
guint16 reserved : 7;
|
uint16_t reserved : 7;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
uint32_t gtype_name;
|
||||||
guint32 gtype_init;
|
uint32_t gtype_init;
|
||||||
|
|
||||||
guint32 size;
|
uint32_t size;
|
||||||
|
|
||||||
guint16 n_fields;
|
uint16_t n_fields;
|
||||||
guint16 n_functions;
|
uint16_t n_functions;
|
||||||
|
|
||||||
guint32 copy_func;
|
uint32_t copy_func;
|
||||||
guint32 free_func;
|
uint32_t free_func;
|
||||||
|
|
||||||
gint32 discriminator_offset;
|
int32_t discriminator_offset;
|
||||||
SimpleTypeBlob discriminator_type;
|
SimpleTypeBlob discriminator_type;
|
||||||
} UnionBlob;
|
} UnionBlob;
|
||||||
|
|
||||||
@ -971,22 +971,22 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
uint16_t blob_type;
|
||||||
|
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 unregistered : 1;
|
uint16_t unregistered : 1;
|
||||||
guint16 storage_type : 5;
|
uint16_t storage_type : 5;
|
||||||
guint16 reserved : 9;
|
uint16_t reserved : 9;
|
||||||
|
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
uint32_t gtype_name;
|
||||||
guint32 gtype_init;
|
uint32_t gtype_init;
|
||||||
|
|
||||||
guint16 n_values;
|
uint16_t n_values;
|
||||||
guint16 n_methods;
|
uint16_t n_methods;
|
||||||
|
|
||||||
guint32 error_domain;
|
uint32_t error_domain;
|
||||||
|
|
||||||
ValueBlob values[];
|
ValueBlob values[];
|
||||||
} EnumBlob;
|
} EnumBlob;
|
||||||
@ -1021,20 +1021,20 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint32 deprecated : 1;
|
uint32_t deprecated : 1;
|
||||||
guint32 readable : 1;
|
uint32_t readable : 1;
|
||||||
guint32 writable : 1;
|
uint32_t writable : 1;
|
||||||
guint32 construct : 1;
|
uint32_t construct : 1;
|
||||||
guint32 construct_only : 1;
|
uint32_t construct_only : 1;
|
||||||
guint32 transfer_ownership : 1;
|
uint32_t transfer_ownership : 1;
|
||||||
guint32 transfer_container_ownership : 1;
|
uint32_t transfer_container_ownership : 1;
|
||||||
guint32 setter :10;
|
uint32_t setter :10;
|
||||||
guint32 getter :10;
|
uint32_t getter :10;
|
||||||
guint32 reserved : 5;
|
uint32_t reserved : 5;
|
||||||
|
|
||||||
guint32 reserved2;
|
uint32_t reserved2;
|
||||||
|
|
||||||
SimpleTypeBlob type;
|
SimpleTypeBlob type;
|
||||||
} PropertyBlob;
|
} PropertyBlob;
|
||||||
@ -1064,25 +1064,25 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 run_first : 1;
|
uint16_t run_first : 1;
|
||||||
guint16 run_last : 1;
|
uint16_t run_last : 1;
|
||||||
guint16 run_cleanup : 1;
|
uint16_t run_cleanup : 1;
|
||||||
guint16 no_recurse : 1;
|
uint16_t no_recurse : 1;
|
||||||
guint16 detailed : 1;
|
uint16_t detailed : 1;
|
||||||
guint16 action : 1;
|
uint16_t action : 1;
|
||||||
guint16 no_hooks : 1;
|
uint16_t no_hooks : 1;
|
||||||
guint16 has_class_closure : 1;
|
uint16_t has_class_closure : 1;
|
||||||
guint16 true_stops_emit : 1;
|
uint16_t true_stops_emit : 1;
|
||||||
guint16 reserved : 6;
|
uint16_t reserved : 6;
|
||||||
|
|
||||||
guint16 class_closure;
|
uint16_t class_closure;
|
||||||
|
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint32 reserved2;
|
uint32_t reserved2;
|
||||||
|
|
||||||
guint32 signature;
|
uint32_t signature;
|
||||||
} SignalBlob;
|
} SignalBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1115,22 +1115,22 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint16 must_chain_up : 1;
|
uint16_t must_chain_up : 1;
|
||||||
guint16 must_be_implemented : 1;
|
uint16_t must_be_implemented : 1;
|
||||||
guint16 must_not_be_implemented : 1;
|
uint16_t must_not_be_implemented : 1;
|
||||||
guint16 class_closure : 1;
|
uint16_t class_closure : 1;
|
||||||
guint16 throws : 1;
|
uint16_t throws : 1;
|
||||||
guint16 reserved :11;
|
uint16_t reserved :11;
|
||||||
guint16 signal;
|
uint16_t signal;
|
||||||
|
|
||||||
guint16 struct_offset;
|
uint16_t struct_offset;
|
||||||
guint16 invoker : 10; /* Number of bits matches @index in FunctionBlob */
|
uint16_t invoker : 10; /* Number of bits matches @index in FunctionBlob */
|
||||||
guint16 reserved2 : 6;
|
uint16_t reserved2 : 6;
|
||||||
|
|
||||||
guint32 reserved3;
|
uint32_t reserved3;
|
||||||
guint32 signature;
|
uint32_t signature;
|
||||||
} VFuncBlob;
|
} VFuncBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1177,38 +1177,38 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type; /* 7 */
|
uint16_t blob_type; /* 7 */
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 abstract : 1;
|
uint16_t abstract : 1;
|
||||||
guint16 fundamental : 1;
|
uint16_t fundamental : 1;
|
||||||
guint16 final_ : 1;
|
uint16_t final_ : 1;
|
||||||
guint16 reserved :12;
|
uint16_t reserved :12;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
uint32_t gtype_name;
|
||||||
guint32 gtype_init;
|
uint32_t gtype_init;
|
||||||
|
|
||||||
guint16 parent;
|
uint16_t parent;
|
||||||
guint16 gtype_struct;
|
uint16_t gtype_struct;
|
||||||
|
|
||||||
guint16 n_interfaces;
|
uint16_t n_interfaces;
|
||||||
guint16 n_fields;
|
uint16_t n_fields;
|
||||||
guint16 n_properties;
|
uint16_t n_properties;
|
||||||
guint16 n_methods;
|
uint16_t n_methods;
|
||||||
guint16 n_signals;
|
uint16_t n_signals;
|
||||||
guint16 n_vfuncs;
|
uint16_t n_vfuncs;
|
||||||
guint16 n_constants;
|
uint16_t n_constants;
|
||||||
guint16 n_field_callbacks;
|
uint16_t n_field_callbacks;
|
||||||
|
|
||||||
guint32 ref_func;
|
uint32_t ref_func;
|
||||||
guint32 unref_func;
|
uint32_t unref_func;
|
||||||
guint32 set_value_func;
|
uint32_t set_value_func;
|
||||||
guint32 get_value_func;
|
uint32_t get_value_func;
|
||||||
|
|
||||||
guint32 reserved3;
|
uint32_t reserved3;
|
||||||
guint32 reserved4;
|
uint32_t reserved4;
|
||||||
|
|
||||||
guint16 interfaces[];
|
uint16_t interfaces[];
|
||||||
} ObjectBlob;
|
} ObjectBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1239,28 +1239,28 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
uint16_t blob_type;
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 reserved :15;
|
uint16_t reserved :15;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
guint32 gtype_name;
|
uint32_t gtype_name;
|
||||||
guint32 gtype_init;
|
uint32_t gtype_init;
|
||||||
guint16 gtype_struct;
|
uint16_t gtype_struct;
|
||||||
|
|
||||||
guint16 n_prerequisites;
|
uint16_t n_prerequisites;
|
||||||
guint16 n_properties;
|
uint16_t n_properties;
|
||||||
guint16 n_methods;
|
uint16_t n_methods;
|
||||||
guint16 n_signals;
|
uint16_t n_signals;
|
||||||
guint16 n_vfuncs;
|
uint16_t n_vfuncs;
|
||||||
guint16 n_constants;
|
uint16_t n_constants;
|
||||||
|
|
||||||
guint16 padding;
|
uint16_t padding;
|
||||||
|
|
||||||
guint32 reserved2;
|
uint32_t reserved2;
|
||||||
guint32 reserved3;
|
uint32_t reserved3;
|
||||||
|
|
||||||
guint16 prerequisites[];
|
uint16_t prerequisites[];
|
||||||
} InterfaceBlob;
|
} InterfaceBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1280,17 +1280,17 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint16 blob_type;
|
uint16_t blob_type;
|
||||||
guint16 deprecated : 1;
|
uint16_t deprecated : 1;
|
||||||
guint16 reserved :15;
|
uint16_t reserved :15;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
|
|
||||||
SimpleTypeBlob type;
|
SimpleTypeBlob type;
|
||||||
|
|
||||||
guint32 size;
|
uint32_t size;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
|
|
||||||
guint32 reserved2;
|
uint32_t reserved2;
|
||||||
} ConstantBlob;
|
} ConstantBlob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1306,15 +1306,15 @@ typedef struct {
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
guint32 name;
|
uint32_t name;
|
||||||
guint32 value;
|
uint32_t value;
|
||||||
} AttributeBlob;
|
} AttributeBlob;
|
||||||
|
|
||||||
struct _GITypelib {
|
struct _GITypelib {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
guchar *data;
|
uint8_t *data;
|
||||||
gsize len;
|
size_t len;
|
||||||
gboolean owns_memory;
|
gboolean owns_memory;
|
||||||
GMappedFile *mfile;
|
GMappedFile *mfile;
|
||||||
GList *modules;
|
GList *modules;
|
||||||
@ -1322,24 +1322,21 @@ struct _GITypelib {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DirEntry *gi_typelib_get_dir_entry (GITypelib *typelib,
|
DirEntry *gi_typelib_get_dir_entry (GITypelib *typelib,
|
||||||
guint16 index);
|
uint16_t index);
|
||||||
|
|
||||||
DirEntry *gi_typelib_get_dir_entry_by_name (GITypelib *typelib,
|
DirEntry *gi_typelib_get_dir_entry_by_name (GITypelib *typelib,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
DirEntry *gi_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
|
DirEntry *gi_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
|
||||||
const gchar *gtype_name);
|
const char *gtype_name);
|
||||||
|
|
||||||
DirEntry *gi_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
|
DirEntry *gi_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
|
||||||
GQuark error_domain);
|
GQuark error_domain);
|
||||||
|
|
||||||
gboolean gi_typelib_matches_gtype_name_prefix (GITypelib *typelib,
|
gboolean gi_typelib_matches_gtype_name_prefix (GITypelib *typelib,
|
||||||
const gchar *gtype_name);
|
const char *gtype_name);
|
||||||
|
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
|
||||||
void gi_typelib_check_format (void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gi_typelib_get_string:
|
* gi_typelib_get_string:
|
||||||
* @typelib: TODO
|
* @typelib: TODO
|
||||||
@ -1350,7 +1347,7 @@ void gi_typelib_check_format (void);
|
|||||||
* Returns: TODO
|
* Returns: TODO
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
#define gi_typelib_get_string(typelib,offset) ((const gchar*)&(typelib->data)[(offset)])
|
#define gi_typelib_get_string(typelib,offset) ((const char*)&(typelib->data)[(offset)])
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1393,7 +1390,7 @@ gboolean gi_typelib_validate (GITypelib *typelib,
|
|||||||
|
|
||||||
/* defined in gibaseinfo.c */
|
/* defined in gibaseinfo.c */
|
||||||
AttributeBlob *_attribute_blob_find_first (GIBaseInfo *info,
|
AttributeBlob *_attribute_blob_find_first (GIBaseInfo *info,
|
||||||
guint32 blob_offset);
|
uint32_t blob_offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GITypelibHashBuilder:
|
* GITypelibHashBuilder:
|
||||||
@ -1406,17 +1403,17 @@ typedef struct _GITypelibHashBuilder GITypelibHashBuilder;
|
|||||||
|
|
||||||
GITypelibHashBuilder * gi_typelib_hash_builder_new (void);
|
GITypelibHashBuilder * gi_typelib_hash_builder_new (void);
|
||||||
|
|
||||||
void gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, guint16 value);
|
void gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, uint16_t value);
|
||||||
|
|
||||||
gboolean gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder);
|
gboolean gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder);
|
||||||
|
|
||||||
guint32 gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder);
|
uint32_t gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder);
|
||||||
|
|
||||||
void gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 size);
|
void gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, uint8_t* mem, uint32_t size);
|
||||||
|
|
||||||
void gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder);
|
void gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder);
|
||||||
|
|
||||||
guint16 gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries);
|
uint16_t gi_typelib_hash_search (uint8_t* memory, const char *str, uint32_t n_entries);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -65,16 +65,16 @@ pop_context (ValidateContext *ctx)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_interface_blob (ValidateContext *ctx,
|
validate_interface_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
static DirEntry *
|
static DirEntry *
|
||||||
get_dir_entry_checked (GITypelib *typelib,
|
get_dir_entry_checked (GITypelib *typelib,
|
||||||
guint16 index,
|
uint16_t index,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
Header *header = (Header *)typelib->data;
|
Header *header = (Header *)typelib->data;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
|
|
||||||
if (index == 0 || index > header->n_entries)
|
if (index == 0 || index > header->n_entries)
|
||||||
{
|
{
|
||||||
@ -102,7 +102,7 @@ get_dir_entry_checked (GITypelib *typelib,
|
|||||||
|
|
||||||
static CommonBlob *
|
static CommonBlob *
|
||||||
get_blob (GITypelib *typelib,
|
get_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
if (typelib->len < offset + sizeof (CommonBlob))
|
if (typelib->len < offset + sizeof (CommonBlob))
|
||||||
@ -155,7 +155,7 @@ get_type_blob (GITypelib *typelib,
|
|||||||
*/
|
*/
|
||||||
DirEntry *
|
DirEntry *
|
||||||
gi_typelib_get_dir_entry (GITypelib *typelib,
|
gi_typelib_get_dir_entry (GITypelib *typelib,
|
||||||
guint16 index)
|
uint16_t index)
|
||||||
{
|
{
|
||||||
Header *header = (Header *)typelib->data;
|
Header *header = (Header *)typelib->data;
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ gi_typelib_get_dir_entry_by_name (GITypelib *typelib,
|
|||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
Section *dirindex;
|
Section *dirindex;
|
||||||
gint i, n_entries;
|
size_t i, n_entries;
|
||||||
const char *entry_name;
|
const char *entry_name;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
|
|
||||||
@ -218,8 +218,8 @@ gi_typelib_get_dir_entry_by_name (GITypelib *typelib,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
guint8 *hash = (guint8*) &typelib->data[dirindex->offset];
|
uint8_t *hash = (uint8_t *) &typelib->data[dirindex->offset];
|
||||||
guint16 index;
|
uint16_t index;
|
||||||
|
|
||||||
index = gi_typelib_hash_search (hash, name, n_entries);
|
index = gi_typelib_hash_search (hash, name, n_entries);
|
||||||
entry = gi_typelib_get_dir_entry (typelib, index + 1);
|
entry = gi_typelib_get_dir_entry (typelib, index + 1);
|
||||||
@ -244,12 +244,11 @@ gi_typelib_get_dir_entry_by_name (GITypelib *typelib,
|
|||||||
*/
|
*/
|
||||||
DirEntry *
|
DirEntry *
|
||||||
gi_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
|
gi_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
|
||||||
const gchar *gtype_name)
|
const char *gtype_name)
|
||||||
{
|
{
|
||||||
Header *header = (Header *)typelib->data;
|
Header *header = (Header *)typelib->data;
|
||||||
guint i;
|
|
||||||
|
|
||||||
for (i = 1; i <= header->n_local_entries; i++)
|
for (size_t i = 1; i <= header->n_local_entries; i++)
|
||||||
{
|
{
|
||||||
RegisteredTypeBlob *blob;
|
RegisteredTypeBlob *blob;
|
||||||
const char *type;
|
const char *type;
|
||||||
@ -271,7 +270,7 @@ gi_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
const char *s;
|
const char *s;
|
||||||
const char *separator;
|
const char *separator;
|
||||||
gsize sep_len;
|
size_t sep_len;
|
||||||
GString buf;
|
GString buf;
|
||||||
} StrSplitIter;
|
} StrSplitIter;
|
||||||
|
|
||||||
@ -294,7 +293,7 @@ strsplit_iter_next (StrSplitIter *iter,
|
|||||||
{
|
{
|
||||||
const char *s = iter->s;
|
const char *s = iter->s;
|
||||||
const char *next;
|
const char *next;
|
||||||
gsize len;
|
size_t len;
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -340,14 +339,14 @@ strsplit_iter_clear (StrSplitIter *iter)
|
|||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gi_typelib_matches_gtype_name_prefix (GITypelib *typelib,
|
gi_typelib_matches_gtype_name_prefix (GITypelib *typelib,
|
||||||
const gchar *gtype_name)
|
const char *gtype_name)
|
||||||
{
|
{
|
||||||
Header *header = (Header *)typelib->data;
|
Header *header = (Header *)typelib->data;
|
||||||
const char *c_prefix;
|
const char *c_prefix;
|
||||||
const gchar *prefix;
|
const char *prefix;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
StrSplitIter split_iter;
|
StrSplitIter split_iter;
|
||||||
gsize gtype_name_len;
|
size_t gtype_name_len;
|
||||||
|
|
||||||
c_prefix = gi_typelib_get_string (typelib, header->c_prefix);
|
c_prefix = gi_typelib_get_string (typelib, header->c_prefix);
|
||||||
if (c_prefix == NULL || strlen (c_prefix) == 0)
|
if (c_prefix == NULL || strlen (c_prefix) == 0)
|
||||||
@ -400,12 +399,11 @@ gi_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
|
|||||||
GQuark error_domain)
|
GQuark error_domain)
|
||||||
{
|
{
|
||||||
Header *header = (Header *)typelib->data;
|
Header *header = (Header *)typelib->data;
|
||||||
guint n_entries = header->n_local_entries;
|
size_t n_entries = header->n_local_entries;
|
||||||
const char *domain_string = g_quark_to_string (error_domain);
|
const char *domain_string = g_quark_to_string (error_domain);
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
guint i;
|
|
||||||
|
|
||||||
for (i = 1; i <= n_entries; i++)
|
for (size_t i = 1; i <= n_entries; i++)
|
||||||
{
|
{
|
||||||
EnumBlob *blob;
|
EnumBlob *blob;
|
||||||
const char *enum_domain_string;
|
const char *enum_domain_string;
|
||||||
@ -425,31 +423,7 @@ gi_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* When changing the size of a typelib structure, you are required to update
|
||||||
* gi_typelib_check_format:
|
|
||||||
*
|
|
||||||
* Check compile-time sizes of various typelib file format types are as
|
|
||||||
* expected.
|
|
||||||
*
|
|
||||||
* Since: 2.80
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gi_typelib_check_format (void)
|
|
||||||
{
|
|
||||||
#ifndef G_DISABLE_ASSERT
|
|
||||||
/* Check that struct layout is as we expect */
|
|
||||||
|
|
||||||
gboolean size_check_ok = TRUE;
|
|
||||||
|
|
||||||
#define CHECK_SIZE(s,n) \
|
|
||||||
if (sizeof(s) != n) \
|
|
||||||
{ \
|
|
||||||
g_printerr ("sizeof("#s") is expected to be %d but is %"G_GSIZE_FORMAT".\n", \
|
|
||||||
n, sizeof (s)); \
|
|
||||||
size_check_ok = FALSE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* When changing the size of a typelib structure, you are required to update
|
|
||||||
* the hardcoded size here. Do NOT change these to use sizeof(); these
|
* the hardcoded size here. Do NOT change these to use sizeof(); these
|
||||||
* should match whatever is defined in the text specification and serve as
|
* should match whatever is defined in the text specification and serve as
|
||||||
* a sanity check on structure modifications.
|
* a sanity check on structure modifications.
|
||||||
@ -457,40 +431,34 @@ gi_typelib_check_format (void)
|
|||||||
* Everything else in the code however should be using sizeof().
|
* Everything else in the code however should be using sizeof().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CHECK_SIZE (Header, 112);
|
G_STATIC_ASSERT (sizeof (Header) == 112);
|
||||||
CHECK_SIZE (DirEntry, 12);
|
G_STATIC_ASSERT (sizeof (DirEntry) == 12);
|
||||||
CHECK_SIZE (SimpleTypeBlob, 4);
|
G_STATIC_ASSERT (sizeof (SimpleTypeBlob) == 4);
|
||||||
CHECK_SIZE (ArgBlob, 16);
|
G_STATIC_ASSERT (sizeof (ArgBlob) == 16);
|
||||||
CHECK_SIZE (SignatureBlob, 8);
|
G_STATIC_ASSERT (sizeof (SignatureBlob) == 8);
|
||||||
CHECK_SIZE (CommonBlob, 8);
|
G_STATIC_ASSERT (sizeof (CommonBlob) == 8);
|
||||||
CHECK_SIZE (FunctionBlob, 20);
|
G_STATIC_ASSERT (sizeof (FunctionBlob) == 20);
|
||||||
CHECK_SIZE (CallbackBlob, 12);
|
G_STATIC_ASSERT (sizeof (CallbackBlob) == 12);
|
||||||
CHECK_SIZE (InterfaceTypeBlob, 4);
|
G_STATIC_ASSERT (sizeof (InterfaceTypeBlob) == 4);
|
||||||
CHECK_SIZE (ArrayTypeBlob, 8);
|
G_STATIC_ASSERT (sizeof (ArrayTypeBlob) == 8);
|
||||||
CHECK_SIZE (ParamTypeBlob, 4);
|
G_STATIC_ASSERT (sizeof (ParamTypeBlob) == 4);
|
||||||
CHECK_SIZE (ErrorTypeBlob, 4);
|
G_STATIC_ASSERT (sizeof (ErrorTypeBlob) == 4);
|
||||||
CHECK_SIZE (ValueBlob, 12);
|
G_STATIC_ASSERT (sizeof (ValueBlob) == 12);
|
||||||
CHECK_SIZE (FieldBlob, 16);
|
G_STATIC_ASSERT (sizeof (FieldBlob) == 16);
|
||||||
CHECK_SIZE (RegisteredTypeBlob, 16);
|
G_STATIC_ASSERT (sizeof (RegisteredTypeBlob) == 16);
|
||||||
CHECK_SIZE (StructBlob, 32);
|
G_STATIC_ASSERT (sizeof (StructBlob) == 32);
|
||||||
CHECK_SIZE (EnumBlob, 24);
|
G_STATIC_ASSERT (sizeof (EnumBlob) == 24);
|
||||||
CHECK_SIZE (PropertyBlob, 16);
|
G_STATIC_ASSERT (sizeof (PropertyBlob) == 16);
|
||||||
CHECK_SIZE (SignalBlob, 16);
|
G_STATIC_ASSERT (sizeof (SignalBlob) == 16);
|
||||||
CHECK_SIZE (VFuncBlob, 20);
|
G_STATIC_ASSERT (sizeof (VFuncBlob) == 20);
|
||||||
CHECK_SIZE (ObjectBlob, 60);
|
G_STATIC_ASSERT (sizeof (ObjectBlob) == 60);
|
||||||
CHECK_SIZE (InterfaceBlob, 40);
|
G_STATIC_ASSERT (sizeof (InterfaceBlob) == 40);
|
||||||
CHECK_SIZE (ConstantBlob, 24);
|
G_STATIC_ASSERT (sizeof (ConstantBlob) == 24);
|
||||||
CHECK_SIZE (AttributeBlob, 12);
|
G_STATIC_ASSERT (sizeof (AttributeBlob) == 12);
|
||||||
CHECK_SIZE (UnionBlob, 40);
|
G_STATIC_ASSERT (sizeof (UnionBlob) == 40);
|
||||||
#undef CHECK_SIZE
|
|
||||||
|
|
||||||
g_assert (size_check_ok);
|
|
||||||
#endif /* !G_DISABLE_ASSERT */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_aligned (guint32 offset)
|
is_aligned (uint32_t offset)
|
||||||
{
|
{
|
||||||
return offset == ALIGN_VALUE (offset, 4);
|
return offset == ALIGN_VALUE (offset, 4);
|
||||||
}
|
}
|
||||||
@ -498,7 +466,7 @@ is_aligned (guint32 offset)
|
|||||||
#define MAX_NAME_LEN 2048
|
#define MAX_NAME_LEN 2048
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
get_string (GITypelib *typelib, guint32 offset, GError **error)
|
get_string (GITypelib *typelib, uint32_t offset, GError **error)
|
||||||
{
|
{
|
||||||
if (typelib->len < offset)
|
if (typelib->len < offset)
|
||||||
{
|
{
|
||||||
@ -513,7 +481,7 @@ get_string (GITypelib *typelib, guint32 offset, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
get_string_nofail (GITypelib *typelib, guint32 offset)
|
get_string_nofail (GITypelib *typelib, uint32_t offset)
|
||||||
{
|
{
|
||||||
const char *ret = get_string (typelib, offset, NULL);
|
const char *ret = get_string (typelib, offset, NULL);
|
||||||
g_assert (ret);
|
g_assert (ret);
|
||||||
@ -523,7 +491,8 @@ get_string_nofail (GITypelib *typelib, guint32 offset)
|
|||||||
static gboolean
|
static gboolean
|
||||||
validate_name (GITypelib *typelib,
|
validate_name (GITypelib *typelib,
|
||||||
const char *msg,
|
const char *msg,
|
||||||
const guchar *data, guint32 offset,
|
const uint8_t *data,
|
||||||
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -557,8 +526,8 @@ validate_name (GITypelib *typelib,
|
|||||||
|
|
||||||
/* Fast path sanity check, operates on a memory blob */
|
/* Fast path sanity check, operates on a memory blob */
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_header_basic (const guint8 *memory,
|
validate_header_basic (const uint8_t *memory,
|
||||||
gsize len,
|
size_t len,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
Header *header = (Header *)memory;
|
Header *header = (Header *)memory;
|
||||||
@ -568,8 +537,7 @@ validate_header_basic (const guint8 *memory,
|
|||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
GI_TYPELIB_ERROR,
|
GI_TYPELIB_ERROR,
|
||||||
GI_TYPELIB_ERROR_INVALID,
|
GI_TYPELIB_ERROR_INVALID,
|
||||||
"The specified typelib length %" G_GSIZE_FORMAT " is too short",
|
"The specified typelib length %zu is too short", len);
|
||||||
len);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,17 +576,16 @@ validate_header_basic (const guint8 *memory,
|
|||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
GI_TYPELIB_ERROR,
|
GI_TYPELIB_ERROR,
|
||||||
GI_TYPELIB_ERROR_INVALID_HEADER,
|
GI_TYPELIB_ERROR_INVALID_HEADER,
|
||||||
"Typelib size %" G_GSIZE_FORMAT " does not match %" G_GSIZE_FORMAT,
|
"Typelib size %zu does not match %zu",
|
||||||
(gsize) header->size, len);
|
(size_t) header->size, len);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a sanity check for a specific typelib; it
|
/* This is a sanity check for a specific typelib; it
|
||||||
* prevents us from loading an incompatible typelib.
|
* prevents us from loading an incompatible typelib.
|
||||||
*
|
*
|
||||||
* The hardcoded checks in gi_typelib_check_format to
|
* The hardcoded static checks to protect against inadvertent
|
||||||
* protect against inadvertent or buggy changes to the typelib format
|
* or buggy changes to the typelib format itself.
|
||||||
* itself.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (header->entry_blob_size != sizeof (DirEntry) ||
|
if (header->entry_blob_size != sizeof (DirEntry) ||
|
||||||
@ -695,15 +662,15 @@ validate_header (ValidateContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean validate_type_blob (GITypelib *typelib,
|
static gboolean validate_type_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 signature_offset,
|
uint32_t signature_offset,
|
||||||
gboolean return_type,
|
gboolean return_type,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_array_type_blob (GITypelib *typelib,
|
validate_array_type_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 signature_offset,
|
uint32_t signature_offset,
|
||||||
gboolean return_type,
|
gboolean return_type,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -719,8 +686,8 @@ validate_array_type_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_iface_type_blob (GITypelib *typelib,
|
validate_iface_type_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 signature_offset,
|
uint32_t signature_offset,
|
||||||
gboolean return_type,
|
gboolean return_type,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -741,14 +708,13 @@ validate_iface_type_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_param_type_blob (GITypelib *typelib,
|
validate_param_type_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 signature_offset,
|
uint32_t signature_offset,
|
||||||
gboolean return_type,
|
gboolean return_type,
|
||||||
gint n_params,
|
size_t n_params,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ParamTypeBlob *blob;
|
ParamTypeBlob *blob;
|
||||||
gint i;
|
|
||||||
|
|
||||||
blob = (ParamTypeBlob*)&typelib->data[offset];
|
blob = (ParamTypeBlob*)&typelib->data[offset];
|
||||||
|
|
||||||
@ -770,7 +736,7 @@ validate_param_type_blob (GITypelib *typelib,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n_params; i++)
|
for (size_t i = 0; i < n_params; i++)
|
||||||
{
|
{
|
||||||
if (!validate_type_blob (typelib,
|
if (!validate_type_blob (typelib,
|
||||||
offset + sizeof (ParamTypeBlob) +
|
offset + sizeof (ParamTypeBlob) +
|
||||||
@ -784,8 +750,8 @@ validate_param_type_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_error_type_blob (GITypelib *typelib,
|
validate_error_type_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 signature_offset,
|
uint32_t signature_offset,
|
||||||
gboolean return_type,
|
gboolean return_type,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -807,8 +773,8 @@ validate_error_type_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_type_blob (GITypelib *typelib,
|
validate_type_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 signature_offset,
|
uint32_t signature_offset,
|
||||||
gboolean return_type,
|
gboolean return_type,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -886,8 +852,8 @@ validate_type_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_arg_blob (GITypelib *typelib,
|
validate_arg_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 signature_offset,
|
uint32_t signature_offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ArgBlob *blob;
|
ArgBlob *blob;
|
||||||
@ -916,7 +882,7 @@ validate_arg_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static SimpleTypeBlob *
|
static SimpleTypeBlob *
|
||||||
return_type_from_signature (GITypelib *typelib,
|
return_type_from_signature (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
SignatureBlob *blob;
|
SignatureBlob *blob;
|
||||||
@ -944,11 +910,10 @@ return_type_from_signature (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_signature_blob (GITypelib *typelib,
|
validate_signature_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
SignatureBlob *blob;
|
SignatureBlob *blob;
|
||||||
gint i;
|
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (SignatureBlob))
|
if (typelib->len < offset + sizeof (SignatureBlob))
|
||||||
{
|
{
|
||||||
@ -969,7 +934,7 @@ validate_signature_blob (GITypelib *typelib,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < blob->n_arguments; i++)
|
for (size_t i = 0; i < blob->n_arguments; i++)
|
||||||
{
|
{
|
||||||
if (!validate_arg_blob (typelib,
|
if (!validate_arg_blob (typelib,
|
||||||
offset + sizeof (SignatureBlob) +
|
offset + sizeof (SignatureBlob) +
|
||||||
@ -986,8 +951,8 @@ validate_signature_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_function_blob (ValidateContext *ctx,
|
validate_function_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint16 container_type,
|
uint16_t container_type,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
@ -1106,7 +1071,7 @@ validate_function_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_callback_blob (ValidateContext *ctx,
|
validate_callback_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
@ -1147,10 +1112,10 @@ validate_callback_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_constant_blob (GITypelib *typelib,
|
validate_constant_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
guint value_size[] = {
|
size_t value_size[] = {
|
||||||
0, /* VOID */
|
0, /* VOID */
|
||||||
4, /* BOOLEAN */
|
4, /* BOOLEAN */
|
||||||
1, /* INT8 */
|
1, /* INT8 */
|
||||||
@ -1161,8 +1126,8 @@ validate_constant_blob (GITypelib *typelib,
|
|||||||
4, /* UINT32 */
|
4, /* UINT32 */
|
||||||
8, /* INT64 */
|
8, /* INT64 */
|
||||||
8, /* UINT64 */
|
8, /* UINT64 */
|
||||||
sizeof (gfloat),
|
sizeof (float),
|
||||||
sizeof (gdouble),
|
sizeof (double),
|
||||||
0, /* GTYPE */
|
0, /* GTYPE */
|
||||||
0, /* UTF8 */
|
0, /* UTF8 */
|
||||||
0, /* FILENAME */
|
0, /* FILENAME */
|
||||||
@ -1244,7 +1209,7 @@ validate_constant_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_value_blob (GITypelib *typelib,
|
validate_value_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ValueBlob *blob;
|
ValueBlob *blob;
|
||||||
@ -1268,7 +1233,7 @@ validate_value_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_field_blob (ValidateContext *ctx,
|
validate_field_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
@ -1304,7 +1269,7 @@ validate_field_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_property_blob (GITypelib *typelib,
|
validate_property_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
PropertyBlob *blob;
|
PropertyBlob *blob;
|
||||||
@ -1333,12 +1298,12 @@ validate_property_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_signal_blob (GITypelib *typelib,
|
validate_signal_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 container_offset,
|
uint32_t container_offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
SignalBlob *blob;
|
SignalBlob *blob;
|
||||||
gint n_signals;
|
size_t n_signals;
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (SignalBlob))
|
if (typelib->len < offset + sizeof (SignalBlob))
|
||||||
{
|
{
|
||||||
@ -1402,12 +1367,12 @@ validate_signal_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_vfunc_blob (GITypelib *typelib,
|
validate_vfunc_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint32 container_offset,
|
uint32_t container_offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
VFuncBlob *blob;
|
VFuncBlob *blob;
|
||||||
gint n_vfuncs;
|
size_t n_vfuncs;
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (VFuncBlob))
|
if (typelib->len < offset + sizeof (VFuncBlob))
|
||||||
{
|
{
|
||||||
@ -1460,14 +1425,14 @@ validate_vfunc_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_struct_blob (ValidateContext *ctx,
|
validate_struct_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint16 blob_type,
|
uint16_t blob_type,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
StructBlob *blob;
|
StructBlob *blob;
|
||||||
gint i;
|
size_t i;
|
||||||
guint32 field_offset;
|
uint32_t field_offset;
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (StructBlob))
|
if (typelib->len < offset + sizeof (StructBlob))
|
||||||
{
|
{
|
||||||
@ -1557,14 +1522,13 @@ validate_struct_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_enum_blob (ValidateContext *ctx,
|
validate_enum_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint16 blob_type,
|
uint16_t blob_type,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
EnumBlob *blob;
|
EnumBlob *blob;
|
||||||
gint i;
|
uint32_t offset2;
|
||||||
guint32 offset2;
|
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (EnumBlob))
|
if (typelib->len < offset + sizeof (EnumBlob))
|
||||||
{
|
{
|
||||||
@ -1624,7 +1588,7 @@ validate_enum_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
push_context (ctx, get_string_nofail (typelib, blob->name));
|
push_context (ctx, get_string_nofail (typelib, blob->name));
|
||||||
|
|
||||||
for (i = 0; i < blob->n_values; i++, offset2 += sizeof (ValueBlob))
|
for (size_t i = 0; i < blob->n_values; i++, offset2 += sizeof (ValueBlob))
|
||||||
{
|
{
|
||||||
if (!validate_value_blob (typelib,
|
if (!validate_value_blob (typelib,
|
||||||
offset2,
|
offset2,
|
||||||
@ -1652,7 +1616,7 @@ validate_enum_blob (ValidateContext *ctx,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < blob->n_methods; i++, offset2 += sizeof (FunctionBlob))
|
for (size_t i = 0; i < blob->n_methods; i++, offset2 += sizeof (FunctionBlob))
|
||||||
{
|
{
|
||||||
if (!validate_function_blob (ctx, offset2, BLOB_TYPE_ENUM, error))
|
if (!validate_function_blob (ctx, offset2, BLOB_TYPE_ENUM, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1665,15 +1629,15 @@ validate_enum_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_object_blob (ValidateContext *ctx,
|
validate_object_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
Header *header;
|
Header *header;
|
||||||
ObjectBlob *blob;
|
ObjectBlob *blob;
|
||||||
gint i;
|
size_t i;
|
||||||
guint32 offset2;
|
uint32_t offset2;
|
||||||
guint16 n_field_callbacks;
|
uint16_t n_field_callbacks;
|
||||||
|
|
||||||
header = (Header *)typelib->data;
|
header = (Header *)typelib->data;
|
||||||
|
|
||||||
@ -1771,10 +1735,10 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
for (i = 0; i < blob->n_interfaces; i++, offset2 += 2)
|
for (i = 0; i < blob->n_interfaces; i++, offset2 += 2)
|
||||||
{
|
{
|
||||||
guint16 iface;
|
uint16_t iface;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
|
|
||||||
iface = *(guint16*)&typelib->data[offset2];
|
iface = *(uint16_t *)&typelib->data[offset2];
|
||||||
if (iface == 0 || iface > header->n_entries)
|
if (iface == 0 || iface > header->n_entries)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
@ -1867,14 +1831,14 @@ validate_object_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_interface_blob (ValidateContext *ctx,
|
validate_interface_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
Header *header;
|
Header *header;
|
||||||
InterfaceBlob *blob;
|
InterfaceBlob *blob;
|
||||||
gint i;
|
size_t i;
|
||||||
guint32 offset2;
|
uint32_t offset2;
|
||||||
|
|
||||||
header = (Header *)typelib->data;
|
header = (Header *)typelib->data;
|
||||||
|
|
||||||
@ -1928,9 +1892,9 @@ validate_interface_blob (ValidateContext *ctx,
|
|||||||
for (i = 0; i < blob->n_prerequisites; i++, offset2 += 2)
|
for (i = 0; i < blob->n_prerequisites; i++, offset2 += 2)
|
||||||
{
|
{
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
guint16 req;
|
uint16_t req;
|
||||||
|
|
||||||
req = *(guint16*)&typelib->data[offset2];
|
req = *(uint16_t *)&typelib->data[offset2];
|
||||||
if (req == 0 || req > header->n_entries)
|
if (req == 0 || req > header->n_entries)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
@ -1994,7 +1958,7 @@ validate_interface_blob (ValidateContext *ctx,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_union_blob (GITypelib *typelib,
|
validate_union_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2002,7 +1966,7 @@ validate_union_blob (GITypelib *typelib,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_blob (ValidateContext *ctx,
|
validate_blob (ValidateContext *ctx,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
@ -2073,7 +2037,7 @@ validate_directory (ValidateContext *ctx,
|
|||||||
GITypelib *typelib = ctx->typelib;
|
GITypelib *typelib = ctx->typelib;
|
||||||
Header *header = (Header *)typelib->data;
|
Header *header = (Header *)typelib->data;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
gint i;
|
size_t i;
|
||||||
|
|
||||||
if (typelib->len < header->directory + header->n_entries * sizeof (DirEntry))
|
if (typelib->len < header->directory + header->n_entries * sizeof (DirEntry))
|
||||||
{
|
{
|
||||||
@ -2342,8 +2306,7 @@ gi_typelib_do_dlopen (GITypelib *typelib)
|
|||||||
|
|
||||||
if (shlib_str != NULL && shlib_str[0] != '\0')
|
if (shlib_str != NULL && shlib_str[0] != '\0')
|
||||||
{
|
{
|
||||||
gchar **shlibs;
|
char **shlibs;
|
||||||
gint i;
|
|
||||||
|
|
||||||
/* shared-library is a comma-separated list of libraries */
|
/* shared-library is a comma-separated list of libraries */
|
||||||
shlibs = g_strsplit (shlib_str, ",", 0);
|
shlibs = g_strsplit (shlib_str, ",", 0);
|
||||||
@ -2352,7 +2315,7 @@ gi_typelib_do_dlopen (GITypelib *typelib)
|
|||||||
* again with g_module_open(), the same file handle will be returned. See bug:
|
* again with g_module_open(), the same file handle will be returned. See bug:
|
||||||
* http://bugzilla.gnome.org/show_bug.cgi?id=555294
|
* http://bugzilla.gnome.org/show_bug.cgi?id=555294
|
||||||
*/
|
*/
|
||||||
for (i = 0; shlibs[i]; i++)
|
for (size_t i = 0; shlibs[i]; i++)
|
||||||
{
|
{
|
||||||
GModule *module;
|
GModule *module;
|
||||||
|
|
||||||
@ -2410,8 +2373,8 @@ gi_typelib_ensure_open (GITypelib *typelib)
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
GITypelib *
|
GITypelib *
|
||||||
gi_typelib_new_from_memory (guint8 *memory,
|
gi_typelib_new_from_memory (uint8_t *memory,
|
||||||
gsize len,
|
size_t len,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *meta;
|
GITypelib *meta;
|
||||||
@ -2440,8 +2403,8 @@ gi_typelib_new_from_memory (guint8 *memory,
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
GITypelib *
|
GITypelib *
|
||||||
gi_typelib_new_from_const_memory (const guchar *memory,
|
gi_typelib_new_from_const_memory (const uint8_t *memory,
|
||||||
gsize len,
|
size_t len,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *meta;
|
GITypelib *meta;
|
||||||
@ -2450,7 +2413,7 @@ gi_typelib_new_from_const_memory (const guchar *memory,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
meta = g_slice_new0 (GITypelib);
|
meta = g_slice_new0 (GITypelib);
|
||||||
meta->data = (guchar *) memory;
|
meta->data = (uint8_t *) memory;
|
||||||
meta->len = len;
|
meta->len = len;
|
||||||
meta->owns_memory = FALSE;
|
meta->owns_memory = FALSE;
|
||||||
meta->modules = NULL;
|
meta->modules = NULL;
|
||||||
@ -2474,8 +2437,8 @@ gi_typelib_new_from_mapped_file (GMappedFile *mfile,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GITypelib *meta;
|
GITypelib *meta;
|
||||||
guint8 *data = (guint8 *) g_mapped_file_get_contents (mfile);
|
uint8_t *data = (uint8_t *) g_mapped_file_get_contents (mfile);
|
||||||
gsize len = g_mapped_file_get_length (mfile);
|
size_t len = g_mapped_file_get_length (mfile);
|
||||||
|
|
||||||
if (!validate_header_basic (data, len, error))
|
if (!validate_header_basic (data, len, error))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2522,7 +2485,7 @@ gi_typelib_free (GITypelib *typelib)
|
|||||||
* Returns: name of the namespace represented by @typelib
|
* Returns: name of the namespace represented by @typelib
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const char *
|
||||||
gi_typelib_get_namespace (GITypelib *typelib)
|
gi_typelib_get_namespace (GITypelib *typelib)
|
||||||
{
|
{
|
||||||
return gi_typelib_get_string (typelib, ((Header *) typelib->data)->namespace);
|
return gi_typelib_get_string (typelib, ((Header *) typelib->data)->namespace);
|
||||||
@ -2541,7 +2504,7 @@ gi_typelib_get_namespace (GITypelib *typelib)
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gi_typelib_symbol (GITypelib *typelib, const char *symbol_name, gpointer *symbol)
|
gi_typelib_symbol (GITypelib *typelib, const char *symbol_name, void **symbol)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ G_BEGIN_DECLS
|
|||||||
typedef struct _GITypelib GITypelib;
|
typedef struct _GITypelib GITypelib;
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypelib * gi_typelib_new_from_memory (guint8 *memory,
|
GITypelib * gi_typelib_new_from_memory (uint8_t *memory,
|
||||||
gsize len,
|
size_t len,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypelib * gi_typelib_new_from_const_memory (const guint8 *memory,
|
GITypelib * gi_typelib_new_from_const_memory (const uint8_t *memory,
|
||||||
gsize len,
|
size_t len,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
@ -55,11 +55,11 @@ void gi_typelib_free (GITypelib *typelib);
|
|||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_typelib_symbol (GITypelib *typelib,
|
gboolean gi_typelib_symbol (GITypelib *typelib,
|
||||||
const gchar *symbol_name,
|
const char *symbol_name,
|
||||||
gpointer *symbol);
|
void **symbol);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const gchar * gi_typelib_get_namespace (GITypelib *typelib);
|
const char * gi_typelib_get_namespace (GITypelib *typelib);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#error "Only <girepository.h> can be included directly."
|
#error "Only <girepository.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
@ -114,26 +116,26 @@ GI_AVAILABLE_IN_ALL GType gi_unresolved_info_get_type (void);
|
|||||||
union _GIArgument
|
union _GIArgument
|
||||||
{
|
{
|
||||||
gboolean v_boolean;
|
gboolean v_boolean;
|
||||||
gint8 v_int8;
|
int8_t v_int8;
|
||||||
guint8 v_uint8;
|
uint8_t v_uint8;
|
||||||
gint16 v_int16;
|
int16_t v_int16;
|
||||||
guint16 v_uint16;
|
uint16_t v_uint16;
|
||||||
gint32 v_int32;
|
int32_t v_int32;
|
||||||
guint32 v_uint32;
|
uint32_t v_uint32;
|
||||||
gint64 v_int64;
|
int64_t v_int64;
|
||||||
guint64 v_uint64;
|
uint64_t v_uint64;
|
||||||
gfloat v_float;
|
float v_float;
|
||||||
gdouble v_double;
|
double v_double;
|
||||||
gshort v_short;
|
short v_short;
|
||||||
gushort v_ushort;
|
unsigned short v_ushort;
|
||||||
gint v_int;
|
int v_int;
|
||||||
guint v_uint;
|
unsigned int v_uint;
|
||||||
glong v_long;
|
long v_long;
|
||||||
gulong v_ulong;
|
unsigned long v_ulong;
|
||||||
gssize v_ssize;
|
gssize v_ssize;
|
||||||
gsize v_size;
|
size_t v_size;
|
||||||
gchar * v_string;
|
char *v_string;
|
||||||
gpointer v_pointer;
|
void *v_pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
* Returns: number of fields
|
* Returns: number of fields
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_union_info_get_n_fields (GIUnionInfo *info)
|
gi_union_info_get_n_fields (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -75,7 +75,7 @@ gi_union_info_get_n_fields (GIUnionInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIFieldInfo *
|
GIFieldInfo *
|
||||||
gi_union_info_get_field (GIUnionInfo *info,
|
gi_union_info_get_field (GIUnionInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
@ -94,7 +94,7 @@ gi_union_info_get_field (GIUnionInfo *info,
|
|||||||
* Returns: number of methods
|
* Returns: number of methods
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
unsigned int
|
||||||
gi_union_info_get_n_methods (GIUnionInfo *info)
|
gi_union_info_get_n_methods (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -116,12 +116,12 @@ gi_union_info_get_n_methods (GIUnionInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_union_info_get_method (GIUnionInfo *info,
|
gi_union_info_get_method (GIUnionInfo *info,
|
||||||
guint n)
|
unsigned int n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
gint offset;
|
size_t 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
|
||||||
@ -157,7 +157,7 @@ gi_union_info_is_discriminated (GIUnionInfo *info)
|
|||||||
* Returns: offset, in bytes, of the discriminator
|
* Returns: offset, in bytes, of the discriminator
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
size_t
|
||||||
gi_union_info_get_discriminator_offset (GIUnionInfo *info)
|
gi_union_info_get_discriminator_offset (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -202,7 +202,7 @@ gi_union_info_get_discriminator_type (GIUnionInfo *info)
|
|||||||
*/
|
*/
|
||||||
GIConstantInfo *
|
GIConstantInfo *
|
||||||
gi_union_info_get_discriminator (GIUnionInfo *info,
|
gi_union_info_get_discriminator (GIUnionInfo *info,
|
||||||
guint n)
|
size_t n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -210,7 +210,7 @@ gi_union_info_get_discriminator (GIUnionInfo *info,
|
|||||||
if (blob->discriminated)
|
if (blob->discriminated)
|
||||||
{
|
{
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
gint offset;
|
size_t 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
|
||||||
@ -238,9 +238,9 @@ gi_union_info_get_discriminator (GIUnionInfo *info,
|
|||||||
*/
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
gi_union_info_find_method (GIUnionInfo *info,
|
gi_union_info_find_method (GIUnionInfo *info,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
gint offset;
|
size_t offset;
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -260,7 +260,7 @@ gi_union_info_find_method (GIUnionInfo *info,
|
|||||||
* Returns: size of the union, in bytes
|
* Returns: size of the union, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gsize
|
size_t
|
||||||
gi_union_info_get_size (GIUnionInfo *info)
|
gi_union_info_get_size (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -278,7 +278,7 @@ gi_union_info_get_size (GIUnionInfo *info)
|
|||||||
* Returns: required alignment, in bytes
|
* Returns: required alignment, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gsize
|
size_t
|
||||||
gi_union_info_get_alignment (GIUnionInfo *info)
|
gi_union_info_get_alignment (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
@ -44,41 +44,41 @@ G_BEGIN_DECLS
|
|||||||
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNION)
|
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNION)
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_union_info_get_n_fields (GIUnionInfo *info);
|
unsigned int gi_union_info_get_n_fields (GIUnionInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFieldInfo * gi_union_info_get_field (GIUnionInfo *info,
|
GIFieldInfo * gi_union_info_get_field (GIUnionInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_union_info_get_n_methods (GIUnionInfo *info);
|
unsigned int gi_union_info_get_n_methods (GIUnionInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIFunctionInfo * gi_union_info_get_method (GIUnionInfo *info,
|
GIFunctionInfo * gi_union_info_get_method (GIUnionInfo *info,
|
||||||
guint n);
|
unsigned int n);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gboolean gi_union_info_is_discriminated (GIUnionInfo *info);
|
gboolean gi_union_info_is_discriminated (GIUnionInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_union_info_get_discriminator_offset (GIUnionInfo *info);
|
size_t gi_union_info_get_discriminator_offset (GIUnionInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GITypeInfo * gi_union_info_get_discriminator_type (GIUnionInfo *info);
|
GITypeInfo * gi_union_info_get_discriminator_type (GIUnionInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GIConstantInfo * gi_union_info_get_discriminator (GIUnionInfo *info,
|
GIConstantInfo * gi_union_info_get_discriminator (GIUnionInfo *info,
|
||||||
guint n);
|
size_t n);
|
||||||
|
|
||||||
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 char *name);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gsize gi_union_info_get_size (GIUnionInfo *info);
|
size_t gi_union_info_get_size (GIUnionInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gsize gi_union_info_get_alignment (GIUnionInfo *info);
|
size_t gi_union_info_get_alignment (GIUnionInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
const char * gi_union_info_get_copy_function_name (GIUnionInfo *info);
|
const char * gi_union_info_get_copy_function_name (GIUnionInfo *info);
|
||||||
|
@ -47,17 +47,17 @@
|
|||||||
|
|
||||||
GIVFuncInfo *
|
GIVFuncInfo *
|
||||||
gi_base_info_find_vfunc (GIRealInfo *rinfo,
|
gi_base_info_find_vfunc (GIRealInfo *rinfo,
|
||||||
guint32 offset,
|
uint32_t offset,
|
||||||
guint n_vfuncs,
|
uint16_t n_vfuncs,
|
||||||
const gchar *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
/* FIXME hash */
|
/* FIXME hash */
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
|
|
||||||
for (guint i = 0; i < n_vfuncs; i++)
|
for (uint16_t i = 0; i < n_vfuncs; i++)
|
||||||
{
|
{
|
||||||
VFuncBlob *fblob = (VFuncBlob *)&rinfo->typelib->data[offset];
|
VFuncBlob *fblob = (VFuncBlob *)&rinfo->typelib->data[offset];
|
||||||
const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
|
const char *fname = (const char *)&rinfo->typelib->data[fblob->name];
|
||||||
|
|
||||||
if (strcmp (name, fname) == 0)
|
if (strcmp (name, fname) == 0)
|
||||||
return (GIVFuncInfo *) gi_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*) rinfo,
|
return (GIVFuncInfo *) gi_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*) rinfo,
|
||||||
@ -121,7 +121,7 @@ gi_vfunc_info_get_flags (GIVFuncInfo *info)
|
|||||||
* Returns: the struct offset or `0xFFFF` if it’s unknown
|
* Returns: the struct offset or `0xFFFF` if it’s unknown
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
guint
|
size_t
|
||||||
gi_vfunc_info_get_offset (GIVFuncInfo *info)
|
gi_vfunc_info_get_offset (GIVFuncInfo *info)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
@ -217,7 +217,7 @@ gi_vfunc_info_get_invoker (GIVFuncInfo *info)
|
|||||||
* Returns: address to a function
|
* Returns: address to a function
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
gpointer
|
void *
|
||||||
gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
|
gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
|
||||||
GType implementor_gtype,
|
GType implementor_gtype,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -228,8 +228,8 @@ gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
|
|||||||
GIStructInfo *struct_info;
|
GIStructInfo *struct_info;
|
||||||
GIFieldInfo *field_info = NULL;
|
GIFieldInfo *field_info = NULL;
|
||||||
int length, i, offset;
|
int length, i, offset;
|
||||||
gpointer implementor_class, implementor_vtable;
|
void *implementor_class, *implementor_vtable;
|
||||||
gpointer func = NULL;
|
void *func = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (vfunc_info != NULL, NULL);
|
g_return_val_if_fail (vfunc_info != NULL, NULL);
|
||||||
g_return_val_if_fail (GI_IS_VFUNC_INFO (vfunc_info), NULL);
|
g_return_val_if_fail (GI_IS_VFUNC_INFO (vfunc_info), NULL);
|
||||||
@ -288,7 +288,7 @@ gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
offset = gi_field_info_get_offset (field_info);
|
offset = gi_field_info_get_offset (field_info);
|
||||||
func = *(gpointer*) G_STRUCT_MEMBER_P (implementor_vtable, offset);
|
func = *(void**) G_STRUCT_MEMBER_P (implementor_vtable, offset);
|
||||||
g_type_class_unref (implementor_class);
|
g_type_class_unref (implementor_class);
|
||||||
gi_base_info_unref ((GIBaseInfo *) field_info);
|
gi_base_info_unref ((GIBaseInfo *) field_info);
|
||||||
|
|
||||||
@ -341,13 +341,13 @@ gboolean
|
|||||||
gi_vfunc_info_invoke (GIVFuncInfo *info,
|
gi_vfunc_info_invoke (GIVFuncInfo *info,
|
||||||
GType implementor,
|
GType implementor,
|
||||||
const GIArgument *in_args,
|
const GIArgument *in_args,
|
||||||
gsize n_in_args,
|
size_t n_in_args,
|
||||||
GIArgument *out_args,
|
GIArgument *out_args,
|
||||||
gsize n_out_args,
|
size_t n_out_args,
|
||||||
GIArgument *return_value,
|
GIArgument *return_value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gpointer func;
|
void *func;
|
||||||
GError *local_error = NULL;
|
GError *local_error = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, FALSE);
|
g_return_val_if_fail (info != NULL, FALSE);
|
||||||
|
@ -47,7 +47,7 @@ GI_AVAILABLE_IN_ALL
|
|||||||
GIVFuncInfoFlags gi_vfunc_info_get_flags (GIVFuncInfo *info);
|
GIVFuncInfoFlags gi_vfunc_info_get_flags (GIVFuncInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
guint gi_vfunc_info_get_offset (GIVFuncInfo *info);
|
size_t gi_vfunc_info_get_offset (GIVFuncInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
GISignalInfo * gi_vfunc_info_get_signal (GIVFuncInfo *info);
|
GISignalInfo * gi_vfunc_info_get_signal (GIVFuncInfo *info);
|
||||||
@ -56,7 +56,7 @@ GI_AVAILABLE_IN_ALL
|
|||||||
GIFunctionInfo * gi_vfunc_info_get_invoker (GIVFuncInfo *info);
|
GIFunctionInfo * gi_vfunc_info_get_invoker (GIVFuncInfo *info);
|
||||||
|
|
||||||
GI_AVAILABLE_IN_ALL
|
GI_AVAILABLE_IN_ALL
|
||||||
gpointer gi_vfunc_info_get_address (GIVFuncInfo *info,
|
void * gi_vfunc_info_get_address (GIVFuncInfo *info,
|
||||||
GType implementor_gtype,
|
GType implementor_gtype,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
@ -64,9 +64,9 @@ GI_AVAILABLE_IN_ALL
|
|||||||
gboolean gi_vfunc_info_invoke (GIVFuncInfo *info,
|
gboolean gi_vfunc_info_invoke (GIVFuncInfo *info,
|
||||||
GType implementor,
|
GType implementor,
|
||||||
const GIArgument *in_args,
|
const GIArgument *in_args,
|
||||||
gsize n_in_args,
|
size_t n_in_args,
|
||||||
GIArgument *out_args,
|
GIArgument *out_args,
|
||||||
gsize n_out_args,
|
size_t n_out_args,
|
||||||
GIArgument *return_value,
|
GIArgument *return_value,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
* INT32 mph_size
|
* INT32 mph_size
|
||||||
* MPH (mph_size bytes)
|
* MPH (mph_size bytes)
|
||||||
* (padding for alignment to uint32 if necessary)
|
* (padding for alignment to uint32 if necessary)
|
||||||
* INDEX (array of guint16)
|
* INDEX (array of uint16_t)
|
||||||
*
|
*
|
||||||
* Because BDZ is not order preserving, we need a lookaside table which
|
* Because BDZ is not order preserving, we need a lookaside table which
|
||||||
* maps the hash value into the directory index.
|
* maps the hash value into the directory index.
|
||||||
@ -59,8 +59,8 @@ struct _GITypelibHashBuilder {
|
|||||||
gboolean buildable;
|
gboolean buildable;
|
||||||
cmph_t *c;
|
cmph_t *c;
|
||||||
GHashTable *strings;
|
GHashTable *strings;
|
||||||
guint32 dirmap_offset;
|
uint32_t dirmap_offset;
|
||||||
guint32 packed_size;
|
uint32_t packed_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
GITypelibHashBuilder *
|
GITypelibHashBuilder *
|
||||||
@ -75,10 +75,10 @@ gi_typelib_hash_builder_new (void)
|
|||||||
void
|
void
|
||||||
gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder,
|
gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder,
|
||||||
const char *str,
|
const char *str,
|
||||||
guint16 value)
|
uint16_t value)
|
||||||
{
|
{
|
||||||
g_return_if_fail (builder->c == NULL);
|
g_return_if_fail (builder->c == NULL);
|
||||||
g_hash_table_insert (builder->strings, g_strdup (str), GUINT_TO_POINTER ((guint) value));
|
g_hash_table_insert (builder->strings, g_strdup (str), GUINT_TO_POINTER (value));
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -86,12 +86,12 @@ gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder)
|
|||||||
{
|
{
|
||||||
char **strs;
|
char **strs;
|
||||||
GHashTableIter hashiter;
|
GHashTableIter hashiter;
|
||||||
gpointer key, value;
|
void *key, *value;
|
||||||
cmph_io_adapter_t *io;
|
cmph_io_adapter_t *io;
|
||||||
cmph_config_t *config;
|
cmph_config_t *config;
|
||||||
guint32 num_elts;
|
uint32_t num_elts;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
guint i;
|
unsigned i;
|
||||||
|
|
||||||
if (builder->prepared)
|
if (builder->prepared)
|
||||||
return builder->buildable;
|
return builder->buildable;
|
||||||
@ -127,9 +127,9 @@ gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder)
|
|||||||
g_assert (cmph_size (builder->c) == num_elts);
|
g_assert (cmph_size (builder->c) == num_elts);
|
||||||
|
|
||||||
/* Pack a size counter at front */
|
/* Pack a size counter at front */
|
||||||
offset = sizeof(guint32) + cmph_packed_size (builder->c);
|
offset = sizeof (uint32_t) + cmph_packed_size (builder->c);
|
||||||
builder->dirmap_offset = ALIGN_VALUE (offset, 4);
|
builder->dirmap_offset = ALIGN_VALUE (offset, 4);
|
||||||
builder->packed_size = builder->dirmap_offset + (num_elts * sizeof(guint16));
|
builder->packed_size = builder->dirmap_offset + (num_elts * sizeof (uint16_t));
|
||||||
out:
|
out:
|
||||||
g_strfreev (strs);
|
g_strfreev (strs);
|
||||||
cmph_config_destroy (config);
|
cmph_config_destroy (config);
|
||||||
@ -137,7 +137,7 @@ gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder)
|
|||||||
return builder->buildable;
|
return builder->buildable;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint32
|
uint32_t
|
||||||
gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder)
|
gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (builder != NULL, 0);
|
g_return_val_if_fail (builder != NULL, 0);
|
||||||
@ -148,15 +148,15 @@ gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 len)
|
gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, uint8_t* mem, uint32_t len)
|
||||||
{
|
{
|
||||||
guint16 *table;
|
uint16_t *table;
|
||||||
GHashTableIter hashiter;
|
GHashTableIter hashiter;
|
||||||
gpointer key, value;
|
void *key, *value;
|
||||||
#ifndef G_DISABLE_ASSERT
|
#ifndef G_DISABLE_ASSERT
|
||||||
guint32 num_elts;
|
uint32_t num_elts;
|
||||||
#endif
|
#endif
|
||||||
guint8 *packed_mem;
|
uint8_t *packed_mem;
|
||||||
|
|
||||||
g_return_if_fail (builder != NULL);
|
g_return_if_fail (builder != NULL);
|
||||||
g_return_if_fail (builder->prepared);
|
g_return_if_fail (builder->prepared);
|
||||||
@ -167,11 +167,11 @@ gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint3
|
|||||||
|
|
||||||
memset (mem, 0, len);
|
memset (mem, 0, len);
|
||||||
|
|
||||||
*((guint32*) mem) = builder->dirmap_offset;
|
*((uint32_t*) mem) = builder->dirmap_offset;
|
||||||
packed_mem = (guint8*)(mem + sizeof(guint32));
|
packed_mem = (uint8_t*)(mem + sizeof (uint32_t));
|
||||||
cmph_pack (builder->c, packed_mem);
|
cmph_pack (builder->c, packed_mem);
|
||||||
|
|
||||||
table = (guint16*) (mem + builder->dirmap_offset);
|
table = (uint16_t*) (mem + builder->dirmap_offset);
|
||||||
|
|
||||||
#ifndef G_DISABLE_ASSERT
|
#ifndef G_DISABLE_ASSERT
|
||||||
num_elts = g_hash_table_size (builder->strings);
|
num_elts = g_hash_table_size (builder->strings);
|
||||||
@ -180,8 +180,8 @@ gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint3
|
|||||||
while (g_hash_table_iter_next (&hashiter, &key, &value))
|
while (g_hash_table_iter_next (&hashiter, &key, &value))
|
||||||
{
|
{
|
||||||
const char *str = key;
|
const char *str = key;
|
||||||
guint16 strval = (guint16)GPOINTER_TO_UINT(value);
|
uint16_t strval = (uint16_t)GPOINTER_TO_UINT(value);
|
||||||
guint32 hashv;
|
uint32_t hashv;
|
||||||
|
|
||||||
hashv = cmph_search_packed (packed_mem, str, strlen (str));
|
hashv = cmph_search_packed (packed_mem, str, strlen (str));
|
||||||
g_assert (hashv < num_elts);
|
g_assert (hashv < num_elts);
|
||||||
@ -201,16 +201,16 @@ gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder)
|
|||||||
g_slice_free (GITypelibHashBuilder, builder);
|
g_slice_free (GITypelibHashBuilder, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
guint16
|
uint16_t
|
||||||
gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries)
|
gi_typelib_hash_search (uint8_t* memory, const char *str, uint32_t n_entries)
|
||||||
{
|
{
|
||||||
guint32 *mph;
|
uint32_t *mph;
|
||||||
guint16 *table;
|
uint16_t *table;
|
||||||
guint32 dirmap_offset;
|
uint32_t dirmap_offset;
|
||||||
guint32 offset;
|
uint32_t offset;
|
||||||
|
|
||||||
g_assert ((((size_t)memory) & 0x3) == 0);
|
g_assert ((((size_t)memory) & 0x3) == 0);
|
||||||
mph = ((guint32*)memory)+1;
|
mph = ((uint32_t*)memory)+1;
|
||||||
|
|
||||||
offset = cmph_search_packed (mph, str, strlen (str));
|
offset = cmph_search_packed (mph, str, strlen (str));
|
||||||
|
|
||||||
@ -222,8 +222,8 @@ gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries)
|
|||||||
if (offset >= n_entries)
|
if (offset >= n_entries)
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
dirmap_offset = *((guint32*)memory);
|
dirmap_offset = *((uint32_t*)memory);
|
||||||
table = (guint16*) (memory + dirmap_offset);
|
table = (uint16_t*) (memory + dirmap_offset);
|
||||||
|
|
||||||
return table[offset];
|
return table[offset];
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ build (void)
|
|||||||
cmph_io_adapter_t *io;
|
cmph_io_adapter_t *io;
|
||||||
char **strings;
|
char **strings;
|
||||||
cmph_t *c;
|
cmph_t *c;
|
||||||
guint32 size;
|
uint32_t size;
|
||||||
|
|
||||||
strings = g_strsplit ("foo,bar,baz", ",", -1);
|
strings = g_strsplit ("foo,bar,baz", ",", -1);
|
||||||
|
|
||||||
@ -50,15 +50,14 @@ build (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
assert_hashes_unique (guint n_hashes,
|
assert_hashes_unique (size_t n_hashes,
|
||||||
guint32* hashes)
|
uint32_t* hashes)
|
||||||
{
|
{
|
||||||
guint i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < n_hashes; i++)
|
for (i = 0; i < n_hashes; i++)
|
||||||
{
|
{
|
||||||
guint j = 0;
|
for (size_t j = 0; j < n_hashes; j++)
|
||||||
for (j = 0; j < n_hashes; j++)
|
|
||||||
{
|
{
|
||||||
if (j != i)
|
if (j != i)
|
||||||
g_assert_cmpuint (hashes[i], !=, hashes[j]);
|
g_assert_cmpuint (hashes[i], !=, hashes[j]);
|
||||||
@ -70,10 +69,10 @@ static void
|
|||||||
test_search (void)
|
test_search (void)
|
||||||
{
|
{
|
||||||
cmph_t *c = build();
|
cmph_t *c = build();
|
||||||
guint i;
|
size_t i;
|
||||||
guint32 hash;
|
uint32_t hash;
|
||||||
guint32 hashes[3];
|
uint32_t hashes[3];
|
||||||
guint32 size;
|
uint32_t size;
|
||||||
|
|
||||||
size = cmph_size (c);
|
size = cmph_size (c);
|
||||||
|
|
||||||
@ -102,12 +101,12 @@ static void
|
|||||||
test_search_packed (void)
|
test_search_packed (void)
|
||||||
{
|
{
|
||||||
cmph_t *c = build();
|
cmph_t *c = build();
|
||||||
guint32 bufsize;
|
size_t i;
|
||||||
guint i;
|
uint32_t bufsize;
|
||||||
guint32 hash;
|
uint32_t hash;
|
||||||
guint32 hashes[3];
|
uint32_t hashes[3];
|
||||||
guint32 size;
|
uint32_t size;
|
||||||
guint8 *buf;
|
uint8_t *buf;
|
||||||
|
|
||||||
bufsize = cmph_packed_size (c);
|
bufsize = cmph_packed_size (c);
|
||||||
buf = g_malloc (bufsize);
|
buf = g_malloc (bufsize);
|
||||||
@ -142,15 +141,11 @@ test_search_packed (void)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
gint ret;
|
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/cmph-bdz/search", test_search);
|
g_test_add_func ("/cmph-bdz/search", test_search);
|
||||||
g_test_add_func ("/cmph-bdz/search-packed", test_search_packed);
|
g_test_add_func ("/cmph-bdz/search-packed", test_search_packed);
|
||||||
|
|
||||||
ret = g_test_run ();
|
return g_test_run ();
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include "gitypelib-internal.h"
|
#include "gitypelib-internal.h"
|
||||||
|
|
||||||
@ -28,8 +29,8 @@ static void
|
|||||||
test_build_retrieve (void)
|
test_build_retrieve (void)
|
||||||
{
|
{
|
||||||
GITypelibHashBuilder *builder;
|
GITypelibHashBuilder *builder;
|
||||||
guint32 bufsize;
|
uint32_t bufsize;
|
||||||
guint8* buf;
|
uint8_t* buf;
|
||||||
|
|
||||||
builder = gi_typelib_hash_builder_new ();
|
builder = gi_typelib_hash_builder_new ();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user