Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
3aead6d2
Commit
3aead6d2
authored
Mar 18, 2015
by
funshine
Browse files
try to fix cjson.encode in integer only version
parent
a61cbfb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/cjson.c
View file @
3aead6d2
...
...
@@ -45,13 +45,10 @@
#include "flash_api.h"
#include "strbuf.h"
#ifdef LUA_NUMBER_INTEGRAL
#include "fpconv.h"
#else
#define FPCONV_G_FMT_BUFSIZE 32
#define fpconv_strtod c_strtod
#define fpconv_init() ((void)0)
#endif
#ifndef CJSON_MODNAME
#define CJSON_MODNAME "cjson"
...
...
@@ -774,12 +771,10 @@ static void json_append_number(lua_State *l, json_config_t *cfg,
}
strbuf_ensure_empty_length
(
json
,
FPCONV_G_FMT_BUFSIZE
);
#ifdef LUA_NUMBER_INTEGRAL
len
=
fpconv_g_fmt
(
strbuf_empty_ptr
(
json
),
num
,
cfg
->
encode_number_precision
);
#else
c_sprintf
(
strbuf_empty_ptr
(
json
),
"%.14g"
,
num
);
// len = fpconv_g_fmt(strbuf_empty_ptr(json), num, cfg->encode_number_precision);
c_sprintf
(
strbuf_empty_ptr
(
json
),
LUA_NUMBER_FMT
,
num
);
len
=
c_strlen
(
strbuf_empty_ptr
(
json
));
#endif
strbuf_extend_length
(
json
,
len
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment