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
3795e22b
Commit
3795e22b
authored
Sep 22, 2020
by
philip
Committed by
Marcel Stör
Nov 07, 2020
Browse files
Give it a chance of working under Lua 5.1
parent
60f01507
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/lua53/luaconf.h
View file @
3795e22b
...
@@ -401,7 +401,7 @@
...
@@ -401,7 +401,7 @@
@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89.
@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89.
** (All uses in Lua have only one format item.)
** (All uses in Lua have only one format item.)
*/
*/
#if !defined(LUA_USE_C89)
&& !
defined(LUA_USE_ESP8266)
#if !defined(LUA_USE_C89)
||
defined(LUA_USE_ESP8266)
#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i)
#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i)
#else
#else
#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i))
#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i))
...
...
app/modules/sjson.c
View file @
3795e22b
...
@@ -725,9 +725,9 @@ static void encode_lua_object(lua_State *L, ENC_DATA *data, int argno, const cha
...
@@ -725,9 +725,9 @@ static void encode_lua_object(lua_State *L, ENC_DATA *data, int argno, const cha
char
value
[
50
];
char
value
[
50
];
if
(
lua_isinteger
(
L
,
-
1
))
{
if
(
lua_isinteger
(
L
,
-
1
))
{
l_
sprintf
(
value
,
sizeof
(
value
),
LUA_INTEGER_FMT
,
lua_tointeger
(
L
,
-
1
));
s
n
printf
(
value
,
sizeof
(
value
),
LUA_INTEGER_FMT
,
lua_tointeger
(
L
,
-
1
));
}
else
{
}
else
{
l_
sprintf
(
value
,
sizeof
(
value
),
SJSON_FLOAT_FMT
,
lua_tonumber
(
L
,
-
1
));
s
n
printf
(
value
,
sizeof
(
value
),
SJSON_FLOAT_FMT
,
lua_tonumber
(
L
,
-
1
));
}
}
lua_pop
(
L
,
1
);
lua_pop
(
L
,
1
);
if
(
strcmp
(
value
,
"-Infinity"
)
==
0
||
strcmp
(
value
,
"NaN"
)
==
0
||
strcmp
(
value
,
"Infinity"
)
==
0
)
{
if
(
strcmp
(
value
,
"-Infinity"
)
==
0
||
strcmp
(
value
,
"NaN"
)
==
0
||
strcmp
(
value
,
"Infinity"
)
==
0
)
{
...
...
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