commit 5b1f240d9331ea54ff8e99259c6788b67a47ce62
parent fafbfebf68d5f724ff4d4d3c75150fbaad575451
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Wed, 23 Dec 2020 12:27:56 -0800
Address some -Wextra compiler warnings
Fix sign comparison warnings. The unused parameter warnings are
unavoidable in the current state of the program, perhaps a struct
would be good.
Diffstat:
M | main.c | | | 22 | +++++++++++----------- |
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/main.c b/main.c
@@ -48,7 +48,7 @@ enum gphitem { GI_INFO, GI_PATH, GI_HOST, GI_PORT, GI_NULL };
enum address { AR_PATH, AR_HOST, AR_PORT, AR_NULL };
typedef int (command)(int, const char **, int, const char **);
-typedef int (filter)(int, const char **, int, const char **, command);
+typedef int (filter)(int, const char **, unsigned int, const char **);
typedef int (stack_command)(int, const char **, int, const char **);
int gawk(const char **);
@@ -213,7 +213,7 @@ int
input(char *buf, int size, const char *delims, const char *prompt, FILE *fp)
{
int next;
- static int len;
+ static unsigned int len;
static char bb[MY_INPUT_MAX];
if (len <= 0) {
@@ -283,7 +283,7 @@ gph_write_resp(int sock, const char *path)
/* TODO: exclude ".\r\n" terminator */
while ((bytes = recv(sock, buf, sizeof(buf), 0)) > 0) {
- if (fwrite(buf, 1, bytes, fp) != bytes) {
+ if (fwrite(buf, 1, bytes, fp) != (size_t)bytes) {
wfclose(fp);
return 1;
}
@@ -313,7 +313,7 @@ gph_write(const char **addr, const char *path)
/* Returns -1 on fatal error, 0 on no match, and 1 on match. */
int
-splitrun(filter **filters, int argc, const char **argv, int index, char *s, command *func)
+splitrun(filter **filters, int argc, const char **argv, unsigned int index, char *s, command *func)
{
int i, n;
char *item[6];
@@ -327,7 +327,7 @@ splitrun(filter **filters, int argc, const char **argv, int index, char *s, comm
}
for (i = 0; filters[i] != NULL; ++i) {
- n = filters[i](argc, argv, index, (const char **)item, func);
+ n = filters[i](argc, argv, index, (const char **)item);
if (n <= 0)
return n;
argc -= n;
@@ -343,7 +343,7 @@ run_filters(const char *cache, filter **filters, int argc, const char **argv, co
{
FILE *fp;
char item[MY_LINE_MAX];
- int i;
+ unsigned int i;
fp = wfopen(cache, "r");
if (fp == NULL)
@@ -357,7 +357,7 @@ run_filters(const char *cache, filter **filters, int argc, const char **argv, co
}
int
-findex(int argc, const char **argv, int index, const char **item, command *func)
+findex(int argc, const char **argv, unsigned int index, const char **item)
{
unsigned int n;
@@ -372,7 +372,7 @@ findex(int argc, const char **argv, int index, const char **item, command *func)
/* NOTE: inclusive */
int
-frange(int argc, const char **argv, int index, const char **item, command *func)
+frange(int argc, const char **argv, unsigned int index, const char **item)
{
unsigned int range[2];
int i;
@@ -389,7 +389,7 @@ frange(int argc, const char **argv, int index, const char **item, command *func)
}
int
-fstring(int argc, const char **argv, int index, const char **item, command *func)
+fstring(int argc, const char **argv, unsigned int index, const char **item)
{
if (badargs(1, -1, argc, argv))
return -1;
@@ -399,7 +399,7 @@ fstring(int argc, const char **argv, int index, const char **item, command *func
}
int
-ftype(int argc, const char **argv, int index, const char **item, command *func)
+ftype(int argc, const char **argv, unsigned int index, const char **item)
{
if (badargs(1, -1, argc, argv))
return -1;
@@ -585,7 +585,7 @@ int
execute(int argc, const char **argv, int depth, const char *cache,
const char **addr)
{
- int i;
+ unsigned int i;
filter *filters[MY_FILTER_MAX];
command *command;
stack_command *stackc;