* [Qemu-devel] [PULL 0/1]: QMP patches for 1.1
@ 2012-05-14 13:25 Luiz Capitulino
2012-05-14 13:25 ` [Qemu-devel] [PULL 1/1] qapi: QMP input visitor, handle floats parsed as ints Luiz Capitulino
2012-05-14 20:08 ` [Qemu-devel] [PULL 0/1]: QMP patches for 1.1 Anthony Liguori
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Capitulino @ 2012-05-14 13:25 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel
Only patch, from Michael, that fixes a bug in the QMP input visitor.
The changes (since 94d1991445fa3582c042ee4e5b72606e2fc39cc2) are available
in the following repository:
git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
Michael Roth (1):
qapi: QMP input visitor, handle floats parsed as ints
qapi/qmp-input-visitor.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PULL 1/1] qapi: QMP input visitor, handle floats parsed as ints
2012-05-14 13:25 [Qemu-devel] [PULL 0/1]: QMP patches for 1.1 Luiz Capitulino
@ 2012-05-14 13:25 ` Luiz Capitulino
2012-05-14 20:08 ` [Qemu-devel] [PULL 0/1]: QMP patches for 1.1 Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Capitulino @ 2012-05-14 13:25 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel, Michael Roth
From: Michael Roth <mdroth@linux.vnet.ibm.com>
JSON numbers can be interpreted as either integers or floating point
values depending on their representation. As a result, QMP input visitor
might visit a QInt when it was expecting a QFloat, so add handling to
account for this.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
---
qapi/qmp-input-visitor.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
index 4cdc47d..107d8d3 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,
--
1.7.9.2.384.g4a92a
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PULL 0/1]: QMP patches for 1.1
2012-05-14 13:25 [Qemu-devel] [PULL 0/1]: QMP patches for 1.1 Luiz Capitulino
2012-05-14 13:25 ` [Qemu-devel] [PULL 1/1] qapi: QMP input visitor, handle floats parsed as ints Luiz Capitulino
@ 2012-05-14 20:08 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2012-05-14 20:08 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: qemu-devel
On 05/14/2012 08:25 AM, Luiz Capitulino wrote:
> Only patch, from Michael, that fixes a bug in the QMP input visitor.
>
> The changes (since 94d1991445fa3582c042ee4e5b72606e2fc39cc2) are available
> in the following repository:
>
> git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
Pulled. Thanks.
Regards,
Anthony Liguori
>
> Michael Roth (1):
> qapi: QMP input visitor, handle floats parsed as ints
>
> qapi/qmp-input-visitor.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-14 20:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-14 13:25 [Qemu-devel] [PULL 0/1]: QMP patches for 1.1 Luiz Capitulino
2012-05-14 13:25 ` [Qemu-devel] [PULL 1/1] qapi: QMP input visitor, handle floats parsed as ints Luiz Capitulino
2012-05-14 20:08 ` [Qemu-devel] [PULL 0/1]: QMP patches for 1.1 Anthony Liguori
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.