From 0c9080c7a9c2e0f9ee39a887bbde5385160b9747 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 18 Dec 1998 11:26:43 -0200 Subject: "tonumber" goes crazy with negative numbers in other bases (not 10), because "strtol" returns long, not unsigned long. --- lbuiltin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lbuiltin.c') diff --git a/lbuiltin.c b/lbuiltin.c index 0398c7ac..d72a320d 100644 --- a/lbuiltin.c +++ b/lbuiltin.c @@ -1,5 +1,5 @@ /* -** $Id: lbuiltin.c,v 1.37 1998/12/15 14:59:59 roberto Exp roberto $ +** $Id: lbuiltin.c,v 1.38 1998/12/15 15:21:09 roberto Exp $ ** Built-in functions ** See Copyright Notice in lua.h */ @@ -268,7 +268,7 @@ static void luaB_tonumber (void) { } else { char *s = luaL_check_string(1); - unsigned long n; + long n; luaL_arg_check(0 <= base && base <= 36, 2, "base out of range"); n = strtol(s, &s, base); while (isspace(*s)) s++; /* skip trailing spaces */ -- cgit v1.2.3-55-g6feb