json: Fix *GetBoolean functions

They were not used anywhere so far so nobody noticed they are broken.
This commit is contained in:
Jiri Denemark 2011-05-05 13:48:31 +02:00
parent 0f536dea9b
commit b9171eba2f
2 changed files with 8 additions and 7 deletions

View File

@ -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 -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; virJSONValuePtr val;
if (object->type != VIR_JSON_TYPE_OBJECT) if (object->type != VIR_JSON_TYPE_OBJECT)
@ -603,7 +604,7 @@ int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key)
if (!val) if (!val)
return -1; return -1;
return virJSONValueGetBoolean(val); return virJSONValueGetBoolean(val, value);
} }

View File

@ -105,7 +105,7 @@ int virJSONValueGetNumberUint(virJSONValuePtr object, unsigned int *value);
int virJSONValueGetNumberLong(virJSONValuePtr object, long long *value); int virJSONValueGetNumberLong(virJSONValuePtr object, long long *value);
int virJSONValueGetNumberUlong(virJSONValuePtr object, unsigned long long *value); int virJSONValueGetNumberUlong(virJSONValuePtr object, unsigned long long *value);
int virJSONValueGetNumberDouble(virJSONValuePtr object, double *value); int virJSONValueGetNumberDouble(virJSONValuePtr object, double *value);
int virJSONValueGetBoolean(virJSONValuePtr object); int virJSONValueGetBoolean(virJSONValuePtr object, bool *value);
int virJSONValueIsNull(virJSONValuePtr object); int virJSONValueIsNull(virJSONValuePtr object);
const char *virJSONValueObjectGetString(virJSONValuePtr object, const char *key); 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 virJSONValueObjectGetNumberLong(virJSONValuePtr object, const char *key, long long *value);
int virJSONValueObjectGetNumberUlong(virJSONValuePtr object, const char *key, unsigned long long *value); int virJSONValueObjectGetNumberUlong(virJSONValuePtr object, const char *key, unsigned long long *value);
int virJSONValueObjectGetNumberDouble(virJSONValuePtr object, const char *key, double *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 virJSONValueObjectIsNull(virJSONValuePtr object, const char *key);
int virJSONValueObjectAppendString(virJSONValuePtr object, const char *key, const char *value); int virJSONValueObjectAppendString(virJSONValuePtr object, const char *key, const char *value);