aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-05-14 10:18:06 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-05-14 10:18:06 -0500
commit981b1628b3430a21cf1c76d6acd7c883c86fceb2 (patch)
treee9b88ec09d96c0c1b9899a836c6a6b4bf177ef82
parent8592d5259a2be71fdca45fc0db62a5ad10abe9f5 (diff)
parent1ee518760aee476879d5c59476d9a316edbff332 (diff)
Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp: qapi: QMP input visitor, handle floats parsed as ints
-rw-r--r--qapi/qmp-input-visitor.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
index 4cdc47dab5..107d8d361b 100644
--- a/qapi/qmp-input-visitor.c
+++ b/qapi/qmp-input-visitor.c
@@ -246,13 +246,18 @@ static void qmp_input_type_number(Visitor *v, double *obj, const char *name,
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name);
- if (!qobj || qobject_type(qobj) != QTYPE_QFLOAT) {
+ if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT &&
+ qobject_type(qobj) != QTYPE_QINT)) {
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
- "double");
+ "number");
return;
}
- *obj = qfloat_get_double(qobject_to_qfloat(qobj));
+ if (qobject_type(qobj) == QTYPE_QINT) {
+ *obj = qint_get_int(qobject_to_qint(qobj));
+ } else {
+ *obj = qfloat_get_double(qobject_to_qfloat(qobj));
+ }
}
static void qmp_input_start_optional(Visitor *v, bool *present,