Resolve a few compiler warnings.

This commit is contained in:
Tom van Dijck 2017-05-24 14:16:32 -07:00
parent 3e4ebb8acc
commit 3c1373c4a0
3 changed files with 5 additions and 5 deletions

View File

@ -673,7 +673,7 @@ static int skipBOM (LoadF *lf) {
do {
c = getc(lf->f);
if (c == EOF || c != *(const unsigned char *)p++) return c;
lf->buff[lf->n++] = c; /* to be read by the parser */
lf->buff[lf->n++] = (char)c; /* to be read by the parser */
} while (*p != '\0');
lf->n = 0; /* prefix matched; discard it */
return getc(lf->f); /* return next character */
@ -723,7 +723,7 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
skipcomment(&lf, &c); /* re-read initial portion */
}
if (c != EOF)
lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */
lf.buff[lf.n++] = (char)c; /* 'c' is the first character of the stream */
status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);
readstatus = ferror(lf.f);
if (filename) fclose(lf.f); /* close file (even in case of errors) */

View File

@ -28,7 +28,7 @@ int do_getcwd(char* buffer, size_t size)
result = (GetCurrentDirectoryW(PATH_MAX, wbuffer) != 0);
if (result) {
WideCharToMultiByte(CP_UTF8, 0, wbuffer, -1, buffer, size, NULL, NULL);
WideCharToMultiByte(CP_UTF8, 0, wbuffer, -1, buffer, (int)size, NULL, NULL);
do_translate(buffer, '/');
}

View File

@ -11,8 +11,8 @@
int string_hash(lua_State* L)
{
const char* str = luaL_checkstring(L, 1);
unsigned long seed = luaL_optnumber(L, 2, 0);
lua_pushnumber(L, (lua_Number)do_hash(str, seed));
int seed = (int)luaL_optinteger(L, 2, 0);
lua_pushinteger(L, do_hash(str, seed));
return 1;
}