mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-01 02:16:14 +01:00
Deprecate ErrorDomain
The previous ErrorDomain blob was never actually scanned or used, and it was kind of a lame API conceptually. To keep some compatibility, rather than removing the enumeration values, rename them to _INVALID, and don't bump the typelib version. This should in theory allow a new libgirepository to read an old typelib. Based on a patch from Colin Walters https://bugzilla.gnome.org/show_bug.cgi?id=602516
This commit is contained in:
parent
34c298a51e
commit
6ee82c14e8
@ -202,7 +202,6 @@ _g_type_info_init (GIBaseInfo *info,
|
|||||||
* +----<link linkend="gi-GIArgInfo">GIArgInfo</link>
|
* +----<link linkend="gi-GIArgInfo">GIArgInfo</link>
|
||||||
* +----<link linkend="gi-GICallableInfo">GICallableInfo</link>
|
* +----<link linkend="gi-GICallableInfo">GICallableInfo</link>
|
||||||
* +----<link linkend="gi-GIConstantInfo">GIConstantInfo</link>
|
* +----<link linkend="gi-GIConstantInfo">GIConstantInfo</link>
|
||||||
* +----<link linkend="gi-GIErrorDomainInfo">GIErrorDomainInfo</link>
|
|
||||||
* +----<link linkend="gi-GIFieldInfo">GIFieldInfo</link>
|
* +----<link linkend="gi-GIFieldInfo">GIFieldInfo</link>
|
||||||
* +----<link linkend="gi-GIPropertyInfo">GIPropertyInfo</link>
|
* +----<link linkend="gi-GIPropertyInfo">GIPropertyInfo</link>
|
||||||
* +----<link linkend="gi-GIRegisteredTypeInfo">GIRegisteredTypeInfo</link>
|
* +----<link linkend="gi-GIRegisteredTypeInfo">GIRegisteredTypeInfo</link>
|
||||||
@ -299,7 +298,7 @@ g_base_info_get_name (GIBaseInfo *info)
|
|||||||
case GI_INFO_TYPE_OBJECT:
|
case GI_INFO_TYPE_OBJECT:
|
||||||
case GI_INFO_TYPE_INTERFACE:
|
case GI_INFO_TYPE_INTERFACE:
|
||||||
case GI_INFO_TYPE_CONSTANT:
|
case GI_INFO_TYPE_CONSTANT:
|
||||||
case GI_INFO_TYPE_ERROR_DOMAIN:
|
case GI_INFO_TYPE_INVALID_0:
|
||||||
case GI_INFO_TYPE_UNION:
|
case GI_INFO_TYPE_UNION:
|
||||||
{
|
{
|
||||||
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
|
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
@ -421,7 +420,7 @@ g_base_info_is_deprecated (GIBaseInfo *info)
|
|||||||
case GI_INFO_TYPE_OBJECT:
|
case GI_INFO_TYPE_OBJECT:
|
||||||
case GI_INFO_TYPE_INTERFACE:
|
case GI_INFO_TYPE_INTERFACE:
|
||||||
case GI_INFO_TYPE_CONSTANT:
|
case GI_INFO_TYPE_CONSTANT:
|
||||||
case GI_INFO_TYPE_ERROR_DOMAIN:
|
case GI_INFO_TYPE_INVALID_0:
|
||||||
{
|
{
|
||||||
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
|
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
@ -1,95 +0,0 @@
|
|||||||
/* GObject introspection: ErrorDomain implementation
|
|
||||||
*
|
|
||||||
* Copyright (C) 2005 Matthias Clasen
|
|
||||||
* Copyright (C) 2008,2009 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#include <girepository.h>
|
|
||||||
#include "girepository-private.h"
|
|
||||||
#include "gitypelib-internal.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:gierrordomaininfo
|
|
||||||
* @Short_description: Struct representing an error domain
|
|
||||||
* @Title: GIErrorDomainInfo
|
|
||||||
*
|
|
||||||
* A GIErrorDomainInfo struct represents a domain of a #GError.
|
|
||||||
* An error domain is associated with a #GQuark and contains a pointer
|
|
||||||
* to an enum with all the error codes.
|
|
||||||
*
|
|
||||||
* <refsect1 id="gi-gierrordomaininfo.struct-hierarchy" role="struct_hierarchy">
|
|
||||||
* <title role="struct_hierarchy.title">Struct hierarchy</title>
|
|
||||||
* <synopsis>
|
|
||||||
* <link linkend="gi-GIBaseInfo">GIBaseInfo</link>
|
|
||||||
* +----GIErrorDomainInfo
|
|
||||||
* </synopsis>
|
|
||||||
* </refsect1>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_error_domain_info_get_quark:
|
|
||||||
* @info: a #GIErrorDomainInfo
|
|
||||||
*
|
|
||||||
* Obtain a string representing the quark for this error domain.
|
|
||||||
* %NULL will be returned if the type tag is wrong or if a quark is
|
|
||||||
* missing in the typelib.
|
|
||||||
*
|
|
||||||
* Returns: the quark represented as a string or %NULL
|
|
||||||
*/
|
|
||||||
const gchar *
|
|
||||||
g_error_domain_info_get_quark (GIErrorDomainInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
||||||
ErrorDomainBlob *blob;
|
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
|
||||||
g_return_val_if_fail (GI_IS_ERROR_DOMAIN_INFO (info), NULL);
|
|
||||||
|
|
||||||
blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->get_quark);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_error_domain_info_get_codes:
|
|
||||||
* @info: a #GIErrorDomainInfo
|
|
||||||
*
|
|
||||||
* Obtain the enum containing all the error codes for this error domain.
|
|
||||||
* The return value will have a #GIInfoType of %GI_INFO_TYPE_ERROR_DOMAIN
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): the error domain or %NULL if type tag is wrong,
|
|
||||||
* free the struct with g_base_info_unref() when done.
|
|
||||||
*/
|
|
||||||
GIInterfaceInfo *
|
|
||||||
g_error_domain_info_get_codes (GIErrorDomainInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
||||||
ErrorDomainBlob *blob;
|
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
|
||||||
g_return_val_if_fail (GI_IS_ERROR_DOMAIN_INFO (info), NULL);
|
|
||||||
|
|
||||||
blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
|
|
||||||
rinfo->typelib, blob->error_codes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
/* GObject introspection: Error Domain
|
|
||||||
*
|
|
||||||
* Copyright (C) 2005 Matthias Clasen
|
|
||||||
* Copyright (C) 2008,2009 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GIERRORDOMAININFO_H__
|
|
||||||
#define __GIERRORDOMAININFO_H__
|
|
||||||
|
|
||||||
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
|
|
||||||
#error "Only <girepository.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <gitypes.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define GI_IS_ERROR_DOMAIN_INFO(info) \
|
|
||||||
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ERROR_DOMAIN)
|
|
||||||
|
|
||||||
const gchar * g_error_domain_info_get_quark (GIErrorDomainInfo *info);
|
|
||||||
GIInterfaceInfo * g_error_domain_info_get_codes (GIErrorDomainInfo *info);
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIERRORDOMAININFO_H__ */
|
|
||||||
|
|
@ -322,7 +322,7 @@ g_field_info_get_field (GIFieldInfo *field_info,
|
|||||||
case GI_INFO_TYPE_INTERFACE:
|
case GI_INFO_TYPE_INTERFACE:
|
||||||
case GI_INFO_TYPE_FUNCTION:
|
case GI_INFO_TYPE_FUNCTION:
|
||||||
case GI_INFO_TYPE_CONSTANT:
|
case GI_INFO_TYPE_CONSTANT:
|
||||||
case GI_INFO_TYPE_ERROR_DOMAIN:
|
case GI_INFO_TYPE_INVALID_0:
|
||||||
case GI_INFO_TYPE_VALUE:
|
case GI_INFO_TYPE_VALUE:
|
||||||
case GI_INFO_TYPE_SIGNAL:
|
case GI_INFO_TYPE_SIGNAL:
|
||||||
case GI_INFO_TYPE_PROPERTY:
|
case GI_INFO_TYPE_PROPERTY:
|
||||||
@ -498,7 +498,7 @@ g_field_info_set_field (GIFieldInfo *field_info,
|
|||||||
case GI_INFO_TYPE_INTERFACE:
|
case GI_INFO_TYPE_INTERFACE:
|
||||||
case GI_INFO_TYPE_FUNCTION:
|
case GI_INFO_TYPE_FUNCTION:
|
||||||
case GI_INFO_TYPE_CONSTANT:
|
case GI_INFO_TYPE_CONSTANT:
|
||||||
case GI_INFO_TYPE_ERROR_DOMAIN:
|
case GI_INFO_TYPE_INVALID_0:
|
||||||
case GI_INFO_TYPE_VALUE:
|
case GI_INFO_TYPE_VALUE:
|
||||||
case GI_INFO_TYPE_SIGNAL:
|
case GI_INFO_TYPE_SIGNAL:
|
||||||
case GI_INFO_TYPE_PROPERTY:
|
case GI_INFO_TYPE_PROPERTY:
|
||||||
|
@ -1466,8 +1466,6 @@ g_info_type_to_string (GIInfoType type)
|
|||||||
return "interface";
|
return "interface";
|
||||||
case GI_INFO_TYPE_CONSTANT:
|
case GI_INFO_TYPE_CONSTANT:
|
||||||
return "constant";
|
return "constant";
|
||||||
case GI_INFO_TYPE_ERROR_DOMAIN:
|
|
||||||
return "error domain";
|
|
||||||
case GI_INFO_TYPE_UNION:
|
case GI_INFO_TYPE_UNION:
|
||||||
return "union";
|
return "union";
|
||||||
case GI_INFO_TYPE_VALUE:
|
case GI_INFO_TYPE_VALUE:
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <gicallableinfo.h>
|
#include <gicallableinfo.h>
|
||||||
#include <giconstantinfo.h>
|
#include <giconstantinfo.h>
|
||||||
#include <gienuminfo.h>
|
#include <gienuminfo.h>
|
||||||
#include <gierrordomaininfo.h>
|
|
||||||
#include <gifieldinfo.h>
|
#include <gifieldinfo.h>
|
||||||
#include <gifunctioninfo.h>
|
#include <gifunctioninfo.h>
|
||||||
#include <giinterfaceinfo.h>
|
#include <giinterfaceinfo.h>
|
||||||
|
@ -415,7 +415,7 @@ _g_ir_module_build_typelib (GIrModule *module)
|
|||||||
header->field_blob_size = sizeof (FieldBlob);
|
header->field_blob_size = sizeof (FieldBlob);
|
||||||
header->value_blob_size = sizeof (ValueBlob);
|
header->value_blob_size = sizeof (ValueBlob);
|
||||||
header->constant_blob_size = sizeof (ConstantBlob);
|
header->constant_blob_size = sizeof (ConstantBlob);
|
||||||
header->error_domain_blob_size = sizeof (ErrorDomainBlob);
|
header->error_domain_blob_size = 16; /* No longer used */
|
||||||
header->attribute_blob_size = sizeof (AttributeBlob);
|
header->attribute_blob_size = sizeof (AttributeBlob);
|
||||||
header->signature_blob_size = sizeof (SignatureBlob);
|
header->signature_blob_size = sizeof (SignatureBlob);
|
||||||
header->enum_blob_size = sizeof (EnumBlob);
|
header->enum_blob_size = sizeof (EnumBlob);
|
||||||
|
70
girnode.c
70
girnode.c
@ -101,8 +101,6 @@ _g_ir_node_type_to_string (GIrNodeTypeId type)
|
|||||||
return "value";
|
return "value";
|
||||||
case G_IR_NODE_CONSTANT:
|
case G_IR_NODE_CONSTANT:
|
||||||
return "constant";
|
return "constant";
|
||||||
case G_IR_NODE_ERROR_DOMAIN:
|
|
||||||
return "error-domain";
|
|
||||||
case G_IR_NODE_XREF:
|
case G_IR_NODE_XREF:
|
||||||
return "xref";
|
return "xref";
|
||||||
case G_IR_NODE_UNION:
|
case G_IR_NODE_UNION:
|
||||||
@ -175,10 +173,6 @@ _g_ir_node_new (GIrNodeTypeId type,
|
|||||||
node = g_malloc0 (sizeof (GIrNodeConstant));
|
node = g_malloc0 (sizeof (GIrNodeConstant));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_IR_NODE_ERROR_DOMAIN:
|
|
||||||
node = g_malloc0 (sizeof (GIrNodeErrorDomain));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case G_IR_NODE_XREF:
|
case G_IR_NODE_XREF:
|
||||||
node = g_malloc0 (sizeof (GIrNodeXRef));
|
node = g_malloc0 (sizeof (GIrNodeXRef));
|
||||||
break;
|
break;
|
||||||
@ -379,16 +373,6 @@ _g_ir_node_free (GIrNode *node)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_IR_NODE_ERROR_DOMAIN:
|
|
||||||
{
|
|
||||||
GIrNodeErrorDomain *domain = (GIrNodeErrorDomain *)node;
|
|
||||||
|
|
||||||
g_free (node->name);
|
|
||||||
g_free (domain->getquark);
|
|
||||||
g_free (domain->codes);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case G_IR_NODE_XREF:
|
case G_IR_NODE_XREF:
|
||||||
{
|
{
|
||||||
GIrNodeXRef *xref = (GIrNodeXRef *)node;
|
GIrNodeXRef *xref = (GIrNodeXRef *)node;
|
||||||
@ -535,10 +519,6 @@ _g_ir_node_get_size (GIrNode *node)
|
|||||||
size = sizeof (ConstantBlob);
|
size = sizeof (ConstantBlob);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_IR_NODE_ERROR_DOMAIN:
|
|
||||||
size = sizeof (ErrorDomainBlob);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case G_IR_NODE_XREF:
|
case G_IR_NODE_XREF:
|
||||||
size = 0;
|
size = 0;
|
||||||
break;
|
break;
|
||||||
@ -665,16 +645,7 @@ _g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
size += _g_ir_node_get_full_size_internal (node, (GIrNode *)type->parameter_type2);
|
size += _g_ir_node_get_full_size_internal (node, (GIrNode *)type->parameter_type2);
|
||||||
break;
|
break;
|
||||||
case GI_TYPE_TAG_ERROR:
|
case GI_TYPE_TAG_ERROR:
|
||||||
{
|
size += sizeof (ErrorTypeBlob);
|
||||||
gint n;
|
|
||||||
|
|
||||||
if (type->errors)
|
|
||||||
n = g_strv_length (type->errors);
|
|
||||||
else
|
|
||||||
n = 0;
|
|
||||||
|
|
||||||
size += sizeof (ErrorTypeBlob) + 2 * (n + n % 2);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_error ("Unknown type tag %d\n", type->tag);
|
g_error ("Unknown type tag %d\n", type->tag);
|
||||||
@ -844,16 +815,6 @@ _g_ir_node_get_full_size_internal (GIrNode *parent,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_IR_NODE_ERROR_DOMAIN:
|
|
||||||
{
|
|
||||||
GIrNodeErrorDomain *domain = (GIrNodeErrorDomain *)node;
|
|
||||||
|
|
||||||
size = sizeof (ErrorDomainBlob);
|
|
||||||
size += ALIGN_VALUE (strlen (node->name) + 1, 4);
|
|
||||||
size += ALIGN_VALUE (strlen (domain->getquark) + 1, 4);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case G_IR_NODE_XREF:
|
case G_IR_NODE_XREF:
|
||||||
{
|
{
|
||||||
GIrNodeXRef *xref = (GIrNodeXRef *)node;
|
GIrNodeXRef *xref = (GIrNodeXRef *)node;
|
||||||
@ -935,7 +896,7 @@ _g_ir_node_can_have_member (GIrNode *node)
|
|||||||
case G_IR_NODE_ENUM:
|
case G_IR_NODE_ENUM:
|
||||||
case G_IR_NODE_FLAGS:
|
case G_IR_NODE_FLAGS:
|
||||||
case G_IR_NODE_CONSTANT:
|
case G_IR_NODE_CONSTANT:
|
||||||
case G_IR_NODE_ERROR_DOMAIN:
|
case G_IR_NODE_INVALID_0:
|
||||||
case G_IR_NODE_PARAM:
|
case G_IR_NODE_PARAM:
|
||||||
case G_IR_NODE_TYPE:
|
case G_IR_NODE_TYPE:
|
||||||
case G_IR_NODE_PROPERTY:
|
case G_IR_NODE_PROPERTY:
|
||||||
@ -1559,21 +1520,14 @@ _g_ir_node_build_typelib (GIrNode *node,
|
|||||||
case GI_TYPE_TAG_ERROR:
|
case GI_TYPE_TAG_ERROR:
|
||||||
{
|
{
|
||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2];
|
ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2];
|
||||||
gint i;
|
|
||||||
|
|
||||||
blob->pointer = 1;
|
blob->pointer = 1;
|
||||||
blob->reserved = 0;
|
blob->reserved = 0;
|
||||||
blob->tag = type->tag;
|
blob->tag = type->tag;
|
||||||
blob->reserved2 = 0;
|
blob->reserved2 = 0;
|
||||||
if (type->errors)
|
blob->n_domains = 0;
|
||||||
blob->n_domains = g_strv_length (type->errors);
|
|
||||||
else
|
|
||||||
blob->n_domains = 0;
|
|
||||||
|
|
||||||
*offset2 = ALIGN_VALUE (*offset2 + G_STRUCT_OFFSET (ErrorTypeBlob, domains)
|
*offset2 += sizeof (ErrorTypeBlob);
|
||||||
+ 2 * blob->n_domains, 4);
|
|
||||||
for (i = 0; i < blob->n_domains; i++)
|
|
||||||
blob->domains[i] = find_entry (build, type->errors[i]);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2234,22 +2188,6 @@ _g_ir_node_build_typelib (GIrNode *node,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_IR_NODE_ERROR_DOMAIN:
|
|
||||||
{
|
|
||||||
GIrNodeErrorDomain *domain = (GIrNodeErrorDomain *)node;
|
|
||||||
ErrorDomainBlob *blob = (ErrorDomainBlob *)&data[*offset];
|
|
||||||
*offset += sizeof (ErrorDomainBlob);
|
|
||||||
|
|
||||||
blob->blob_type = BLOB_TYPE_ERROR_DOMAIN;
|
|
||||||
blob->deprecated = domain->deprecated;
|
|
||||||
blob->reserved = 0;
|
|
||||||
blob->name = _g_ir_write_string (node->name, strings, data, offset2);
|
|
||||||
blob->get_quark = _g_ir_write_string (domain->getquark, strings, data, offset2);
|
|
||||||
blob->error_codes = find_entry (build, domain->codes);
|
|
||||||
blob->reserved2 = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case G_IR_NODE_CONSTANT:
|
case G_IR_NODE_CONSTANT:
|
||||||
{
|
{
|
||||||
GIrNodeConstant *constant = (GIrNodeConstant *)node;
|
GIrNodeConstant *constant = (GIrNodeConstant *)node;
|
||||||
|
15
girnode.h
15
girnode.h
@ -41,7 +41,6 @@ typedef struct _GIrNodeEnum GIrNodeEnum;
|
|||||||
typedef struct _GIrNodeBoxed GIrNodeBoxed;
|
typedef struct _GIrNodeBoxed GIrNodeBoxed;
|
||||||
typedef struct _GIrNodeStruct GIrNodeStruct;
|
typedef struct _GIrNodeStruct GIrNodeStruct;
|
||||||
typedef struct _GIrNodeConstant GIrNodeConstant;
|
typedef struct _GIrNodeConstant GIrNodeConstant;
|
||||||
typedef struct _GIrNodeErrorDomain GIrNodeErrorDomain;
|
|
||||||
typedef struct _GIrNodeXRef GIrNodeXRef;
|
typedef struct _GIrNodeXRef GIrNodeXRef;
|
||||||
typedef struct _GIrNodeUnion GIrNodeUnion;
|
typedef struct _GIrNodeUnion GIrNodeUnion;
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ typedef enum
|
|||||||
G_IR_NODE_OBJECT = 7,
|
G_IR_NODE_OBJECT = 7,
|
||||||
G_IR_NODE_INTERFACE = 8,
|
G_IR_NODE_INTERFACE = 8,
|
||||||
G_IR_NODE_CONSTANT = 9,
|
G_IR_NODE_CONSTANT = 9,
|
||||||
G_IR_NODE_ERROR_DOMAIN = 10,
|
G_IR_NODE_INVALID_0 = 10, /* DELETED - used to be ERROR_DOMAIN */
|
||||||
G_IR_NODE_UNION = 11,
|
G_IR_NODE_UNION = 11,
|
||||||
G_IR_NODE_PARAM = 12,
|
G_IR_NODE_PARAM = 12,
|
||||||
G_IR_NODE_TYPE = 13,
|
G_IR_NODE_TYPE = 13,
|
||||||
@ -343,18 +342,6 @@ struct _GIrNodeUnion
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct _GIrNodeErrorDomain
|
|
||||||
{
|
|
||||||
GIrNode node;
|
|
||||||
|
|
||||||
gboolean deprecated;
|
|
||||||
|
|
||||||
gchar *name;
|
|
||||||
gchar *getquark;
|
|
||||||
gchar *codes;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
GIrNode * _g_ir_node_new (GIrNodeTypeId type,
|
GIrNode * _g_ir_node_new (GIrNodeTypeId type,
|
||||||
GIrModule *module);
|
GIrModule *module);
|
||||||
void _g_ir_node_free (GIrNode *node);
|
void _g_ir_node_free (GIrNode *node);
|
||||||
|
81
girparser.c
81
girparser.c
@ -68,13 +68,12 @@ typedef enum
|
|||||||
STATE_BOXED_FIELD,
|
STATE_BOXED_FIELD,
|
||||||
STATE_STRUCT,
|
STATE_STRUCT,
|
||||||
STATE_STRUCT_FIELD,
|
STATE_STRUCT_FIELD,
|
||||||
STATE_ERRORDOMAIN, /* 25 */
|
STATE_UNION, /* 25 */
|
||||||
STATE_UNION,
|
|
||||||
STATE_UNION_FIELD,
|
STATE_UNION_FIELD,
|
||||||
STATE_NAMESPACE_CONSTANT,
|
STATE_NAMESPACE_CONSTANT,
|
||||||
STATE_CLASS_CONSTANT,
|
STATE_CLASS_CONSTANT,
|
||||||
STATE_INTERFACE_CONSTANT, /* 30 */
|
STATE_INTERFACE_CONSTANT,
|
||||||
STATE_ALIAS,
|
STATE_ALIAS, /* 30 */
|
||||||
STATE_TYPE,
|
STATE_TYPE,
|
||||||
STATE_ATTRIBUTE,
|
STATE_ATTRIBUTE,
|
||||||
STATE_DOC,
|
STATE_DOC,
|
||||||
@ -1614,68 +1613,6 @@ start_constant (GMarkupParseContext *context,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
start_errordomain (GMarkupParseContext *context,
|
|
||||||
const gchar *element_name,
|
|
||||||
const gchar **attribute_names,
|
|
||||||
const gchar **attribute_values,
|
|
||||||
ParseContext *ctx,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
const gchar *name;
|
|
||||||
const gchar *getquark;
|
|
||||||
const gchar *codes;
|
|
||||||
const gchar *deprecated;
|
|
||||||
GIrNodeErrorDomain *domain;
|
|
||||||
|
|
||||||
if (!(strcmp (element_name, "errordomain") == 0 &&
|
|
||||||
ctx->state == STATE_NAMESPACE))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_ERRORDOMAIN))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
|
|
||||||
name = find_attribute ("name", attribute_names, attribute_values);
|
|
||||||
getquark = find_attribute ("get-quark", attribute_names, attribute_values);
|
|
||||||
codes = find_attribute ("codes", attribute_names, attribute_values);
|
|
||||||
deprecated = find_attribute ("deprecated", attribute_names, attribute_values);
|
|
||||||
|
|
||||||
if (name == NULL)
|
|
||||||
{
|
|
||||||
MISSING_ATTRIBUTE (context, error, element_name, "name");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else if (getquark == NULL)
|
|
||||||
{
|
|
||||||
MISSING_ATTRIBUTE (context, error, element_name, "getquark");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else if (codes == NULL)
|
|
||||||
{
|
|
||||||
MISSING_ATTRIBUTE (context, error, element_name, "codes");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
domain = (GIrNodeErrorDomain *) _g_ir_node_new (G_IR_NODE_ERROR_DOMAIN,
|
|
||||||
ctx->current_module);
|
|
||||||
|
|
||||||
((GIrNode *)domain)->name = g_strdup (name);
|
|
||||||
domain->getquark = g_strdup (getquark);
|
|
||||||
domain->codes = g_strdup (codes);
|
|
||||||
|
|
||||||
if (deprecated)
|
|
||||||
domain->deprecated = TRUE;
|
|
||||||
else
|
|
||||||
domain->deprecated = FALSE;
|
|
||||||
|
|
||||||
push_node (ctx, (GIrNode *) domain);
|
|
||||||
ctx->current_module->entries =
|
|
||||||
g_list_append (ctx->current_module->entries, domain);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
start_interface (GMarkupParseContext *context,
|
start_interface (GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const gchar *element_name,
|
||||||
@ -2788,10 +2725,6 @@ start_element_handler (GMarkupParseContext *context,
|
|||||||
attribute_names, attribute_values,
|
attribute_names, attribute_values,
|
||||||
ctx, error))
|
ctx, error))
|
||||||
goto out;
|
goto out;
|
||||||
else if (start_errordomain (context, element_name,
|
|
||||||
attribute_names, attribute_values,
|
|
||||||
ctx, error))
|
|
||||||
goto out;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
@ -3290,14 +3223,6 @@ end_element_handler (GMarkupParseContext *context,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_ERRORDOMAIN:
|
|
||||||
if (require_end_element (context, ctx, "errordomain", element_name, error))
|
|
||||||
{
|
|
||||||
pop_node (ctx);
|
|
||||||
state_switch (ctx, STATE_NAMESPACE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STATE_INTERFACE_PROPERTY:
|
case STATE_INTERFACE_PROPERTY:
|
||||||
if (strcmp ("type", element_name) == 0)
|
if (strcmp ("type", element_name) == 0)
|
||||||
break;
|
break;
|
||||||
|
40
girwriter.c
40
girwriter.c
@ -212,7 +212,6 @@ write_type_info (const gchar *namespace,
|
|||||||
Xml *file)
|
Xml *file)
|
||||||
{
|
{
|
||||||
gint tag;
|
gint tag;
|
||||||
gint i;
|
|
||||||
GITypeInfo *type;
|
GITypeInfo *type;
|
||||||
gboolean is_pointer;
|
gboolean is_pointer;
|
||||||
|
|
||||||
@ -329,24 +328,8 @@ write_type_info (const gchar *namespace,
|
|||||||
}
|
}
|
||||||
else if (tag == GI_TYPE_TAG_ERROR)
|
else if (tag == GI_TYPE_TAG_ERROR)
|
||||||
{
|
{
|
||||||
gint n;
|
|
||||||
|
|
||||||
xml_start_element (file, "type");
|
xml_start_element (file, "type");
|
||||||
xml_printf (file, " name=\"GLib.Error\"");
|
xml_printf (file, " name=\"GLib.Error\"");
|
||||||
|
|
||||||
n = g_type_info_get_n_error_domains (info);
|
|
||||||
if (n > 0)
|
|
||||||
{
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
GIErrorDomainInfo *ed = g_type_info_get_error_domain (info, i);
|
|
||||||
xml_start_element (file, "type");
|
|
||||||
write_type_name_attribute (namespace, (GIBaseInfo *)ed, "name", file);
|
|
||||||
xml_end_element (file, "type");
|
|
||||||
g_base_info_unref ((GIBaseInfo *)ed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xml_end_element (file, "type");
|
xml_end_element (file, "type");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1193,25 +1176,6 @@ write_interface_info (const gchar *namespace,
|
|||||||
xml_end_element (file, "interface");
|
xml_end_element (file, "interface");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
write_error_domain_info (const gchar *namespace,
|
|
||||||
GIErrorDomainInfo *info,
|
|
||||||
Xml *file)
|
|
||||||
{
|
|
||||||
GIBaseInfo *enum_;
|
|
||||||
const gchar *name, *quark;
|
|
||||||
|
|
||||||
name = g_base_info_get_name ((GIBaseInfo *)info);
|
|
||||||
quark = g_error_domain_info_get_quark (info);
|
|
||||||
enum_ = (GIBaseInfo *)g_error_domain_info_get_codes (info);
|
|
||||||
xml_start_element (file, "errordomain");
|
|
||||||
xml_printf (file, " name=\"%s\" get-quark=\"%s\"",
|
|
||||||
name, quark);
|
|
||||||
write_type_name_attribute (namespace, enum_, "codes", file);
|
|
||||||
xml_end_element (file, "errordomain");
|
|
||||||
g_base_info_unref (enum_);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_union_info (const gchar *namespace,
|
write_union_info (const gchar *namespace,
|
||||||
GIUnionInfo *info,
|
GIUnionInfo *info,
|
||||||
@ -1411,10 +1375,6 @@ gir_writer_write (const char *filename,
|
|||||||
write_interface_info (ns, (GIInterfaceInfo *)info, xml);
|
write_interface_info (ns, (GIInterfaceInfo *)info, xml);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GI_INFO_TYPE_ERROR_DOMAIN:
|
|
||||||
write_error_domain_info (ns, (GIErrorDomainInfo *)info, xml);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_error ("unknown info type %d\n", g_base_info_get_type (info));
|
g_error ("unknown info type %d\n", g_base_info_get_type (info));
|
||||||
}
|
}
|
||||||
|
69
gitypeinfo.c
69
gitypeinfo.c
@ -340,72 +340,3 @@ g_type_info_get_array_type (GITypeInfo *info)
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* g_type_info_get_n_error_domains:
|
|
||||||
* @info: a #GITypeInfo
|
|
||||||
*
|
|
||||||
* Obtain the number of error domains for this type. The type tag
|
|
||||||
* must be a #GI_TYPE_TAG_ERROR or -1 will be returned.
|
|
||||||
*
|
|
||||||
* Returns: number of error domains or -1
|
|
||||||
*/
|
|
||||||
gint
|
|
||||||
g_type_info_get_n_error_domains (GITypeInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
||||||
SimpleTypeBlob *type;
|
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, 0);
|
|
||||||
g_return_val_if_fail (GI_IS_TYPE_INFO (info), 0);
|
|
||||||
|
|
||||||
type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
|
||||||
{
|
|
||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
if (blob->tag == GI_TYPE_TAG_ERROR)
|
|
||||||
return blob->n_domains;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* g_type_info_get_error_domain:
|
|
||||||
* @info: a #GITypeInfo
|
|
||||||
* @n: index of error domain
|
|
||||||
*
|
|
||||||
* Obtain the error domains at index @n for this type. The type tag
|
|
||||||
* must be a #GI_TYPE_TAG_ERROR or -1 will be returned.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): the error domain or %NULL if type tag is wrong,
|
|
||||||
* free the struct with g_base_info_unref() when done.
|
|
||||||
*/
|
|
||||||
GIErrorDomainInfo *
|
|
||||||
g_type_info_get_error_domain (GITypeInfo *info,
|
|
||||||
gint n)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
||||||
SimpleTypeBlob *type;
|
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
|
||||||
g_return_val_if_fail (GI_IS_TYPE_INFO (info), NULL);
|
|
||||||
|
|
||||||
type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
|
||||||
{
|
|
||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
if (blob->tag == GI_TYPE_TAG_ERROR)
|
|
||||||
return (GIErrorDomainInfo *) _g_info_from_entry (rinfo->repository,
|
|
||||||
rinfo->typelib,
|
|
||||||
blob->domains[n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,9 +48,6 @@ gint g_type_info_get_array_fixed_size(GITypeInfo *info);
|
|||||||
gboolean g_type_info_is_zero_terminated (GITypeInfo *info);
|
gboolean g_type_info_is_zero_terminated (GITypeInfo *info);
|
||||||
GIArrayType g_type_info_get_array_type (GITypeInfo *info);
|
GIArrayType g_type_info_get_array_type (GITypeInfo *info);
|
||||||
|
|
||||||
gint g_type_info_get_n_error_domains (GITypeInfo *info);
|
|
||||||
GIErrorDomainInfo *g_type_info_get_error_domain (GITypeInfo *info,
|
|
||||||
gint n);
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ G_BEGIN_DECLS
|
|||||||
* directory ::= list of entries
|
* directory ::= list of entries
|
||||||
*
|
*
|
||||||
* entry ::= blob type, name, namespace, offset
|
* entry ::= blob type, name, namespace, offset
|
||||||
* blob ::= function|callback|struct|boxed|enum|flags|object|interface|constant|errordomain|union
|
* blob ::= function|callback|struct|boxed|enum|flags|object|interface|constant|union
|
||||||
* attributes ::= list of attributes, sorted by offset
|
* attributes ::= list of attributes, sorted by offset
|
||||||
* attribute ::= offset, key, value
|
* attribute ::= offset, key, value
|
||||||
* attributedata ::= string data for attributes
|
* attributedata ::= string data for attributes
|
||||||
@ -156,7 +156,6 @@ Changes since 0.1:
|
|||||||
* @BLOB_TYPE_OBJECT: An #ObjectBlob
|
* @BLOB_TYPE_OBJECT: An #ObjectBlob
|
||||||
* @BLOB_TYPE_INTERFACE: An #InterfaceBlob
|
* @BLOB_TYPE_INTERFACE: An #InterfaceBlob
|
||||||
* @BLOB_TYPE_CONSTANT: A #ConstantBlob
|
* @BLOB_TYPE_CONSTANT: A #ConstantBlob
|
||||||
* @BLOB_TYPE_ERROR_DOMAIN: A #ErrorDomainBlob
|
|
||||||
* @BLOB_TYPE_UNION: A #UnionBlob
|
* @BLOB_TYPE_UNION: A #UnionBlob
|
||||||
*
|
*
|
||||||
* The integral value of this enumeration appears in each "Blob"
|
* The integral value of this enumeration appears in each "Blob"
|
||||||
@ -173,7 +172,7 @@ typedef enum {
|
|||||||
BLOB_TYPE_OBJECT,
|
BLOB_TYPE_OBJECT,
|
||||||
BLOB_TYPE_INTERFACE,
|
BLOB_TYPE_INTERFACE,
|
||||||
BLOB_TYPE_CONSTANT,
|
BLOB_TYPE_CONSTANT,
|
||||||
BLOB_TYPE_ERROR_DOMAIN,
|
BLOB_TYPE_INVALID_0, /* DELETED - used to be ErrorDomain */
|
||||||
BLOB_TYPE_UNION
|
BLOB_TYPE_UNION
|
||||||
} GTypelibBlobType;
|
} GTypelibBlobType;
|
||||||
|
|
||||||
@ -624,8 +623,6 @@ typedef struct {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ErrorTypeBlob:
|
* ErrorTypeBlob:
|
||||||
* @n_domains: The number of domains to follow
|
|
||||||
* @domains: Indices of the directory entries for the error domains
|
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint8 pointer :1;
|
guint8 pointer :1;
|
||||||
@ -633,31 +630,11 @@ typedef struct {
|
|||||||
guint8 tag :5;
|
guint8 tag :5;
|
||||||
|
|
||||||
guint8 reserved2;
|
guint8 reserved2;
|
||||||
guint16 n_domains;
|
|
||||||
|
|
||||||
|
guint16 n_domains; /* Must be 0 */
|
||||||
guint16 domains[];
|
guint16 domains[];
|
||||||
} ErrorTypeBlob;
|
} ErrorTypeBlob;
|
||||||
|
|
||||||
/**
|
|
||||||
* ErrorDomainBlob:
|
|
||||||
* @get_quark: The symbol name of the function which must be called to obtain the
|
|
||||||
* GQuark for the error domain.
|
|
||||||
* @error_codes: Index of the InterfaceBlob describing the enumeration which lists
|
|
||||||
* the possible error codes.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
guint16 blob_type; /* 10 */
|
|
||||||
|
|
||||||
guint16 deprecated : 1;
|
|
||||||
guint16 reserved :15;
|
|
||||||
|
|
||||||
guint32 name;
|
|
||||||
|
|
||||||
guint32 get_quark;
|
|
||||||
guint16 error_codes;
|
|
||||||
guint16 reserved2;
|
|
||||||
} ErrorDomainBlob;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ValueBlob:
|
* ValueBlob:
|
||||||
* @deprecated: Whether this value is deprecated
|
* @deprecated: Whether this value is deprecated
|
||||||
|
40
gitypelib.c
40
gitypelib.c
@ -284,7 +284,6 @@ g_typelib_check_sanity (void)
|
|||||||
CHECK_SIZE (ArrayTypeBlob, 8);
|
CHECK_SIZE (ArrayTypeBlob, 8);
|
||||||
CHECK_SIZE (ParamTypeBlob, 4);
|
CHECK_SIZE (ParamTypeBlob, 4);
|
||||||
CHECK_SIZE (ErrorTypeBlob, 4);
|
CHECK_SIZE (ErrorTypeBlob, 4);
|
||||||
CHECK_SIZE (ErrorDomainBlob, 16);
|
|
||||||
CHECK_SIZE (ValueBlob, 12);
|
CHECK_SIZE (ValueBlob, 12);
|
||||||
CHECK_SIZE (FieldBlob, 16);
|
CHECK_SIZE (FieldBlob, 16);
|
||||||
CHECK_SIZE (RegisteredTypeBlob, 16);
|
CHECK_SIZE (RegisteredTypeBlob, 16);
|
||||||
@ -446,7 +445,6 @@ validate_header_basic (const guint8 *memory,
|
|||||||
header->field_blob_size != sizeof (FieldBlob) ||
|
header->field_blob_size != sizeof (FieldBlob) ||
|
||||||
header->value_blob_size != sizeof (ValueBlob) ||
|
header->value_blob_size != sizeof (ValueBlob) ||
|
||||||
header->constant_blob_size != sizeof (ConstantBlob) ||
|
header->constant_blob_size != sizeof (ConstantBlob) ||
|
||||||
header->error_domain_blob_size != sizeof (ErrorDomainBlob) ||
|
|
||||||
header->attribute_blob_size != sizeof (AttributeBlob) ||
|
header->attribute_blob_size != sizeof (AttributeBlob) ||
|
||||||
header->signature_blob_size != sizeof (SignatureBlob) ||
|
header->signature_blob_size != sizeof (SignatureBlob) ||
|
||||||
header->enum_blob_size != sizeof (EnumBlob) ||
|
header->enum_blob_size != sizeof (EnumBlob) ||
|
||||||
@ -607,8 +605,6 @@ validate_error_type_blob (GITypelib *typelib,
|
|||||||
{
|
{
|
||||||
ErrorTypeBlob *blob;
|
ErrorTypeBlob *blob;
|
||||||
Header *header;
|
Header *header;
|
||||||
gint i;
|
|
||||||
DirEntry *entry;
|
|
||||||
|
|
||||||
blob = (ErrorTypeBlob*)&typelib->data[offset];
|
blob = (ErrorTypeBlob*)&typelib->data[offset];
|
||||||
|
|
||||||
@ -623,30 +619,6 @@ validate_error_type_blob (GITypelib *typelib,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < blob->n_domains; i++)
|
|
||||||
{
|
|
||||||
if (blob->domains[i] == 0 || blob->domains[i] > header->n_entries)
|
|
||||||
{
|
|
||||||
g_set_error (error,
|
|
||||||
G_TYPELIB_ERROR,
|
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
|
||||||
"Invalid directory index %d", blob->domains[i]);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
entry = g_typelib_get_dir_entry (typelib, blob->domains[i]);
|
|
||||||
|
|
||||||
if (entry->blob_type != BLOB_TYPE_ERROR_DOMAIN &&
|
|
||||||
(entry->local || entry->blob_type != BLOB_TYPE_INVALID))
|
|
||||||
{
|
|
||||||
g_set_error (error,
|
|
||||||
G_TYPELIB_ERROR,
|
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
|
||||||
"Wrong blob type");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1824,14 +1796,6 @@ validate_interface_blob (ValidateContext *ctx,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
validate_errordomain_blob (GITypelib *typelib,
|
|
||||||
guint32 offset,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_union_blob (GITypelib *typelib,
|
validate_union_blob (GITypelib *typelib,
|
||||||
guint32 offset,
|
guint32 offset,
|
||||||
@ -1891,10 +1855,6 @@ validate_blob (ValidateContext *ctx,
|
|||||||
if (!validate_constant_blob (typelib, offset, error))
|
if (!validate_constant_blob (typelib, offset, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case BLOB_TYPE_ERROR_DOMAIN:
|
|
||||||
if (!validate_errordomain_blob (typelib, offset, error))
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
case BLOB_TYPE_UNION:
|
case BLOB_TYPE_UNION:
|
||||||
if (!validate_union_blob (typelib, offset, error))
|
if (!validate_union_blob (typelib, offset, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
10
gitypes.h
10
gitypes.h
@ -150,13 +150,6 @@ typedef GIBaseInfo GIArgInfo;
|
|||||||
*/
|
*/
|
||||||
typedef GIBaseInfo GITypeInfo;
|
typedef GIBaseInfo GITypeInfo;
|
||||||
|
|
||||||
/**
|
|
||||||
* GIErrorDomainInfo:
|
|
||||||
*
|
|
||||||
* Represents a #GError error domain.
|
|
||||||
*/
|
|
||||||
typedef GIBaseInfo GIErrorDomainInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GIUnresolvedInfo:
|
* GIUnresolvedInfo:
|
||||||
*
|
*
|
||||||
@ -202,7 +195,6 @@ typedef union _GIArgument GIArgument;
|
|||||||
* @GI_INFO_TYPE_OBJECT: object, see #GIObjectInfo
|
* @GI_INFO_TYPE_OBJECT: object, see #GIObjectInfo
|
||||||
* @GI_INFO_TYPE_INTERFACE: interface, see #GIInterfaceInfo
|
* @GI_INFO_TYPE_INTERFACE: interface, see #GIInterfaceInfo
|
||||||
* @GI_INFO_TYPE_CONSTANT: contant, see #GIConstantInfo
|
* @GI_INFO_TYPE_CONSTANT: contant, see #GIConstantInfo
|
||||||
* @GI_INFO_TYPE_ERROR_DOMAIN: error domain for a #GError, see #GIErrorDomainInfo
|
|
||||||
* @GI_INFO_TYPE_UNION: union, see #GIUnionInfo
|
* @GI_INFO_TYPE_UNION: union, see #GIUnionInfo
|
||||||
* @GI_INFO_TYPE_VALUE: enum value, see #GIValueInfo
|
* @GI_INFO_TYPE_VALUE: enum value, see #GIValueInfo
|
||||||
* @GI_INFO_TYPE_SIGNAL: signal, see #GISignalInfo
|
* @GI_INFO_TYPE_SIGNAL: signal, see #GISignalInfo
|
||||||
@ -228,7 +220,7 @@ typedef enum
|
|||||||
GI_INFO_TYPE_OBJECT,
|
GI_INFO_TYPE_OBJECT,
|
||||||
GI_INFO_TYPE_INTERFACE,
|
GI_INFO_TYPE_INTERFACE,
|
||||||
GI_INFO_TYPE_CONSTANT,
|
GI_INFO_TYPE_CONSTANT,
|
||||||
GI_INFO_TYPE_ERROR_DOMAIN, /* 10 */
|
GI_INFO_TYPE_INVALID_0, /* 10 */ /** DELETED - used to be ERROR_DOMAIN **/
|
||||||
GI_INFO_TYPE_UNION,
|
GI_INFO_TYPE_UNION,
|
||||||
GI_INFO_TYPE_VALUE,
|
GI_INFO_TYPE_VALUE,
|
||||||
GI_INFO_TYPE_SIGNAL,
|
GI_INFO_TYPE_SIGNAL,
|
||||||
|
Loading…
Reference in New Issue
Block a user