Roberto Ierusalimschy 20 年之前
父节点
当前提交
1d99a7360b
共有 4 个文件被更改,包括 8 次插入8 次删除
  1. 2 2
      llex.c
  2. 2 2
      lobject.c
  3. 2 2
      lstring.c
  4. 2 2
      ltable.c

+ 2 - 2
llex.c

@@ -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);
   }

+ 2 - 2
lobject.c

@@ -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;

+ 2 - 2
lstring.c

@@ -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) {

+ 2 - 2
ltable.c

@@ -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);