From 1de8c1bb596a7dbff39ab55685ead31a5d0c9373 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Fri, 24 Oct 2014 23:04:05 -0400 Subject: Fixed bug in `lL_event()` for LUA_TNUMBER type size mismatches; src/textadept.c The type extracted for LUA_TNUMBER was `sptr_t` (long), however most of the time, `int` is used. Since `sizeof(long) > sizeof(int)`, `lL_event()` sometimes pushed extra bytes in memory around the original integer passed (at least I think this explains the behavior I observed). --- src/textadept.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/textadept.c') diff --git a/src/textadept.c b/src/textadept.c index a2073525..b5fe7b55 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -239,9 +239,9 @@ static int lL_event(lua_State *L, const char *name, ...) { if (type == LUA_TNIL) lua_pushnil(L); else if (type == LUA_TBOOLEAN) - lua_pushboolean(L, va_arg(ap, sptr_t)); + lua_pushboolean(L, va_arg(ap, int)); else if (type == LUA_TNUMBER) - lua_pushinteger(L, va_arg(ap, sptr_t)); + lua_pushinteger(L, va_arg(ap, int)); else if (type == LUA_TSTRING) lua_pushstring(L, va_arg(ap, char *)); else if (type == LUA_TLIGHTUSERDATA || type == LUA_TTABLE) { -- cgit v1.2.3