提交 b9171eba 编写于 作者: J Jiri Denemark

json: Fix *GetBoolean functions

They were not used anywhere so far so nobody noticed they are broken.
上级 0f536dea
......@@ -491,12 +491,13 @@ int virJSONValueGetNumberDouble(virJSONValuePtr number, double *value)
}
int virJSONValueGetBoolean(virJSONValuePtr val)
int virJSONValueGetBoolean(virJSONValuePtr val, bool *value)
{
if (val->type != VIR_JSON_TYPE_NUMBER)
if (val->type != VIR_JSON_TYPE_BOOLEAN)
return -1;
return val->data.boolean;
*value = val->data.boolean;
return 0;
}
......@@ -593,7 +594,7 @@ int virJSONValueObjectGetNumberDouble(virJSONValuePtr object, const char *key, d
}
int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key)
int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key, bool *value)
{
virJSONValuePtr val;
if (object->type != VIR_JSON_TYPE_OBJECT)
......@@ -603,7 +604,7 @@ int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key)
if (!val)
return -1;
return virJSONValueGetBoolean(val);
return virJSONValueGetBoolean(val, value);
}
......
......@@ -105,7 +105,7 @@ int virJSONValueGetNumberUint(virJSONValuePtr object, unsigned int *value);
int virJSONValueGetNumberLong(virJSONValuePtr object, long long *value);
int virJSONValueGetNumberUlong(virJSONValuePtr object, unsigned long long *value);
int virJSONValueGetNumberDouble(virJSONValuePtr object, double *value);
int virJSONValueGetBoolean(virJSONValuePtr object);
int virJSONValueGetBoolean(virJSONValuePtr object, bool *value);
int virJSONValueIsNull(virJSONValuePtr object);
const char *virJSONValueObjectGetString(virJSONValuePtr object, const char *key);
......@@ -114,7 +114,7 @@ int virJSONValueObjectGetNumberUint(virJSONValuePtr object, const char *key, uns
int virJSONValueObjectGetNumberLong(virJSONValuePtr object, const char *key, long long *value);
int virJSONValueObjectGetNumberUlong(virJSONValuePtr object, const char *key, unsigned long long *value);
int virJSONValueObjectGetNumberDouble(virJSONValuePtr object, const char *key, double *value);
int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key);
int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key, bool *value);
int virJSONValueObjectIsNull(virJSONValuePtr object, const char *key);
int virJSONValueObjectAppendString(virJSONValuePtr object, const char *key, const char *value);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册