arguments for "format" 'x', 'X', 'o' and 'u' must be unsigned int.

This commit is contained in:
Roberto Ierusalimschy 1998-05-18 19:21:55 -03:00
parent 9890bedaab
commit da252eeff7
2 changed files with 9 additions and 3 deletions

4
bugs
View File

@ -37,3 +37,7 @@ Wed Jan 28 14:48:12 EDT 1998
Mon Mar 9 15:26:09 EST 1998
>> gsub('a', '(b?)%1*' ...) loops (because the capture is empty).
** lstrlib.c
Mon May 18 19:20:00 EST 1998
>> arguments for "format" 'x', 'X', 'o' and 'u' must be unsigned int.

View File

@ -1,5 +1,5 @@
/*
** $Id: lstrlib.c,v 1.11 1998/03/09 18:28:08 roberto Exp roberto $
** $Id: lstrlib.c,v 1.12 1998/03/24 20:14:25 roberto Exp roberto $
** Standard library for strings and pattern-matching
** See Copyright Notice in lua.h
*/
@ -494,10 +494,12 @@ static void str_format (void)
sprintf(buff, form, s);
break;
}
case 'c': case 'd': case 'i': case 'o':
case 'u': case 'x': case 'X':
case 'c': case 'd': case 'i':
sprintf(buff, form, (int)luaL_check_number(arg));
break;
case 'o': case 'u': case 'x': case 'X':
sprintf(buff, form, (unsigned int)luaL_check_number(arg));
break;
case 'e': case 'E': case 'f': case 'g': case 'G':
sprintf(buff, form, luaL_check_number(arg));
break;