Re: [Qemu-devel] [PATCH 3/8] Add QBuffer

2010-05-16 Thread Avi Kivity
On 05/17/2010 03:12 AM, Anthony Liguori wrote: On Sun, May 16, 2010 at 12:38 PM, Jamie Lokier wrote: Anthony Liguori wrote: Instead of encoding just as a string, it would be a good idea to encode it as something like: {'__class__': 'base64', 'data': ...} Is there a benefit

Re: [Qemu-devel] [PATCH 3/8] Add QBuffer

2010-05-16 Thread Anthony Liguori
On Sun, May 16, 2010 at 12:38 PM, Jamie Lokier wrote: > Anthony Liguori wrote: >> Instead of encoding just as a string, it would be a good idea to encode >> it as something like: >> >> {'__class__': 'base64', 'data': ...} > > Is there a benefit to the class indirection, over simply a keyword?: > >

Re: [Qemu-devel] [PATCH 3/8] Add QBuffer

2010-05-16 Thread Jamie Lokier
Anthony Liguori wrote: > Instead of encoding just as a string, it would be a good idea to encode > it as something like: > > {'__class__': 'base64', 'data': ...} Is there a benefit to the class indirection, over simply a keyword?: {'__base64__': ...} __class__ seems to suggest much more than i

Re: [Qemu-devel] [PATCH 3/8] Add QBuffer

2010-05-14 Thread Anthony Liguori
On 05/14/2010 08:20 AM, Jan Kiszka wrote: diff --git a/qjson.c b/qjson.c index 483c667..4d1c21a 100644 --- a/qjson.c +++ b/qjson.c @@ -19,7 +19,9 @@ #include "qlist.h" #include "qbool.h" #include "qfloat.h" +#include "qbuffer.h" #include "qdict.h" +#include "base64.h" typedef struct JS

[Qemu-devel] [PATCH 3/8] Add QBuffer

2010-05-14 Thread Jan Kiszka
This introduces a buffer object for use with QMP. As a buffer is not natively encodable in JSON, we encode it as a base64 string. To decode this kind of strings back to a QBuffer, the receiving side has to be aware of their semantic, which is normally no problem within QMP. The first use case of t