aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-06-14 15:12:53 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-06-14 15:12:53 -0300
commit0394314c7ab2918c60d55d33906402a71a0e324c (patch)
treef205702017faa835834012b0753c6c162f9e13c1 /lauxlib.c
parent0beeb4f6fa9ed3f0b92d110c9774a6b50d5690fe (diff)
downloadlua-0394314c7ab2918c60d55d33906402a71a0e324c.tar.gz
lua-0394314c7ab2918c60d55d33906402a71a0e324c.tar.bz2
lua-0394314c7ab2918c60d55d33906402a71a0e324c.zip
avoid using a negative value to test 'lua_tounsigned'
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c9
1 files 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 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.249 2013/04/25 13:53:13 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.250 2013/06/04 19:36:42 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -955,10 +955,11 @@ LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver) {
955 ver, *v); 955 ver, *v);
956 /* check conversions number -> integer types */ 956 /* check conversions number -> integer types */
957 lua_pushnumber(L, -(lua_Number)0x1234); 957 lua_pushnumber(L, -(lua_Number)0x1234);
958 if (lua_tointeger(L, -1) != -0x1234 || 958 lua_pushnumber(L, (lua_Number)0x4321);
959 lua_tounsigned(L, -1) != (lua_Unsigned)-0x1234) 959 if (lua_tointeger(L, -2) != -0x1234 ||
960 lua_tounsigned(L, -1) != (lua_Unsigned)0x4321)
960 luaL_error(L, "bad conversion number->int;" 961 luaL_error(L, "bad conversion number->int;"
961 " must recompile Lua with proper settings"); 962 " must recompile Lua with proper settings");
962 lua_pop(L, 1); 963 lua_pop(L, 2);
963} 964}
964 965