Merge branch '1.1'

Conflicts:
	configure.ac
	doc/conf.py
This commit is contained in:
Petri Lehtinen
2009-12-20 21:18:27 +02:00
7 changed files with 36 additions and 5 deletions

View File

@@ -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

View File

@@ -191,10 +191,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);
}

View File

@@ -772,7 +772,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);