mirror of
https://github.com/sigmasternchen/libargo
synced 2025-03-15 21:28:54 +00:00
long value can now also be considered double
This commit is contained in:
parent
d9a3ba7a81
commit
a21ec9553f
1 changed files with 5 additions and 2 deletions
|
@ -104,14 +104,17 @@ static void* json_unmarshall_long(jsonValue_t* value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* json_unmarshall_double(jsonValue_t* value) {
|
static void* json_unmarshall_double(jsonValue_t* value) {
|
||||||
if (value->type != JSON_DOUBLE)
|
if (value->type != JSON_DOUBLE && value->type != JSON_LONG)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
double* tmp = malloc(sizeof(double));
|
double* tmp = malloc(sizeof(double));
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
*tmp = value->value.real;
|
if (value->type == JSON_DOUBLE)
|
||||||
|
*tmp = value->value.real;
|
||||||
|
else
|
||||||
|
*tmp = value->value.integer;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue