mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 10:10:18 +01:00
cli: fix _values_fcn_gobject_enum() for flag types
For flags, the integer is cast to "unsigned", hence, the min/max
range must be different.
Fixes: f53218ed7c
This commit is contained in:
parent
43c3501f97
commit
da5a6534bc
1 changed files with 13 additions and 0 deletions
|
|
@ -1052,6 +1052,7 @@ _values_fcn_gobject_enum (ARGS_VALUES_FCN)
|
|||
{
|
||||
GType gtype = 0;
|
||||
gboolean has_gtype = FALSE;
|
||||
gboolean has_minmax = FALSE;
|
||||
int min = G_MININT;
|
||||
int max = G_MAXINT;
|
||||
char **v, **w;
|
||||
|
|
@ -1061,6 +1062,7 @@ _values_fcn_gobject_enum (ARGS_VALUES_FCN)
|
|||
|| property_info->property_typ_data->subtype.gobject_enum.max) {
|
||||
min = property_info->property_typ_data->subtype.gobject_enum.min;
|
||||
max = property_info->property_typ_data->subtype.gobject_enum.max;
|
||||
has_minmax = TRUE;
|
||||
}
|
||||
if (property_info->property_typ_data->subtype.gobject_enum.get_gtype) {
|
||||
gtype = property_info->property_typ_data->subtype.gobject_enum.get_gtype ();
|
||||
|
|
@ -1073,6 +1075,17 @@ _values_fcn_gobject_enum (ARGS_VALUES_FCN)
|
|||
property_info->property_name);
|
||||
}
|
||||
|
||||
if ( !has_minmax
|
||||
&& G_TYPE_IS_CLASSED (gtype)) {
|
||||
nm_auto_unref_gtypeclass GTypeClass *class = NULL;
|
||||
|
||||
class = g_type_class_ref (gtype);
|
||||
if (G_IS_FLAGS_CLASS (class)) {
|
||||
min = 0;
|
||||
max = (gint) G_MAXUINT;
|
||||
}
|
||||
}
|
||||
|
||||
/* the gobject_enum.value_infos are currently ignored for the list of
|
||||
* values. They only declare additional (hidden) aliases for the setter. */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue