fix a few compiler warnings.
This commit is contained in:
parent
3f00944625
commit
8c4cf353b5
@ -52,7 +52,7 @@ int criteria_compile(lua_State* L)
|
|||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
|
|
||||||
/* create array to hold the incoming list of patterns */
|
/* create array to hold the incoming list of patterns */
|
||||||
n = lua_rawlen(L, 1);
|
n = (int)lua_rawlen(L, 1);
|
||||||
patterns->n = n;
|
patterns->n = n;
|
||||||
patterns->pattern = (struct Pattern*)malloc(sizeof(struct Pattern) * 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;
|
int i, n;
|
||||||
|
|
||||||
/* create array to hold the incoming list of words */
|
/* create array to hold the incoming list of words */
|
||||||
n = lua_rawlen(L, -1);
|
n = (int)lua_rawlen(L, -1);
|
||||||
pattern->n = n;
|
pattern->n = n;
|
||||||
pattern->word = (struct Word*)malloc(sizeof(struct Word) * n);
|
pattern->word = (struct Word*)malloc(sizeof(struct Word) * n);
|
||||||
pattern->matchesFiles = 0;
|
pattern->matchesFiles = 0;
|
||||||
|
@ -41,7 +41,7 @@ void do_getabsolute(char* result, const char* value, const char* relative_to)
|
|||||||
while (ch) {
|
while (ch) {
|
||||||
/* remove ".." where I can */
|
/* remove ".." where I can */
|
||||||
if (strcmp(ch, "..") == 0 && (prev == NULL || (prev[0] != '$' && prev[0] != '%' && strcmp(prev, "..") != 0))) {
|
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] != '/') {
|
while (i >= 0 && result[i] != '/') {
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ void do_getabsolute(char* result, const char* value, const char* relative_to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* remove trailing slash */
|
/* remove trailing slash */
|
||||||
i = strlen(result) - 1;
|
i = (int)strlen(result) - 1;
|
||||||
if (result[i] == '/') {
|
if (result[i] == '/') {
|
||||||
result[i] = '\0';
|
result[i] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ int string_endswith(lua_State* L)
|
|||||||
|
|
||||||
if (haystack && needle)
|
if (haystack && needle)
|
||||||
{
|
{
|
||||||
int hlen = strlen(haystack);
|
size_t hlen = strlen(haystack);
|
||||||
int nlen = strlen(needle);
|
size_t nlen = strlen(needle);
|
||||||
if (hlen >= nlen)
|
if (hlen >= nlen)
|
||||||
{
|
{
|
||||||
lua_pushboolean(L, strcmp(haystack + hlen - nlen, needle) == 0);
|
lua_pushboolean(L, strcmp(haystack + hlen - nlen, needle) == 0);
|
||||||
|
@ -15,7 +15,7 @@ int string_startswith(lua_State* L)
|
|||||||
|
|
||||||
if (haystack && needle)
|
if (haystack && needle)
|
||||||
{
|
{
|
||||||
int nlen = strlen(needle);
|
size_t nlen = strlen(needle);
|
||||||
lua_pushboolean(L, strncmp(haystack, needle, nlen) == 0);
|
lua_pushboolean(L, strncmp(haystack, needle, nlen) == 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user