[GIRepository] Rename GTypelib to GITypelib

Keep a typedef for backwards compatibility, until
the major bindings has moved over.
This commit is contained in:
Johan Dahlin 2010-08-31 17:36:06 -03:00
parent 9c80c84dc7
commit 14edb06326
11 changed files with 124 additions and 123 deletions

View File

@ -35,7 +35,7 @@ GIBaseInfo *
_g_info_new_full (GIInfoType type, _g_info_new_full (GIInfoType type,
GIRepository *repository, GIRepository *repository,
GIBaseInfo *container, GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
GIRealInfo *info; GIRealInfo *info;
@ -58,7 +58,7 @@ _g_info_new_full (GIInfoType type,
GIBaseInfo * GIBaseInfo *
g_info_new (GIInfoType type, g_info_new (GIInfoType type,
GIBaseInfo *container, GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
return _g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset); return _g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
@ -69,7 +69,7 @@ _g_info_init (GIRealInfo *info,
GIInfoType type, GIInfoType type,
GIRepository *repository, GIRepository *repository,
GIBaseInfo *container, GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
memset (info, 0, sizeof (GIRealInfo)); memset (info, 0, sizeof (GIRealInfo));
@ -90,7 +90,7 @@ _g_info_init (GIRealInfo *info,
GIBaseInfo * GIBaseInfo *
_g_info_from_entry (GIRepository *repository, _g_info_from_entry (GIRepository *repository,
GTypelib *typelib, GITypelib *typelib,
guint16 index) guint16 index)
{ {
GIBaseInfo *result; GIBaseInfo *result;
@ -127,7 +127,7 @@ _g_info_from_entry (GIRepository *repository,
GITypeInfo * GITypeInfo *
_g_type_info_new (GIBaseInfo *container, _g_type_info_new (GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset]; SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
@ -139,7 +139,7 @@ _g_type_info_new (GIBaseInfo *container,
void void
_g_type_info_init (GIBaseInfo *info, _g_type_info_init (GIBaseInfo *info,
GIBaseInfo *container, GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset) guint32 offset)
{ {
GIRealInfo *rinfo = (GIRealInfo*)container; GIRealInfo *rinfo = (GIRealInfo*)container;
@ -153,7 +153,7 @@ _g_type_info_init (GIBaseInfo *info,
/** /**
* SECTION:gibaseinfo * SECTION:gibaseinfo
* @Short_description: Base struct for all GTypelib structs * @Short_description: Base struct for all GITypelib structs
* @Title: GIBaseInfo * @Title: GIBaseInfo
* *
* GIBaseInfo is the common base struct of all other *Info structs * GIBaseInfo is the common base struct of all other *Info structs
@ -611,7 +611,7 @@ g_base_info_get_container (GIBaseInfo *info)
* *
* Returns: (transfer none): the typelib. * Returns: (transfer none): the typelib.
*/ */
GTypelib * GITypelib *
g_base_info_get_typelib (GIBaseInfo *info) g_base_info_get_typelib (GIBaseInfo *info)
{ {
return ((GIRealInfo*)info)->typelib; return ((GIRealInfo*)info)->typelib;

View File

@ -71,12 +71,12 @@ gboolean g_base_info_iterate_attributes (GIBaseInfo *info,
char **name, char **name,
char **value); char **value);
GIBaseInfo * g_base_info_get_container (GIBaseInfo *info); GIBaseInfo * g_base_info_get_container (GIBaseInfo *info);
GTypelib * g_base_info_get_typelib (GIBaseInfo *info); GITypelib * g_base_info_get_typelib (GIBaseInfo *info);
gboolean g_base_info_equal (GIBaseInfo *info1, gboolean g_base_info_equal (GIBaseInfo *info1,
GIBaseInfo *info2); GIBaseInfo *info2);
GIBaseInfo * g_info_new (GIInfoType type, GIBaseInfo * g_info_new (GIInfoType type,
GIBaseInfo *container, GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
G_END_DECLS G_END_DECLS

View File

@ -49,7 +49,7 @@ struct _GIRealInfo
/* Resolved specific */ /* Resolved specific */
GTypelib *typelib; GITypelib *typelib;
guint32 offset; guint32 offset;
guint32 type_is_embedded : 1; /* Used by GITypeInfo */ guint32 type_is_embedded : 1; /* Used by GITypeInfo */
@ -76,26 +76,26 @@ void _g_info_init (GIRealInfo *info,
GIInfoType type, GIInfoType type,
GIRepository *repository, GIRepository *repository,
GIBaseInfo *container, GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
GIBaseInfo * _g_info_from_entry (GIRepository *repository, GIBaseInfo * _g_info_from_entry (GIRepository *repository,
GTypelib *typelib, GITypelib *typelib,
guint16 index); guint16 index);
GIBaseInfo * _g_info_new_full (GIInfoType type, GIBaseInfo * _g_info_new_full (GIInfoType type,
GIRepository *repository, GIRepository *repository,
GIBaseInfo *container, GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
GITypeInfo * _g_type_info_new (GIBaseInfo *container, GITypeInfo * _g_type_info_new (GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
void _g_type_info_init (GIBaseInfo *info, void _g_type_info_init (GIBaseInfo *info,
GIBaseInfo *container, GIBaseInfo *container,
GTypelib *typelib, GITypelib *typelib,
guint32 offset); guint32 offset);
GIFunctionInfo * _g_base_info_find_method (GIBaseInfo *base, GIFunctionInfo * _g_base_info_find_method (GIBaseInfo *base,

View File

@ -42,8 +42,8 @@ static GSList *override_search_path = NULL;
struct _GIRepositoryPrivate struct _GIRepositoryPrivate
{ {
GHashTable *typelibs; /* (string) namespace -> GTypelib */ GHashTable *typelibs; /* (string) namespace -> GITypelib */
GHashTable *lazy_typelibs; /* (string) namespace-version -> GTypelib */ GHashTable *lazy_typelibs; /* (string) namespace-version -> GITypelib */
GHashTable *info_by_gtype; /* GType -> GIBaseInfo */ GHashTable *info_by_gtype; /* GType -> GIBaseInfo */
}; };
@ -193,7 +193,7 @@ build_typelib_key (const char *name, const char *source)
} }
static char ** static char **
get_typelib_dependencies (GTypelib *typelib) get_typelib_dependencies (GITypelib *typelib)
{ {
Header *header; Header *header;
const char *dependencies_glob; const char *dependencies_glob;
@ -218,8 +218,8 @@ get_repository (GIRepository *repository)
return default_repository; return default_repository;
} }
static GTypelib * static GITypelib *
check_version_conflict (GTypelib *typelib, check_version_conflict (GITypelib *typelib,
const gchar *namespace, const gchar *namespace,
const gchar *expected_version, const gchar *expected_version,
char **version_conflict) char **version_conflict)
@ -249,7 +249,7 @@ check_version_conflict (GTypelib *typelib,
return typelib; return typelib;
} }
static GTypelib * static GITypelib *
get_registered_status (GIRepository *repository, get_registered_status (GIRepository *repository,
const char *namespace, const char *namespace,
const char *version, const char *version,
@ -257,7 +257,7 @@ get_registered_status (GIRepository *repository,
gboolean *lazy_status, gboolean *lazy_status,
char **version_conflict) char **version_conflict)
{ {
GTypelib *typelib; GITypelib *typelib;
repository = get_repository (repository); repository = get_repository (repository);
if (lazy_status) if (lazy_status)
*lazy_status = FALSE; *lazy_status = FALSE;
@ -274,7 +274,7 @@ get_registered_status (GIRepository *repository,
return check_version_conflict (typelib, namespace, version, version_conflict); return check_version_conflict (typelib, namespace, version, version_conflict);
} }
static GTypelib * static GITypelib *
get_registered (GIRepository *repository, get_registered (GIRepository *repository,
const char *namespace, const char *namespace,
const char *version) const char *version)
@ -284,7 +284,7 @@ get_registered (GIRepository *repository,
static gboolean static gboolean
load_dependencies_recurse (GIRepository *repository, load_dependencies_recurse (GIRepository *repository,
GTypelib *typelib, GITypelib *typelib,
GError **error) GError **error)
{ {
char **dependencies; char **dependencies;
@ -324,7 +324,7 @@ static const char *
register_internal (GIRepository *repository, register_internal (GIRepository *repository,
const char *source, const char *source,
gboolean lazy, gboolean lazy,
GTypelib *typelib, GITypelib *typelib,
GError **error) GError **error)
{ {
Header *header; Header *header;
@ -388,7 +388,7 @@ char **
g_irepository_get_dependencies (GIRepository *repository, g_irepository_get_dependencies (GIRepository *repository,
const char *namespace) const char *namespace)
{ {
GTypelib *typelib; GITypelib *typelib;
g_return_val_if_fail (namespace != NULL, NULL); g_return_val_if_fail (namespace != NULL, NULL);
@ -402,7 +402,7 @@ g_irepository_get_dependencies (GIRepository *repository,
const char * const char *
g_irepository_load_typelib (GIRepository *repository, g_irepository_load_typelib (GIRepository *repository,
GTypelib *typelib, GITypelib *typelib,
GIRepositoryLoadFlags flags, GIRepositoryLoadFlags flags,
GError **error) GError **error)
{ {
@ -497,7 +497,7 @@ gint
g_irepository_get_n_infos (GIRepository *repository, g_irepository_get_n_infos (GIRepository *repository,
const gchar *namespace) const gchar *namespace)
{ {
GTypelib *typelib; GITypelib *typelib;
gint n_interfaces = 0; gint n_interfaces = 0;
g_return_val_if_fail (namespace != NULL, -1); g_return_val_if_fail (namespace != NULL, -1);
@ -529,7 +529,7 @@ find_interface (gpointer key,
gpointer data) gpointer data)
{ {
gint i; gint i;
GTypelib *typelib = (GTypelib *)value; GITypelib *typelib = (GITypelib *)value;
Header *header = (Header *) typelib->data; Header *header = (Header *) typelib->data;
IfaceData *iface_data = (IfaceData *)data; IfaceData *iface_data = (IfaceData *)data;
gint index; gint index;
@ -633,7 +633,7 @@ g_irepository_get_info (GIRepository *repository,
gint index) gint index)
{ {
IfaceData data; IfaceData data;
GTypelib *typelib; GITypelib *typelib;
g_return_val_if_fail (namespace != NULL, NULL); g_return_val_if_fail (namespace != NULL, NULL);
@ -727,7 +727,7 @@ g_irepository_find_by_name (GIRepository *repository,
const gchar *name) const gchar *name)
{ {
IfaceData data; IfaceData data;
GTypelib *typelib; GITypelib *typelib;
g_return_val_if_fail (namespace != NULL, NULL); g_return_val_if_fail (namespace != NULL, NULL);
@ -804,7 +804,7 @@ const gchar *
g_irepository_get_version (GIRepository *repository, g_irepository_get_version (GIRepository *repository,
const gchar *namespace) const gchar *namespace)
{ {
GTypelib *typelib; GITypelib *typelib;
Header *header; Header *header;
g_return_val_if_fail (namespace != NULL, NULL); g_return_val_if_fail (namespace != NULL, NULL);
@ -838,7 +838,7 @@ const gchar *
g_irepository_get_shared_library (GIRepository *repository, g_irepository_get_shared_library (GIRepository *repository,
const gchar *namespace) const gchar *namespace)
{ {
GTypelib *typelib; GITypelib *typelib;
Header *header; Header *header;
g_return_val_if_fail (namespace != NULL, NULL); g_return_val_if_fail (namespace != NULL, NULL);
@ -874,7 +874,7 @@ const gchar *
g_irepository_get_c_prefix (GIRepository *repository, g_irepository_get_c_prefix (GIRepository *repository,
const gchar *namespace_) const gchar *namespace_)
{ {
GTypelib *typelib; GITypelib *typelib;
Header *header; Header *header;
g_return_val_if_fail (namespace_ != NULL, NULL); g_return_val_if_fail (namespace_ != NULL, NULL);
@ -1206,7 +1206,7 @@ g_irepository_enumerate_versions (GIRepository *repository,
return ret; return ret;
} }
static GTypelib * static GITypelib *
require_internal (GIRepository *repository, require_internal (GIRepository *repository,
const gchar *namespace, const gchar *namespace,
const gchar *version, const gchar *version,
@ -1215,9 +1215,9 @@ require_internal (GIRepository *repository,
GError **error) GError **error)
{ {
GMappedFile *mfile; GMappedFile *mfile;
GTypelib *ret = NULL; GITypelib *ret = NULL;
Header *header; Header *header;
GTypelib *typelib = NULL; GITypelib *typelib = NULL;
const gchar *typelib_namespace, *typelib_version; const gchar *typelib_namespace, *typelib_version;
gboolean allow_lazy = (flags & G_IREPOSITORY_LOAD_FLAG_LAZY) > 0; gboolean allow_lazy = (flags & G_IREPOSITORY_LOAD_FLAG_LAZY) > 0;
gboolean is_lazy; gboolean is_lazy;
@ -1335,9 +1335,9 @@ require_internal (GIRepository *repository,
* version @version of namespace may be specified. If @version is * version @version of namespace may be specified. If @version is
* not specified, the latest will be used. * not specified, the latest will be used.
* *
* Returns: (transfer full): a pointer to the #GTypelib if successful, %NULL otherwise * Returns: (transfer full): a pointer to the #GITypelib if successful, %NULL otherwise
*/ */
GTypelib * GITypelib *
g_irepository_require (GIRepository *repository, g_irepository_require (GIRepository *repository,
const gchar *namespace, const gchar *namespace,
const gchar *version, const gchar *version,
@ -1345,7 +1345,7 @@ g_irepository_require (GIRepository *repository,
GError **error) GError **error)
{ {
GSList *search_path; GSList *search_path;
GTypelib *typelib; GITypelib *typelib;
search_path = build_search_path_with_overrides (); search_path = build_search_path_with_overrides ();
typelib = require_internal (repository, namespace, version, flags, typelib = require_internal (repository, namespace, version, flags,
@ -1370,9 +1370,9 @@ g_irepository_require (GIRepository *repository,
* version @version of namespace should be specified. If @version is * version @version of namespace should be specified. If @version is
* not specified, the latest will be used. * not specified, the latest will be used.
* *
* Returns: (transfer full): a pointer to the #GTypelib if successful, %NULL otherwise * Returns: (transfer full): a pointer to the #GITypelib if successful, %NULL otherwise
*/ */
GTypelib * GITypelib *
g_irepository_require_private (GIRepository *repository, g_irepository_require_private (GIRepository *repository,
const gchar *typelib_dir, const gchar *typelib_dir,
const gchar *namespace, const gchar *namespace,

View File

@ -92,7 +92,7 @@ GIRepository *g_irepository_get_default (void);
void g_irepository_prepend_search_path (const char *directory); void g_irepository_prepend_search_path (const char *directory);
GSList * g_irepository_get_search_path (void); GSList * g_irepository_get_search_path (void);
const char * g_irepository_load_typelib (GIRepository *repository, const char * g_irepository_load_typelib (GIRepository *repository,
GTypelib *typelib, GITypelib *typelib,
GIRepositoryLoadFlags flags, GIRepositoryLoadFlags flags,
GError **error); GError **error);
gboolean g_irepository_is_registered (GIRepository *repository, gboolean g_irepository_is_registered (GIRepository *repository,
@ -103,12 +103,12 @@ GIBaseInfo * g_irepository_find_by_name (GIRepository *repository,
const gchar *name); const gchar *name);
GList * g_irepository_enumerate_versions (GIRepository *repository, GList * g_irepository_enumerate_versions (GIRepository *repository,
const gchar *namespace_); const gchar *namespace_);
GTypelib * g_irepository_require (GIRepository *repository, GITypelib * g_irepository_require (GIRepository *repository,
const gchar *namespace_, const gchar *namespace_,
const gchar *version, const gchar *version,
GIRepositoryLoadFlags flags, GIRepositoryLoadFlags flags,
GError **error); GError **error);
GTypelib * g_irepository_require_private (GIRepository *repository, GITypelib * g_irepository_require_private (GIRepository *repository,
const gchar *typelib_dir, const gchar *typelib_dir,
const gchar *namespace, const gchar *namespace,
const gchar *version, const gchar *version,

View File

@ -221,11 +221,11 @@ node_cmp_offset_func (gconstpointer a,
} }
GTypelib * GITypelib *
g_ir_module_build_typelib (GIrModule *module) g_ir_module_build_typelib (GIrModule *module)
{ {
GError *error = NULL; GError *error = NULL;
GTypelib *typelib; GITypelib *typelib;
gsize length; gsize length;
guint i; guint i;
GList *e; GList *e;

View File

@ -68,7 +68,7 @@ void g_ir_module_free (GIrModule *module);
void g_ir_module_add_include_module (GIrModule *module, void g_ir_module_add_include_module (GIrModule *module,
GIrModule *include_module); GIrModule *include_module);
GTypelib * g_ir_module_build_typelib (GIrModule *module); GITypelib * g_ir_module_build_typelib (GIrModule *module);
void g_ir_module_fatal (GIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN; void g_ir_module_fatal (GIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;

View File

@ -1085,9 +1085,9 @@ typedef struct {
} AttributeBlob; } AttributeBlob;
/** /**
* GTypelib: * GITypelib:
*/ */
struct _GTypelib { struct _GITypelib {
/* <private> */ /* <private> */
guchar *data; guchar *data;
gsize len; gsize len;
@ -1097,7 +1097,7 @@ struct _GTypelib {
gboolean open_attempted; gboolean open_attempted;
}; };
DirEntry *g_typelib_get_dir_entry (GTypelib *typelib, DirEntry *g_typelib_get_dir_entry (GITypelib *typelib,
guint16 index); guint16 index);
void g_typelib_check_sanity (void); void g_typelib_check_sanity (void);
@ -1106,14 +1106,14 @@ void g_typelib_check_sanity (void);
/** /**
* GTypelibError: * GITypelibError:
* @G_TYPELIB_ERROR_INVALID: the typelib is invalid * @G_TYPELIB_ERROR_INVALID: the typelib is invalid
* @G_TYPELIB_ERROR_INVALID_HEADER: the typelib header is invalid * @G_TYPELIB_ERROR_INVALID_HEADER: the typelib header is invalid
* @G_TYPELIB_ERROR_INVALID_DIRECTORY: the typelib directory is invalid * @G_TYPELIB_ERROR_INVALID_DIRECTORY: the typelib directory is invalid
* @G_TYPELIB_ERROR_INVALID_ENTRY: a typelib entry is invalid * @G_TYPELIB_ERROR_INVALID_ENTRY: a typelib entry is invalid
* @G_TYPELIB_ERROR_INVALID_BLOB: a typelib blob is invalid * @G_TYPELIB_ERROR_INVALID_BLOB: a typelib blob is invalid
* *
* A error set while validating the #GTypelib * A error set while validating the #GITypelib
*/ */
typedef enum typedef enum
{ {
@ -1122,13 +1122,13 @@ typedef enum
G_TYPELIB_ERROR_INVALID_DIRECTORY, G_TYPELIB_ERROR_INVALID_DIRECTORY,
G_TYPELIB_ERROR_INVALID_ENTRY, G_TYPELIB_ERROR_INVALID_ENTRY,
G_TYPELIB_ERROR_INVALID_BLOB G_TYPELIB_ERROR_INVALID_BLOB
} GTypelibError; } GITypelibError;
#define G_TYPELIB_ERROR (g_typelib_error_quark ()) #define G_TYPELIB_ERROR (g_typelib_error_quark ())
GQuark g_typelib_error_quark (void); GQuark g_typelib_error_quark (void);
gboolean g_typelib_validate (GTypelib *typelib, gboolean g_typelib_validate (GITypelib *typelib,
GError **error); GError **error);

View File

@ -29,7 +29,7 @@
#include "glib-compat.h" #include "glib-compat.h"
typedef struct { typedef struct {
GTypelib *typelib; GITypelib *typelib;
GSList *context_stack; GSList *context_stack;
} ValidateContext; } ValidateContext;
@ -56,7 +56,7 @@ validate_interface_blob (ValidateContext *ctx,
GError **error); GError **error);
static DirEntry * static DirEntry *
get_dir_entry_checked (GTypelib *typelib, get_dir_entry_checked (GITypelib *typelib,
guint16 index, guint16 index,
GError **error) GError **error)
{ {
@ -88,7 +88,7 @@ get_dir_entry_checked (GTypelib *typelib,
static CommonBlob * static CommonBlob *
get_blob (GTypelib *typelib, get_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
@ -104,7 +104,7 @@ get_blob (GTypelib *typelib,
} }
static InterfaceTypeBlob * static InterfaceTypeBlob *
get_type_blob (GTypelib *typelib, get_type_blob (GITypelib *typelib,
SimpleTypeBlob *simple, SimpleTypeBlob *simple,
GError **error) GError **error)
{ {
@ -131,7 +131,7 @@ get_type_blob (GTypelib *typelib,
} }
DirEntry * DirEntry *
g_typelib_get_dir_entry (GTypelib *typelib, g_typelib_get_dir_entry (GITypelib *typelib,
guint16 index) guint16 index)
{ {
Header *header = (Header *)typelib->data; Header *header = (Header *)typelib->data;
@ -203,7 +203,7 @@ is_aligned (guint32 offset)
#define MAX_NAME_LEN 200 #define MAX_NAME_LEN 200
static const char * static const char *
get_string (GTypelib *typelib, guint32 offset, GError **error) get_string (GITypelib *typelib, guint32 offset, GError **error)
{ {
if (typelib->len < offset) if (typelib->len < offset)
{ {
@ -218,7 +218,7 @@ get_string (GTypelib *typelib, guint32 offset, GError **error)
} }
static const char * static const char *
get_string_nofail (GTypelib *typelib, guint32 offset) get_string_nofail (GITypelib *typelib, guint32 offset)
{ {
const char *ret = get_string (typelib, offset, NULL); const char *ret = get_string (typelib, offset, NULL);
g_assert (ret); g_assert (ret);
@ -226,7 +226,7 @@ get_string_nofail (GTypelib *typelib, guint32 offset)
} }
static gboolean static gboolean
validate_name (GTypelib *typelib, validate_name (GITypelib *typelib,
const char *msg, const char *msg,
const guchar *data, guint32 offset, const guchar *data, guint32 offset,
GError **error) GError **error)
@ -386,7 +386,7 @@ static gboolean
validate_header (ValidateContext *ctx, validate_header (ValidateContext *ctx,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
if (!validate_header_basic (typelib->data, typelib->len, error)) if (!validate_header_basic (typelib->data, typelib->len, error))
return FALSE; return FALSE;
@ -400,14 +400,14 @@ validate_header (ValidateContext *ctx,
return TRUE; return TRUE;
} }
static gboolean validate_type_blob (GTypelib *typelib, static gboolean validate_type_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 signature_offset, guint32 signature_offset,
gboolean return_type, gboolean return_type,
GError **error); GError **error);
static gboolean static gboolean
validate_array_type_blob (GTypelib *typelib, validate_array_type_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 signature_offset, guint32 signature_offset,
gboolean return_type, gboolean return_type,
@ -437,7 +437,7 @@ validate_array_type_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_iface_type_blob (GTypelib *typelib, validate_iface_type_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 signature_offset, guint32 signature_offset,
gboolean return_type, gboolean return_type,
@ -459,7 +459,7 @@ validate_iface_type_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_param_type_blob (GTypelib *typelib, validate_param_type_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 signature_offset, guint32 signature_offset,
gboolean return_type, gboolean return_type,
@ -502,7 +502,7 @@ validate_param_type_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_error_type_blob (GTypelib *typelib, validate_error_type_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 signature_offset, guint32 signature_offset,
gboolean return_type, gboolean return_type,
@ -554,7 +554,7 @@ validate_error_type_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_type_blob (GTypelib *typelib, validate_type_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 signature_offset, guint32 signature_offset,
gboolean return_type, gboolean return_type,
@ -632,7 +632,7 @@ validate_type_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_arg_blob (GTypelib *typelib, validate_arg_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 signature_offset, guint32 signature_offset,
GError **error) GError **error)
@ -662,7 +662,7 @@ validate_arg_blob (GTypelib *typelib,
} }
static SimpleTypeBlob * static SimpleTypeBlob *
return_type_from_signature (GTypelib *typelib, return_type_from_signature (GITypelib *typelib,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
@ -690,7 +690,7 @@ return_type_from_signature (GTypelib *typelib,
} }
static gboolean static gboolean
validate_signature_blob (GTypelib *typelib, validate_signature_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
@ -737,7 +737,7 @@ validate_function_blob (ValidateContext *ctx,
guint16 container_type, guint16 container_type,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
FunctionBlob *blob; FunctionBlob *blob;
SignatureBlob *sigblob; SignatureBlob *sigblob;
gboolean is_method; gboolean is_method;
@ -873,7 +873,7 @@ validate_callback_blob (ValidateContext *ctx,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
CallbackBlob *blob; CallbackBlob *blob;
if (typelib->len < offset + sizeof (CallbackBlob)) if (typelib->len < offset + sizeof (CallbackBlob))
@ -910,7 +910,7 @@ validate_callback_blob (ValidateContext *ctx,
} }
static gboolean static gboolean
validate_constant_blob (GTypelib *typelib, validate_constant_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
@ -1006,7 +1006,7 @@ validate_constant_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_value_blob (GTypelib *typelib, validate_value_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
@ -1034,7 +1034,7 @@ validate_field_blob (ValidateContext *ctx,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
Header *header = (Header *)typelib->data; Header *header = (Header *)typelib->data;
FieldBlob *blob; FieldBlob *blob;
@ -1066,7 +1066,7 @@ validate_field_blob (ValidateContext *ctx,
} }
static gboolean static gboolean
validate_property_blob (GTypelib *typelib, validate_property_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
@ -1095,7 +1095,7 @@ validate_property_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_signal_blob (GTypelib *typelib, validate_signal_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 container_offset, guint32 container_offset,
GError **error) GError **error)
@ -1164,7 +1164,7 @@ validate_signal_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_vfunc_blob (GTypelib *typelib, validate_vfunc_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
guint32 container_offset, guint32 container_offset,
GError **error) GError **error)
@ -1227,7 +1227,7 @@ validate_struct_blob (ValidateContext *ctx,
guint16 blob_type, guint16 blob_type,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
StructBlob *blob; StructBlob *blob;
gint i; gint i;
guint32 field_offset; guint32 field_offset;
@ -1324,7 +1324,7 @@ validate_enum_blob (ValidateContext *ctx,
guint16 blob_type, guint16 blob_type,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
EnumBlob *blob; EnumBlob *blob;
gint i; gint i;
@ -1423,7 +1423,7 @@ validate_object_blob (ValidateContext *ctx,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
Header *header; Header *header;
ObjectBlob *blob; ObjectBlob *blob;
gint i; gint i;
@ -1603,7 +1603,7 @@ validate_interface_blob (ValidateContext *ctx,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
Header *header; Header *header;
InterfaceBlob *blob; InterfaceBlob *blob;
gint i; gint i;
@ -1726,7 +1726,7 @@ validate_interface_blob (ValidateContext *ctx,
} }
static gboolean static gboolean
validate_errordomain_blob (GTypelib *typelib, validate_errordomain_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
@ -1734,7 +1734,7 @@ validate_errordomain_blob (GTypelib *typelib,
} }
static gboolean static gboolean
validate_union_blob (GTypelib *typelib, validate_union_blob (GITypelib *typelib,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
@ -1746,7 +1746,7 @@ validate_blob (ValidateContext *ctx,
guint32 offset, guint32 offset,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
CommonBlob *common; CommonBlob *common;
if (typelib->len < offset + sizeof (CommonBlob)) if (typelib->len < offset + sizeof (CommonBlob))
@ -1815,7 +1815,7 @@ static gboolean
validate_directory (ValidateContext *ctx, validate_directory (ValidateContext *ctx,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
Header *header = (Header *)typelib->data; Header *header = (Header *)typelib->data;
DirEntry *entry; DirEntry *entry;
gint i; gint i;
@ -1892,7 +1892,7 @@ static gboolean
validate_attributes (ValidateContext *ctx, validate_attributes (ValidateContext *ctx,
GError **error) GError **error)
{ {
GTypelib *typelib = ctx->typelib; GITypelib *typelib = ctx->typelib;
Header *header = (Header *)typelib->data; Header *header = (Header *)typelib->data;
if (header->size < header->attributes + header->n_attributes * sizeof (AttributeBlob)) if (header->size < header->attributes + header->n_attributes * sizeof (AttributeBlob))
@ -1936,7 +1936,7 @@ prefix_with_context (GError **error,
} }
gboolean gboolean
g_typelib_validate (GTypelib *typelib, g_typelib_validate (GITypelib *typelib,
GError **error) GError **error)
{ {
ValidateContext ctx; ValidateContext ctx;
@ -1974,7 +1974,7 @@ g_typelib_error_quark (void)
} }
static void static void
_g_typelib_do_dlopen (GTypelib *typelib) _g_typelib_do_dlopen (GITypelib *typelib)
{ {
Header *header; Header *header;
const char *shlib_str; const char *shlib_str;
@ -2060,7 +2060,7 @@ _g_typelib_do_dlopen (GTypelib *typelib)
} }
static inline void static inline void
_g_typelib_ensure_open (GTypelib *typelib) _g_typelib_ensure_open (GITypelib *typelib)
{ {
if (typelib->open_attempted) if (typelib->open_attempted)
return; return;
@ -2074,23 +2074,23 @@ _g_typelib_ensure_open (GTypelib *typelib)
* @len: length of memory chunk containing the typelib * @len: length of memory chunk containing the typelib
* @error: a #GError * @error: a #GError
* *
* Creates a new #GTypelib from a memory location. The memory block * Creates a new #GITypelib from a memory location. The memory block
* pointed to by @typelib will be automatically g_free()d when the * pointed to by @typelib will be automatically g_free()d when the
* repository is destroyed. * repository is destroyed.
* *
* Return value: the new #GTypelib * Return value: the new #GITypelib
**/ **/
GTypelib * GITypelib *
g_typelib_new_from_memory (guint8 *memory, g_typelib_new_from_memory (guint8 *memory,
gsize len, gsize len,
GError **error) GError **error)
{ {
GTypelib *meta; GITypelib *meta;
if (!validate_header_basic (memory, len, error)) if (!validate_header_basic (memory, len, error))
return NULL; return NULL;
meta = g_slice_new0 (GTypelib); meta = g_slice_new0 (GITypelib);
meta->data = memory; meta->data = memory;
meta->len = len; meta->len = len;
meta->owns_memory = TRUE; meta->owns_memory = TRUE;
@ -2105,21 +2105,21 @@ g_typelib_new_from_memory (guint8 *memory,
* @len: length of memory chunk containing the typelib * @len: length of memory chunk containing the typelib
* @error: A #GError * @error: A #GError
* *
* Creates a new #GTypelib from a memory location. * Creates a new #GITypelib from a memory location.
* *
* Return value: the new #GTypelib * Return value: the new #GITypelib
**/ **/
GTypelib * GITypelib *
g_typelib_new_from_const_memory (const guchar *memory, g_typelib_new_from_const_memory (const guchar *memory,
gsize len, gsize len,
GError **error) GError **error)
{ {
GTypelib *meta; GITypelib *meta;
if (!validate_header_basic (memory, len, error)) if (!validate_header_basic (memory, len, error))
return NULL; return NULL;
meta = g_slice_new0 (GTypelib); meta = g_slice_new0 (GITypelib);
meta->data = (guchar *) memory; meta->data = (guchar *) memory;
meta->len = len; meta->len = len;
meta->owns_memory = FALSE; meta->owns_memory = FALSE;
@ -2133,22 +2133,22 @@ g_typelib_new_from_const_memory (const guchar *memory,
* @mfile: a #GMappedFile, that will be free'd when the repository is destroyed * @mfile: a #GMappedFile, that will be free'd when the repository is destroyed
* @error: a #GError * @error: a #GError
* *
* Creates a new #GTypelib from a #GMappedFile. * Creates a new #GITypelib from a #GMappedFile.
* *
* Return value: the new #GTypelib * Return value: the new #GITypelib
**/ **/
GTypelib * GITypelib *
g_typelib_new_from_mapped_file (GMappedFile *mfile, g_typelib_new_from_mapped_file (GMappedFile *mfile,
GError **error) GError **error)
{ {
GTypelib *meta; GITypelib *meta;
guint8 *data = (guint8 *) g_mapped_file_get_contents (mfile); guint8 *data = (guint8 *) g_mapped_file_get_contents (mfile);
gsize len = g_mapped_file_get_length (mfile); gsize 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;
meta = g_slice_new0 (GTypelib); meta = g_slice_new0 (GITypelib);
meta->mfile = mfile; meta->mfile = mfile;
meta->owns_memory = FALSE; meta->owns_memory = FALSE;
meta->data = data; meta->data = data;
@ -2159,12 +2159,12 @@ g_typelib_new_from_mapped_file (GMappedFile *mfile,
/** /**
* g_typelib_free: * g_typelib_free:
* @typelib: a #GTypelib * @typelib: a #GITypelib
* *
* Free a #GTypelib. * Free a #GITypelib.
**/ **/
void void
g_typelib_free (GTypelib *typelib) g_typelib_free (GITypelib *typelib)
{ {
if (typelib->mfile) if (typelib->mfile)
g_mapped_file_unref (typelib->mfile); g_mapped_file_unref (typelib->mfile);
@ -2176,11 +2176,11 @@ g_typelib_free (GTypelib *typelib)
g_list_foreach (typelib->modules, (GFunc) g_module_close, NULL); g_list_foreach (typelib->modules, (GFunc) g_module_close, NULL);
g_list_free (typelib->modules); g_list_free (typelib->modules);
} }
g_slice_free (GTypelib, typelib); g_slice_free (GITypelib, typelib);
} }
const gchar * const gchar *
g_typelib_get_namespace (GTypelib *typelib) g_typelib_get_namespace (GITypelib *typelib)
{ {
return g_typelib_get_string (typelib, ((Header *) typelib->data)->namespace); return g_typelib_get_string (typelib, ((Header *) typelib->data)->namespace);
} }
@ -2191,12 +2191,12 @@ g_typelib_get_namespace (GTypelib *typelib)
* @symbol_name: name of symbol to be loaded * @symbol_name: name of symbol to be loaded
* @symbol: returns a pointer to the symbol value * @symbol: returns a pointer to the symbol value
* *
* Loads a symbol from #GTypelib. * Loads a symbol from #GITypelib.
* *
* Return value: #TRUE on success * Return value: #TRUE on success
**/ **/
gboolean gboolean
g_typelib_symbol (GTypelib *typelib, const char *symbol_name, gpointer *symbol) g_typelib_symbol (GITypelib *typelib, const char *symbol_name, gpointer *symbol)
{ {
GList *l; GList *l;

View File

@ -32,22 +32,22 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct _GTypelib GTypelib; typedef struct _GITypelib GITypelib;
GTypelib * g_typelib_new_from_memory (guint8 *memory, GITypelib * g_typelib_new_from_memory (guint8 *memory,
gsize len, gsize len,
GError **error); GError **error);
GTypelib * g_typelib_new_from_const_memory (const guint8 *memory, GITypelib * g_typelib_new_from_const_memory (const guint8 *memory,
gsize len, gsize len,
GError **error); GError **error);
GTypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile, GITypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile,
GError **error); GError **error);
void g_typelib_free (GTypelib *typelib); void g_typelib_free (GITypelib *typelib);
gboolean g_typelib_symbol (GTypelib *typelib, gboolean g_typelib_symbol (GITypelib *typelib,
const gchar *symbol_name, const gchar *symbol_name,
gpointer *symbol); gpointer *symbol);
const gchar * g_typelib_get_namespace (GTypelib *typelib); const gchar * g_typelib_get_namespace (GITypelib *typelib);
G_END_DECLS G_END_DECLS

View File

@ -441,6 +441,7 @@ typedef enum
#ifndef __GI_SCANNER__ #ifndef __GI_SCANNER__
/* backwards compatibility */ /* backwards compatibility */
typedef union GIArgument GArgument; typedef union GIArgument GArgument;
typedef union GITypelib GTypelib;
#endif #endif
G_END_DECLS G_END_DECLS