mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-30 20:33:08 +02:00
Strengthen check for interface vs basic types
Previously we were just checking "reserved", but to be more correct we should check whether reserved2 is zero as well because it is possible for offsets to have reserved = 0 but reserved2 != 0. svn path=/trunk/; revision=620
This commit is contained in:
parent
c760a31723
commit
bfb6271201
20
ginfo.c
20
ginfo.c
@ -548,7 +548,7 @@ g_type_info_new (GIBaseInfo *container,
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
||||
|
||||
return (GITypeInfo *) g_info_new (GI_INFO_TYPE_TYPE, container, typelib,
|
||||
type->reserved == 0 ? offset : type->offset);
|
||||
(type->reserved == 0 && type->reserved2 == 0) ? offset : type->offset);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -735,7 +735,7 @@ g_type_info_is_pointer (GITypeInfo *info)
|
||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
if (type->reserved == 0)
|
||||
if (type->reserved == 0 && type->reserved2 == 0)
|
||||
return type->pointer;
|
||||
else
|
||||
{
|
||||
@ -751,7 +751,7 @@ g_type_info_get_tag (GITypeInfo *info)
|
||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
if (type->reserved == 0)
|
||||
if (type->reserved == 0 && type->reserved2 == 0)
|
||||
return type->tag;
|
||||
else
|
||||
{
|
||||
@ -768,7 +768,7 @@ g_type_info_get_param_type (GITypeInfo *info,
|
||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
if (type->reserved != 0)
|
||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
||||
{
|
||||
ParamTypeBlob *param = (ParamTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
@ -794,7 +794,7 @@ g_type_info_get_interface (GITypeInfo *info)
|
||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
if (type->reserved != 0)
|
||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
||||
{
|
||||
InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
@ -811,7 +811,7 @@ g_type_info_get_array_length (GITypeInfo *info)
|
||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
if (type->reserved != 0)
|
||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
||||
{
|
||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
@ -831,7 +831,7 @@ g_type_info_is_zero_terminated (GITypeInfo *info)
|
||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
if (type->reserved != 0)
|
||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
||||
{
|
||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
@ -848,7 +848,7 @@ g_type_info_get_n_error_domains (GITypeInfo *info)
|
||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
if (type->reserved != 0)
|
||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
||||
{
|
||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
@ -866,7 +866,7 @@ g_type_info_get_error_domain (GITypeInfo *info,
|
||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
if (type->reserved != 0)
|
||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
||||
{
|
||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
@ -1679,7 +1679,7 @@ g_constant_info_get_value (GIConstantInfo *info,
|
||||
ConstantBlob *blob = (ConstantBlob *)&base->typelib->data[base->offset];
|
||||
|
||||
/* FIXME non-basic types ? */
|
||||
if (blob->type.reserved == 0)
|
||||
if (blob->type.reserved == 0 && blob->type.reserved2 == 0)
|
||||
{
|
||||
if (blob->type.pointer)
|
||||
value->v_pointer = g_memdup (&base->typelib->data[blob->offset], blob->size);
|
||||
|
@ -968,7 +968,7 @@ validate_constant_blob (GTypelib *typelib,
|
||||
}
|
||||
|
||||
type = (SimpleTypeBlob *)&typelib->data[offset + G_STRUCT_OFFSET (ConstantBlob, type)];
|
||||
if (type->reserved == 0)
|
||||
if (type->reserved == 0 && type->reserved2 == 0)
|
||||
{
|
||||
if (type->tag == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user