Procházet zdrojové kódy

added some casts to avoid warnings in some compilers

Roberto Ierusalimschy před 10 roky
rodič
revize
ff9ca88aa6
2 změnil soubory, kde provedl 6 přidání a 6 odebrání
  1. 3 3
      lobject.c
  2. 3 3
      lstrlib.c

+ 3 - 3
lobject.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lobject.c,v 2.92 2014/10/10 22:23:04 roberto Exp roberto $
+** $Id: lobject.c,v 2.93 2014/10/17 16:28:21 roberto Exp roberto $
 ** Some generic functions over Lua objects
 ** Some generic functions over Lua objects
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -317,8 +317,8 @@ int luaO_utf8esc (char *buff, unsigned long x) {
     buff[UTF8BUFFSZ - 1] = cast(char, x);
     buff[UTF8BUFFSZ - 1] = cast(char, x);
   else {  /* need continuation bytes */
   else {  /* need continuation bytes */
     unsigned int mfb = 0x3f;  /* maximum that fits in first byte */
     unsigned int mfb = 0x3f;  /* maximum that fits in first byte */
-    do {
-      buff[UTF8BUFFSZ - (n++)] = 0x80 | (x & 0x3f);  /* add continuation byte */
+    do {  /* add continuation bytes */
+      buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f));
       x >>= 6;  /* remove added bits */
       x >>= 6;  /* remove added bits */
       mfb >>= 1;  /* now there is one less bit available in first byte */
       mfb >>= 1;  /* now there is one less bit available in first byte */
     } while (x > mfb);  /* still needs continuation byte? */
     } while (x > mfb);  /* still needs continuation byte? */

+ 3 - 3
lstrlib.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lstrlib.c,v 1.204 2014/10/17 16:28:21 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.205 2014/10/20 16:44:54 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -1136,10 +1136,10 @@ static void packint (luaL_Buffer *b, lua_Unsigned n,
   char *buff = luaL_prepbuffsize(b, size);
   char *buff = luaL_prepbuffsize(b, size);
   int i;
   int i;
   for (i = 0; i < size - 1; i++) {
   for (i = 0; i < size - 1; i++) {
-    buff[islittle ? i : size - 1 - i] = (n & MC);
+    buff[islittle ? i : size - 1 - i] = (char)(n & MC);
     n = (n >> NB) | mask;
     n = (n >> NB) | mask;
   }
   }
-  buff[islittle ? i : size - 1 - i] = (n & MC);
+  buff[islittle ? i : size - 1 - i] = (char)(n & MC);
   luaL_addsize(b, size);  /* add result to buffer */
   luaL_addsize(b, size);  /* add result to buffer */
 }
 }