This commit is contained in:
Roberto Ierusalimschy 2004-11-24 17:16:03 -02:00
parent 2f82bf6fe9
commit 1d99a7360b
4 changed files with 8 additions and 8 deletions

4
llex.c
View File

@ -1,5 +1,5 @@
/*
** $Id: llex.c,v 2.3 2004/04/30 20:13:38 roberto Exp roberto $
** $Id: llex.c,v 2.4 2004/09/22 14:02:00 roberto Exp roberto $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@ -64,7 +64,7 @@ void luaX_init (lua_State *L) {
const char *luaX_token2str (LexState *ls, int token) {
if (token < FIRST_RESERVED) {
lua_assert(token == (unsigned char)token);
lua_assert(token == cast(unsigned char, token));
return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) :
luaO_pushfstring(ls->L, "%c", token);
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lobject.c,v 2.5 2004/10/06 18:34:16 roberto Exp $
** $Id: lobject.c,v 2.6 2004/11/01 15:06:50 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@ -89,7 +89,7 @@ int luaO_str2d (const char *s, lua_Number *result) {
char *endptr;
lua_Number res = lua_str2number(s, &endptr);
if (endptr == s) return 0; /* no conversion */
while (isspace((unsigned char)(*endptr))) endptr++;
while (isspace(cast(unsigned char, *endptr))) endptr++;
if (*endptr != '\0') return 0; /* invalid trailing characters? */
*result = res;
return 1;

View File

@ -1,5 +1,5 @@
/*
** $Id: lstring.c,v 2.3 2004/08/24 20:12:06 roberto Exp roberto $
** $Id: lstring.c,v 2.4 2004/11/19 15:52:40 roberto Exp roberto $
** String table (keeps all strings handled by Lua)
** See Copyright Notice in lua.h
*/
@ -78,7 +78,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */
size_t l1;
for (l1=l; l1>=step; l1-=step) /* compute hash */
h = h ^ ((h<<5)+(h>>2)+(unsigned char)(str[l1-1]));
h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));
for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)];
o != NULL;
o = o->gch.next) {

View File

@ -1,5 +1,5 @@
/*
** $Id: ltable.c,v 2.7 2004/10/06 18:34:16 roberto Exp roberto $
** $Id: ltable.c,v 2.8 2004/11/24 18:55:42 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@ -393,7 +393,7 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
*/
const TValue *luaH_getnum (Table *t, int key) {
/* (1 <= key && key <= t->sizearray) */
if ((unsigned int)(key-1) < (unsigned int)t->sizearray)
if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))
return &t->array[key-1];
else {
lua_Number nk = cast(lua_Number, key);