Fixed 64b build warnings.

This commit is contained in:
g012 2017-09-28 11:10:25 +02:00
parent f49f973b2a
commit 42826585df
4 changed files with 11 additions and 11 deletions

View File

@ -92,7 +92,7 @@ set(L65_SCRIPTS
${L65_FILES}
)
add_executable(embed ${L65_SOURCE_DIR}/embed.c ${L65_SCRIPTS})
add_executable(embed ${L65_SOURCE_DIR}/embed.c)
add_custom_command(
OUTPUT ${L65_BINARY_DIR}/scripts.h
COMMAND embed -o ${L65_BINARY_DIR}/scripts.h ${L65_SCRIPTS}

View File

@ -68,7 +68,7 @@ static int doargs(int argc, char* argv[])
#define FUNCTION "(function()end)();"
static int w_o;
static size_t w_o;
static int writer(lua_State* L, const void* p, size_t size, void* f)
{
for (size_t i = 0; i < size; ++i)
@ -98,7 +98,7 @@ static int pmain(lua_State* L)
char *name = malloc(1024);
sprintf(name, "script_%s", ufname + fnix);
free(ufname);
int fnl = strlen(filename);
int fnl = (int)strlen(filename);
compile = fnl > 4 && !strcmp(".lua", filename + fnl - 4);
if (compile)
{

2
lfs.c
View File

@ -214,7 +214,7 @@ static int get_dir (lua_State *L) {
path = realloc(path, size);
if (!path) /* failed to allocate */
return pusherror(L, "get_dir realloc() failed");
if (getcwd(path, size) != NULL) {
if (getcwd(path, (int)size) != NULL) {
/* success, push the path to the Lua stack */
lua_pushstring(L, path);
result = 1;

14
lpeg.c
View File

@ -2340,11 +2340,11 @@ static void newktable (lua_State *L, int n) {
** If new element is nil, does not add it to table (as it would be
** useless) and returns 0, as ktable[0] is always nil.
*/
static int addtoktable (lua_State *L, int idx) {
static lua_Integer addtoktable (lua_State *L, int idx) {
if (lua_isnil(L, idx)) /* nil value? */
return 0;
else {
int n;
lua_Integer n;
lua_getuservalue(L, -1); /* get ktable from pattern */
n = lua_rawlen(L, -1);
if (n >= USHRT_MAX)
@ -2363,7 +2363,7 @@ static int addtoktable (lua_State *L, int idx) {
** a table. Treat it as an empty table. In Lua 5.1, assumes that
** the environment has no numeric indices (len == 0)
*/
static int ktablelen (lua_State *L, int idx) {
static lua_Integer ktablelen (lua_State *L, int idx) {
if (!lua_istable(L, idx)) return 0;
else return lua_rawlen(L, idx);
}
@ -2521,7 +2521,7 @@ static Pattern *getpattern (lua_State *L, int idx) {
}
static int getsize (lua_State *L, int idx) {
static lua_Integer getsize (lua_State *L, int idx) {
return (lua_rawlen(L, idx) - sizeof(Pattern)) / sizeof(TTree) + 1;
}
@ -2539,7 +2539,7 @@ static TTree *gettree (lua_State *L, int idx, int *len) {
** metatable. (It could be any empty sequence; the metatable is at
** hand here, so we use it.)
*/
static TTree *newtree (lua_State *L, int len) {
static TTree *newtree (lua_State *L, lua_Integer len) {
size_t size = (len - 1) * sizeof(TTree) + sizeof(Pattern);
Pattern *p = (Pattern *)lua_newuserdata(L, size);
luaL_getmetatable(L, PATTERN_T);
@ -2632,7 +2632,7 @@ static TTree *getpatt (lua_State *L, int idx, int *len) {
tree = newleaf(L, TTrue); /* always match */
else {
tree = newtree(L, 2 * (slen - 1) + 1);
fillseq(tree, TChar, slen, s); /* sequence of 'slen' chars */
fillseq(tree, TChar, (int)slen, s); /* sequence of 'slen' chars */
}
break;
}
@ -3252,7 +3252,7 @@ static void verifygrammar (lua_State *L, TTree *grammar) {
*/
static void initialrulename (lua_State *L, TTree *grammar, int frule) {
if (sib1(grammar)->key == 0) { /* initial rule is not referenced? */
int n = lua_rawlen(L, -1) + 1; /* index for name */
lua_Integer n = lua_rawlen(L, -1) + 1; /* index for name */
lua_pushvalue(L, frule); /* rule's name */
lua_rawseti(L, -2, n); /* ktable was on the top of the stack */
sib1(grammar)->key = n;