Skip to content
  • Colomban Wendling's avatar
    Fix converting enumerations and flags to arrays · 72671f62
    Colomban Wendling authored and Rico Tzschichholz's avatar Rico Tzschichholz committed
    Enumerations and flags are classed types for Vala, not integers, so
    they don't fall in the `typeof(G) == typeof(int)` kind of tests. This
    leads to using the generic code in which Vala assumes pointer-sized
    elements, which is often not true for enumerations and flags.
    
    Add special case for those to use the `int` converters for enumerations
    and flags.
    
    This is most generally correct, but not always: the compiler will
    likely chose a larger type for a specific enumeration if one of its
    value is larger than `int`.  It would be tempting to use the
    enumeration's class minimum and maximum values to determine the
    appropriate type, but unfortunately the API for this uses int itself,
    so doesn't help.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774669
    72671f62