mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 07:38:54 +02:00
Special-case flag value of 0. Instead of returning the first random
* gobject/genums.c: (g_flags_get_first_value): Special-case flag value of 0. Instead of returning the first random GFlagsValue we come across, return the GFlagsValue for 0 if it exists or NULL if it does not exist. Never return the GFlagsValue for 0 if the requested flags value is nonzero.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2005-08-12 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gobject/genums.c: (g_flags_get_first_value): Special-case flag
|
||||||
|
value of 0. Instead of returning the first random GFlagsValue
|
||||||
|
we come across, return the GFlagsValue for 0 if it exists or
|
||||||
|
NULL if it does not exist. Never return the GFlagsValue for 0
|
||||||
|
if the requested flags value is nonzero.
|
||||||
|
|
||||||
2005-08-12 Matthias Clasen <mclasen@redhat.com>
|
2005-08-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* configure.in: Bump version to 2.8.0
|
* configure.in: Bump version to 2.8.0
|
||||||
|
@@ -1,3 +1,11 @@
|
|||||||
|
2005-08-12 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gobject/genums.c: (g_flags_get_first_value): Special-case flag
|
||||||
|
value of 0. Instead of returning the first random GFlagsValue
|
||||||
|
we come across, return the GFlagsValue for 0 if it exists or
|
||||||
|
NULL if it does not exist. Never return the GFlagsValue for 0
|
||||||
|
if the requested flags value is nonzero.
|
||||||
|
|
||||||
2005-08-12 Matthias Clasen <mclasen@redhat.com>
|
2005-08-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* configure.in: Bump version to 2.8.0
|
* configure.in: Bump version to 2.8.0
|
||||||
|
@@ -1,3 +1,11 @@
|
|||||||
|
2005-08-12 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gobject/genums.c: (g_flags_get_first_value): Special-case flag
|
||||||
|
value of 0. Instead of returning the first random GFlagsValue
|
||||||
|
we come across, return the GFlagsValue for 0 if it exists or
|
||||||
|
NULL if it does not exist. Never return the GFlagsValue for 0
|
||||||
|
if the requested flags value is nonzero.
|
||||||
|
|
||||||
2005-08-12 Matthias Clasen <mclasen@redhat.com>
|
2005-08-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* configure.in: Bump version to 2.8.0
|
* configure.in: Bump version to 2.8.0
|
||||||
|
@@ -1,3 +1,11 @@
|
|||||||
|
2005-08-12 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gobject/genums.c: (g_flags_get_first_value): Special-case flag
|
||||||
|
value of 0. Instead of returning the first random GFlagsValue
|
||||||
|
we come across, return the GFlagsValue for 0 if it exists or
|
||||||
|
NULL if it does not exist. Never return the GFlagsValue for 0
|
||||||
|
if the requested flags value is nonzero.
|
||||||
|
|
||||||
2005-08-12 Matthias Clasen <mclasen@redhat.com>
|
2005-08-12 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* configure.in: Bump version to 2.8.0
|
* configure.in: Bump version to 2.8.0
|
||||||
|
@@ -379,10 +379,19 @@ g_flags_get_first_value (GFlagsClass *flags_class,
|
|||||||
if (flags_class->n_values)
|
if (flags_class->n_values)
|
||||||
{
|
{
|
||||||
GFlagsValue *flags_value;
|
GFlagsValue *flags_value;
|
||||||
|
|
||||||
for (flags_value = flags_class->values; flags_value->value_name; flags_value++)
|
if (value == 0)
|
||||||
if ((flags_value->value & value) == flags_value->value)
|
{
|
||||||
return flags_value;
|
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;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user