1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

fixed some signed/unsigned issues

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1304 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-02-28 19:26:21 +00:00 committed by cras
parent fb488720f5
commit 51c1fee749
5 changed files with 11 additions and 11 deletions

View File

@ -52,7 +52,7 @@ static void sig_dcc_request(GET_DCC_REC *dcc, const char *nickaddr)
/* check file size limit, NOTE: it's still possible to send a /* check file size limit, NOTE: it's still possible to send a
bogus file size and then just send what ever sized file.. */ bogus file size and then just send what ever sized file.. */
max_size = settings_get_int("dcc_autoget_max_size"); max_size = settings_get_int("dcc_autoget_max_size");
if (max_size > 0 && max_size*1024 < dcc->size) if (max_size > 0 && (unsigned long) max_size*1024 < dcc->size)
return; return;
/* ok. but do we want/need to resume? */ /* ok. but do we want/need to resume? */

View File

@ -45,7 +45,7 @@ static FILE_DCC_REC *dcc_resume_find(int type, const char *nick, int port)
} }
static int dcc_ctcp_resume_parse(int type, const char *data, const char *nick, static int dcc_ctcp_resume_parse(int type, const char *data, const char *nick,
FILE_DCC_REC **dcc, long *size) FILE_DCC_REC **dcc, unsigned long *size)
{ {
char **params; char **params;
int paramcount; int paramcount;
@ -57,7 +57,7 @@ static int dcc_ctcp_resume_parse(int type, const char *data, const char *nick,
if (paramcount >= 3) { if (paramcount >= 3) {
port = atoi(params[paramcount-2]); port = atoi(params[paramcount-2]);
*size = atol(params[paramcount-1]); *size = strtoul(params[paramcount-1], NULL, 10);
*dcc = dcc_resume_find(type, nick, port); *dcc = dcc_resume_find(type, nick, port);
} }
@ -66,13 +66,13 @@ static int dcc_ctcp_resume_parse(int type, const char *data, const char *nick,
} }
static int dcc_resume_file_check(FILE_DCC_REC *dcc, IRC_SERVER_REC *server, static int dcc_resume_file_check(FILE_DCC_REC *dcc, IRC_SERVER_REC *server,
long size) unsigned long size)
{ {
if (size >= dcc->size) { if (size >= dcc->size) {
/* whole file sent */ /* whole file sent */
dcc->starttime = time(NULL); dcc->starttime = time(NULL);
dcc_reject(DCC(dcc), server); dcc_reject(DCC(dcc), server);
} else if (lseek(dcc->fhandle, size, SEEK_SET) != size) { } else if (lseek(dcc->fhandle, size, SEEK_SET) != (long)size) {
/* error, or trying to seek after end of file */ /* error, or trying to seek after end of file */
dcc_reject(DCC(dcc), server); dcc_reject(DCC(dcc), server);
} else { } else {
@ -90,7 +90,7 @@ static void ctcp_msg_dcc_resume(IRC_SERVER_REC *server, const char *data,
{ {
FILE_DCC_REC *dcc; FILE_DCC_REC *dcc;
char *str; char *str;
long size; unsigned long size;
if (!dcc_ctcp_resume_parse(DCC_SEND_TYPE, data, nick, &dcc, &size)) { if (!dcc_ctcp_resume_parse(DCC_SEND_TYPE, data, nick, &dcc, &size)) {
signal_emit("dcc error ctcp", 5, "RESUME", data, signal_emit("dcc error ctcp", 5, "RESUME", data,
@ -112,7 +112,7 @@ static void ctcp_msg_dcc_accept(IRC_SERVER_REC *server, const char *data,
const char *target, DCC_REC *chat) const char *target, DCC_REC *chat)
{ {
FILE_DCC_REC *dcc; FILE_DCC_REC *dcc;
long size; unsigned long size;
if (!dcc_ctcp_resume_parse(DCC_GET_TYPE, data, nick, &dcc, &size) || if (!dcc_ctcp_resume_parse(DCC_GET_TYPE, data, nick, &dcc, &size) ||
(dcc != NULL && DCC_GET(dcc)->get_type != DCC_GET_RESUME)) { (dcc != NULL && DCC_GET(dcc)->get_type != DCC_GET_RESUME)) {

View File

@ -101,7 +101,7 @@ static void dcc_send_read_size(SEND_DCC_REC *dcc)
memcpy(&bytes, dcc->count_buf, 4); memcpy(&bytes, dcc->count_buf, 4);
bytes = (guint32) ntohl(bytes); bytes = (guint32) ntohl(bytes);
dcc->gotalldata = (long) bytes == dcc->transfd; dcc->gotalldata = (unsigned long) bytes == dcc->transfd;
dcc->count_pos = 0; dcc->count_pos = 0;
if (dcc->waitforend && dcc->gotalldata) { if (dcc->waitforend && dcc->gotalldata) {

View File

@ -181,9 +181,9 @@ void dcc_str2ip(const char *str, IPADDR *ip)
} }
/* Start listening for incoming connections */ /* Start listening for incoming connections */
GIOChannel *dcc_listen(GIOChannel *interface, IPADDR *ip, int *port) GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port)
{ {
if (net_getsockname(interface, ip, NULL) == -1) if (net_getsockname(iface, ip, NULL) == -1)
return NULL; return NULL;
*port = settings_get_int("dcc_port"); *port = settings_get_int("dcc_port");

View File

@ -48,7 +48,7 @@ void dcc_ip2str(IPADDR *ip, char *str);
void dcc_str2ip(const char *str, IPADDR *ip); void dcc_str2ip(const char *str, IPADDR *ip);
/* Start listening for incoming connections */ /* Start listening for incoming connections */
GIOChannel *dcc_listen(GIOChannel *interface, IPADDR *ip, int *port); GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port);
/* Close DCC - sends "dcc closed" signal and calls dcc_destroy() */ /* Close DCC - sends "dcc closed" signal and calls dcc_destroy() */
void dcc_close(DCC_REC *dcc); void dcc_close(DCC_REC *dcc);