From 0394314c7ab2918c60d55d33906402a71a0e324c Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 14 Jun 2013 15:12:53 -0300 Subject: [PATCH] avoid using a negative value to test 'lua_tounsigned' --- lauxlib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lauxlib.c b/lauxlib.c index db46e167..7cb6821e 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.249 2013/04/25 13:53:13 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.250 2013/06/04 19:36:42 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -955,10 +955,11 @@ LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver) { ver, *v); /* check conversions number -> integer types */ lua_pushnumber(L, -(lua_Number)0x1234); - if (lua_tointeger(L, -1) != -0x1234 || - lua_tounsigned(L, -1) != (lua_Unsigned)-0x1234) + lua_pushnumber(L, (lua_Number)0x4321); + if (lua_tointeger(L, -2) != -0x1234 || + lua_tounsigned(L, -1) != (lua_Unsigned)0x4321) luaL_error(L, "bad conversion number->int;" " must recompile Lua with proper settings"); - lua_pop(L, 1); + lua_pop(L, 2); }