From ec7a0d6e13f0fa66299cab7fdad8e639e01ee9dd Mon Sep 17 00:00:00 2001 From: Arnavion Date: Mon, 15 Dec 2014 10:25:28 -0800 Subject: Fixed some more signed-unsigned-comparison warnings. --- src/common/dcc.c | 4 ++-- src/common/outbound.c | 4 ++-- src/common/outbound.h | 2 +- src/common/plugin.c | 2 +- src/common/proto-irc.c | 2 +- src/common/server.c | 10 +++++----- src/common/text.c | 26 +++++++++----------------- src/common/text.h | 4 ++-- src/common/url.c | 2 +- src/common/url.h | 2 +- 10 files changed, 25 insertions(+), 33 deletions(-) (limited to 'src/common') diff --git a/src/common/dcc.c b/src/common/dcc.c index 58dc493f..a918aaca 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -511,7 +511,7 @@ dcc_chat_line (struct DCC *dcc, char *line) char *utf; char *conv; int ret, i; - int len; + gssize len; gsize utf_len; char portbuf[32]; message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; @@ -571,7 +571,7 @@ dcc_chat_line (struct DCC *dcc, char *line) return 0; } - url_check_line (line, len); + url_check_line (line); if (line[0] == 1 && !g_ascii_strncasecmp (line + 1, "ACTION", 6)) { diff --git a/src/common/outbound.c b/src/common/outbound.c index 8181bd8a..a193d03e 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -4147,7 +4147,7 @@ help (session *sess, char *tbuf, char *helpcmd, int quiet) * - this beast is used for UserCommands, UserlistButtons and CTCP replies */ int -auto_insert (char *dest, int destlen, unsigned char *src, char *word[], +auto_insert (char *dest, gsize destlen, unsigned char *src, char *word[], char *word_eol[], char *a, char *c, char *d, char *e, char *h, char *n, char *s, char *u) { @@ -4219,7 +4219,7 @@ auto_insert (char *dest, int destlen, unsigned char *src, char *word[], switch (src[0]) { case '%': - if ((dest - orig) + 2 >= destlen) + if ((dest - orig) + 2u >= destlen) return 2; dest[0] = '%'; dest[1] = 0; diff --git a/src/common/outbound.h b/src/common/outbound.h index b9fe6331..490a58ca 100644 --- a/src/common/outbound.h +++ b/src/common/outbound.h @@ -25,7 +25,7 @@ extern const struct commands xc_cmds[]; extern GSList *menu_list; -int auto_insert (char *dest, int destlen, unsigned char *src, char *word[], char *word_eol[], +int auto_insert (char *dest, gsize destlen, unsigned char *src, char *word[], char *word_eol[], char *a, char *c, char *d, char *e, char *h, char *n, char *s, char *u); char *command_insert_vars (session *sess, char *cmd); int handle_command (session *sess, char *cmd, int check_spch); diff --git a/src/common/plugin.c b/src/common/plugin.c index fbef743a..367e3230 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -989,7 +989,7 @@ void hexchat_command (hexchat_plugin *ph, const char *command) { char *conv; - int len = -1; + gssize len = -1; if (!is_session (ph->context)) { diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 2bfcb393..d5a8fc04 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -1509,7 +1509,7 @@ irc_inline (server *serv, char *buf, int len) handle_message_tags(serv, tags, &tags_data); } - url_check_line (buf, len); + url_check_line (buf); /* split line into words and words_to_end_of_line */ process_data_init (pdibuf, buf, word, word_eol, FALSE, FALSE); diff --git a/src/common/server.c b/src/common/server.c index 174e0d17..f42ec20c 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -156,7 +156,7 @@ server_send_real (server *serv, char *buf, int len) { fe_add_rawlog (serv, buf, len, TRUE); - url_check_line (buf, len); + url_check_line (buf); return tcp_send_real (serv->ssl, serv->sok, serv->encoding, serv->using_irc, buf, len); @@ -308,7 +308,7 @@ close_socket (int sok) /* handle 1 line of text received from the server */ static void -server_inline (server *serv, char *line, int len) +server_inline (server *serv, char *line, gssize len) { char *utf_line_allocated = NULL; @@ -325,8 +325,8 @@ server_inline (server *serv, char *line, int len) it to be ISO-8859-1 (see text_validate). */ utf_line_allocated = text_validate (&line, &len); - - } else + } + else { /* Since the user has an explicit charset set, either via /charset command or from his non-UTF8 locale, @@ -344,7 +344,7 @@ server_inline (server *serv, char *line, int len) if (encoding != NULL) { char *conv_line; /* holds a copy of the original string */ - int conv_len; /* tells g_convert how much of line to convert */ + gsize conv_len; /* tells g_convert how much of line to convert */ gsize utf_len; gsize read_len; GError *err; diff --git a/src/common/text.c b/src/common/text.c index b789371f..62e7b730 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -848,7 +848,7 @@ iso_8859_1_to_utf8 (unsigned char *text, int len, gsize *bytes_written) } char * -text_validate (char **text, int *len) +text_validate (char **text, gssize *len) { char *utf; gsize utf_len; @@ -905,7 +905,7 @@ PrintTextTimeStamp (session *sess, char *text, time_t timestamp) } else { - int len = -1; + gssize len = -1; conv = text_validate ((char **)&text, &len); } @@ -1804,9 +1804,10 @@ load_text_events () #define ARG_FLAG(argn) (1 << (argn)) void -format_event (session *sess, int index, char **args, char *o, int sizeofo, unsigned int stripcolor_args) +format_event (session *sess, int index, char **args, char *o, gsize sizeofo, unsigned int stripcolor_args) { - int len, oi, ii, numargs; + int len, ii, numargs; + gsize oi; char *i, *ar, d, a, done_all = FALSE; i = pntevts[index]; @@ -1864,19 +1865,10 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig done_all = TRUE; continue; case 3: -/* if (sess->type == SESS_DIALOG) - { - if (prefs.dialog_indent_nicks) - o[oi++] = '\t'; - else - o[oi++] = ' '; - } else - {*/ - if (prefs.hex_text_indent) - o[oi++] = '\t'; - else - o[oi++] = ' '; - /*}*/ + if (prefs.hex_text_indent) + o[oi++] = '\t'; + else + o[oi++] = ' '; break; } } diff --git a/src/common/text.h b/src/common/text.h index 9a385167..2534187e 100644 --- a/src/common/text.h +++ b/src/common/text.h @@ -57,9 +57,9 @@ void text_emit (int index, session *sess, char *a, char *b, char *c, char *d, time_t timestamp); int text_emit_by_name (char *name, session *sess, time_t timestamp, char *a, char *b, char *c, char *d); -char *text_validate (char **text, int *len); +char *text_validate (char **text, gssize *len); int get_stamp_str (char *fmt, time_t tim, char **ret); -void format_event (session *sess, int index, char **args, char *o, int sizeofo, unsigned int stripcolor_args); +void format_event (session *sess, int index, char **args, char *o, gsize sizeofo, unsigned int stripcolor_args); char *text_find_format_string (char *name); void sound_play (const char *file, gboolean quiet); diff --git a/src/common/url.c b/src/common/url.c index 732449a4..bf058f89 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -332,7 +332,7 @@ static char *commands[] = { #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) void -url_check_line (char *buf, int len) +url_check_line (char *buf) { GRegex *re(void); GMatchInfo *gmi; diff --git a/src/common/url.h b/src/common/url.h index 676f9a6d..1b1deb3d 100644 --- a/src/common/url.h +++ b/src/common/url.h @@ -36,6 +36,6 @@ void url_clear (void); void url_save_tree (const char *fname, const char *mode, gboolean fullpath); int url_last (int *, int *); int url_check_word (const char *word); -void url_check_line (char *buf, int len); +void url_check_line (char *buf); #endif -- cgit 1.4.1