fix a few compiler warnings.

This commit is contained in:
Tom van Dijck 2018-04-21 12:21:47 +02:00
parent 3f00944625
commit 8c4cf353b5
4 changed files with 7 additions and 7 deletions

View File

@ -52,7 +52,7 @@ int criteria_compile(lua_State* L)
lua_setmetatable(L, -2);
/* create array to hold the incoming list of patterns */
n = lua_rawlen(L, 1);
n = (int)lua_rawlen(L, 1);
patterns->n = n;
patterns->pattern = (struct Pattern*)malloc(sizeof(struct Pattern) * n);
@ -82,7 +82,7 @@ int criteria_compilePattern(lua_State* L, struct Pattern* pattern)
int i, n;
/* create array to hold the incoming list of words */
n = lua_rawlen(L, -1);
n = (int)lua_rawlen(L, -1);
pattern->n = n;
pattern->word = (struct Word*)malloc(sizeof(struct Word) * n);
pattern->matchesFiles = 0;

View File

@ -41,7 +41,7 @@ void do_getabsolute(char* result, const char* value, const char* relative_to)
while (ch) {
/* remove ".." where I can */
if (strcmp(ch, "..") == 0 && (prev == NULL || (prev[0] != '$' && prev[0] != '%' && strcmp(prev, "..") != 0))) {
i = strlen(result) - 2;
i = (int)strlen(result) - 2;
while (i >= 0 && result[i] != '/') {
--i;
}
@ -62,7 +62,7 @@ void do_getabsolute(char* result, const char* value, const char* relative_to)
}
/* remove trailing slash */
i = strlen(result) - 1;
i = (int)strlen(result) - 1;
if (result[i] == '/') {
result[i] = '\0';
}

View File

@ -15,8 +15,8 @@ int string_endswith(lua_State* L)
if (haystack && needle)
{
int hlen = strlen(haystack);
int nlen = strlen(needle);
size_t hlen = strlen(haystack);
size_t nlen = strlen(needle);
if (hlen >= nlen)
{
lua_pushboolean(L, strcmp(haystack + hlen - nlen, needle) == 0);

View File

@ -15,7 +15,7 @@ int string_startswith(lua_State* L)
if (haystack && needle)
{
int nlen = strlen(needle);
size_t nlen = strlen(needle);
lua_pushboolean(L, strncmp(haystack, needle, nlen) == 0);
return 1;
}