Fixed some more signed-unsigned-comparison warnings.

This commit is contained in:
Arnavion 2014-12-15 10:25:28 -08:00
parent a86b03e939
commit ec7a0d6e13
10 changed files with 25 additions and 33 deletions

View File

@ -511,7 +511,7 @@ dcc_chat_line (struct DCC *dcc, char *line)
char *utf; char *utf;
char *conv; char *conv;
int ret, i; int ret, i;
int len; gssize len;
gsize utf_len; gsize utf_len;
char portbuf[32]; char portbuf[32];
message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
@ -571,7 +571,7 @@ dcc_chat_line (struct DCC *dcc, char *line)
return 0; return 0;
} }
url_check_line (line, len); url_check_line (line);
if (line[0] == 1 && !g_ascii_strncasecmp (line + 1, "ACTION", 6)) if (line[0] == 1 && !g_ascii_strncasecmp (line + 1, "ACTION", 6))
{ {

View File

@ -4147,7 +4147,7 @@ help (session *sess, char *tbuf, char *helpcmd, int quiet)
* - this beast is used for UserCommands, UserlistButtons and CTCP replies */ * - this beast is used for UserCommands, UserlistButtons and CTCP replies */
int 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 *word_eol[], char *a, char *c, char *d, char *e, char *h,
char *n, char *s, char *u) char *n, char *s, char *u)
{ {
@ -4219,7 +4219,7 @@ auto_insert (char *dest, int destlen, unsigned char *src, char *word[],
switch (src[0]) switch (src[0])
{ {
case '%': case '%':
if ((dest - orig) + 2 >= destlen) if ((dest - orig) + 2u >= destlen)
return 2; return 2;
dest[0] = '%'; dest[0] = '%';
dest[1] = 0; dest[1] = 0;

View File

@ -25,7 +25,7 @@
extern const struct commands xc_cmds[]; extern const struct commands xc_cmds[];
extern GSList *menu_list; 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 *a, char *c, char *d, char *e, char *h, char *n, char *s, char *u);
char *command_insert_vars (session *sess, char *cmd); char *command_insert_vars (session *sess, char *cmd);
int handle_command (session *sess, char *cmd, int check_spch); int handle_command (session *sess, char *cmd, int check_spch);

View File

@ -989,7 +989,7 @@ void
hexchat_command (hexchat_plugin *ph, const char *command) hexchat_command (hexchat_plugin *ph, const char *command)
{ {
char *conv; char *conv;
int len = -1; gssize len = -1;
if (!is_session (ph->context)) if (!is_session (ph->context))
{ {

View File

@ -1509,7 +1509,7 @@ irc_inline (server *serv, char *buf, int len)
handle_message_tags(serv, tags, &tags_data); 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 */ /* split line into words and words_to_end_of_line */
process_data_init (pdibuf, buf, word, word_eol, FALSE, FALSE); process_data_init (pdibuf, buf, word, word_eol, FALSE, FALSE);

View File

@ -156,7 +156,7 @@ server_send_real (server *serv, char *buf, int len)
{ {
fe_add_rawlog (serv, buf, len, TRUE); 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, return tcp_send_real (serv->ssl, serv->sok, serv->encoding, serv->using_irc,
buf, len); buf, len);
@ -308,7 +308,7 @@ close_socket (int sok)
/* handle 1 line of text received from the server */ /* handle 1 line of text received from the server */
static void static void
server_inline (server *serv, char *line, int len) server_inline (server *serv, char *line, gssize len)
{ {
char *utf_line_allocated = NULL; 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). */ it to be ISO-8859-1 (see text_validate). */
utf_line_allocated = text_validate (&line, &len); utf_line_allocated = text_validate (&line, &len);
}
} else else
{ {
/* Since the user has an explicit charset set, either /* Since the user has an explicit charset set, either
via /charset command or from his non-UTF8 locale, via /charset command or from his non-UTF8 locale,
@ -344,7 +344,7 @@ server_inline (server *serv, char *line, int len)
if (encoding != NULL) if (encoding != NULL)
{ {
char *conv_line; /* holds a copy of the original string */ 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 utf_len;
gsize read_len; gsize read_len;
GError *err; GError *err;

View File

@ -848,7 +848,7 @@ iso_8859_1_to_utf8 (unsigned char *text, int len, gsize *bytes_written)
} }
char * char *
text_validate (char **text, int *len) text_validate (char **text, gssize *len)
{ {
char *utf; char *utf;
gsize utf_len; gsize utf_len;
@ -905,7 +905,7 @@ PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
} }
else else
{ {
int len = -1; gssize len = -1;
conv = text_validate ((char **)&text, &len); conv = text_validate ((char **)&text, &len);
} }
@ -1804,9 +1804,10 @@ load_text_events ()
#define ARG_FLAG(argn) (1 << (argn)) #define ARG_FLAG(argn) (1 << (argn))
void 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; char *i, *ar, d, a, done_all = FALSE;
i = pntevts[index]; i = pntevts[index];
@ -1864,19 +1865,10 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig
done_all = TRUE; done_all = TRUE;
continue; continue;
case 3: case 3:
/* if (sess->type == SESS_DIALOG) if (prefs.hex_text_indent)
{ o[oi++] = '\t';
if (prefs.dialog_indent_nicks) else
o[oi++] = '\t'; o[oi++] = ' ';
else
o[oi++] = ' ';
} else
{*/
if (prefs.hex_text_indent)
o[oi++] = '\t';
else
o[oi++] = ' ';
/*}*/
break; break;
} }
} }

View File

@ -57,9 +57,9 @@ void text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
time_t timestamp); time_t timestamp);
int text_emit_by_name (char *name, session *sess, time_t timestamp, int text_emit_by_name (char *name, session *sess, time_t timestamp,
char *a, char *b, char *c, char *d); 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); 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); char *text_find_format_string (char *name);
void sound_play (const char *file, gboolean quiet); void sound_play (const char *file, gboolean quiet);

View File

@ -332,7 +332,7 @@ static char *commands[] = {
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
void void
url_check_line (char *buf, int len) url_check_line (char *buf)
{ {
GRegex *re(void); GRegex *re(void);
GMatchInfo *gmi; GMatchInfo *gmi;

View File

@ -36,6 +36,6 @@ void url_clear (void);
void url_save_tree (const char *fname, const char *mode, gboolean fullpath); void url_save_tree (const char *fname, const char *mode, gboolean fullpath);
int url_last (int *, int *); int url_last (int *, int *);
int url_check_word (const char *word); int url_check_word (const char *word);
void url_check_line (char *buf, int len); void url_check_line (char *buf);
#endif #endif