Merge pull request #832 from Blizzard/fix-compiler-warnings

Fix a few compiler warnings
This commit is contained in:
Tom van Dijck 2017-06-21 09:36:58 -07:00 committed by GitHub
commit 9ad28d038a
4 changed files with 7 additions and 6 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

@ -9,6 +9,8 @@
#include "lauxlib.h"
#include "lualib.h"
#include <stdlib.h>
#define PREMAKE_VERSION "5.0.0-dev"
#define PREMAKE_COPYRIGHT "Copyright (C) 2002-2017 Jason Perkins and the Premake Project"
#define PREMAKE_PROJECT_URL "https://github.com/premake/premake-core/wiki"
@ -48,7 +50,6 @@
#if PLATFORM_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#else
#include <unistd.h>
#endif

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