Fix some compiler warnings about signed/unsigned comparison.

This commit is contained in:
Jilles Tjoelker 2015-03-01 23:46:20 +01:00
parent 4f0d2b588b
commit 9279ad6461
8 changed files with 12 additions and 10 deletions

View file

@ -732,7 +732,7 @@ msg_client(enum message_type msgtype,
!IsOper(target_p))
{
if(rb_dlink_list_length(&source_p->localClient->allow_list) <
ConfigFileEntry.max_accept)
(unsigned long)ConfigFileEntry.max_accept)
{
rb_dlinkAddAlloc(target_p, &source_p->localClient->allow_list);
rb_dlinkAddAlloc(source_p, &target_p->on_allow_list);

View file

@ -551,7 +551,7 @@ clean_nick(const char *nick, int loc_client)
}
/* nicklen is +1 */
if(len >= NICKLEN && len >= ConfigFileEntry.nicklen)
if(len >= NICKLEN && (unsigned int)len >= ConfigFileEntry.nicklen)
return 0;
return 1;

View file

@ -80,7 +80,7 @@ add_monitor(struct Client *client_p, const char *nicks)
continue;
if(rb_dlink_list_length(&client_p->localClient->monitor_list) >=
ConfigFileEntry.max_monitor)
(unsigned long)ConfigFileEntry.max_monitor)
{
char buf[100];

View file

@ -256,7 +256,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
*/
if(MyClient(source_p))
{
if((rb_dlink_list_length(&chptr->banlist) + rb_dlink_list_length(&chptr->exceptlist) + rb_dlink_list_length(&chptr->invexlist) + rb_dlink_list_length(&chptr->quietlist)) >= (chptr->mode.mode & MODE_EXLIMIT ? ConfigChannel.max_bans_large : ConfigChannel.max_bans))
if((rb_dlink_list_length(&chptr->banlist) + rb_dlink_list_length(&chptr->exceptlist) + rb_dlink_list_length(&chptr->invexlist) + rb_dlink_list_length(&chptr->quietlist)) >= (unsigned long)(chptr->mode.mode & MODE_EXLIMIT ? ConfigChannel.max_bans_large : ConfigChannel.max_bans))
{
sendto_one(source_p, form_str(ERR_BANLISTFULL),
me.name, source_p->name, chptr->chname, realban);

View file

@ -697,7 +697,7 @@ find_cli_fd_hash(int fd)
}
static void
output_hash(struct Client *source_p, const char *name, int length, int *counts, int deepest)
output_hash(struct Client *source_p, const char *name, int length, int *counts, unsigned long deepest)
{
unsigned long total = 0;
int i;
@ -724,7 +724,7 @@ output_hash(struct Client *source_p, const char *name, int length, int *counts,
(float) (total / (length - counts[0])),
(float) (total / length));
sendto_one_numeric(source_p, RPL_STATSDEBUG,
"B :Average depth: %s Highest depth: %d",
"B :Average depth: %s Highest depth: %lu",
buf, deepest);
}
@ -741,7 +741,7 @@ static void
count_hash(struct Client *source_p, rb_dlink_list *table, int length, const char *name)
{
int counts[11];
int deepest = 0;
unsigned long deepest = 0;
int i;
memset(counts, 0, sizeof(counts));

View file

@ -60,7 +60,7 @@ int ratelimit_client(struct Client *client_p, unsigned int penalty)
}
/* Don't make it impossible to execute anything. */
if (penalty > ConfigFileEntry.max_ratelimit_tokens)
if (penalty > (unsigned int)ConfigFileEntry.max_ratelimit_tokens)
penalty = ConfigFileEntry.max_ratelimit_tokens;
if (client_p->localClient->ratelimit <= rb_current_time() - ConfigFileEntry.max_ratelimit_tokens)

View file

@ -76,7 +76,7 @@ struct reslist
char sends; /* number of sends (>1 means resent) */
time_t sentat;
time_t timeout;
unsigned int lastns; /* index of last server sent to */
int lastns; /* index of last server sent to */
struct rb_sockaddr_storage addr;
char *name;
struct DNSQuery *query; /* query callback for this request */

View file

@ -519,6 +519,7 @@ auth_connect_callback(rb_fde_t *F, int error, void *data)
{
struct AuthRequest *auth = data;
char authbuf[32];
int authlen;
/* Check the error */
if(error != RB_OK)
@ -530,8 +531,9 @@ auth_connect_callback(rb_fde_t *F, int error, void *data)
rb_snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n",
auth->rport, auth->lport);
authlen = strlen(authbuf);
if(rb_write(auth->F, authbuf, strlen(authbuf)) != strlen(authbuf))
if(rb_write(auth->F, authbuf, authlen) != authlen)
{
auth_error(auth);
return;