summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-04-27 17:08:43 +0200
committerThomas Haller <thaller@redhat.com>2017-04-27 17:59:51 +0200
commitda5a6534bca0e2219a69629b2046c8ef9c971b59 (patch)
tree9a2b80ef7b393d4c961e31e15cf44af2ec2a15fb
parent43c3501f978aeb783b363bff923e781302736985 (diff)
downloadNetworkManager-da5a6534bca0e2219a69629b2046c8ef9c971b59.tar.gz
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: f53218ed7cd7b5ed9dbe9cc2df122efc1efbf621
-rw-r--r--clients/common/nm-meta-setting-desc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 2116487e48..98a5c38cd9 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -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. */