Skip to content
  • Aurelien Jarno's avatar
    Fix list/hashtable enum <-> hash conversion on 64-bit big endian · f4d858c0
    Aurelien Jarno authored and Christoph Reiter's avatar Christoph Reiter committed
    glist and ghashtable objects both store pointers. Complex objects are
    stored as pointers to the objects, but simpler objects like an integer
    value are stored directly as a pointer, using for example the
    GINT_TO_POINTER and GPOINTER_TO_INT macros.
    
    This is done in pygobject with the _pygi_hash_pointer_to_arg and
    _pygi_arg_to_hash_pointer functions. These functions handle the various
    type of objects. However they consider that an enum, represented with the
    GI_TYPE_TAG_INTERFACE type (extended interface object), are always a
    pointer. This is wrong as it is often a 32-bit value. Therefore on 64-bit
    big endian machines, the value is handle with the 2 32-bit parts swapped.
    
    This patches fixes that by changing the second argument of both functions
    from GITypeTag to GITypeInfo. This way the interface can be determined,
    and the underlying storage type can also be determined. This currently
    only handles enum and flags, leaving other types as pointers....
    f4d858c0