Skip to content
Browse files

update yajl_gen_double to enforce that serialized double values alway…

…s contain a decimal point, even if no digits follow the point. this prevents some readers from parsing such values as an integer.
  • Loading branch information...
1 parent e2d0806 commit dca2535092c2a48a1b4aaaacbf68b978c08d535e @bovine bovine committed Jul 30, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/yajl_gen.c
3 src/yajl_gen.c
@@ -222,6 +222,9 @@ yajl_gen_double(yajl_gen g, double number)
if (isnan(number) || isinf(number)) return yajl_gen_invalid_number;
sprintf(i, "%.20g", number);
+ if (strspn(i, "0123456789-") == strlen(i)) {
+ strcat(i, ".0");
+ }
g->print(g->ctx, i, (unsigned int)strlen(i));

0 comments on commit dca2535

Please sign in to comment.
Something went wrong with that request. Please try again.