mirror of https://github.com/xemu-project/xemu.git
Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp: qapi: QMP input visitor, handle floats parsed as ints
This commit is contained in:
commit
981b1628b3
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue