aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/core/qdev-properties.c7
-rw-r--r--qapi/qapi-visit-core.c2
2 files changed, 6 insertions, 3 deletions
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 078fc5d239..7512bd4379 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -72,7 +72,9 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque,
static void set_default_value_enum(Object *obj, const Property *prop)
{
- object_property_set_str(obj, prop->info->enum_table[prop->defval.i],
+ object_property_set_str(obj,
+ qapi_enum_lookup(prop->info->enum_table,
+ prop->defval.i),
prop->name, &error_abort);
}
@@ -1095,7 +1097,8 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value)
Property *prop;
prop = qdev_prop_find(dev, name);
- object_property_set_str(OBJECT(dev), prop->info->enum_table[value],
+ object_property_set_str(OBJECT(dev),
+ qapi_enum_lookup(prop->info->enum_table, value),
name, &error_abort);
}
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index f285879d72..30dc85b6f3 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -345,7 +345,7 @@ static void output_type_enum(Visitor *v, const char *name, int *obj,
return;
}
- enum_str = (char *)strings[value];
+ enum_str = (char *)qapi_enum_lookup(strings, value);
visit_type_str(v, name, &enum_str, errp);
}