Skip to content

Commit

Permalink
Merge pull request #4 from Lihis/fix-warnings-when-compiling-with-wal…
Browse files Browse the repository at this point in the history
…l-and-wextra

Fix warnings when compiling with -Wall and -Wextra
  • Loading branch information
n0la authored Apr 5, 2023
2 parents aefddb9 + 04c9476 commit 35a7f14
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion irc/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ irc_message_t irc_message_makev(char const *prefix,
irc_error_t irc_message_string(irc_message_t m, char **s, size_t *slen);

bool irc_message_is(irc_message_t m, char const *cmd);
bool irc_message_arg_is(irc_message_t m, int idx, char const *what);
bool irc_message_arg_is(irc_message_t m, size_t idx, char const *what);
bool irc_message_prefix_nick(irc_message_t m, char const *nick);

#endif
2 changes: 1 addition & 1 deletion irc/strbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ssize_t strbuf_getstr(strbuf_t b, char **line, size_t *linesize,
char *strbuf_strdup(strbuf_t b);

int strbuf_getc(strbuf_t b);
int strbuf_delete(strbuf_t b, int how);
int strbuf_delete(strbuf_t b, size_t how);

void strbuf_reset(strbuf_t b);

Expand Down
3 changes: 1 addition & 2 deletions lib/irc.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ static irc_error_t irc_think_data(irc_t i)
size_t linesize = 0;
irc_error_t r = irc_error_internal;
irc_message_t m = NULL;
int idx = 0;

pthread_mutex_lock(&i->buffermtx);
s = strbuf_getstr(i->buf, &line, &linesize, "\r\n");
Expand Down Expand Up @@ -264,7 +263,7 @@ static irc_error_t irc_think_data(irc_t i)
goto cleanup;
}

for (idx = 0; idx < i->handlerlen; idx++) {
for (size_t idx = 0; idx < i->handlerlen; idx++) {
irc_handler_t *h = i->handler + idx;

if (strlen(h->cmd) == 0 ||
Expand Down
4 changes: 2 additions & 2 deletions lib/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ bool irc_message_is(irc_message_t m, char const *cmd)
return (strcmp(m->command, cmd) == 0);
}

bool irc_message_arg_is(irc_message_t m, int idx, char const *what)
bool irc_message_arg_is(irc_message_t m, size_t idx, char const *what)
{
return_if_true(m == NULL, false);
return_if_true(idx >= m->argslen || idx < 0, false);
return_if_true(idx >= m->argslen, false);
return (strcmp(m->args[idx], what) == 0);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/strbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int strbuf_getc(strbuf_t b)
return *b->buf;
}

int strbuf_delete(strbuf_t b, int how)
int strbuf_delete(strbuf_t b, size_t how)
{
if (b == NULL || how > b->end) {
return -1;
Expand Down
1 change: 0 additions & 1 deletion lib/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ irc_error_t irc_tag_parse(irc_tag_t t, const char *str)
{
char *tmp = NULL;
char *key = NULL;
char *value = NULL;

if (t == NULL || str == NULL) {
return irc_error_argument;
Expand Down
1 change: 0 additions & 1 deletion tests/test_tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ static void test_tag_parse_single(void **data)

static void test_tag_unescape(void **data)
{
irc_tag_t t = *data;
char *unscaped = NULL;

ASSERT_TAG_UNSESCAPED ("\\:", ";");
Expand Down

0 comments on commit 35a7f14

Please sign in to comment.