Commit 3795e22b authored by philip's avatar philip Committed by Marcel Stör
Browse files

Give it a chance of working under Lua 5.1

parent 60f01507
......@@ -401,7 +401,7 @@
@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89.
** (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)
#else
#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i))
......
......@@ -725,9 +725,9 @@ static void encode_lua_object(lua_State *L, ENC_DATA *data, int argno, const cha
char value[50];
if (lua_isinteger(L, -1)) {
l_sprintf(value, sizeof(value), LUA_INTEGER_FMT, lua_tointeger(L, -1));
snprintf(value, sizeof(value), LUA_INTEGER_FMT, lua_tointeger(L, -1));
} else {
l_sprintf(value, sizeof(value), SJSON_FLOAT_FMT, lua_tonumber(L, -1));
snprintf(value, sizeof(value), SJSON_FLOAT_FMT, lua_tonumber(L, -1));
}
lua_pop(L, 1);
if (strcmp(value, "-Infinity") == 0 || strcmp(value, "NaN") == 0 || strcmp(value, "Infinity") == 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment