Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34fb97998c | ||
|
|
ec96cbf016 | ||
|
|
7c707a73a2 | ||
|
|
330e892ff6 | ||
|
|
d857fd08a5 |
7
CHANGES
7
CHANGES
@@ -1,3 +1,10 @@
|
||||
Version 1.1.3, released 2009-12-18
|
||||
|
||||
* Encode reals correctly, so that first encoding and then decoding a
|
||||
real always produces the same value
|
||||
* Don't export private symbols in libjansson.so
|
||||
|
||||
|
||||
Version 1.1.2, released 2009-11-08
|
||||
|
||||
* Fix a bug where an error message was not produced if the input file
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AC_PREREQ([2.59])
|
||||
AC_INIT([jansson], [1.1.2], [petri@digip.org])
|
||||
AC_INIT([jansson], [1.1.3], [petri@digip.org])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.10 foreign])
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ copyright = u'2009, Petri Lehtinen'
|
||||
# The short X.Y version.
|
||||
version = '1.1'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.1.2'
|
||||
release = '1.1.3'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ libjansson_la_SOURCES = \
|
||||
utf.h \
|
||||
util.h \
|
||||
value.c
|
||||
libjansson_la_LDFLAGS = -version-info 1:1:1
|
||||
libjansson_la_LDFLAGS = \
|
||||
-export-symbols-regex '^json_' \
|
||||
-version-info 1:2:1
|
||||
|
||||
AM_CFLAGS = -Wall -Wextra -Werror
|
||||
|
||||
17
src/dump.c
17
src/dump.c
@@ -145,10 +145,25 @@ static int do_dump(const json_t *json, unsigned long flags, int depth,
|
||||
char buffer[MAX_REAL_STR_LENGTH];
|
||||
int size;
|
||||
|
||||
size = snprintf(buffer, MAX_REAL_STR_LENGTH, "%0.17f", json_real_value(json));
|
||||
size = snprintf(buffer, MAX_REAL_STR_LENGTH, "%.17g",
|
||||
json_real_value(json));
|
||||
if(size >= MAX_REAL_STR_LENGTH)
|
||||
return -1;
|
||||
|
||||
/* Make sure there's a dot or 'e' in the output. Otherwise
|
||||
a real is converted to an integer when decoding */
|
||||
if(strchr(buffer, '.') == NULL &&
|
||||
strchr(buffer, 'e') == NULL)
|
||||
{
|
||||
if(size + 2 >= MAX_REAL_STR_LENGTH) {
|
||||
/* No space to append ".0" */
|
||||
return -1;
|
||||
}
|
||||
buffer[size] = '.';
|
||||
buffer[size + 1] = '0';
|
||||
size += 2;
|
||||
}
|
||||
|
||||
return dump(buffer, size, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -771,7 +771,7 @@ static json_t *parse_value(lex_t *lex, json_error_t *error)
|
||||
return json;
|
||||
}
|
||||
|
||||
json_t *parse_json(lex_t *lex, json_error_t *error)
|
||||
static json_t *parse_json(lex_t *lex, json_error_t *error)
|
||||
{
|
||||
error_init(error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user