added two casts to avoid warnings in VS

This commit is contained in:
Roberto Ierusalimschy 2014-10-04 19:57:10 -03:00
parent 4f4e0e49bb
commit c5cae9362c

View File

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