Fixes
This commit is contained in:
@@ -64,14 +64,14 @@ void luaInitThemesAndWidgets();
|
|||||||
#define lua_pushtablenumber(L, k, v) (lua_pushstring(L, (k)), lua_pushnumber(L, (v)), lua_settable(L, -3))
|
#define lua_pushtablenumber(L, k, v) (lua_pushstring(L, (k)), lua_pushnumber(L, (v)), lua_settable(L, -3))
|
||||||
|
|
||||||
// size based string (possibly no null-termination)
|
// size based string (possibly no null-termination)
|
||||||
#define __lua_strncpy(s) \
|
#define __lua_strncpy(s) \
|
||||||
char tmp[sizeof(s) + 1]; \
|
char tmp[sizeof(s) + 1]; \
|
||||||
strncpy(tmp, (s), sizeof(s)); \
|
strncpy(tmp, (s), sizeof(tmp) - 1); \
|
||||||
tmp[sizeof(s)] = '\0';
|
tmp[sizeof(s)] = '\0';
|
||||||
|
|
||||||
// size based string (possibly no null-termination)
|
// size based string (possibly no null-termination)
|
||||||
#define lua_pushnstring(L, s) { __lua_strncpy(s); lua_pushstring(L, tmp); }
|
#define lua_pushnstring(L, s) { __lua_strncpy(s); lua_pushstring(L, tmp); }
|
||||||
#define lua_pushtablenstring(L, k, v) { __lua_strncpy(s); lua_pushstring(L, (k)); lua_pushstring(L, tmp); lua_settable(L, -3); }
|
#define lua_pushtablenstring(L, k, v) { __lua_strncpy(v); lua_pushstring(L, (k)); lua_pushstring(L, tmp); lua_settable(L, -3); }
|
||||||
|
|
||||||
// null-terminated string
|
// null-terminated string
|
||||||
#define lua_pushtablestring(L, k, v) (lua_pushstring(L, (k)), lua_pushstring(L, (v)), lua_settable(L, -3))
|
#define lua_pushtablestring(L, k, v) (lua_pushstring(L, (k)), lua_pushstring(L, (v)), lua_settable(L, -3))
|
||||||
|
|||||||
Reference in New Issue
Block a user