浏览代码

added two casts to avoid warnings in VS

Roberto Ierusalimschy 10 年之前
父节点
当前提交
c5cae9362c
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      lobject.c

+ 3 - 3
lobject.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lobject.c,v 2.89 2014/08/01 17:24:02 roberto Exp roberto $
+** $Id: lobject.c,v 2.90 2014/10/01 11:52:33 roberto Exp roberto $
 ** Some generic functions over Lua objects
 ** See Copyright Notice in lua.h
 */
@@ -314,7 +314,7 @@ int luaO_utf8esc (char *buff, unsigned long x) {
   int n = 1;  /* number of bytes put in buffer (backwards) */
   lua_assert(x <= 0x10FFFF);
   if (x < 0x80)  /* ascii? */
-    buff[UTF8BUFFSZ - 1] = x;
+    buff[UTF8BUFFSZ - 1] = cast(char, x);
   else {  /* need continuation bytes */
     unsigned int mfb = 0x3f;  /* maximum that fits in first byte */
     do {
@@ -322,7 +322,7 @@ int luaO_utf8esc (char *buff, unsigned long x) {
       x >>= 6;  /* remove added bits */
       mfb >>= 1;  /* now there is one less bit available in first byte */
     } while (x > mfb);  /* still needs continuation byte? */
-    buff[UTF8BUFFSZ - n] = (~mfb << 1) | x;  /* add first byte */
+    buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x);  /* add first byte */
   }
   return n;
 }