提交 66cb1fa2 编写于 作者: P Peter Krempa

util: qemu: Don't access virJSONValue directly in virQEMUBuildCommandLineJSONRecurse

Use the accessors instead.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 1cbe6aa2
......@@ -148,6 +148,7 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
struct virQEMUCommandLineJSONIteratorData data = { key, buf, arrayFunc };
virJSONType type = virJSONValueGetType(value);
virJSONValuePtr elem;
bool tmp;
size_t i;
if (!key && type != VIR_JSON_TYPE_OBJECT) {
......@@ -159,16 +160,17 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
switch (type) {
case VIR_JSON_TYPE_STRING:
virBufferAsprintf(buf, "%s=", key);
virQEMUBuildBufferEscapeComma(buf, value->data.string);
virQEMUBuildBufferEscapeComma(buf, virJSONValueGetString(value));
virBufferAddLit(buf, ",");
break;
case VIR_JSON_TYPE_NUMBER:
virBufferAsprintf(buf, "%s=%s,", key, value->data.number);
virBufferAsprintf(buf, "%s=%s,", key, virJSONValueGetNumberString(value));
break;
case VIR_JSON_TYPE_BOOLEAN:
if (value->data.boolean)
virJSONValueGetBoolean(value, &tmp);
if (tmp)
virBufferAsprintf(buf, "%s=yes,", key);
else
virBufferAsprintf(buf, "%s=no,", key);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册