mirror of https://gitee.com/bigwinds/arangodb
fix stringbuffer appending for special numeric values
This commit is contained in:
parent
dca899101f
commit
390916c417
|
@ -1476,7 +1476,23 @@ static bool StringifyJsonShapeDataNumber (TRI_shaper_t* shaper,
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
v = * (TRI_shape_number_t const*) data;
|
v = * (TRI_shape_number_t const*) data;
|
||||||
res = TRI_AppendDoubleStringBuffer(buffer, v);
|
// check for special values
|
||||||
|
|
||||||
|
if (v != v) {
|
||||||
|
// NaN
|
||||||
|
res = TRI_AppendStringStringBuffer(buffer, "null");
|
||||||
|
}
|
||||||
|
else if (v == HUGE_VAL) {
|
||||||
|
// +inf
|
||||||
|
res = TRI_AppendStringStringBuffer(buffer, "null");
|
||||||
|
}
|
||||||
|
else if (v == -HUGE_VAL) {
|
||||||
|
// -inf
|
||||||
|
res = TRI_AppendStringStringBuffer(buffer, "null");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res = TRI_AppendDoubleStringBuffer(buffer, v);
|
||||||
|
}
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue