Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

clean up type warning in modern clang/gcc 32/64bit environment

  • Loading branch information...
commit d9e390f6ab59216b2a3e17711c1fe421af6cb37b 1 parent 218cd07
@youknowone youknowone authored
Showing with 393 additions and 359 deletions.
  1. +16 −13 src/common/cfgfiles.c
  2. +3 −1 src/common/chanopt.c
  3. +48 −45 src/common/dcc.c
  4. +5 −5 src/common/dcc.h
  5. +11 −9 src/common/fe.h
  6. +5 −4 src/common/ignore.c
  7. +18 −16 src/common/inbound.c
  8. +9 −7 src/common/modes.c
  9. +1 −1  src/common/modes.h
  10. +1 −1  src/common/network.c
  11. +2 −2 src/common/notify.c
  12. +1 −1  src/common/notify.h
  13. +43 −38 src/common/outbound.c
  14. +1 −1  src/common/outbound.h
  15. +4 −4 src/common/plugin-timer.c
  16. +23 −24 src/common/plugin.c
  17. +3 −1 src/common/plugin.h
  18. +6 −6 src/common/proto-irc.c
  19. +35 −30 src/common/server.c
  20. +2 −2 src/common/server.h
  21. +3 −3 src/common/servlist.c
  22. +10 −10 src/common/ssl.c
  23. +4 −4 src/common/ssl.h
  24. +36 −32 src/common/text.c
  25. +4 −5 src/common/text.h
  26. +17 −14 src/common/tree.c
  27. +5 −5 src/common/tree.h
  28. +7 −7 src/common/url.c
  29. +2 −2 src/common/url.h
  30. +7 −6 src/common/userlist.c
  31. +13 −12 src/common/util.c
  32. +8 −8 src/common/util.h
  33. +12 −12 src/common/xchat.c
  34. +8 −8 src/common/xchat.h
  35. +10 −10 src/fe-gtk/fe-gtk.c
  36. +10 −10 src/fe-text/fe-text.c
View
29 src/common/cfgfiles.c
@@ -46,7 +46,7 @@ void
list_addentry (GSList ** list, char *cmd, char *name)
{
struct popup *pop;
- int cmd_len = 1, name_len;
+ size_t cmd_len = 1, name_len;
/* remove <2.8.0 stuff */
if (!strcmp (cmd, "away") && !strcmp (name, "BACK"))
@@ -72,7 +72,7 @@ list_addentry (GSList ** list, char *cmd, char *name)
/* read it in from a buffer to our linked list */
static void
-list_load_from_data (GSList ** list, char *ibuf, int size)
+list_load_from_data (GSList ** list, char *ibuf, size_t size)
{
char cmd[384];
char name[128];
@@ -126,11 +126,11 @@ list_loadconf (char *file, GSList ** list, char *defaultconf)
abort ();
}
- ibuf = malloc (st.st_size);
- read (fh, ibuf, st.st_size);
+ ibuf = malloc ((size_t)st.st_size);
+ read (fh, ibuf, (size_t)st.st_size);
close (fh);
- list_load_from_data (list, ibuf, st.st_size);
+ list_load_from_data (list, ibuf, (size_t)st.st_size);
free (ibuf);
}
@@ -207,7 +207,7 @@ static int
cfg_put_str (int fh, char *var, char *value)
{
char buf[512];
- int len;
+ size_t len;
snprintf (buf, sizeof buf, "%s = %s\n", var, value);
len = strlen (buf);
@@ -218,7 +218,7 @@ int
cfg_put_color (int fh, int r, int g, int b, char *var)
{
char buf[400];
- int len;
+ size_t len;
snprintf (buf, sizeof buf, "%s = %04x %04x %04x\n", var, r, g, b);
len = strlen (buf);
@@ -229,7 +229,7 @@ int
cfg_put_int (int fh, int value, char *var)
{
char buf[400];
- int len;
+ size_t len;
if (value == -1)
value = 1;
@@ -247,7 +247,7 @@ cfg_get_color (char *cfg, char *var, int *r, int *g, int *b)
if (!cfg_get_str (cfg, var, str, sizeof (str)))
return 0;
- sscanf (str, "%04x %04x %04x", r, g, b);
+ sscanf (str, "%04x %04x %04x", (unsigned *)r, (unsigned *)g, (unsigned *)b);
return 1;
}
@@ -608,7 +608,8 @@ load_config (void)
struct stat st;
char *cfg, *sp;
const char *username, *realname;
- int res, val, i, fh;
+ int res, val, fh;
+ ssize_t i;
check_prefs_dir ();
username = g_get_user_name ();
@@ -747,9 +748,9 @@ load_config (void)
if (fh != -1)
{
fstat (fh, &st);
- cfg = malloc (st.st_size + 1);
+ cfg = malloc ((size_t)st.st_size + 1);
cfg[0] = '\0';
- i = read (fh, cfg, st.st_size);
+ i = read (fh, cfg, (size_t)st.st_size);
if (i >= 0)
cfg[i] = '\0'; /* make sure cfg is NULL terminated */
close (fh);
@@ -910,7 +911,9 @@ save_config (void)
static void
set_showval (session *sess, const struct prefs *var, char *tbuf)
{
- int len, dots, j;
+ size_t len;
+ ssize_t dots;
+ int j;
len = strlen (var->name);
memcpy (tbuf, var->name, len);
View
4 src/common/chanopt.c
@@ -64,7 +64,9 @@ chanopt_value (guint8 val)
int
chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[])
{
- int dots, i = 0, j, p = 0;
+ size_t dots;
+ int i = 0, j;
+ size_t p = 0;
guint8 val;
int offset = 2;
char *find;
View
93 src/common/dcc.c
@@ -73,7 +73,7 @@ struct dccstat_info dccstat[] = {
};
static int dcc_global_throttle; /* 0x1 = sends, 0x2 = gets */
-/*static*/ int dcc_sendcpssum, dcc_getcpssum;
+/*static*/ DCC_SIZE dcc_sendcpssum, dcc_getcpssum;
static struct DCC *new_dcc (void);
static void dcc_close (struct DCC *dcc, int dccstat, int destroy);
@@ -122,10 +122,11 @@ static void
dcc_calc_cps (struct DCC *dcc)
{
GTimeVal now;
- int oldcps;
+ DCC_SIZE oldcps;
double timediff, startdiff;
int glob_throttle_bit, wasthrottled;
- int *cpssum, glob_limit;
+ DCC_SIZE *cpssum;
+ int glob_limit;
DCC_SIZE pos, posdiff;
g_get_current_time (&now);
@@ -473,7 +474,7 @@ struct DCC *
dcc_write_chat (char *nick, char *text)
{
struct DCC *dcc;
- int len;
+ size_t len;
dcc = find_dcc (nick, "", TYPE_CHATRECV);
if (!dcc)
@@ -503,7 +504,7 @@ dcc_chat_line (struct DCC *dcc, char *line)
char *utf;
char *conv;
int ret, i;
- int len;
+ ssize_t len;
gsize utf_len;
char portbuf[32];
@@ -588,7 +589,8 @@ dcc_chat_line (struct DCC *dcc, char *line)
static gboolean
dcc_read_chat (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
- int i, len, dead;
+ int i, dead;
+ ssize_t len;
char portbuf[32];
char lbuf[2050];
@@ -602,7 +604,7 @@ dcc_read_chat (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
}
if (!dcc->iotag)
- dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, dcc_read_chat, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, (input_callback)dcc_read_chat, dcc);
len = recv (dcc->sok, lbuf, sizeof (lbuf) - 2, 0);
if (len < 1)
@@ -666,7 +668,7 @@ static void
dcc_send_ack (struct DCC *dcc)
{
/* send in 32-bit big endian */
- guint32 pos = htonl (dcc->pos & 0xffffffff);
+ guint32 pos = htonl ((uint32_t)dcc->pos & 0xffffffff);
send (dcc->sok, (char *) &pos, 4, 0);
}
@@ -675,7 +677,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
char *old;
char buf[4096];
- int n;
+ ssize_t n;
gboolean need_ack = FALSE;
if (dcc->fp == -1)
@@ -697,7 +699,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
do
{
n++;
- snprintf (buf, sizeof (buf), "%s.%d", dcc->destfile_fs, n);
+ snprintf (buf, sizeof (buf), "%s.%ld", dcc->destfile_fs, n);
}
while (access (buf, F_OK) == 0);
@@ -737,7 +739,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
}
if (!dcc->iotag)
- dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, dcc_read, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, (input_callback)dcc_read, dcc);
n = recv (dcc->sok, buf, sizeof (buf), 0);
if (n < 1)
@@ -780,7 +782,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
dcc_send_ack (dcc);
dcc_close (dcc, STAT_DONE, FALSE);
dcc_calc_average_cps (dcc); /* this must be done _after_ dcc_close, or dcc_remove_from_sum will see the wrong value in dcc->cps */
- sprintf (buf, "%d", dcc->cps);
+ sprintf (buf, "%"DCC_SFMT, dcc->cps);
EMIT_SIGNAL (XP_TE_DCCRECVCOMP, dcc->serv->front_session,
dcc->file, dcc->destfile, dcc->nick, buf, 0);
return TRUE;
@@ -862,7 +864,7 @@ dcc_connect_finished (GIOChannel *source, GIOCondition condition, struct DCC *dc
switch (dcc->type)
{
case TYPE_RECV:
- dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, dcc_read, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, (input_callback)dcc_read, dcc);
EMIT_SIGNAL (XP_TE_DCCCONRECV, dcc->serv->front_session,
dcc->nick, host, dcc->file, NULL, 0);
break;
@@ -870,8 +872,8 @@ dcc_connect_finished (GIOChannel *source, GIOCondition condition, struct DCC *dc
/* passive send */
dcc->fastsend = prefs.fastdccsend;
if (dcc->fastsend)
- dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE, dcc_send_data, dcc);
- dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, dcc_read_ack, dcc);
+ dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE, (input_callback)dcc_send_data, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, (input_callback)dcc_read_ack, dcc);
dcc_send_data (NULL, 0, (gpointer)dcc);
EMIT_SIGNAL (XP_TE_DCCCONSEND, dcc->serv->front_session,
dcc->nick, host, dcc->file, NULL, 0);
@@ -879,7 +881,7 @@ dcc_connect_finished (GIOChannel *source, GIOCondition condition, struct DCC *dc
case TYPE_CHATSEND: /* pchat */
dcc_open_query (dcc->serv, dcc->nick);
case TYPE_CHATRECV: /* normal chat */
- dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, dcc_read_chat, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, (input_callback)dcc_read_chat, dcc);
dcc->dccchat = malloc (sizeof (struct dcc_chat));
dcc->dccchat->pos = 0;
EMIT_SIGNAL (XP_TE_DCCCONCHAT, dcc->serv->front_session,
@@ -899,7 +901,7 @@ read_proxy (struct DCC *dcc)
struct proxy_state *proxy = dcc->proxy;
while (proxy->bufferused < proxy->buffersize)
{
- int ret = recv (dcc->sok, &proxy->buffer[proxy->bufferused],
+ ssize_t ret = recv (dcc->sok, &proxy->buffer[proxy->bufferused],
proxy->buffersize - proxy->bufferused, 0);
if (ret > 0)
proxy->bufferused += ret;
@@ -929,7 +931,7 @@ write_proxy (struct DCC *dcc)
struct proxy_state *proxy = dcc->proxy;
while (proxy->bufferused < proxy->buffersize)
{
- int ret = send (dcc->sok, &proxy->buffer[proxy->bufferused],
+ ssize_t ret = send (dcc->sok, &proxy->buffer[proxy->bufferused],
proxy->buffersize - proxy->bufferused, 0);
if (ret >= 0)
proxy->bufferused += ret;
@@ -982,7 +984,7 @@ dcc_wingate_proxy_traverse (GIOChannel *source, GIOCondition condition, struct D
dcc->port);
proxy->bufferused = 0;
dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX,
- dcc_wingate_proxy_traverse, dcc);
+ (input_callback)dcc_wingate_proxy_traverse, dcc);
++proxy->phase;
}
if (proxy->phase == 1)
@@ -1021,7 +1023,7 @@ dcc_socks_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
proxy->buffersize = 8 + strlen (sc.username) + 1;
proxy->bufferused = 0;
dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX,
- dcc_socks_proxy_traverse, dcc);
+ (input_callback)dcc_socks_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1034,7 +1036,7 @@ dcc_socks_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
proxy->bufferused = 0;
proxy->buffersize = 8;
dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX,
- dcc_socks_proxy_traverse, dcc);
+ (input_callback)dcc_socks_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1081,7 +1083,7 @@ dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DC
proxy->buffersize = 3;
proxy->bufferused = 0;
dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX,
- dcc_socks5_proxy_traverse, dcc);
+ (input_callback)dcc_socks5_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1094,7 +1096,7 @@ dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DC
proxy->bufferused = 0;
proxy->buffersize = 2;
dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX,
- dcc_socks5_proxy_traverse, dcc);
+ (input_callback)dcc_socks5_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1112,7 +1114,7 @@ dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DC
/* Set up authentication I/O */
if (auth)
{
- int len_u=0, len_p=0;
+ size_t len_u=0, len_p=0;
/* authentication sub-negotiation (RFC1929) */
if ( proxy->buffer[0] != 5 || proxy->buffer[1] != 2 ) /* UPA not supported by server */
@@ -1137,7 +1139,7 @@ dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DC
proxy->buffersize = 3 + len_u + len_p;
proxy->bufferused = 0;
dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX,
- dcc_socks5_proxy_traverse, dcc);
+ (input_callback)dcc_socks5_proxy_traverse, dcc);
++proxy->phase;
}
else
@@ -1162,7 +1164,7 @@ dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DC
proxy->buffersize = 2;
proxy->bufferused = 0;
dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX,
- dcc_socks5_proxy_traverse, dcc);
+ (input_callback)dcc_socks5_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1201,7 +1203,7 @@ dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DC
proxy->buffersize = 10;
proxy->bufferused = 0;
dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX,
- dcc_socks5_proxy_traverse, dcc);
+ (input_callback)dcc_socks5_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1214,7 +1216,7 @@ dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DC
proxy->buffersize = 4;
proxy->bufferused = 0;
dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX,
- dcc_socks5_proxy_traverse, dcc);
+ (input_callback)dcc_socks5_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1289,7 +1291,7 @@ dcc_http_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
proxy->bufferused = 0;
memcpy (proxy->buffer, buf, proxy->buffersize);
dcc->wiotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX,
- dcc_http_proxy_traverse, dcc);
+ (input_callback)dcc_http_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1301,7 +1303,7 @@ dcc_http_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
dcc->wiotag = 0;
proxy->bufferused = 0;
dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX,
- dcc_http_proxy_traverse, dcc);
+ (input_callback)dcc_http_proxy_traverse, dcc);
++proxy->phase;
}
@@ -1315,7 +1317,7 @@ dcc_http_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
{
fe_input_remove (dcc->iotag);
dcc->iotag = 0;
- PrintText (dcc->serv->front_session, proxy->buffer);
+ PrintText (dcc->serv->front_session, (const char *)proxy->buffer);
dcc->dccstat = STAT_FAILED;
fe_dcc_update (dcc);
return TRUE;
@@ -1337,7 +1339,7 @@ dcc_http_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
break;
}
if (proxy->bufferused > 1)
- PrintText (dcc->serv->front_session, proxy->buffer);
+ PrintText (dcc->serv->front_session, (const char *)proxy->buffer);
proxy->bufferused = 0;
}
else
@@ -1421,9 +1423,9 @@ dcc_connect (struct DCC *dcc)
return;
}
if (DCC_USE_PROXY ())
- dcc->iotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX, dcc_proxy_connect, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX, (input_callback)dcc_proxy_connect, dcc);
else
- dcc->iotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX, dcc_connect_finished, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_WRITE|FIA_EX, (input_callback)dcc_connect_finished, dcc);
}
fe_dcc_update (dcc);
@@ -1433,7 +1435,8 @@ static gboolean
dcc_send_data (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
char *buf;
- int len, sent, sok = dcc->sok;
+ ssize_t len, sent;
+ int sok = dcc->sok;
if (prefs.dcc_blocksize < 1) /* this is too little! */
prefs.dcc_blocksize = 1024;
@@ -1454,7 +1457,7 @@ dcc_send_data (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
return TRUE;
}
else if (!dcc->wiotag)
- dcc->wiotag = fe_input_add (sok, FIA_WRITE, dcc_send_data, dcc);
+ dcc->wiotag = fe_input_add (sok, FIA_WRITE, (input_callback)dcc_send_data, dcc);
buf = malloc (prefs.dcc_blocksize);
if (!buf)
@@ -1524,7 +1527,7 @@ dcc_handle_new_ack (struct DCC *dcc)
dcc->ack = dcc->size; /* force 100% ack for >4 GB */
dcc_close (dcc, STAT_DONE, FALSE);
dcc_calc_average_cps (dcc); /* this must be done _after_ dcc_close, or dcc_remove_from_sum will see the wrong value in dcc->cps */
- sprintf (buf, "%d", dcc->cps);
+ sprintf (buf, "%"DCC_SFMT, dcc->cps);
EMIT_SIGNAL (XP_TE_DCCSENDCOMP, dcc->serv->front_session,
file_part (dcc->file), dcc->nick, buf, NULL, 0);
done = TRUE;
@@ -1547,7 +1550,7 @@ dcc_handle_new_ack (struct DCC *dcc)
static gboolean
dcc_read_ack (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
- int len;
+ ssize_t len;
while (1)
{
@@ -1614,8 +1617,8 @@ dcc_accept (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
{
case TYPE_SEND:
if (dcc->fastsend)
- dcc->wiotag = fe_input_add (sok, FIA_WRITE, dcc_send_data, dcc);
- dcc->iotag = fe_input_add (sok, FIA_READ|FIA_EX, dcc_read_ack, dcc);
+ dcc->wiotag = fe_input_add (sok, FIA_WRITE, (input_callback)dcc_send_data, dcc);
+ dcc->iotag = fe_input_add (sok, FIA_READ|FIA_EX, (input_callback)dcc_read_ack, dcc);
dcc_send_data (NULL, 0, (gpointer)dcc);
EMIT_SIGNAL (XP_TE_DCCCONSEND, dcc->serv->front_session,
dcc->nick, host, dcc->file, NULL, 0);
@@ -1623,7 +1626,7 @@ dcc_accept (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
case TYPE_CHATSEND:
dcc_open_query (dcc->serv, dcc->nick);
- dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, dcc_read_chat, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, (input_callback)dcc_read_chat, dcc);
dcc->dccchat = malloc (sizeof (struct dcc_chat));
dcc->dccchat->pos = 0;
EMIT_SIGNAL (XP_TE_DCCCONCHAT, dcc->serv->front_session,
@@ -1741,7 +1744,7 @@ dcc_listen_init (struct DCC *dcc, session *sess)
listen (dcc->sok, 1);
set_blocking (dcc->sok);
- dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, dcc_accept, dcc);
+ dcc->iotag = fe_input_add (dcc->sok, FIA_READ|FIA_EX, (input_callback)dcc_accept, dcc);
return TRUE;
}
@@ -2055,7 +2058,7 @@ is_resumable (struct DCC *dcc)
}
}
- return dcc->resumable;
+ return dcc->resumable != 0;
}
void
@@ -2405,7 +2408,7 @@ handle_dcc (struct session *sess, char *nick, char *word[],
if (!strcasecmp (type, "CHAT"))
{
port = atoi (word[8]);
- addr = strtoul (word[7], NULL, 10);
+ addr = (guint32)strtoul (word[7], NULL, 10);
if (port == 0)
pasvid = atoi (word[9]);
@@ -2508,7 +2511,7 @@ handle_dcc (struct session *sess, char *nick, char *word[],
char *file = file_part (word[6]);
port = atoi (word[8]);
- addr = strtoul (word[7], NULL, 10);
+ addr = (guint32)strtoul (word[7], NULL, 10);
size = BIG_STR_TO_INT (word[9]);
if (port == 0) /* Passive dcc requested */
View
10 src/common/dcc.h
@@ -42,7 +42,7 @@ struct DCC
int wiotag; /* writing/sending io tag */
int port;
int pasvid; /* mIRC's passive DCC id */
- int cps;
+ DCC_SIZE cps;
int resume_error;
int resume_errno;
@@ -51,7 +51,7 @@ struct DCC
int maxcps;
unsigned char ack_buf[4]; /* buffer for reading 4-byte ack */
- int ack_pos;
+ size_t ack_pos;
DCC_SIZE size;
DCC_SIZE resumable;
@@ -79,14 +79,14 @@ struct proxy_state
{
int phase;
unsigned char buffer[MAX_PROXY_BUFFER];
- int buffersize;
- int bufferused;
+ size_t buffersize;
+ size_t bufferused;
};
struct dcc_chat
{
char linebuf[2048];
- int pos;
+ long pos;
};
struct dccstat_info
View
20 src/common/fe.h
@@ -25,16 +25,18 @@ typedef struct
char *icon; /* filename */
} menu_entry;
+typedef gboolean (*input_callback) (GIOChannel *source, GIOCondition condition, void *user_data);
+
int fe_args (int argc, char *argv[]);
void fe_init (void);
void fe_main (void);
void fe_cleanup (void);
void fe_exit (void);
-int fe_timeout_add (int interval, void *callback, void *userdata);
-void fe_timeout_remove (int tag);
+long fe_timeout_add (long interval, void *callback, void *userdata);
+void fe_timeout_remove (long tag);
void fe_new_window (struct session *sess, int focus);
void fe_new_server (struct server *serv);
-void fe_add_rawlog (struct server *serv, char *text, int len, int outbound);
+void fe_add_rawlog (struct server *serv, const char *text, const ssize_t len, int outbound);
#define FE_MSG_WAIT 1
#define FE_MSG_INFO 2
#define FE_MSG_WARN 4
@@ -45,8 +47,8 @@ void fe_message (char *msg, int flags);
#define FIA_WRITE 2
#define FIA_EX 4
#define FIA_FD 8
-int fe_input_add (int sok, int flags, void *func, void *data);
-void fe_input_remove (int tag);
+int fe_input_add (int sok, int flags, input_callback func, void *data);
+void fe_input_remove (long tag);
void fe_idle_add (void *func, void *data);
void fe_set_topic (struct session *sess, char *topic, char *stripped_topic);
void fe_set_hilight (struct session *sess);
@@ -68,12 +70,12 @@ void fe_text_clear (struct session *sess, int lines);
void fe_close_window (struct session *sess);
void fe_progressbar_start (struct session *sess);
void fe_progressbar_end (struct server *serv);
-void fe_print_text (struct session *sess, char *text, time_t stamp);
-void fe_userlist_insert (struct session *sess, struct User *newuser, int row, int sel);
+void fe_print_text (struct session *sess, const char *text, time_t stamp);
+void fe_userlist_insert (struct session *sess, struct User *newuser, long row, int sel);
int fe_userlist_remove (struct session *sess, struct User *user);
void fe_userlist_rehash (struct session *sess, struct User *user);
void fe_userlist_update (struct session *sess, struct User *user);
-void fe_userlist_move (struct session *sess, struct User *user, int new_row);
+void fe_userlist_move (struct session *sess, struct User *user, long new_row);
void fe_userlist_numbers (struct session *sess);
void fe_userlist_clear (struct session *sess);
void fe_userlist_set_selected (struct session *sess);
@@ -99,7 +101,7 @@ void fe_set_nick (struct server *serv, char *newnick);
void fe_ignore_update (int level);
void fe_beep (void);
void fe_lastlog (session *sess, session *lastlog_sess, char *sstr, gboolean regexp);
-void fe_set_lag (server *serv, int lag);
+void fe_set_lag (server *serv, long lag);
void fe_set_throttle (server *serv);
void fe_set_away (server *serv);
void fe_serverlist_open (session *sess);
View
9 src/common/ignore.c
@@ -271,7 +271,8 @@ ignore_load ()
struct ignore *ignore;
struct stat st;
char *cfg, *my_cfg;
- int fh, i;
+ int fh;
+ ssize_t i;
fh = xchat_open_file ("ignore.conf", O_RDONLY, 0, 0);
if (fh != -1)
@@ -279,9 +280,9 @@ ignore_load ()
fstat (fh, &st);
if (st.st_size)
{
- cfg = malloc (st.st_size + 1);
+ cfg = malloc ((size_t)st.st_size + 1);
cfg[0] = '\0';
- i = read (fh, cfg, st.st_size);
+ i = read (fh, cfg, (size_t)st.st_size);
if (i >= 0)
cfg[i] = '\0';
my_cfg = cfg;
@@ -412,7 +413,7 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
/*FIXME: only ignore ctcp or all?, its ignoring ctcps for now */
prefs.autodialog = 0;
/* turn it back on in 30 secs */
- fe_timeout_add (30000, flood_autodialog_timeout, NULL);
+ fe_timeout_add (30000, (void *)flood_autodialog_timeout, NULL);
}
return 0;
}
View
34 src/common/inbound.c
@@ -236,7 +236,7 @@ alert_match_word (char *word, char *masks)
gboolean
alert_match_text (char *text, char *masks)
{
- unsigned char *p = text;
+ unsigned char *p = (unsigned char *)text;
unsigned char endchar;
int res;
@@ -264,7 +264,7 @@ alert_match_text (char *text, char *masks)
/* if it's a 0, space or comma, the word has ended. */
if (*p == 0 || *p == ' ' || *p == ',' ||
/* if it's anything BUT a letter, the word has ended. */
- (!g_unichar_isalpha (g_utf8_get_char (p))))
+ (!g_unichar_isalpha (g_utf8_get_char ((char *)p))))
{
endchar = *p;
*p = 0;
@@ -274,7 +274,7 @@ alert_match_text (char *text, char *masks)
if (res)
return TRUE; /* yes, matched! */
- text = p + g_utf8_skip [p[0]];
+ text = (char *)p + g_utf8_skip [p[0]];
if (*p == 0)
return FALSE;
}
@@ -297,7 +297,7 @@ is_hilight (char *from, char *text, session *sess, server *serv)
{
g_free (text);
if (sess != current_tab)
- sess->nick_said = TRUE;
+ sess->nick_said = -TRUE;
fe_set_hilight (sess);
return 1;
}
@@ -354,10 +354,10 @@ inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int
if (fromme)
{
sess->msg_said = FALSE;
- sess->new_data = TRUE;
+ sess->new_data = -TRUE;
} else
{
- sess->msg_said = TRUE;
+ sess->msg_said = -TRUE;
sess->new_data = FALSE;
}
}
@@ -415,7 +415,7 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from, char *text
if (sess != current_tab)
{
- sess->msg_said = TRUE;
+ sess->msg_said = -TRUE;
sess->new_data = FALSE;
}
@@ -562,9 +562,9 @@ inbound_ujoin (server *serv, char *chan, char *nick, char *ip)
log_open_or_close (sess);
sess->waitchannel[0] = 0;
- sess->ignore_date = TRUE;
- sess->ignore_mode = TRUE;
- sess->ignore_names = TRUE;
+ sess->ignore_date = -TRUE;
+ sess->ignore_mode = -TRUE;
+ sess->ignore_names = -TRUE;
sess->end_of_names = FALSE;
/* sends a MODE */
@@ -576,7 +576,7 @@ inbound_ujoin (server *serv, char *chan, char *nick, char *ip)
{
/* sends WHO #channel */
serv->p_user_list (sess->server, chan);
- sess->doing_who = TRUE;
+ sess->doing_who = -TRUE;
}
}
@@ -754,7 +754,8 @@ inbound_quit (server *serv, char *nick, char *ip, char *reason)
{
if (sess == current_sess)
was_on_front_session = TRUE;
- if (user = userlist_find (sess, nick))
+ user = userlist_find (sess, nick);
+ if (user)
{
EMIT_SIGNAL (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0);
userlist_remove_user (sess, user);
@@ -772,7 +773,8 @@ inbound_quit (server *serv, char *nick, char *ip, char *reason)
void
inbound_ping_reply (session *sess, char *timestring, char *from)
{
- unsigned long tim, nowtim, dif;
+ unsigned long tim, nowtim;
+ long dif;
int lag = 0;
char outbuf[64];
@@ -982,7 +984,7 @@ inbound_nameslist_end (server *serv, char *chan)
sess = list->data;
if (sess->server == serv)
{
- sess->end_of_names = TRUE;
+ sess->end_of_names = -TRUE;
sess->ignore_names = FALSE;
}
list = list->next;
@@ -992,7 +994,7 @@ inbound_nameslist_end (server *serv, char *chan)
sess = find_channel (serv, chan);
if (sess)
{
- sess->end_of_names = TRUE;
+ sess->end_of_names = -TRUE;
sess->ignore_names = FALSE;
return TRUE;
}
@@ -1319,7 +1321,7 @@ inbound_login_end (session *sess, char *text)
if (serv->network && ((ircnet *)serv->network)->nickserv &&
prefs.irc_join_delay)
serv->joindelay_tag = fe_timeout_add (prefs.irc_join_delay * 1000,
- check_autojoin_channels, serv);
+ (void *)check_autojoin_channels, serv);
else
check_autojoin_channels (serv);
if (serv->supports_watch)
View
16 src/common/modes.c
@@ -61,7 +61,9 @@ void
send_channel_modes (session *sess, char *tbuf, char *word[], int wpos,
int end, char sign, char mode, int modes_per_line)
{
- int usable_modes, orig_len, len, wlen, i, max;
+ int usable_modes, i;
+ size_t orig_len, len, wlen;
+ ssize_t max;
server *serv = sess->server;
/* sanity check. IRC RFC says three per line. */
@@ -182,7 +184,7 @@ get_nick_prefix (server * serv, unsigned int access)
+nick would return 001000 in binary */
unsigned int
-nick_access (server * serv, char *nick, int *modechars)
+nick_access (server * serv, char *nick, long *modechars)
{
int i;
unsigned int access = 0;
@@ -243,9 +245,9 @@ record_chan_mode (session *sess, char sign, char mode, char *arg)
GString *current = g_string_new(sess->current_modes);
gint mode_pos = -1;
gchar *current_char = current->str;
- gint modes_length;
+ glong modes_length;
gint argument_num = 0;
- gint argument_offset = 0;
+ glong argument_offset = 0;
gint argument_length = 0;
int i = 0;
gchar *arguments_start;
@@ -366,7 +368,7 @@ record_chan_mode (session *sess, char sign, char mode, char *arg)
static char *
mode_cat (char *str, char *addition)
{
- int len;
+ size_t len;
if (str)
{
@@ -626,7 +628,7 @@ handle_mode (server * serv, char *word[], char *word_eol[],
char *modes;
char *argstr;
char sign;
- int len;
+ size_t len;
int arg;
int i, num_args;
int num_modes;
@@ -799,7 +801,7 @@ inbound_005 (server * serv, char *word[])
} else if (strncmp (word[w], "CASEMAPPING=", 12) == 0)
{
if (strcmp (word[w] + 12, "ascii") == 0) /* bahamut */
- serv->p_cmp = (void *)strcasecmp;
+ serv->p_cmp = strcasecmp;
} else if (strncmp (word[w], "CHARSET=", 8) == 0)
{
if (strcasecmp (word[w] + 8, "UTF-8") == 0)
View
2  src/common/modes.h
@@ -3,7 +3,7 @@
int is_channel (server *serv, char *chan);
char get_nick_prefix (server *serv, unsigned int access);
-unsigned int nick_access (server *serv, char *nick, int *modechars);
+unsigned int nick_access (server *serv, char *nick, long *modechars);
int mode_access (server *serv, char mode, char *prefix);
void inbound_005 (server *serv, char *word[]);
void handle_mode (server *serv, char *word[], char *word_eol[], char *nick, int numeric_324);
View
2  src/common/network.c
@@ -373,7 +373,7 @@ int
net_getsockport (int sok4, int sok6)
{
struct sockaddr_in addr;
- int len = sizeof (addr);
+ socklen_t len = sizeof (addr);
if (getsockname (sok4, (struct sockaddr *)&addr, &len) == -1)
return -1;
View
4 src/common/notify.c
@@ -36,7 +36,7 @@
GSList *notify_list = 0;
-int notify_tag = 0;
+long notify_tag = 0;
static char *
@@ -328,7 +328,7 @@ notify_send_watches (server * serv)
struct notify *notify;
GSList *list;
GSList *point;
- int len;
+ size_t len;
len = 0;
point = list = notify_list;
View
2  src/common/notify.h
@@ -19,7 +19,7 @@ struct notify_per_server
};
extern GSList *notify_list;
-extern int notify_tag;
+extern long notify_tag;
/* the WATCH stuff */
void notify_set_online (server * serv, char *nick);
View
81 src/common/outbound.c
@@ -385,7 +385,7 @@ static int
cmd_back (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
GSList *list;
- unsigned int gone;
+ time_t gone;
if (sess->server->is_away)
{
@@ -394,7 +394,7 @@ cmd_back (struct session *sess, char *tbuf, char *word[], char *word_eol[])
if (prefs.show_away_message)
{
gone = time (NULL) - sess->server->away_time;
- sprintf (tbuf, "me is back (gone %.2d:%.2d:%.2d)", gone / 3600,
+ sprintf (tbuf, "me is back (gone %.2ld:%.2ld:%.2ld)", gone / 3600,
(gone / 60) % 60, gone % 60);
for (list = sess_list; list; list = list->next)
{
@@ -711,14 +711,14 @@ cmd_country (struct session *sess, char *tbuf, char *word[], char *word_eol[])
/* search? */
if (strcmp (code, "-s") == 0)
{
- country_search (word[3], sess, (void *)PrintTextf);
+ country_search (word[3], sess, PrintTextf);
return TRUE;
}
/* search, but forgot the -s */
if (strchr (code, '*'))
{
- country_search (code, sess, (void *)PrintTextf);
+ country_search (code, sess, PrintTextf);
return TRUE;
}
@@ -881,8 +881,8 @@ cmd_debug (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
s = (struct session *) list->data;
sprintf (tbuf, "%p %1x %-10.10s %-10.10s %-10.10s %p\n",
- s, s->type, s->channel, s->waitchannel,
- s->willjoinchannel, s->server);
+ (void *)s, s->type, s->channel, s->waitchannel,
+ s->willjoinchannel, (void *)s->server);
PrintText (sess, tbuf);
list = list->next;
}
@@ -893,7 +893,7 @@ cmd_debug (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
v = (struct server *) list->data;
sprintf (tbuf, "%p %-5d %s\n",
- v, v->sok, v->servername);
+ (void *)v, v->sok, v->servername);
PrintText (sess, tbuf);
list = list->next;
}
@@ -901,7 +901,7 @@ cmd_debug (struct session *sess, char *tbuf, char *word[], char *word_eol[])
sprintf (tbuf,
"\nfront_session: %p\n"
"current_tab: %p\n\n",
- sess->server->front_session, current_tab);
+ (void *)(sess->server->front_session), (void *)current_tab);
PrintText (sess, tbuf);
#ifdef USE_DEBUG
sprintf (tbuf, "current mem: %d\n\n", current_mem_usage);
@@ -1222,7 +1222,7 @@ static int
cmd_menu (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
int idx = 2;
- int len;
+ size_t len;
int pos = 0xffff;
int state;
int toggle = FALSE;
@@ -1515,7 +1515,7 @@ cmd_execk (struct session *sess, char *tbuf, char *word[], char *word_eol[])
static int
cmd_execw (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
- int len;
+ size_t len;
char *temp;
exec_check_process (sess);
if (sess->running_exec == NULL)
@@ -1541,7 +1541,7 @@ static short escconv[] =
{ 1,4,3,5,2,10,6,1, 1,7,9,8,12,11,13,1 };
static void
-exec_handle_colors (char *buf, int len)
+exec_handle_colors (char *buf, const size_t len)
{
char numb[16];
char *nbuf;
@@ -1666,7 +1666,8 @@ static gboolean
exec_data (GIOChannel *source, GIOCondition condition, struct nbexec *s)
{
char *buf, *readpos, *rest;
- int rd, len;
+ ssize_t rd;
+ size_t len;
int sok = s->myfd;
len = s->buffill;
@@ -1848,7 +1849,7 @@ cmd_exec (struct session *sess, char *tbuf, char *word[], char *word_eol[])
/* Parent path */
close(fds[1]);
s->childpid = pid;
- s->iotag = fe_input_add (s->myfd, FIA_READ|FIA_EX, exec_data, s);
+ s->iotag = fe_input_add (s->myfd, FIA_READ|FIA_EX, (input_callback)exec_data, s);
sess->running_exec = s;
return TRUE;
}
@@ -1861,7 +1862,7 @@ cmd_exec (struct session *sess, char *tbuf, char *word[], char *word_eol[])
static int
cmd_flushq (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
- sprintf (tbuf, "Flushing server send queue, %d bytes.\n", sess->server->sendq_len);
+ sprintf (tbuf, "Flushing server send queue, %ld bytes.\n", sess->server->sendq_len);
PrintText (sess, tbuf);
sess->server->flush_queue (sess->server);
return TRUE;
@@ -1932,13 +1933,13 @@ cmd_getint (struct session *sess, char *tbuf, char *word[], char *word_eol[])
info->cmd = strdup (word[3]);
info->sess = sess;
- fe_get_int (word[4], atoi (word[2]), get_int_cb, info);
+ fe_get_int (word[4], atoi (word[2]), (void *)get_int_cb, info);
return TRUE;
}
static void
-get_file_cb (char *cmd, char *file)
+get_file_cb (void *cmd, char *file)
{
char buf[1024 + 128];
@@ -1946,7 +1947,7 @@ get_file_cb (char *cmd, char *file)
no args */
if (file)
{
- snprintf (buf, sizeof (buf), "%s %s", cmd, file);
+ snprintf (buf, sizeof (buf), "%s %s", (char *)cmd, file);
handle_command (current_sess, buf, FALSE);
}
else
@@ -1983,7 +1984,7 @@ cmd_getfile (struct session *sess, char *tbuf, char *word[], char *word_eol[])
idx++;
}
- fe_get_file (word[idx+1], word[idx+2], (void *)get_file_cb, strdup (word[idx]), flags);
+ fe_get_file (word[idx+1], word[idx+2], get_file_cb, strdup (word[idx]), flags);
return TRUE;
}
@@ -2016,7 +2017,7 @@ cmd_getstr (struct session *sess, char *tbuf, char *word[], char *word_eol[])
info->cmd = strdup (word[3]);
info->sess = sess;
- fe_get_str (word[4], word[2], get_str_cb, info);
+ fe_get_str (word[4], word[2], (void *)get_str_cb, info);
return TRUE;
}
@@ -2069,7 +2070,8 @@ typedef struct
static void
show_help_line (session *sess, help_list *hl, char *name, char *usage)
{
- int j, len, max;
+ size_t len, max;
+ int j;
char *p;
if (name[0] == '.') /* hidden command? */
@@ -2181,7 +2183,7 @@ cmd_help (struct session *sess, char *tbuf, char *word[], char *word_eol[])
buf[2] = 0;
hl.t = 0;
hl.i = 0;
- plugin_command_foreach (sess, &hl, (void *)show_help_line);
+ plugin_command_foreach (sess, &hl, (plugin_foreach_callback)show_help_line);
strcat (buf, "\n");
PrintText (sess, buf);
free (buf);
@@ -2437,7 +2439,7 @@ static int
cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
char *error, *arg, *file;
- int len;
+ size_t len;
if (!word[2][0])
return FALSE;
@@ -2462,7 +2464,7 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[])
#if defined(__hpux)
if (len > 3 && strcasecmp (".sl", word[2] + len - 3) == 0)
#elif defined (FE_AQUA)
- if (len > 3 && strcasecmp (".so", word[2] + len - 3) == 0 || len > 7 && strcasecmp (".bundle", word[2] + len - 7) == 0)
+ if ((len > 3 && strcasecmp (".so", word[2] + len - 3) == 0) || (len > 7 && strcasecmp (".bundle", word[2] + len - 7) == 0))
#else
if (len > 3 && strcasecmp (".so", word[2] + len - 3) == 0)
#endif
@@ -3204,7 +3206,8 @@ static int
cmd_unload (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
#ifdef USE_PLUGIN
- int len, by_file = FALSE;
+ size_t len;
+ int by_file = FALSE;
len = strlen (word[2]);
#ifdef WIN32
@@ -3735,7 +3738,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, int destlen, const char *src, char *word[],
char *word_eol[], char *a, char *c, char *d, char *e, char *h,
char *n, char *s)
{
@@ -3861,7 +3864,7 @@ auto_insert (char *dest, int destlen, unsigned char *src, char *word[],
src++;
} else
{
- utf_len = g_utf8_skip[src[0]];
+ utf_len = g_utf8_skip[(unsigned char)src[0]];
if ((dest - orig) + utf_len >= destlen)
return 2;
@@ -3890,10 +3893,10 @@ void
check_special_chars (char *cmd, int do_ascii) /* check for %X */
{
int occur = 0;
- int len = strlen (cmd);
+ size_t len = strlen (cmd);
char *buf, *utf;
char tbuf[4];
- int i = 0, j = 0;
+ long i = 0, j = 0;
gsize utf_len;
if (!len)
@@ -3976,9 +3979,9 @@ check_special_chars (char *cmd, int do_ascii) /* check for %X */
typedef struct
{
char *nick;
- int len;
+ size_t len;
struct User *best;
- int bestlen;
+ size_t bestlen;
char *space;
char *tbuf;
} nickdata;
@@ -3986,7 +3989,7 @@ typedef struct
static int
nick_comp_cb (struct User *user, nickdata *data)
{
- int lenu;
+ size_t lenu;
if (!rfc_ncasecmp (user->nick, data->nick, data->len))
{
@@ -4009,7 +4012,7 @@ nick_comp_cb (struct User *user, nickdata *data)
static void
perform_nick_completion (struct session *sess, char *cmd, char *tbuf)
{
- int len;
+ size_t len;
char *space = strchr (cmd, ' ');
if (space && space != cmd)
{
@@ -4074,8 +4077,8 @@ handle_say (session *sess, char *text, int check_spch)
char newcmd_static[1024];
char *pdibuf = pdibuf_static;
char *newcmd = newcmd_static;
- int len;
- int newcmdlen = sizeof newcmd_static;
+ size_t len;
+ size_t newcmdlen = sizeof newcmd_static;
if (strcmp (sess->channel, "(lastlog)") == 0)
{
@@ -4087,8 +4090,10 @@ handle_say (session *sess, char *text, int check_spch)
if (len >= sizeof pdibuf_static)
pdibuf = malloc (len + 1);
- if (len + NICKLEN >= newcmdlen)
- newcmd = malloc (newcmdlen = len + NICKLEN + 1);
+ if (len + NICKLEN >= newcmdlen) {
+ newcmdlen = len + NICKLEN + 1;
+ newcmd = malloc (newcmdlen);
+ }
if (check_spch && prefs.perc_color)
check_special_chars (text, prefs.perc_ascii);
@@ -4136,7 +4141,7 @@ handle_say (session *sess, char *text, int check_spch)
if (sess->server->connected)
{
- unsigned int max;
+ size_t max;
unsigned char t = 0;
/* maximum allowed message text */
@@ -4210,7 +4215,7 @@ handle_command (session *sess, char *cmd, int check_spch)
char tbuf_static[TBUFSIZE];
char *pdibuf;
char *tbuf;
- int len;
+ size_t len;
int ret = TRUE;
if (command_level > 99)
View
2  src/common/outbound.h
@@ -4,7 +4,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, int destlen, const char *src, char *word[], char *word_eol[],
char *a, char *c, char *d, char *e, char *h, char *n, char *s);
int handle_command (session *sess, char *cmd, int check_spch);
void process_data_init (char *buf, char *cmd, char *word[], char *word_eol[], gboolean handle_quotes, gboolean allow_escape_quotes);
View
8 src/common/plugin-timer.c
@@ -22,7 +22,7 @@ typedef struct
char *command;
int ref;
int repeat;
- float timeout;
+ double timeout;
unsigned int forever:1;
} timer;
@@ -78,7 +78,7 @@ timeout_cb (timer *tim)
}
static void
-timer_add (int ref, float timeout, int repeat, char *command)
+timer_add (int ref, double timeout, int repeat, char *command)
{
timer *tim;
GSList *list;
@@ -107,7 +107,7 @@ timer_add (int ref, float timeout, int repeat, char *command)
if (repeat == 0)
tim->forever = TRUE;
- tim->hook = xchat_hook_timer (ph, timeout * 1000.0, (void *)timeout_cb, tim);
+ tim->hook = xchat_hook_timer (ph, (int)(timeout * 1000.0), (int(*)(void *))timeout_cb, tim);
timer_list = g_slist_append (timer_list, tim);
}
@@ -139,7 +139,7 @@ static int
timer_cb (char *word[], char *word_eol[], void *userdata)
{
int repeat = 1;
- float timeout;
+ double timeout;
int offset = 0;
int ref = 0;
int quiet = FALSE;
View
47 src/common/plugin.c
@@ -68,7 +68,7 @@ struct _xchat_hook
void *callback; /* pointer to xdcc_callback */
char *help_text; /* help_text for commands only */
void *userdata; /* passed to the callback */
- int tag; /* for timers & FDs only */
+ long tag; /* for timers & FDs only */
int type; /* HOOK_* */
int pri; /* fd */ /* priority / fd for HOOK_FD only */
};
@@ -131,7 +131,7 @@ plugin_free (xchat_plugin *pl, int do_deinit, int allow_refuse)
/* run the plugin's deinit routine, if any */
if (do_deinit && pl->deinit_callback != NULL)
{
- deinit_func = pl->deinit_callback;
+ deinit_func = (xchat_deinit_func *)pl->deinit_callback;
if (!deinit_func (pl) && allow_refuse)
return FALSE;
}
@@ -407,7 +407,7 @@ plugin_load (session *sess, char *filename, char *arg)
dlerror (); /* Clear any existing error */
/* find the init routine xchat_plugin_init */
- init_func = dlsym (handle, "xchat_plugin_init");
+ init_func = (xchat_init_func *) dlsym (handle, "xchat_plugin_init");
error = (char *)dlerror ();
if (error != NULL)
{
@@ -416,12 +416,12 @@ plugin_load (session *sess, char *filename, char *arg)
}
/* find the plugin's deinit routine, if any */
- deinit_func = dlsym (handle, "xchat_plugin_deinit");
+ deinit_func = (xchat_deinit_func *) dlsym (handle, "xchat_plugin_deinit");
error = (char *)dlerror ();
#endif
/* add it to our linked list */
- plugin_add (sess, filename, handle, init_func, deinit_func, arg, FALSE);
+ plugin_add (sess, filename, handle, (void *)init_func, (void *)deinit_func, arg, FALSE);
return NULL;
}
@@ -725,7 +725,7 @@ plugin_add_hook (xchat_plugin *pl, int type, int pri, const char *name,
plugin_insert_hook (hook);
if (type == HOOK_TIMER)
- hook->tag = fe_timeout_add (timeout, plugin_timeout_cb, hook);
+ hook->tag = fe_timeout_add (timeout, (void *)plugin_timeout_cb, hook);
return hook;
}
@@ -747,8 +747,7 @@ plugin_command_list(GList *tmp_list)
}
void
-plugin_command_foreach (session *sess, void *userdata,
- void (*cb) (session *sess, void *userdata, char *name, char *help))
+plugin_command_foreach (session *sess, void *userdata, plugin_foreach_callback cb)
{
GSList *list;
xchat_hook *hook;
@@ -816,7 +815,7 @@ xchat_hook *
xchat_hook_command (xchat_plugin *ph, const char *name, int pri,
xchat_cmd_cb *callb, const char *help_text, void *userdata)
{
- return plugin_add_hook (ph, HOOK_COMMAND, pri, name, help_text, callb, 0,
+ return plugin_add_hook (ph, HOOK_COMMAND, pri, name, help_text, (void *)callb, 0,
userdata);
}
@@ -824,21 +823,21 @@ xchat_hook *
xchat_hook_server (xchat_plugin *ph, const char *name, int pri,
xchat_serv_cb *callb, void *userdata)
{
- return plugin_add_hook (ph, HOOK_SERVER, pri, name, 0, callb, 0, userdata);
+ return plugin_add_hook (ph, HOOK_SERVER, pri, name, 0, (void *)callb, 0, userdata);
}
xchat_hook *
xchat_hook_print (xchat_plugin *ph, const char *name, int pri,
xchat_print_cb *callb, void *userdata)
{
- return plugin_add_hook (ph, HOOK_PRINT, pri, name, 0, callb, 0, userdata);
+ return plugin_add_hook (ph, HOOK_PRINT, pri, name, 0, (void *)callb, 0, userdata);
}
xchat_hook *
xchat_hook_timer (xchat_plugin *ph, int timeout, xchat_timer_cb *callb,
void *userdata)
{
- return plugin_add_hook (ph, HOOK_TIMER, 0, 0, 0, callb, timeout, userdata);
+ return plugin_add_hook (ph, HOOK_TIMER, 0, 0, 0, (void *)callb, timeout, userdata);
}
xchat_hook *
@@ -847,10 +846,10 @@ xchat_hook_fd (xchat_plugin *ph, int fd, int flags,
{
xchat_hook *hook;
- hook = plugin_add_hook (ph, HOOK_FD, 0, 0, 0, callb, 0, userdata);
+ hook = plugin_add_hook (ph, HOOK_FD, 0, 0, 0, (void *)callb, 0, userdata);
hook->pri = fd;
/* plugin hook_fd flags correspond exactly to FIA_* flags (fe.h) */
- hook->tag = fe_input_add (fd, flags, plugin_fd_cb, hook);
+ hook->tag = fe_input_add (fd, flags, (input_callback)plugin_fd_cb, hook);
return hook;
}
@@ -885,7 +884,7 @@ void
xchat_command (xchat_plugin *ph, const char *command)
{
char *conv;
- int len = -1;
+ ssize_t len = -1;
if (!is_session (ph->context))
{
@@ -1418,21 +1417,21 @@ xchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
case 0x34207553: /* address32 */
return ((struct DCC *)data)->addr;
case 0x181a6: /* cps */
- return ((struct DCC *)data)->cps;
+ return (guint32)((struct DCC *)data)->cps & 0xffffffff;
case 0x349881: /* port */
return ((struct DCC *)data)->port;
case 0x1b254: /* pos */
- return ((struct DCC *)data)->pos & 0xffffffff;
+ return (guint32)((struct DCC *)data)->pos & 0xffffffff;
case 0xe8a945f6: /* poshigh */
- return (((struct DCC *)data)->pos >> 32) & 0xffffffff;
+ return (guint32)(((struct DCC *)data)->pos >> 32) & 0xffffffff;
case 0xc84dc82d: /* resume */
- return ((struct DCC *)data)->resumable & 0xffffffff;
+ return (guint32)((struct DCC *)data)->resumable & 0xffffffff;
case 0xded4c74f: /* resumehigh */
- return (((struct DCC *)data)->resumable >> 32) & 0xffffffff;
+ return (guint32)(((struct DCC *)data)->resumable >> 32) & 0xffffffff;
case 0x35e001: /* size */
- return ((struct DCC *)data)->size & 0xffffffff;
+ return (guint32)((struct DCC *)data)->size & 0xffffffff;
case 0x3284d523: /* sizehigh */
- return (((struct DCC *)data)->size >> 32) & 0xffffffff;
+ return (guint32)(((struct DCC *)data)->size >> 32) & 0xffffffff;
case 0xcacdcff2: /* status */
return ((struct DCC *)data)->dccstat;
case 0x368f3a: /* type */
@@ -1477,11 +1476,11 @@ xchat_list_int (xchat_plugin *ph, xchat_list *xlist, const char *name)
tmp |= ((struct session *)data)->server->connected; /* 0 */
return tmp;
case 0x1a192: /* lag */
- return ((struct session *)data)->server->lag;
+ return (guint32)((struct session *)data)->server->lag & 0xffffffff;
case 0x1916144c: /* maxmodes */
return ((struct session *)data)->server->modes_per_line;
case 0x66f1911: /* queue */
- return ((struct session *)data)->server->sendq_len;
+ return (guint32)((struct session *)data)->server->sendq_len;
case 0x368f3a: /* type */
return ((struct session *)data)->type;
case 0x6a68e08: /* users */
View
4 src/common/plugin.h
@@ -115,6 +115,8 @@ struct _xchat_plugin
};
#endif
+typedef void (*plugin_foreach_callback) (session *sess, void *userdata, char *name, char *help);
+
char *plugin_load (session *sess, char *filename, char *arg);
void plugin_add (session *sess, char *filename, void *handle, void *init_func, void *deinit_func, char *arg, int fake);
int plugin_kill (char *name, int by_filename);
@@ -127,6 +129,6 @@ int plugin_emit_dummy_print (session *sess, char *name);
int plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, int len, char *string);
GList* plugin_command_list(GList *tmp_list);
int plugin_show_help (session *sess, char *cmd);
-void plugin_command_foreach (session *sess, void *userdata, void (*cb) (session *sess, void *userdata, char *name, char *usage));
+void plugin_command_foreach (session *sess, void *userdata, plugin_foreach_callback cb);
#endif
View
12 src/common/proto-irc.c
@@ -128,8 +128,8 @@ irc_join_list (server *serv, GSList *channels, GSList *keys)
GSList *klist;
GString *c = g_string_new (NULL);
GString *k = g_string_new (NULL);
- int len;
- int add;
+ size_t len;
+ size_t add;
int i, j;
i = j = 0;
@@ -412,7 +412,7 @@ irc_ping (server *serv, char *to, char *timestring)
static int
irc_raw (server *serv, char *raw)
{
- int len;
+ size_t len;
char tbuf[4096];
if (*raw)
{
@@ -910,7 +910,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[])
server *serv = sess->server;
char ip[128], nick[NICKLEN];
char *text, *ex;
- int len = strlen (type);
+ size_t len = strlen (type);
/* fill in the "ip" and "nick" buffers */
ex = strchr (word[1], '!');
@@ -1053,7 +1053,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[])
case WORDL('P','R','I','V'):
{
char *to = word[3];
- int len;
+ size_t len;
int id = FALSE; /* identified */
if (*to)
{
@@ -1181,7 +1181,7 @@ process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol
/* irc_inline() - 1 single line received from serv */
static void
-irc_inline (server *serv, char *buf, int len)
+irc_inline (server *serv, char *buf, size_t len)
{
session *sess, *tmp;
char *type, *text;
View
65 src/common/server.c
@@ -95,10 +95,10 @@ extern pxProxyFactory *libproxy_factory;
/* actually send to the socket. This might do a character translation or
send via SSL. server/dcc both use this function. */
-int
-tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int len)
+ssize_t
+tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, gssize len)
{
- int ret;
+ ssize_t ret;
char *locale;
gsize loc_len;
@@ -151,8 +151,8 @@ tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int
return ret;
}
-static int
-server_send_real (server *serv, char *buf, int len)
+static ssize_t
+server_send_real (server *serv, char *buf, ssize_t len)
{
fe_add_rawlog (serv, buf, len, TRUE);
@@ -168,7 +168,9 @@ static int
tcp_send_queue (server *serv)
{
char *buf, *p;
- int len, i, pri;
+ size_t len;
+ long i;
+ int pri;
GSList *list;
time_t now = time (0);
@@ -223,8 +225,8 @@ tcp_send_queue (server *serv)
return 0; /* remove the timeout handler */
}
-int
-tcp_send_len (server *serv, char *buf, int len)
+ssize_t
+tcp_send_len (server *serv, char *buf, size_t len)
{
char *dbuf;
int noqueue = !serv->outbound_queue;
@@ -258,7 +260,7 @@ tcp_send_len (server *serv, char *buf, int len)
serv->sendq_len += len; /* tcp_send_queue uses strlen */
if (tcp_send_queue (serv) && noqueue)
- fe_timeout_add (500, tcp_send_queue, serv);
+ fe_timeout_add (500, (void *)tcp_send_queue, serv);
return 1;
}
@@ -276,7 +278,7 @@ tcp_sendf (server *serv, char *fmt, ...)
/* keep this buffer in BSS. Converting UTF-8 to ISO-8859-x might make the
string shorter, so allow alot more than 512 for now. */
static char send_buf[1540]; /* good code hey (no it's not overflowable) */
- int len;
+ ssize_t len;
va_start (args, fmt);
len = vsnprintf (send_buf, sizeof (send_buf) - 1, fmt, args);
@@ -300,13 +302,13 @@ static void
close_socket (int sok)
{
/* close the socket in 5 seconds so the QUIT message is not lost */
- fe_timeout_add (5000, close_socket_cb, GINT_TO_POINTER (sok));
+ fe_timeout_add (5000, (void *)close_socket_cb, GINT_TO_POINTER (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, ssize_t len)
{
char *utf_line_allocated = NULL;
@@ -342,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 */
+ ssize_t conv_len; /* tells g_convert how much of line to convert */
gsize utf_len;
gsize read_len;
GError *err;
@@ -411,7 +413,8 @@ static gboolean
server_read (GIOChannel *source, GIOCondition condition, server *serv)
{
int sok = serv->sok;
- int error, i, len;
+ int error, i;
+ ssize_t len;
char lbuf[2050];
while (1)
@@ -488,7 +491,7 @@ server_connected (server * serv)
serv->ping_recv = time (0);
serv->connected = TRUE;
set_nonblocking (serv->sok);
- serv->iotag = fe_input_add (serv->sok, FIA_READ|FIA_EX, server_read, serv);
+ serv->iotag = fe_input_add (serv->sok, FIA_READ|FIA_EX, (input_callback)server_read, serv);
if (!serv->no_login)
{
EMIT_SIGNAL (XP_TE_CONNECTED, serv->server_session, NULL, NULL, NULL,
@@ -626,13 +629,13 @@ ssl_do_connect (server * serv)
if (SSL_connect (serv->ssl) <= 0)
{
char err_buf[128];
- int err;
+ unsigned long err;
g_sess = NULL;
if ((err = ERR_get_error ()) > 0)
{
ERR_error_string (err, err_buf);
- snprintf (buf, sizeof (buf), "(%d) %s", err, err_buf);
+ snprintf (buf, sizeof (buf), "(%ld) %s", err, err_buf);
EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL,
NULL, NULL, 0);
@@ -653,7 +656,7 @@ ssl_do_connect (server * serv)
{
struct cert_info cert_info;
struct chiper_info *chiper_info;
- int verify_error;
+ long verify_error;
int i;
if (!_SSL_get_cert_info (&cert_info, serv->ssl))
@@ -730,7 +733,7 @@ ssl_do_connect (server * serv)
case X509_V_ERR_CERT_HAS_EXPIRED:
if (serv->accept_invalid_cert)
{
- snprintf (buf, sizeof (buf), "* Verify E: %s.? (%d) -- Ignored",
+ snprintf (buf, sizeof (buf), "* Verify E: %s.? (%ld) -- Ignored",
X509_verify_cert_error_string (verify_error),
verify_error);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
@@ -738,7 +741,7 @@ ssl_do_connect (server * serv)
break;
}
default:
- snprintf (buf, sizeof (buf), "%s.? (%d)",
+ snprintf (buf, sizeof (buf), "%s.? (%ld)",
X509_verify_cert_error_string (verify_error),
verify_error);
EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL, NULL,
@@ -832,7 +835,7 @@ auto_reconnect (server *serv, int send_quit, int err)
serv->recondelay_tag = 0;
}
- serv->recondelay_tag = fe_timeout_add (del, timeout_auto_reconnect, serv);
+ serv->recondelay_tag = fe_timeout_add (del, (void *)timeout_auto_reconnect, serv);
fe_server_event (serv, FE_SE_RECONDELAY, del);
}
@@ -885,7 +888,7 @@ server_connect_success (server *serv)
/* it'll be a memory leak, if connection isn't terminated by
server_cleanup() */
serv->ssl = _SSL_socket (ctx, serv->sok);
- if ((err = _SSL_set_verify (ctx, ssl_cb_verify, NULL)))
+ if ((err = _SSL_set_verify (ctx, (void *)ssl_cb_verify, NULL)))
{
EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, err, NULL,
NULL, NULL, 0);
@@ -896,7 +899,7 @@ server_connect_success (server *serv)
/* send(serv->sok, "STLS\r\n", 6, 0); sleep(1); */
set_nonblocking (serv->sok);
serv->ssl_do_connect_tag = fe_timeout_add (SSLDOCONNTMOUT,
- ssl_do_connect, serv);
+ (void *)ssl_do_connect, serv);
return;
}
@@ -917,7 +920,9 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
char outbuf[512];
char host[100];
char ip[100];
+ #ifdef USE_MSPROXY
char *p;
+ #endif
waitline2 (source, tbuf, sizeof tbuf);
@@ -1190,7 +1195,7 @@ static int
traverse_socks (int print_fd, int sok, char *serverAddr, int port)
{
struct sock_connect sc;
- unsigned char buf[256];
+ char buf[256];
sc.version = 4;
sc.type = 1;
@@ -1221,8 +1226,8 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port)
{
struct sock5_connect1 sc1;
unsigned char *sc2;
- unsigned int packetlen, addrlen;
- unsigned char buf[260];
+ size_t packetlen, addrlen;
+ char buf[260];
int auth = prefs.proxy_auth && prefs.proxy_user[0] && prefs.proxy_pass[0];
sc1.version = 5;
@@ -1247,7 +1252,7 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port)
if (auth)
{
- int len_u=0, len_p=0;
+ size_t len_u=0, len_p=0;
/* authentication sub-negotiation (RFC1929) */
if (buf[1] != 2) /* UPA not supported by server */
@@ -1363,7 +1368,7 @@ three_to_four (char *from, char *to)
to[1] = tab64 [ ((from[0] << 4) | (from[1] >> 4)) & 63 ];
to[2] = tab64 [ ((from[1] << 2) | (from[2] >> 6)) & 63 ];
to[3] = tab64 [ from[2] & 63 ];
-};
+}
void
base64_encode (char *to, char *from, unsigned int len)
@@ -1687,7 +1692,7 @@ server_connect (server *serv, char *hostname, int port, int no_login)
#ifdef USE_OPENSSL
if (!ctx && serv->use_ssl)
{
- if (!(ctx = _SSL_context_init (ssl_cb_info, FALSE)))
+ if (!(ctx = _SSL_context_init ((void *)ssl_cb_info, FALSE)))
{
fprintf (stderr, "_SSL_context_init failed\n");
exit (1);
@@ -1802,7 +1807,7 @@ server_connect (server *serv, char *hostname, int port, int no_login)
}
#endif
serv->childpid = pid;
- serv->iotag = fe_input_add (serv->childread, FIA_READ, server_read_child,
+ serv->iotag = fe_input_add (serv->childread, FIA_READ, (input_callback)server_read_child,
serv);
}
View
4 src/common/server.h
@@ -4,10 +4,10 @@
extern GSList *serv_list;
/* eventually need to keep the tcp_* functions isolated to server.c */
-int tcp_send_len (server *serv, char *buf, int len);
+ssize_t tcp_send_len (server *serv, char *buf, size_t len);
int tcp_send (server *serv, char *buf);
void tcp_sendf (server *serv, char *fmt, ...);
-int tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int len);
+ssize_t tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, gssize len);
server *server_new (void);
int is_server (server *serv);
View
6 src/common/servlist.c
@@ -690,7 +690,7 @@ servlist_cycle (server *serv)
del = 500; /* so it doesn't block the gui */
if (del)
- serv->recondelay_tag = fe_timeout_add (del, servlist_cycle_cb, serv);
+ serv->recondelay_tag = fe_timeout_add (del, (void *)servlist_cycle_cb, serv);
else
servlist_connect (serv->server_session, net, TRUE);
@@ -936,7 +936,7 @@ servlist_load (void)
{
FILE *fp;
char buf[2048];
- int len;
+ size_t len;
char *tmp;
ircnet *net = NULL;
@@ -1227,7 +1227,7 @@ joinlist_split (char *autojoin, GSList **channels, GSList **keys)
{
char *parta, *partb;
char *chan, *key;
- int len;
+ size_t len;
*channels = NULL;
*keys = NULL;
View
20 src/common/ssl.c
@@ -39,13 +39,13 @@ static char err_buf[256]; /* generic error buffer */
static void
__SSL_fill_err_buf (char *funcname)
{
- int err;
+ unsigned long err;
char buf[256];
err = ERR_get_error ();
ERR_error_string (err, buf);
- snprintf (err_buf, sizeof (err_buf), "%s: %s (%d)\n", funcname, buf, err);
+ snprintf (err_buf, sizeof (err_buf), "%s: %s (%ld)\n", funcname, buf, err);
}
@@ -76,7 +76,7 @@ _SSL_context_init (void (*info_cb_func), int server)
SSL_CTX_set_timeout (ctx, 300);
/* used in SSL_connect(), SSL_accept() */
- SSL_CTX_set_info_callback (ctx, info_cb_func);
+ SSL_CTX_set_info_callback (ctx, (void (*)(const SSL*, int, int))info_cb_func);
#ifdef WIN32
/* under win32, OpenSSL needs to be seeded with some randomness */
@@ -213,13 +213,13 @@ _SSL_get_cipher_info (SSL * ssl)
}
-int
-_SSL_send (SSL * ssl, char *buf, int len)
+ssize_t
+_SSL_send (SSL * ssl, char *buf, size_t len)
{
int num;
- num = SSL_write (ssl, buf, len);
+ num = SSL_write (ssl, buf, (int)len);
switch (SSL_get_error (ssl, num))
{
@@ -241,13 +241,13 @@ _SSL_send (SSL * ssl, char *buf, int len)
}
-int
-_SSL_recv (SSL * ssl, char *buf, int len)
+ssize_t
+_SSL_recv (SSL * ssl, char *buf, size_t len)
{
int num;
- num = SSL_read (ssl, buf, len);
+ num = SSL_read (ssl, buf, (int)len);
switch (SSL_get_error (ssl, num))
{
@@ -308,7 +308,7 @@ _SSL_set_verify (SSL_CTX *ctx, void *verify_callback, char *cacert)
}
}
*/
- SSL_CTX_set_verify (ctx, SSL_VERIFY_PEER, verify_callback);
+ SSL_CTX_set_verify (ctx, SSL_VERIFY_PEER, (int (*)(int, X509_STORE_CTX *))verify_callback);
return (NULL);
}
View
8 src/common/ssl.h
@@ -23,11 +23,11 @@ struct chiper_info {
int chiper_bits;
};
-SSL_CTX *_SSL_context_init (void (*info_cb_func), int server);
+SSL_CTX *_SSL_context_init (void *info_cb_func, int server);
#define _SSL_context_free(a) SSL_CTX_free(a);
SSL *_SSL_socket (SSL_CTX *ctx, int sd);
-char *_SSL_set_verify (SSL_CTX *ctx, void *(verify_callback), char *cacert);
+char *_SSL_set_verify (SSL_CTX *ctx, void *verify_callback, char *cacert);
/*
int SSL_connect(SSL *);
int SSL_accept(SSL *);
@@ -41,8 +41,8 @@ struct chiper_info *_SSL_get_cipher_info (SSL * ssl);
/*char *_SSL_add_keypair (SSL_CTX *ctx, char *privkey, char *cert);*/
/*void _SSL_add_random_keypair(SSL_CTX *ctx, int bits);*/
-int _SSL_send (SSL * ssl, char *buf, int len);
-int _SSL_recv (SSL * ssl, char *buf, int len);
+ssize_t _SSL_send (SSL * ssl, char *buf, size_t len);
+ssize_t _SSL_recv (SSL * ssl, char *buf, size_t len);
/* misc */
/*void broke_oneline (char *oneline, char *parray[]);*/
View
68 src/common/text.c
@@ -44,7 +44,7 @@
struct pevt_stage1
{
- int len;
+ size_t len;
char *data;
struct pevt_stage1 *next;
};
@@ -121,7 +121,7 @@ scrollback_close (session *sess)
}
static char *
-file_to_buffer (char *file, int *len)
+file_to_buffer (char *file, ssize_t *len)
{
int fh;
char *buf;
@@ -133,21 +133,21 @@ file_to_buffer (char *file, int *len)
fstat (fh, &st);
- buf = malloc (st.st_size);
+ buf = malloc ((size_t)st.st_size);
if (!buf)
{
close (fh);
return NULL;
}
- if (read (fh, buf, st.st_size) != st.st_size)
+ if (read (fh, buf, (size_t)st.st_size) != st.st_size)
{
free (buf);
close (fh);
return NULL;
}
- *len = st.st_size;
+ *len = (ssize_t)st.st_size;
close (fh);
return buf;
}
@@ -162,7 +162,7 @@ scrollback_shrink (session *sess)
int fh;
int lines;
int line;
- int len;
+ ssize_t len;
char *p;
scrollback_close (sess);
@@ -215,11 +215,11 @@ scrollback_shrink (session *sess)
}
static void
-scrollback_save (session *sess, char *text)
+scrollback_save (session *sess, const char *text)
{
char buf[512 * 4];
time_t stamp;
- int len;
+ size_t len;
if (sess->type == SESS_SERVER)
return;
@@ -296,7 +296,7 @@ scrollback_load (session *sess)
if (fstat (fh, &statbuf) < 0)
return;
- map = mmap (NULL, statbuf.st_size, PROT_READ, MAP_PRIVATE, fh, 0);
+ map = mmap (NULL, (size_t)statbuf.st_size, PROT_READ, MAP_PRIVATE, fh, 0);
if (map == MAP_FAILED)
return;
@@ -306,7 +306,7 @@ scrollback_load (session *sess)
begin = map;
while (begin < end_