diff options
Diffstat (limited to 'gobject/genums.c')
-rw-r--r-- | gobject/genums.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gobject/genums.c b/gobject/genums.c index 63ccd939e..2ce3dc3b4 100644 --- a/gobject/genums.c +++ b/gobject/genums.c @@ -379,10 +379,19 @@ g_flags_get_first_value (GFlagsClass *flags_class, if (flags_class->n_values) { GFlagsValue *flags_value; - - for (flags_value = flags_class->values; flags_value->value_name; flags_value++) - if ((flags_value->value & value) == flags_value->value) - return flags_value; + + if (value == 0) + { + for (flags_value = flags_class->values; flags_value->value_name; flags_value++) + if (flags_value->value == 0) + return flags_value; + } + else + { + for (flags_value = flags_class->values; flags_value->value_name; flags_value++) + if (flags_value->value != 0 && (flags_value->value & value) == flags_value->value) + return flags_value; + } } return NULL; |