mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-25 03:32:12 +01:00
Name unions to enable compilation on Solaris
Patch by Brian Cameron <brian.cameron@sun.com>. Fixes bug 578199.
This commit is contained in:
parent
378350f3a9
commit
65e241fab8
34
ginfo.c
34
ginfo.c
@ -637,7 +637,7 @@ g_type_info_new (GIBaseInfo *container,
|
|||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
|
||||||
|
|
||||||
return (GITypeInfo *) g_info_new (GI_INFO_TYPE_TYPE, container, typelib,
|
return (GITypeInfo *) g_info_new (GI_INFO_TYPE_TYPE, container, typelib,
|
||||||
(type->reserved == 0 && type->reserved2 == 0) ? offset : type->offset);
|
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -852,8 +852,8 @@ g_type_info_is_pointer (GITypeInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (type->reserved == 0 && type->reserved2 == 0)
|
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
|
||||||
return type->pointer;
|
return type->flags.pointer;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&base->typelib->data[base->offset];
|
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&base->typelib->data[base->offset];
|
||||||
@ -868,8 +868,8 @@ g_type_info_get_tag (GITypeInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (type->reserved == 0 && type->reserved2 == 0)
|
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
|
||||||
return type->tag;
|
return type->flags.tag;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&base->typelib->data[base->offset];
|
InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&base->typelib->data[base->offset];
|
||||||
@ -885,7 +885,7 @@ g_type_info_get_param_type (GITypeInfo *info,
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ParamTypeBlob *param = (ParamTypeBlob *)&base->typelib->data[base->offset];
|
ParamTypeBlob *param = (ParamTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
@ -913,7 +913,7 @@ g_type_info_get_interface (GITypeInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&base->typelib->data[base->offset];
|
InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
@ -930,14 +930,14 @@ g_type_info_get_array_length (GITypeInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
|
ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (blob->tag == GI_TYPE_TAG_ARRAY)
|
if (blob->tag == GI_TYPE_TAG_ARRAY)
|
||||||
{
|
{
|
||||||
if (blob->has_length)
|
if (blob->has_length)
|
||||||
return blob->length;
|
return blob->dimensions.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,14 +950,14 @@ g_type_info_get_array_fixed_size (GITypeInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
|
ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (blob->tag == GI_TYPE_TAG_ARRAY)
|
if (blob->tag == GI_TYPE_TAG_ARRAY)
|
||||||
{
|
{
|
||||||
if (blob->has_size)
|
if (blob->has_size)
|
||||||
return blob->size;
|
return blob->dimensions.size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,7 +970,7 @@ g_type_info_is_zero_terminated (GITypeInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
|
ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
@ -987,7 +987,7 @@ g_type_info_get_n_error_domains (GITypeInfo *info)
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&base->typelib->data[base->offset];
|
ErrorTypeBlob *blob = (ErrorTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
@ -1005,7 +1005,7 @@ g_type_info_get_error_domain (GITypeInfo *info,
|
|||||||
GIBaseInfo *base = (GIBaseInfo *)info;
|
GIBaseInfo *base = (GIBaseInfo *)info;
|
||||||
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
if (!(type->reserved == 0 && type->reserved2 == 0))
|
if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0))
|
||||||
{
|
{
|
||||||
ErrorTypeBlob *blob = (ErrorTypeBlob *)&base->typelib->data[base->offset];
|
ErrorTypeBlob *blob = (ErrorTypeBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
@ -2047,13 +2047,13 @@ g_constant_info_get_value (GIConstantInfo *info,
|
|||||||
ConstantBlob *blob = (ConstantBlob *)&base->typelib->data[base->offset];
|
ConstantBlob *blob = (ConstantBlob *)&base->typelib->data[base->offset];
|
||||||
|
|
||||||
/* FIXME non-basic types ? */
|
/* FIXME non-basic types ? */
|
||||||
if (blob->type.reserved == 0 && blob->type.reserved2 == 0)
|
if (blob->type.flags.reserved == 0 && blob->type.flags.reserved2 == 0)
|
||||||
{
|
{
|
||||||
if (blob->type.pointer)
|
if (blob->type.flags.pointer)
|
||||||
value->v_pointer = g_memdup (&base->typelib->data[blob->offset], blob->size);
|
value->v_pointer = g_memdup (&base->typelib->data[blob->offset], blob->size);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (blob->type.tag)
|
switch (blob->type.flags.tag)
|
||||||
{
|
{
|
||||||
case GI_TYPE_TAG_BOOLEAN:
|
case GI_TYPE_TAG_BOOLEAN:
|
||||||
value->v_boolean = *(gboolean*)&base->typelib->data[blob->offset];
|
value->v_boolean = *(gboolean*)&base->typelib->data[blob->offset];
|
||||||
|
16
girnode.c
16
girnode.c
@ -1437,11 +1437,11 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
type->tag == GI_TYPE_TAG_UTF8 ||
|
type->tag == GI_TYPE_TAG_UTF8 ||
|
||||||
type->tag == GI_TYPE_TAG_FILENAME)
|
type->tag == GI_TYPE_TAG_FILENAME)
|
||||||
{
|
{
|
||||||
blob->reserved = 0;
|
blob->flags.reserved = 0;
|
||||||
blob->reserved2 = 0;
|
blob->flags.reserved2 = 0;
|
||||||
blob->pointer = type->is_pointer;
|
blob->flags.pointer = type->is_pointer;
|
||||||
blob->reserved3 = 0;
|
blob->flags.reserved3 = 0;
|
||||||
blob->tag = type->tag;
|
blob->flags.tag = type->tag;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1481,11 +1481,11 @@ g_ir_node_build_typelib (GIrNode *node,
|
|||||||
array->has_size = type->has_size;
|
array->has_size = type->has_size;
|
||||||
array->reserved2 = 0;
|
array->reserved2 = 0;
|
||||||
if (array->has_length)
|
if (array->has_length)
|
||||||
array->length = type->length;
|
array->dimensions.length = type->length;
|
||||||
else if (array->has_size)
|
else if (array->has_size)
|
||||||
array->size = type->size;
|
array->dimensions.size = type->size;
|
||||||
else
|
else
|
||||||
array->length = -1;
|
array->dimensions.length = -1;
|
||||||
|
|
||||||
pos = *offset2 + G_STRUCT_OFFSET (ArrayTypeBlob, type);
|
pos = *offset2 + G_STRUCT_OFFSET (ArrayTypeBlob, type);
|
||||||
*offset2 += sizeof (ArrayTypeBlob);
|
*offset2 += sizeof (ArrayTypeBlob);
|
||||||
|
24
gtypelib.c
24
gtypelib.c
@ -116,13 +116,13 @@ get_type_blob (GTypelib *typelib,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simple->reserved == 0 && simple->reserved2 == 0)
|
if (simple->flags.reserved == 0 && simple->flags.reserved2 == 0)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID,
|
G_TYPELIB_ERROR_INVALID,
|
||||||
"Expected non-basic type but got %d",
|
"Expected non-basic type but got %d",
|
||||||
simple->tag);
|
simple->flags.tag);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,10 +547,10 @@ validate_type_blob (GTypelib *typelib,
|
|||||||
|
|
||||||
simple = (SimpleTypeBlob *)&typelib->data[offset];
|
simple = (SimpleTypeBlob *)&typelib->data[offset];
|
||||||
|
|
||||||
if (simple->reserved == 0 &&
|
if (simple->flags.reserved == 0 &&
|
||||||
simple->reserved2 == 0)
|
simple->flags.reserved2 == 0)
|
||||||
{
|
{
|
||||||
if (simple->tag >= GI_TYPE_TAG_ARRAY)
|
if (simple->flags.tag >= GI_TYPE_TAG_ARRAY)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
@ -559,13 +559,13 @@ validate_type_blob (GTypelib *typelib,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simple->tag >= GI_TYPE_TAG_UTF8 &&
|
if (simple->flags.tag >= GI_TYPE_TAG_UTF8 &&
|
||||||
!simple->pointer)
|
!simple->flags.pointer)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
G_TYPELIB_ERROR_INVALID_BLOB,
|
G_TYPELIB_ERROR_INVALID_BLOB,
|
||||||
"Pointer type exected for tag %d", simple->tag);
|
"Pointer type exected for tag %d", simple->flags.tag);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -965,9 +965,9 @@ validate_constant_blob (GTypelib *typelib,
|
|||||||
}
|
}
|
||||||
|
|
||||||
type = (SimpleTypeBlob *)&typelib->data[offset + G_STRUCT_OFFSET (ConstantBlob, type)];
|
type = (SimpleTypeBlob *)&typelib->data[offset + G_STRUCT_OFFSET (ConstantBlob, type)];
|
||||||
if (type->reserved == 0 && type->reserved2 == 0)
|
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
|
||||||
{
|
{
|
||||||
if (type->tag == 0)
|
if (type->flags.tag == 0)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
@ -976,8 +976,8 @@ validate_constant_blob (GTypelib *typelib,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value_size[type->tag] != 0 &&
|
if (value_size[type->flags.tag] != 0 &&
|
||||||
blob->size != value_size[type->tag])
|
blob->size != value_size[type->flags.tag])
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_TYPELIB_ERROR,
|
G_TYPELIB_ERROR,
|
||||||
|
@ -313,7 +313,7 @@ typedef union
|
|||||||
guint pointer : 1;
|
guint pointer : 1;
|
||||||
guint reserved3 : 2;
|
guint reserved3 : 2;
|
||||||
guint tag : 5;
|
guint tag : 5;
|
||||||
};
|
} flags;
|
||||||
guint32 offset;
|
guint32 offset;
|
||||||
} SimpleTypeBlob;
|
} SimpleTypeBlob;
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ typedef struct {
|
|||||||
union {
|
union {
|
||||||
guint16 length;
|
guint16 length;
|
||||||
guint16 size;
|
guint16 size;
|
||||||
};
|
} dimensions;
|
||||||
|
|
||||||
SimpleTypeBlob type;
|
SimpleTypeBlob type;
|
||||||
} ArrayTypeBlob;
|
} ArrayTypeBlob;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user