Fix building as c89

This commit is contained in:
TingPing
2014-12-17 18:49:59 -05:00
parent 3f855f07f5
commit 95febd978c
45 changed files with 347 additions and 369 deletions

View File

@@ -220,7 +220,7 @@ cfg_put_str (int fh, char *var, char *value)
char buf[512];
int len;
snprintf (buf, sizeof buf, "%s = %s\n", var, value);
g_snprintf (buf, sizeof buf, "%s = %s\n", var, value);
len = strlen (buf);
return (write (fh, buf, len) == len);
}
@@ -231,7 +231,7 @@ cfg_put_color (int fh, int r, int g, int b, char *var)
char buf[400];
int len;
snprintf (buf, sizeof buf, "%s = %04x %04x %04x\n", var, r, g, b);
g_snprintf (buf, sizeof buf, "%s = %04x %04x %04x\n", var, r, g, b);
len = strlen (buf);
return (write (fh, buf, len) == len);
}
@@ -245,7 +245,7 @@ cfg_put_int (int fh, int value, char *var)
if (value == -1)
value = 1;
snprintf (buf, sizeof buf, "%s = %d\n", var, value);
g_snprintf (buf, sizeof buf, "%s = %d\n", var, value);
len = strlen (buf);
return (write (fh, buf, len) == len);
}
@@ -843,7 +843,7 @@ load_default_config(void)
#ifdef WIN32
if (portable_mode () || SHGetKnownFolderPath (&FOLDERID_Downloads, 0, NULL, &roaming_path_wide) != S_OK)
{
snprintf (prefs.hex_dcc_dir, sizeof (prefs.hex_dcc_dir), "%s\\downloads", get_xdir ());
g_snprintf (prefs.hex_dcc_dir, sizeof (prefs.hex_dcc_dir), "%s\\downloads", get_xdir ());
}
else
{

View File

@@ -368,10 +368,10 @@ chanopt_save_one_channel (chanopt_in_memory *co, int fh)
char buf[256];
guint8 val;
snprintf (buf, sizeof (buf), "%s = %s\n", "network", co->network);
g_snprintf (buf, sizeof (buf), "%s = %s\n", "network", co->network);
write (fh, buf, strlen (buf));
snprintf (buf, sizeof (buf), "%s = %s\n", "channel", co->channel);
g_snprintf (buf, sizeof (buf), "%s = %s\n", "channel", co->channel);
write (fh, buf, strlen (buf));
i = 0;
@@ -380,7 +380,7 @@ chanopt_save_one_channel (chanopt_in_memory *co, int fh)
val = G_STRUCT_MEMBER (guint8, co, chanopt[i].offset);
if (val != SET_DEFAULT)
{
snprintf (buf, sizeof (buf), "%s = %d\n", chanopt[i].name, val);
g_snprintf (buf, sizeof (buf), "%s = %d\n", chanopt[i].name, val);
write (fh, buf, strlen (buf));
}
i++;

View File

@@ -139,10 +139,10 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
if (!g_ascii_strcasecmp (msg, "VERSION") && !prefs.hex_irc_hide_version)
{
#ifdef WIN32
snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" [x%d] / %s",
g_snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" [x%d] / %s",
get_cpu_arch (), get_sys_str (1));
#else
snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" / %s",
g_snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" / %s",
get_sys_str (1));
#endif
serv->p_nctcp (serv, nick, outbuf);

View File

@@ -93,7 +93,7 @@ hexchat_remote (void)
g_object_unref (dbus);
if (!hexchat_running) {
//dbus_g_connection_unref (connection);
/* dbus_g_connection_unref (connection); */
return;
}

View File

@@ -705,7 +705,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
do
{
n++;
snprintf (buf, sizeof (buf), "%s.%d", dcc->destfile, n);
g_snprintf (buf, sizeof (buf), "%s.%d", dcc->destfile, n);
}
while (g_access (buf, F_OK) == 0);
@@ -865,7 +865,7 @@ dcc_connect_finished (GIOChannel *source, GIOCondition condition, struct DCC *dc
return TRUE;
dcc->dccstat = STAT_ACTIVE;
snprintf (host, sizeof host, "%s:%d", net_ip (dcc->addr), dcc->port);
g_snprintf (host, sizeof host, "%s:%d", net_ip (dcc->addr), dcc->port);
switch (dcc->type)
{
@@ -984,7 +984,7 @@ dcc_wingate_proxy_traverse (GIOChannel *source, GIOCondition condition, struct D
struct proxy_state *proxy = dcc->proxy;
if (proxy->phase == 0)
{
proxy->buffersize = snprintf ((char*) proxy->buffer, MAX_PROXY_BUFFER,
proxy->buffersize = g_snprintf ((char*) proxy->buffer, MAX_PROXY_BUFFER,
"%s %d\r\n", net_ip(dcc->addr),
dcc->port);
proxy->bufferused = 0;
@@ -1282,16 +1282,16 @@ dcc_http_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
char auth_data2[68];
int n, n2;
n = snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n",
n = g_snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n",
net_ip(dcc->addr), dcc->port);
if (prefs.hex_net_proxy_auth)
{
n2 = snprintf (auth_data2, sizeof (auth_data2), "%s:%s",
n2 = g_snprintf (auth_data2, sizeof (auth_data2), "%s:%s",
prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass);
base64_encode (auth_data, auth_data2, n2);
n += snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data);
n += g_snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data);
}
n += snprintf (buf+n, sizeof (buf)-n, "\r\n");
n += g_snprintf (buf+n, sizeof (buf)-n, "\r\n");
proxy->buffersize = n;
proxy->bufferused = 0;
memcpy (proxy->buffer, buf, proxy->buffersize);
@@ -1402,12 +1402,12 @@ dcc_connect (struct DCC *dcc)
}
/* possible problems with filenames containing spaces? */
if (dcc->type == TYPE_RECV)
snprintf (tbuf, sizeof (tbuf), strchr (dcc->file, ' ') ?
g_snprintf (tbuf, sizeof (tbuf), strchr (dcc->file, ' ') ?
"DCC SEND \"%s\" %u %d %" G_GUINT64_FORMAT " %d" :
"DCC SEND %s %u %d %" G_GUINT64_FORMAT " %d", dcc->file,
dcc->addr, dcc->port, dcc->size, dcc->pasvid);
else
snprintf (tbuf, sizeof (tbuf), "DCC CHAT chat %u %d %d",
g_snprintf (tbuf, sizeof (tbuf), "DCC CHAT chat %u %d %d",
dcc->addr, dcc->port, dcc->pasvid);
dcc->serv->p_ctcp (dcc->serv, dcc->nick, tbuf);
}
@@ -1605,7 +1605,7 @@ dcc_accept (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
dcc->lasttime = dcc->starttime = time (0);
dcc->fastsend = prefs.hex_dcc_fast_send;
snprintf (host, sizeof (host), "%s:%d", net_ip (dcc->addr), dcc->port);
g_snprintf (host, sizeof (host), "%s:%d", net_ip (dcc->addr), dcc->port);
switch (dcc->type)
{
@@ -1898,7 +1898,7 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas
if (passive)
{
dcc->pasvid = new_id();
snprintf (outbuf, sizeof (outbuf), (havespaces) ?
g_snprintf (outbuf, sizeof (outbuf), (havespaces) ?
"DCC SEND \"%s\" 199 0 %" G_GUINT64_FORMAT " %d" :
"DCC SEND %s 199 0 %" G_GUINT64_FORMAT " %d",
file_part (dcc->file),
@@ -1906,7 +1906,7 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas
}
else
{
snprintf (outbuf, sizeof (outbuf), (havespaces) ?
g_snprintf (outbuf, sizeof (outbuf), (havespaces) ?
"DCC SEND \"%s\" %u %d %" G_GUINT64_FORMAT :
"DCC SEND %s %u %d %" G_GUINT64_FORMAT,
file_part (dcc->file), dcc->addr,
@@ -2309,11 +2309,11 @@ dcc_chat (struct session *sess, char *nick, int passive)
if (passive)
{
dcc->pasvid = new_id ();
snprintf (outbuf, sizeof (outbuf), "DCC CHAT chat 199 %d %d",
g_snprintf (outbuf, sizeof (outbuf), "DCC CHAT chat 199 %d %d",
dcc->port, dcc->pasvid);
} else
{
snprintf (outbuf, sizeof (outbuf), "DCC CHAT chat %u %d",
g_snprintf (outbuf, sizeof (outbuf), "DCC CHAT chat %u %d",
dcc->addr, dcc->port);
}
dcc->serv->p_ctcp (dcc->serv, nick, outbuf);
@@ -2339,7 +2339,7 @@ dcc_resume (struct DCC *dcc)
{
dcc->resume_sent = 1;
/* filename contains spaces? Quote them! */
snprintf (tbuf, sizeof (tbuf) - 10, strchr (dcc->file, ' ') ?
g_snprintf (tbuf, sizeof (tbuf) - 10, strchr (dcc->file, ' ') ?
"DCC RESUME \"%s\" %d %" G_GUINT64_FORMAT :
"DCC RESUME %s %d %" G_GUINT64_FORMAT,
dcc->file, dcc->port, dcc->resumable);
@@ -2416,7 +2416,7 @@ dcc_add_chat (session *sess, char *nick, int port, guint32 addr, int pasvid)
else
{
char buff[128];
snprintf (buff, sizeof (buff), "%s is offering DCC Chat. Do you want to accept?", nick);
g_snprintf (buff, sizeof (buff), "%s is offering DCC Chat. Do you want to accept?", nick);
fe_confirm (buff, dcc_confirm_chat, dcc_deny_chat, dcc);
}
}
@@ -2475,7 +2475,7 @@ dcc_add_file (session *sess, char *file, guint64 size, int port, char *nick, gui
if (prefs.hex_dcc_auto_recv == 1)
{
snprintf (tbuf, sizeof (tbuf), _("%s is offering \"%s\". Do you want to accept?"), nick, file);
g_snprintf (tbuf, sizeof (tbuf), _("%s is offering \"%s\". Do you want to accept?"), nick, file);
fe_confirm (tbuf, dcc_confirm_send, dcc_deny_send, dcc);
}
else if (prefs.hex_dcc_auto_recv == 2)
@@ -2490,7 +2490,7 @@ dcc_add_file (session *sess, char *file, guint64 size, int port, char *nick, gui
fe_dcc_add (dcc);
}
sprintf (tbuf, "%" G_GUINT64_FORMAT, size);
snprintf (tbuf + 24, 300, "%s:%d", net_ip (addr), port);
g_snprintf (tbuf + 24, 300, "%s:%d", net_ip (addr), port);
EMIT_SIGNAL (XP_TE_DCCSENDOFFER, sess->server->front_session, nick,
file, tbuf, tbuf + 24, 0);
@@ -2582,12 +2582,12 @@ handle_dcc (struct session *sess, char *nick, char *word[], char *word_eol[],
/* Checking if dcc is passive and if filename contains spaces */
if (dcc->pasvid)
snprintf (tbuf, sizeof (tbuf), strchr (file_part (dcc->file), ' ') ?
g_snprintf (tbuf, sizeof (tbuf), strchr (file_part (dcc->file), ' ') ?
"DCC ACCEPT \"%s\" %d %" G_GUINT64_FORMAT " %d" :
"DCC ACCEPT %s %d %" G_GUINT64_FORMAT " %d",
file_part (dcc->file), port, dcc->resumable, dcc->pasvid);
else
snprintf (tbuf, sizeof (tbuf), strchr (file_part (dcc->file), ' ') ?
g_snprintf (tbuf, sizeof (tbuf), strchr (file_part (dcc->file), ' ') ?
"DCC ACCEPT \"%s\" %d %" G_GUINT64_FORMAT :
"DCC ACCEPT %s %d %" G_GUINT64_FORMAT,
file_part (dcc->file), port, dcc->resumable);

View File

@@ -280,7 +280,7 @@ lag_check (void)
}
else
{
snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim);
g_snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim);
serv->p_ping (serv, "", tbuf);
if (!serv->lag_sent)
@@ -821,7 +821,7 @@ xchat_init (void)
notify_load ();
ignore_load ();
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
"NAME %s~%s~\n" "CMD query %%s\n\n"\
"NAME %s~%s~\n" "CMD send %%s\n\n"\
"NAME %s~%s~\n" "CMD whois %%s %%s\n\n"\
@@ -877,7 +877,7 @@ xchat_init (void)
list_loadconf ("popup.conf", &popup_list, buf);
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
"NAME %s\n" "CMD part\n\n"
"NAME %s\n" "CMD getstr # join \"%s\"\n\n"
"NAME %s\n" "CMD quote LINKS\n\n"
@@ -891,7 +891,7 @@ xchat_init (void)
_("Hide Version"));
list_loadconf ("usermenu.conf", &usermenu_list, buf);
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
"NAME %s\n" "CMD op %%a\n\n"
"NAME %s\n" "CMD deop %%a\n\n"
"NAME %s\n" "CMD ban %%s\n\n"
@@ -908,7 +908,7 @@ xchat_init (void)
_("Dialog"));
list_loadconf ("buttons.conf", &button_list, buf);
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
"NAME %s\n" "CMD whois %%s %%s\n\n"
"NAME %s\n" "CMD send %%s\n\n"
"NAME %s\n" "CMD dcc chat %%s\n\n"

View File

@@ -38,14 +38,6 @@
#include "history.h"
#ifndef HAVE_SNPRINTF
#define snprintf g_snprintf
#endif
#ifndef HAVE_VSNPRINTF
#define vsnprintf _vsnprintf
#endif
#ifdef SOCKS
#ifdef __sgi
#include <sys/time.h>

View File

@@ -82,7 +82,7 @@ identd (char *username)
EMIT_SIGNAL (XP_TE_IDENTD, current_sess, inet_ntoa (addr.sin_addr), username, NULL, NULL, 0);
#endif
inet_ntop (AF_INET, &addr.sin_addr, ipbuf, sizeof (ipbuf));
snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username);
g_snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username);
PrintText (current_sess, outbuf);
recv (read_sok, buf, sizeof (buf) - 1, 0);
@@ -91,7 +91,7 @@ identd (char *username)
p = strchr (buf, ',');
if (p)
{
snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n",
g_snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n",
atoi (buf), atoi (p + 1), username);
outbuf[sizeof (outbuf) - 1] = 0; /* ensure null termination */
send (read_sok, outbuf, strlen (outbuf), 0);
@@ -155,7 +155,7 @@ identd_ipv6 (char *username)
identd_ipv6_is_running = FALSE;
inet_ntop (AF_INET6, &addr.sin6_addr, ipbuf, sizeof (ipbuf));
snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username);
g_snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username);
PrintText (current_sess, outbuf);
recv (read_sok, buf, sizeof (buf) - 1, 0);
@@ -164,7 +164,7 @@ identd_ipv6 (char *username)
p = strchr (buf, ',');
if (p)
{
snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n", atoi (buf), atoi (p + 1), username);
g_snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n", atoi (buf), atoi (p + 1), username);
outbuf[sizeof (outbuf) - 1] = 0; /* ensure null termination */
send (read_sok, outbuf, strlen (outbuf), 0);
}

View File

@@ -122,7 +122,7 @@ ignore_showlist (session *sess)
ig = list->data;
i++;
snprintf (tbuf, sizeof (tbuf), " %-25s ", ig->mask);
g_snprintf (tbuf, sizeof (tbuf), " %-25s ", ig->mask);
if (ig->type & IG_PRIV)
strcat (tbuf, _("YES "));
else
@@ -319,7 +319,7 @@ ignore_save ()
ig = (struct ignore *) temp->data;
if (!(ig->type & IG_NOSAVE))
{
snprintf (buf, sizeof (buf), "mask = %s\ntype = %u\n\n",
g_snprintf (buf, sizeof (buf), "mask = %s\ntype = %u\n\n",
ig->mask, ig->type);
write (fh, buf, strlen (buf));
}
@@ -372,9 +372,9 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
for (i = 0; i < 128; i++)
if (ip[i] == '@')
break;
snprintf (real_ip, sizeof (real_ip), "*!*%s", &ip[i]);
g_snprintf (real_ip, sizeof (real_ip), "*!*%s", &ip[i]);
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
_("You are being CTCP flooded from %s, ignoring %s\n"),
nick, real_ip);
PrintText (sess, buf);
@@ -399,7 +399,7 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
serv->msg_counter++;
if (serv->msg_counter == prefs.hex_flood_msg_num) /*if we reached the maximun numbers of ctcp in the seconds limits */
{
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
_("You are being MSG flooded from %s, setting gui_autoopen_dialog OFF.\n"),
ip);
PrintText (sess, buf);

View File

@@ -184,7 +184,7 @@ inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
(!sess->topic || strcmp(sess->topic, ip)))
{
char tbuf[1024];
snprintf (tbuf, sizeof (tbuf), "[%s has address %s]\n", from, ip);
g_snprintf (tbuf, sizeof (tbuf), "[%s has address %s]\n", from, ip);
write (sess->logfd, tbuf, strlen (tbuf));
}
set_topic (sess, ip, ip);
@@ -914,7 +914,7 @@ inbound_ping_reply (session *sess, char *timestring, char *from,
tags_data->timestamp);
} else
{
snprintf (outbuf, sizeof (outbuf), "%ld.%03ld", dif / 1000, dif % 1000);
g_snprintf (outbuf, sizeof (outbuf), "%ld.%03ld", dif / 1000, dif % 1000);
EMIT_SIGNAL_TIMESTAMP (XP_TE_PINGREP, sess, from, outbuf, NULL, NULL, 0,
tags_data->timestamp);
}

View File

@@ -341,9 +341,9 @@ notify_watch (server * serv, char *nick, int add)
addchar = '-';
if (serv->supports_monitor)
snprintf (tbuf, sizeof (tbuf), "MONITOR %c %s", addchar, nick);
g_snprintf (tbuf, sizeof (tbuf), "MONITOR %c %s", addchar, nick);
else if (serv->supports_watch)
snprintf (tbuf, sizeof (tbuf), "WATCH %c%s", addchar, nick);
g_snprintf (tbuf, sizeof (tbuf), "WATCH %c%s", addchar, nick);
else
return;
@@ -556,9 +556,9 @@ notify_showlist (struct session *sess, const message_tags_data *tags_data)
notify = (struct notify *) list->data;
servnot = notify_find_server_entry (notify, sess->server);
if (servnot && servnot->ison)
snprintf (outbuf, sizeof (outbuf), _(" %-20s online\n"), notify->name);
g_snprintf (outbuf, sizeof (outbuf), _(" %-20s online\n"), notify->name);
else
snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name);
g_snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name);
PrintTextTimeStamp (sess, outbuf, tags_data->timestamp);
list = list->next;
}

View File

@@ -481,19 +481,19 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
switch (type)
{
case 0:
snprintf (buf, sizeof (buf), "%s %s *!*@%s.*", mode, p2, domain);
g_snprintf (buf, sizeof (buf), "%s %s *!*@%s.*", mode, p2, domain);
break;
case 1:
snprintf (buf, sizeof (buf), "%s %s *!*@%s", mode, p2, fullhost);
g_snprintf (buf, sizeof (buf), "%s %s *!*@%s", mode, p2, fullhost);
break;
case 2:
snprintf (buf, sizeof (buf), "%s %s *!%s@%s.*", mode, p2, username, domain);
g_snprintf (buf, sizeof (buf), "%s %s *!%s@%s.*", mode, p2, username, domain);
break;
case 3:
snprintf (buf, sizeof (buf), "%s %s *!%s@%s", mode, p2, username, fullhost);
g_snprintf (buf, sizeof (buf), "%s %s *!%s@%s", mode, p2, username, fullhost);
break;
}
} else
@@ -501,26 +501,26 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
switch (type)
{
case 0:
snprintf (buf, sizeof (buf), "%s %s *!*@*%s", mode, p2, domain);
g_snprintf (buf, sizeof (buf), "%s %s *!*@*%s", mode, p2, domain);
break;
case 1:
snprintf (buf, sizeof (buf), "%s %s *!*@%s", mode, p2, fullhost);
g_snprintf (buf, sizeof (buf), "%s %s *!*@%s", mode, p2, fullhost);
break;
case 2:
snprintf (buf, sizeof (buf), "%s %s *!%s@*%s", mode, p2, username, domain);
g_snprintf (buf, sizeof (buf), "%s %s *!%s@*%s", mode, p2, username, domain);
break;
case 3:
snprintf (buf, sizeof (buf), "%s %s *!%s@%s", mode, p2, username, fullhost);
g_snprintf (buf, sizeof (buf), "%s %s *!%s@%s", mode, p2, username, fullhost);
break;
}
}
} else
{
snprintf (buf, sizeof (buf), "%s %s", mode, mask);
g_snprintf (buf, sizeof (buf), "%s %s", mode, mask);
}
return g_strdup (buf);
@@ -1108,9 +1108,9 @@ menu_del_children (char *path, char *label)
if (!label)
label = "";
if (path[0])
snprintf (buf, sizeof (buf), "%s/%s", path, label);
g_snprintf (buf, sizeof (buf), "%s/%s", path, label);
else
snprintf (buf, sizeof (buf), "%s", label);
g_snprintf (buf, sizeof (buf), "%s", label);
list = menu_list;
while (list)
@@ -1929,7 +1929,7 @@ get_bool_cb (int val, getvalinfo *info)
{
char buf[512];
snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
g_snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
if (is_session (info->sess))
handle_command (info->sess, buf, FALSE);
@@ -1961,7 +1961,7 @@ get_int_cb (int cancel, int val, getvalinfo *info)
if (!cancel)
{
snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
g_snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
if (is_session (info->sess))
handle_command (info->sess, buf, FALSE);
}
@@ -1996,7 +1996,7 @@ get_file_cb (char *cmd, char *file)
no args */
if (file)
{
snprintf (buf, sizeof (buf), "%s %s", cmd, file);
g_snprintf (buf, sizeof (buf), "%s %s", cmd, file);
handle_command (current_sess, buf, FALSE);
}
else
@@ -2045,7 +2045,7 @@ get_str_cb (int cancel, char *val, getvalinfo *info)
if (!cancel)
{
snprintf (buf, sizeof (buf), "%s %s", info->cmd, val);
g_snprintf (buf, sizeof (buf), "%s %s", info->cmd, val);
if (is_session (info->sess))
handle_command (info->sess, buf, FALSE);
}
@@ -2282,7 +2282,7 @@ cmd_ignore (struct session *sess, char *tbuf, char *word[], char *word_eol[])
strchr (mask, '*') == NULL)
{
mask = tbuf;
snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
g_snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
}
i = ignore_add (mask, type, TRUE);
@@ -2640,7 +2640,7 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[])
return TRUE;
}
snprintf (tbuf, TBUFSIZE, "\001ACTION %s\001\r", act);
g_snprintf (tbuf, TBUFSIZE, "\001ACTION %s\001\r", act);
/* first try through DCC CHAT */
if (dcc_write_chat (sess->channel, tbuf))
{
@@ -2980,7 +2980,7 @@ cmd_ping (struct session *sess, char *tbuf, char *word[], char *word_eol[])
tim = make_ping_time ();
snprintf (timestring, sizeof (timestring), "%lu", tim);
g_snprintf (timestring, sizeof (timestring), "%lu", tim);
sess->server->p_ping (sess->server, to, timestring);
return TRUE;
@@ -3220,9 +3220,9 @@ cmd_send (struct session *sess, char *tbuf, char *word[], char *word_eol[])
if ((addr & 0xffff0000) == 0xc0a80000 || /* 192.168.x.x */
(addr & 0xff000000) == 0x0a000000) /* 10.x.x.x */
/* we got a private net address, let's PSEND or it'll fail */
snprintf (tbuf, 512, "DCC PSEND %s", word_eol[2]);
g_snprintf (tbuf, 512, "DCC PSEND %s", word_eol[2]);
else
snprintf (tbuf, 512, "DCC SEND %s", word_eol[2]);
g_snprintf (tbuf, 512, "DCC SEND %s", word_eol[2]);
handle_command (sess, tbuf, FALSE);
@@ -3522,7 +3522,7 @@ cmd_unignore (struct session *sess, char *tbuf, char *word[],
if (strchr (mask, '?') == NULL && strchr (mask, '*') == NULL)
{
mask = tbuf;
snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
g_snprintf (tbuf, TBUFSIZE, "%s!*@*", word[2]);
}
if (ignore_del (mask, NULL))
@@ -4085,7 +4085,7 @@ usercommand_show_help (session *sess, char *name)
pop = (struct popup *) list->data;
if (!g_ascii_strcasecmp (pop->name, name))
{
snprintf (buf, sizeof(buf), _("User Command for: %s\n"), pop->cmd);
g_snprintf (buf, sizeof(buf), _("User Command for: %s\n"), pop->cmd);
PrintText (sess, buf);
found = TRUE;
@@ -4112,7 +4112,7 @@ help (session *sess, char *tbuf, char *helpcmd, int quiet)
{
if (cmd->help)
{
snprintf (tbuf, TBUFSIZE, _("Usage: %s\n"), _(cmd->help));
g_snprintf (tbuf, TBUFSIZE, _("Usage: %s\n"), _(cmd->help));
PrintText (sess, tbuf);
} else
{
@@ -4241,7 +4241,7 @@ auto_insert (char *dest, gsize destlen, unsigned char *src, char *word[],
case 'y':
now = time (0);
tm_ptr = localtime (&now);
snprintf (buf, sizeof (buf), "%4d%02d%02d", 1900 +
g_snprintf (buf, sizeof (buf), "%4d%02d%02d", 1900 +
tm_ptr->tm_year, 1 + tm_ptr->tm_mon, tm_ptr->tm_mday);
utf = buf;
break;
@@ -4394,7 +4394,7 @@ nick_comp_cb (struct User *user, nickdata *data)
lenu = strlen (user->nick);
if (lenu == data->len)
{
snprintf (data->tbuf, TBUFSIZE, "%s%s", user->nick, data->space);
g_snprintf (data->tbuf, TBUFSIZE, "%s%s", user->nick, data->space);
data->len = -1;
return FALSE;
} else if (lenu < data->bestlen)
@@ -4438,7 +4438,7 @@ perform_nick_completion (struct session *sess, char *cmd, char *tbuf)
if (data.best)
{
snprintf (tbuf, TBUFSIZE, "%s%s", data.best->nick, space - 1);
g_snprintf (tbuf, TBUFSIZE, "%s%s", data.best->nick, space - 1);
return;
}
}

View File

@@ -1926,7 +1926,7 @@ hexchat_pluginpref_set_int (hexchat_plugin *pl, const char *var, int value)
{
char buffer[12];
snprintf (buffer, sizeof (buffer), "%d", value);
g_snprintf (buffer, sizeof (buffer), "%d", value);
return hexchat_pluginpref_set_str_real (pl, var, buffer, 1);
}

View File

@@ -429,7 +429,7 @@ irc_raw (server *serv, char *raw)
len = strlen (raw);
if (len < sizeof (tbuf) - 3)
{
len = snprintf (tbuf, sizeof (tbuf), "%s\r\n", raw);
len = g_snprintf (tbuf, sizeof (tbuf), "%s\r\n", raw);
tcp_send_len (serv, tbuf, len);
} else
{
@@ -590,7 +590,7 @@ process_numeric (session * sess, int n,
char *tim;
char outbuf[64];
snprintf (outbuf, sizeof (outbuf),
g_snprintf (outbuf, sizeof (outbuf),
"%02ld:%02ld:%02ld", idle / 3600, (idle / 60) % 60,
idle % 60);
if (timestamp == 0)

View File

@@ -281,7 +281,7 @@ tcp_sendf (server *serv, const char *fmt, ...)
int len;
va_start (args, fmt);
len = vsnprintf (send_buf, sizeof (send_buf) - 1, fmt, args);
len = g_vsnprintf (send_buf, sizeof (send_buf) - 1, fmt, args);
va_end (args);
send_buf[sizeof (send_buf) - 1] = '\0';
@@ -591,7 +591,7 @@ ssl_cb_info (SSL * s, int where, int ret)
return; /* FIXME: make debug level adjustable in serverlist or settings */
/* snprintf (buf, sizeof (buf), "%s (%d)", SSL_state_string_long (s), where);
/* g_snprintf (buf, sizeof (buf), "%s (%d)", SSL_state_string_long (s), where);
if (g_sess)
EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
else
@@ -611,9 +611,9 @@ ssl_cb_verify (int ok, X509_STORE_CTX * ctx)
X509_NAME_oneline (X509_get_issuer_name (ctx->current_cert), issuer,
sizeof (issuer));
snprintf (buf, sizeof (buf), "* Subject: %s", subject);
g_snprintf (buf, sizeof (buf), "* Subject: %s", subject);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
snprintf (buf, sizeof (buf), "* Issuer: %s", issuer);
g_snprintf (buf, sizeof (buf), "* Issuer: %s", issuer);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
return (TRUE); /* always ok */
@@ -634,7 +634,7 @@ ssl_do_connect (server * serv)
if ((err = ERR_get_error ()) > 0)
{
ERR_error_string (err, err_buf);
snprintf (buf, sizeof (buf), "(%d) %s", err, err_buf);
g_snprintf (buf, sizeof (buf), "(%d) %s", err, err_buf);
EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL,
NULL, NULL, 0);
@@ -660,59 +660,59 @@ ssl_do_connect (server * serv)
if (!_SSL_get_cert_info (&cert_info, serv->ssl))
{
snprintf (buf, sizeof (buf), "* Certification info:");
g_snprintf (buf, sizeof (buf), "* Certification info:");
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
snprintf (buf, sizeof (buf), " Subject:");
g_snprintf (buf, sizeof (buf), " Subject:");
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
for (i = 0; cert_info.subject_word[i]; i++)
{
snprintf (buf, sizeof (buf), " %s", cert_info.subject_word[i]);
g_snprintf (buf, sizeof (buf), " %s", cert_info.subject_word[i]);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
}
snprintf (buf, sizeof (buf), " Issuer:");
g_snprintf (buf, sizeof (buf), " Issuer:");
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
for (i = 0; cert_info.issuer_word[i]; i++)
{
snprintf (buf, sizeof (buf), " %s", cert_info.issuer_word[i]);
g_snprintf (buf, sizeof (buf), " %s", cert_info.issuer_word[i]);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
}
snprintf (buf, sizeof (buf), " Public key algorithm: %s (%d bits)",
g_snprintf (buf, sizeof (buf), " Public key algorithm: %s (%d bits)",
cert_info.algorithm, cert_info.algorithm_bits);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
/*if (cert_info.rsa_tmp_bits)
{
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
" Public key algorithm uses ephemeral key with %d bits",
cert_info.rsa_tmp_bits);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
}*/
snprintf (buf, sizeof (buf), " Sign algorithm %s",
g_snprintf (buf, sizeof (buf), " Sign algorithm %s",
cert_info.sign_algorithm/*, cert_info.sign_algorithm_bits*/);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
snprintf (buf, sizeof (buf), " Valid since %s to %s",
g_snprintf (buf, sizeof (buf), " Valid since %s to %s",
cert_info.notbefore, cert_info.notafter);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
} else
{
snprintf (buf, sizeof (buf), " * No Certificate");
g_snprintf (buf, sizeof (buf), " * No Certificate");
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
}
chiper_info = _SSL_get_cipher_info (serv->ssl); /* static buffer */
snprintf (buf, sizeof (buf), "* Cipher info:");
g_snprintf (buf, sizeof (buf), "* Cipher info:");
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL,
0);
snprintf (buf, sizeof (buf), " Version: %s, cipher %s (%u bits)",
g_snprintf (buf, sizeof (buf), " Version: %s, cipher %s (%u bits)",
chiper_info->version, chiper_info->chiper,
chiper_info->chiper_bits);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL,
@@ -727,7 +727,7 @@ ssl_do_connect (server * serv)
int hostname_err;
if ((hostname_err = _SSL_check_hostname(cert, serv->hostname)) != 0)
{
snprintf (buf, sizeof (buf), "* Verify E: Failed to validate hostname? (%d)%s",
g_snprintf (buf, sizeof (buf), "* Verify E: Failed to validate hostname? (%d)%s",
hostname_err, serv->accept_invalid_cert ? " -- Ignored" : "");
if (serv->accept_invalid_cert)
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0);
@@ -736,7 +736,7 @@ ssl_do_connect (server * serv)
}
break;
}
/* snprintf (buf, sizeof (buf), "* Verify OK (?)"); */
/* g_snprintf (buf, sizeof (buf), "* Verify OK (?)"); */
/* EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); */
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
@@ -745,7 +745,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",
g_snprintf (buf, sizeof (buf), "* Verify E: %s.? (%d) -- Ignored",
X509_verify_cert_error_string (verify_error),
verify_error);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
@@ -753,7 +753,7 @@ ssl_do_connect (server * serv)
break;
}
default:
snprintf (buf, sizeof (buf), "%s.? (%d)",
g_snprintf (buf, sizeof (buf), "%s.? (%d)",
X509_verify_cert_error_string (verify_error),
verify_error);
conn_fail:
@@ -775,7 +775,7 @@ conn_fail:
{
if (serv->ssl->session && serv->ssl->session->time + SSLTMOUT < time (NULL))
{
snprintf (buf, sizeof (buf), "SSL handshake timed out");
g_snprintf (buf, sizeof (buf), "SSL handshake timed out");
EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL,
NULL, NULL, 0);
server_cleanup (serv); /* ->connecting = FALSE */
@@ -970,11 +970,11 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
}
}
#else
snprintf (outbuf, sizeof (outbuf), "%s/auth/xchat_auth",
g_snprintf (outbuf, sizeof (outbuf), "%s/auth/xchat_auth",
g_get_home_dir ());
if (access (outbuf, X_OK) == 0)
{
snprintf (outbuf, sizeof (outbuf), "exec -d %s/auth/xchat_auth %s",
g_snprintf (outbuf, sizeof (outbuf), "exec -d %s/auth/xchat_auth %s",
g_get_home_dir (), prefs.hex_irc_user_name);
handle_command (serv->server_session, outbuf, FALSE);
}
@@ -1198,7 +1198,7 @@ traverse_socks (int print_fd, int sok, char *serverAddr, int port)
if (buf[1] == 90)
return 0;
snprintf (buf, sizeof (buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]);
g_snprintf (buf, sizeof (buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]);
proxy_error (print_fd, buf);
return 1;
}
@@ -1299,9 +1299,9 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port)
if (buf[0] != 5 || buf[1] != 0)
{
if (buf[1] == 2)
snprintf (buf, sizeof (buf), "SOCKS\tProxy refused to connect to host (not allowed).\n");
g_snprintf (buf, sizeof (buf), "SOCKS\tProxy refused to connect to host (not allowed).\n");
else
snprintf (buf, sizeof (buf), "SOCKS\tProxy failed to connect to host (error %d).\n", buf[1]);
g_snprintf (buf, sizeof (buf), "SOCKS\tProxy failed to connect to host (error %d).\n", buf[1]);
proxy_error (print_fd, buf);
return 1;
}
@@ -1334,7 +1334,7 @@ traverse_wingate (int print_fd, int sok, char *serverAddr, int port)
{
char buf[128];
snprintf (buf, sizeof (buf), "%s %d\r\n", serverAddr, port);
g_snprintf (buf, sizeof (buf), "%s %d\r\n", serverAddr, port);
send (sok, buf, strlen (buf), 0);
return 0;
@@ -1422,16 +1422,16 @@ traverse_http (int print_fd, int sok, char *serverAddr, int port)
char auth_data2[252];
int n, n2;
n = snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n",
n = g_snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n",
serverAddr, port);
if (prefs.hex_net_proxy_auth)
{
n2 = snprintf (auth_data2, sizeof (auth_data2), "%s:%s",
n2 = g_snprintf (auth_data2, sizeof (auth_data2), "%s:%s",
prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass);
base64_encode (auth_data, auth_data2, n2);
n += snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data);
n += g_snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data);
}
n += snprintf (buf+n, sizeof (buf)-n, "\r\n");
n += g_snprintf (buf+n, sizeof (buf)-n, "\r\n");
send (sok, buf, n, 0);
n = http_read_line (print_fd, sok, buf, sizeof (buf));
@@ -1504,7 +1504,7 @@ server_child (server * serv)
local_ip = net_resolve (ns_local, prefs.hex_net_bind_host, 0, &real_hostname);
if (local_ip != NULL)
{
snprintf (buf, sizeof (buf), "5\n%s\n", local_ip);
g_snprintf (buf, sizeof (buf), "5\n%s\n", local_ip);
write (serv->childwrite, buf, strlen (buf));
net_bind (ns_local, serv->sok4, serv->sok6);
bound = 1;
@@ -1567,7 +1567,7 @@ server_child (server * serv)
/* first resolve where we want to connect to */
if (proxy_type > 0)
{
snprintf (buf, sizeof (buf), "9\n%s\n", proxy_host);
g_snprintf (buf, sizeof (buf), "9\n%s\n", proxy_host);
write (serv->childwrite, buf, strlen (buf));
ip = net_resolve (ns_server, proxy_host, proxy_port, &real_hostname);
g_free (proxy_host);
@@ -1601,7 +1601,7 @@ server_child (server * serv)
connect_port = port;
}
snprintf (buf, sizeof (buf), "3\n%s\n%s\n%d\n",
g_snprintf (buf, sizeof (buf), "3\n%s\n%s\n%d\n",
real_hostname, ip, connect_port);
write (serv->childwrite, buf, strlen (buf));
@@ -1615,7 +1615,7 @@ server_child (server * serv)
if (error != 0)
{
snprintf (buf, sizeof (buf), "2\n%d\n", sock_error ());
g_snprintf (buf, sizeof (buf), "2\n%d\n", sock_error ());
write (serv->childwrite, buf, strlen (buf));
} else
{
@@ -1627,11 +1627,11 @@ server_child (server * serv)
case 0: /* success */
#ifdef USE_MSPROXY
if (!serv->dont_use_proxy && (proxy_type == 5))
snprintf (buf, sizeof (buf), "4\n%d %d %d %d %d\n", sok, psok, serv->msp_state.clientid, serv->msp_state.serverid,
g_snprintf (buf, sizeof (buf), "4\n%d %d %d %d %d\n", sok, psok, serv->msp_state.clientid, serv->msp_state.serverid,
serv->msp_state.seq_sent);
else
#endif
snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */
g_snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */
write (serv->childwrite, buf, strlen (buf));
break;
case 1: /* socks traversal failed */
@@ -1640,7 +1640,7 @@ server_child (server * serv)
}
} else
{
snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */
g_snprintf (buf, sizeof (buf), "4\n%d\n", sok); /* success */
write (serv->childwrite, buf, strlen (buf));
}
}

View File

@@ -319,9 +319,9 @@ scrollback_load (session *sess)
if (buf[0] == 'T')
{
if (sizeof (time_t) == 4)
stamp = strtoul (buf + 2, NULL, 10);
stamp = g_ascii_strtoull (buf + 2, NULL, 10);
else
stamp = strtoull (buf + 2, NULL, 10); /* in case time_t is 64 bits */
stamp = g_ascii_strtoull (buf + 2, NULL, 10); /* in case time_t is 64 bits */
text = strchr (buf + 3, ' ');
if (text && text[1])
{
@@ -383,7 +383,7 @@ log_close (session *sess)
{
currenttime = time (NULL);
write (sess->logfd, obuf,
snprintf (obuf, sizeof (obuf) - 1, _("**** ENDING LOGGING AT %s\n"),
g_snprintf (obuf, sizeof (obuf) - 1, _("**** ENDING LOGGING AT %s\n"),
ctime (&currenttime)));
close (sess->logfd);
sess->logfd = -1;
@@ -570,11 +570,11 @@ log_create_pathname (char *servname, char *channame, char *netname)
/* create final path/filename */
if (logmask_is_fullpath ())
{
snprintf (fname, sizeof (fname), "%s", fnametime);
g_snprintf (fname, sizeof (fname), "%s", fnametime);
}
else /* relative path */
{
snprintf (fname, sizeof (fname), "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s", get_xdir (), fnametime);
g_snprintf (fname, sizeof (fname), "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s", get_xdir (), fnametime);
}
/* create all the subdirectories */
@@ -606,7 +606,7 @@ log_open_file (char *servname, char *channame, char *netname)
return -1;
currenttime = time (NULL);
write (fd, buf,
snprintf (buf, sizeof (buf), _("**** BEGIN LOGGING AT %s\n"),
g_snprintf (buf, sizeof (buf), _("**** BEGIN LOGGING AT %s\n"),
ctime (&currenttime)));
return fd;
@@ -998,7 +998,7 @@ PrintTextTimeStampf (session *sess, time_t timestamp, const char *format, ...)
Each XP_TE_* signal is hard coded to call text_emit which calls
display_event which decodes the data
This means that this system *should be faster* than snprintf because
This means that this system *should be faster* than g_snprintf because
it always 'knows' that format of the string (basically is preparses much
of the work)
@@ -1584,7 +1584,7 @@ pevent_make_pntevts ()
g_free (pntevts[i]);
if (pevt_build_string (pntevts_text[i], &(pntevts[i]), &m) != 0)
{
snprintf (out, sizeof (out),
g_snprintf (out, sizeof (out),
_("Error parsing event %s.\nLoading default."), te[i].name);
fe_message (out, FE_MSG_WARN);
g_free (pntevts_text[i]);
@@ -1725,7 +1725,7 @@ pevent_check_all_loaded ()
if (pntevts_text[i] == NULL)
{
/*printf ("%s\n", te[i].name);
snprintf(out, sizeof(out), "The data for event %s failed to load. Reverting to defaults.\nThis may be because a new version of HexChat is loading an old config file.\n\nCheck all print event texts are correct", evtnames[i]);
g_snprintf(out, sizeof(out), "The data for event %s failed to load. Reverting to defaults.\nThis may be because a new version of HexChat is loading an old config file.\n\nCheck all print event texts are correct", evtnames[i]);
gtkutil_simpledialog(out); */
/* make-te.c sets this 128 flag (DON'T call gettext() flag) */
if (te[i].num_args & 128)
@@ -1944,7 +1944,7 @@ pevt_build_string (const char *input, char **output, int *max_arg)
}
if (d < '1' || d > '9')
{
snprintf (o, sizeof (o), "Error, invalid argument $%c\n", d);
g_snprintf (o, sizeof (o), "Error, invalid argument $%c\n", d);
fe_message (o, FE_MSG_WARN);
goto err;
}
@@ -2064,7 +2064,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
if (prefs.hex_text_color_nicks && (index == XP_TE_CHANACTION || index == XP_TE_CHANMSG))
{
snprintf (tbuf, sizeof (tbuf), "\003%d%s", text_color_of (a), a);
g_snprintf (tbuf, sizeof (tbuf), "\003%d%s", text_color_of (a), a);
a = tbuf;
stripcolor_args &= ~ARG_FLAG(1); /* don't strip color from this argument */
}
@@ -2196,9 +2196,9 @@ pevent_save (char *fn)
for (i = 0; i < NUM_XP; i++)
{
write (fd, buf, snprintf (buf, sizeof (buf),
write (fd, buf, g_snprintf (buf, sizeof (buf),
"event_name=%s\n", te[i].name));
write (fd, buf, snprintf (buf, sizeof (buf),
write (fd, buf, g_snprintf (buf, sizeof (buf),
"event_text=%s\n\n", pntevts_text[i]));
}
@@ -2373,9 +2373,9 @@ sound_save ()
{
if (sound_files[i] && sound_files[i][0])
{
write (fd, buf, snprintf (buf, sizeof (buf),
write (fd, buf, g_snprintf (buf, sizeof (buf),
"event=%s\n", te[i].name));
write (fd, buf, snprintf (buf, sizeof (buf),
write (fd, buf, g_snprintf (buf, sizeof (buf),
"sound=%s\n\n", sound_files[i]));
}
}

View File

@@ -66,10 +66,6 @@
#endif
#endif
#ifndef HAVE_SNPRINTF
#define snprintf g_snprintf
#endif
char *
file_part (char *file)
{

View File

@@ -94,7 +94,7 @@ chanlist_update_caption (server *serv)
{
gchar tbuf[256];
snprintf (tbuf, sizeof tbuf,
g_snprintf (tbuf, sizeof tbuf,
_("Displaying %d/%d users on %d/%d channels."),
serv->gui->chanlist_users_shown_count,
serv->gui->chanlist_users_found_count,
@@ -456,7 +456,7 @@ chanlist_join (GtkWidget * wid, server *serv)
{
if (serv->connected && (strcmp (chan, "*") != 0))
{
snprintf (tbuf, sizeof (tbuf), "join %s", chan);
g_snprintf (tbuf, sizeof (tbuf), "join %s", chan);
handle_command (serv->server_session, tbuf, FALSE);
} else
gdk_beep ();
@@ -482,7 +482,7 @@ chanlist_filereq_done (server *serv, char *file)
if (fh == -1)
return;
snprintf (buf, sizeof buf, "HexChat Channel List: %s - %s\n",
g_snprintf (buf, sizeof buf, "HexChat Channel List: %s - %s\n",
serv->servername, ctime (&t));
write (fh, buf, strlen (buf));
@@ -494,7 +494,7 @@ chanlist_filereq_done (server *serv, char *file)
COL_CHANNEL, &chan,
COL_USERS, &users,
COL_TOPIC, &topic, -1);
snprintf (buf, sizeof buf, "%-16s %-5d%s\n", chan, users, topic);
g_snprintf (buf, sizeof buf, "%-16s %-5d%s\n", chan, users, topic);
g_free (chan);
g_free (topic);
write (fh, buf, strlen (buf));
@@ -717,7 +717,7 @@ chanlist_opengui (server *serv, int do_refresh)
return;
}
snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Channel List (%s)"),
g_snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Channel List (%s)"),
server_get_network (serv, TRUE));
serv->gui->chanlist_pending_rows = NULL;

View File

@@ -194,12 +194,12 @@ dcc_prepare_row_send (struct DCC *dcc, GtkListStore *store, GtkTreeIter *iter,
per = (float) ((dcc->ack * 100.00) / dcc->size);
proper_unit (dcc->size, size, sizeof (size));
proper_unit (dcc->pos, pos, sizeof (pos));
snprintf (kbs, sizeof (kbs), "%.1f", ((float)dcc->cps) / 1024);
snprintf (perc, sizeof (perc), "%.0f%%", per);
g_snprintf (kbs, sizeof (kbs), "%.1f", ((float)dcc->cps) / 1024);
g_snprintf (perc, sizeof (perc), "%.0f%%", per);
if (dcc->cps != 0)
{
to_go = (dcc->size - dcc->ack) / dcc->cps;
snprintf (eta, sizeof (eta), "%.2d:%.2d:%.2d",
g_snprintf (eta, sizeof (eta), "%.2d:%.2d:%.2d",
to_go / 3600, (to_go / 60) % 60, to_go % 60);
} else
strcpy (eta, "--:--:--");
@@ -252,14 +252,14 @@ dcc_prepare_row_recv (struct DCC *dcc, GtkListStore *store, GtkTreeIter *iter,
proper_unit (dcc->resumable, pos, sizeof (pos));
else
proper_unit (dcc->pos, pos, sizeof (pos));
snprintf (kbs, sizeof (kbs), "%.1f", ((float)dcc->cps) / 1024);
g_snprintf (kbs, sizeof (kbs), "%.1f", ((float)dcc->cps) / 1024);
/* percentage recv'ed */
per = (float) ((dcc->pos * 100.00) / dcc->size);
snprintf (perc, sizeof (perc), "%.0f%%", per);
g_snprintf (perc, sizeof (perc), "%.0f%%", per);
if (dcc->cps != 0)
{
to_go = (dcc->size - dcc->pos) / dcc->cps;
snprintf (eta, sizeof (eta), "%.2d:%.2d:%.2d",
g_snprintf (eta, sizeof (eta), "%.2d:%.2d:%.2d",
to_go / 3600, (to_go / 60) % 60, to_go % 60);
} else
strcpy (eta, "--:--:--");
@@ -525,7 +525,7 @@ resume_clicked (GtkWidget * wid, gpointer none)
fe_message (_("That file is not resumable."), FE_MSG_ERROR);
break;
case 1:
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
_( "Cannot access file: %s\n"
"%s.\n"
"Resuming not possible."), dcc->destfile,
@@ -606,7 +606,7 @@ browse_folder (char *dir)
#else
char buf[512];
snprintf (buf, sizeof (buf), "file://%s", dir);
g_snprintf (buf, sizeof (buf), "file://%s", dir);
fe_open_url (buf);
#endif
}
@@ -639,7 +639,7 @@ dcc_details_populate (struct DCC *dcc)
gtk_label_set_text (GTK_LABEL (dccfwin.file_label), dcc->file);
/* address and port */
snprintf (buf, sizeof (buf), "%s : %d", net_ip (dcc->addr), dcc->port);
g_snprintf (buf, sizeof (buf), "%s : %d", net_ip (dcc->addr), dcc->port);
gtk_label_set_text (GTK_LABEL (dccfwin.address_label), buf);
}
@@ -737,7 +737,7 @@ dcc_detail_label (char *text, GtkWidget *box, int num)
char buf[64];
label = gtk_label_new (NULL);
snprintf (buf, sizeof (buf), "<b>%s</b>", text);
g_snprintf (buf, sizeof (buf), "<b>%s</b>", text);
gtk_label_set_markup (GTK_LABEL (label), buf);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
gtk_table_attach (GTK_TABLE (box), label, 0, 1, 0 + num, 1 + num, GTK_FILL, GTK_FILL, 0, 0);

View File

@@ -265,7 +265,7 @@ create_input_style (GtkStyle *style)
/* fall back */
if (pango_font_description_get_size (style->font_desc) == 0)
{
snprintf (buf, sizeof (buf), _("Failed to open font:\n\n%s"), prefs.hex_text_font);
g_snprintf (buf, sizeof (buf), _("Failed to open font:\n\n%s"), prefs.hex_text_font);
fe_message (buf, FE_MSG_ERROR);
pango_font_description_free (style->font_desc);
style->font_desc = pango_font_description_from_string ("sans 11");
@@ -746,9 +746,9 @@ fe_set_lag (server *serv, long lag)
if (per > 1.0)
per = 1.0;
snprintf (lagtext, sizeof (lagtext) - 1, "%s%ld.%lds",
g_snprintf (lagtext, sizeof (lagtext) - 1, "%s%ld.%lds",
serv->lag_sent ? "+" : "", lag / 1000, (lag/100) % 10);
snprintf (lagtip, sizeof (lagtip) - 1, "Lag: %s%ld.%ld seconds",
g_snprintf (lagtip, sizeof (lagtip) - 1, "Lag: %s%ld.%ld seconds",
serv->lag_sent ? "+" : "", lag / 1000, (lag/100) % 10);
while (list)
@@ -797,8 +797,8 @@ fe_set_throttle (server *serv)
sess = list->data;
if (sess->server == serv)
{
snprintf (tbuf, sizeof (tbuf) - 1, _("%d bytes"), serv->sendq_len);
snprintf (tip, sizeof (tip) - 1, _("Network send queue: %d bytes"), serv->sendq_len);
g_snprintf (tbuf, sizeof (tbuf) - 1, _("%d bytes"), serv->sendq_len);
g_snprintf (tip, sizeof (tip) - 1, _("Network send queue: %d bytes"), serv->sendq_len);
g_free (sess->res->queue_tip);
sess->res->queue_tip = g_strdup (tip);

View File

@@ -849,7 +849,7 @@ key_save_kbs (void)
0x180, XOF_DOMODE);
if (fd < 0)
return 1;
write (fd, buf, snprintf (buf, 510, "# HexChat key bindings config file\n\n"));
write (fd, buf, g_snprintf (buf, 510, "# HexChat key bindings config file\n\n"));
while (list)
{
@@ -857,17 +857,17 @@ key_save_kbs (void)
accel_text = gtk_accelerator_name (kb->keyval, kb->mod);
snprintf (buf, 510, "ACCEL=%s\n%s\n", accel_text, key_actions[kb->action].name);
g_snprintf (buf, 510, "ACCEL=%s\n%s\n", accel_text, key_actions[kb->action].name);
write (fd, buf, strlen (buf));
g_free (accel_text);
if (kb->data1 && kb->data1[0])
write (fd, buf, snprintf (buf, 510, "D1:%s\n", kb->data1));
write (fd, buf, g_snprintf (buf, 510, "D1:%s\n", kb->data1));
else
write (fd, "D1!\n", 4);
if (kb->data2 && kb->data2[0])
write (fd, buf, snprintf (buf, 510, "D2:%s\n", kb->data2));
write (fd, buf, g_snprintf (buf, 510, "D2:%s\n", kb->data2));
else
write (fd, "D2!\n", 4);
@@ -1813,9 +1813,9 @@ replace_handle (GtkWidget *t)
memcpy (outbuf, text, xlen);
outbuf[xlen] = 0;
if (postfix_pnt == NULL)
snprintf (word, sizeof (word), "%s", pop->cmd);
g_snprintf (word, sizeof (word), "%s", pop->cmd);
else
snprintf (word, sizeof (word), "%s%s", pop->cmd, postfix);
g_snprintf (word, sizeof (word), "%s%s", pop->cmd, postfix);
g_strlcat (outbuf, word, sizeof(outbuf));
SPELL_ENTRY_SET_TEXT (t, outbuf);
SPELL_ENTRY_SET_POS (t, -1);

View File

@@ -158,9 +158,9 @@ joind_show_dialog (server *serv)
gtk_widget_show (vbox2);
gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0);
snprintf (buf2, sizeof (buf2), _("Connection to %s complete."),
g_snprintf (buf2, sizeof (buf2), _("Connection to %s complete."),
server_get_network (serv, TRUE));
snprintf (buf, sizeof (buf), "\n<b>%s</b>", buf2);
g_snprintf (buf, sizeof (buf), "\n<b>%s</b>", buf2);
label = gtk_label_new (buf);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
@@ -198,7 +198,7 @@ joind_show_dialog (server *serv)
gtk_widget_show (entry1);
gtk_box_pack_start (GTK_BOX (hbox2), entry1, TRUE, TRUE, 8);
snprintf (buf, sizeof (buf), "<small> %s</small>",
g_snprintf (buf, sizeof (buf), "<small> %s</small>",
_("If you know the name of the channel you want to join, enter it here."));
label = gtk_label_new (buf);
gtk_widget_show (label);
@@ -212,7 +212,7 @@ joind_show_dialog (server *serv)
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton3), radiobutton1_group);
radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton3));
snprintf (buf, sizeof (buf), "<small> %s</small>",
g_snprintf (buf, sizeof (buf), "<small> %s</small>",
_("Retrieving the Channel-List may take a minute or two."));
label = gtk_label_new (buf);
gtk_widget_show (label);

View File

@@ -393,42 +393,42 @@ fe_set_title (session *sess)
switch (type)
{
case SESS_DIALOG:
snprintf (tbuf, sizeof (tbuf), DISPLAY_NAME": %s %s @ %s",
g_snprintf (tbuf, sizeof (tbuf), DISPLAY_NAME": %s %s @ %s",
_("Dialog with"), sess->channel, server_get_network (sess->server, TRUE));
break;
case SESS_SERVER:
snprintf (tbuf, sizeof (tbuf), DISPLAY_NAME": %s @ %s",
g_snprintf (tbuf, sizeof (tbuf), DISPLAY_NAME": %s @ %s",
sess->server->nick, server_get_network (sess->server, TRUE));
break;
case SESS_CHANNEL:
/* don't display keys in the titlebar */
if (prefs.hex_gui_win_modes)
{
snprintf (tbuf, sizeof (tbuf),
g_snprintf (tbuf, sizeof (tbuf),
DISPLAY_NAME": %s @ %s / %s (%s)",
sess->server->nick, server_get_network (sess->server, TRUE),
sess->channel, sess->current_modes ? sess->current_modes : "");
}
else
{
snprintf (tbuf, sizeof (tbuf),
g_snprintf (tbuf, sizeof (tbuf),
DISPLAY_NAME": %s @ %s / %s",
sess->server->nick, server_get_network (sess->server, TRUE),
sess->channel);
}
if (prefs.hex_gui_win_ucount)
{
snprintf (tbuf + strlen (tbuf), 9, " (%d)", sess->total);
g_snprintf (tbuf + strlen (tbuf), 9, " (%d)", sess->total);
}
break;
case SESS_NOTICES:
case SESS_SNOTICES:
snprintf (tbuf, sizeof (tbuf), DISPLAY_NAME": %s @ %s (notices)",
g_snprintf (tbuf, sizeof (tbuf), DISPLAY_NAME": %s @ %s (notices)",
sess->server->nick, server_get_network (sess->server, TRUE));
break;
default:
def:
snprintf (tbuf, sizeof (tbuf), DISPLAY_NAME);
g_snprintf (tbuf, sizeof (tbuf), DISPLAY_NAME);
gtk_window_set_title (GTK_WINDOW (sess->gui->window), tbuf);
return;
}
@@ -1567,7 +1567,7 @@ mg_create_tabmenu (session *sess, GdkEventButton *event, chan *ch)
if (sess)
{
char *name = g_markup_escape_text (sess->channel[0] ? sess->channel : _("<none>"), -1);
snprintf (buf, sizeof (buf), "<span foreground=\"#3344cc\"><b>%s</b></span>", name);
g_snprintf (buf, sizeof (buf), "<span foreground=\"#3344cc\"><b>%s</b></span>", name);
g_free (name);
item = gtk_menu_item_new_with_label ("");
@@ -1940,7 +1940,7 @@ flagl_hit (GtkWidget * wid, struct session *sess)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wid), FALSE);
return;
}
snprintf (modes, sizeof (modes), "+l %d", atoi (limit_str));
g_snprintf (modes, sizeof (modes), "+l %d", atoi (limit_str));
serv->p_mode (serv, sess->channel, modes);
serv->p_join_info (serv, sess->channel);
}
@@ -1956,7 +1956,7 @@ flagk_hit (GtkWidget * wid, struct session *sess)
if (serv->connected && sess->channel[0])
{
snprintf (modes, sizeof (modes), "-k %s",
g_snprintf (modes, sizeof (modes), "-k %s",
gtk_entry_get_text (GTK_ENTRY (sess->gui->key_entry)));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid)))
@@ -2022,7 +2022,7 @@ mg_key_entry_cb (GtkWidget * igad, gpointer userdata)
if (serv->connected && sess->channel[0])
{
snprintf (modes, sizeof (modes), "+k %s",
g_snprintf (modes, sizeof (modes), "+k %s",
gtk_entry_get_text (GTK_ENTRY (igad)));
serv->p_mode (serv, sess->channel, modes);
serv->p_join_info (serv, sess->channel);
@@ -2045,7 +2045,7 @@ mg_limit_entry_cb (GtkWidget * igad, gpointer userdata)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sess->gui->flag_l), FALSE);
return;
}
snprintf (modes, sizeof(modes), "+l %d",
g_snprintf (modes, sizeof(modes), "+l %d",
atoi (gtk_entry_get_text (GTK_ENTRY (igad))));
serv->p_mode (serv, sess->channel, modes);
serv->p_join_info (serv, sess->channel);
@@ -2596,7 +2596,7 @@ mg_change_nick (int cancel, char *text, gpointer userdata)
if (!cancel)
{
snprintf (buf, sizeof (buf), "nick %s", text);
g_snprintf (buf, sizeof (buf), "nick %s", text);
handle_command (current_sess, buf, FALSE);
}
}

View File

@@ -393,9 +393,9 @@ toggle_cb (GtkWidget *item, char *pref_name)
char buf[256];
if (GTK_CHECK_MENU_ITEM (item)->active)
snprintf (buf, sizeof (buf), "set %s 1", pref_name);
g_snprintf (buf, sizeof (buf), "set %s 1", pref_name);
else
snprintf (buf, sizeof (buf), "set %s 0", pref_name);
g_snprintf (buf, sizeof (buf), "set %s 0", pref_name);
handle_command (current_sess, buf, FALSE);
}
@@ -586,7 +586,7 @@ menu_nickinfo_cb (GtkWidget *menu, session *sess)
return;
/* issue a /WHOIS */
snprintf (buf, sizeof (buf), "WHOIS %s %s", str_copy, str_copy);
g_snprintf (buf, sizeof (buf), "WHOIS %s %s", str_copy, str_copy);
handle_command (sess, buf, FALSE);
/* and hide the output */
sess->server->skip_next_whois = 1;
@@ -612,30 +612,30 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
/* let the translators tweak this if need be */
fmt = _("<tt><b>%-11s</b></tt> %s");
snprintf (unknown, sizeof (unknown), "<i>%s</i>", _("Unknown"));
g_snprintf (unknown, sizeof (unknown), "<i>%s</i>", _("Unknown"));
if (user->realname)
{
real = strip_color (user->realname, -1, STRIP_ALL|STRIP_ESCMARKUP);
snprintf (buf, sizeof (buf), fmt, _("Real Name:"), real);
g_snprintf (buf, sizeof (buf), fmt, _("Real Name:"), real);
g_free (real);
} else
{
snprintf (buf, sizeof (buf), fmt, _("Real Name:"), unknown);
g_snprintf (buf, sizeof (buf), fmt, _("Real Name:"), unknown);
}
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (copy_to_clipboard_cb),
user->realname ? user->realname : unknown);
snprintf (buf, sizeof (buf), fmt, _("User:"),
g_snprintf (buf, sizeof (buf), fmt, _("User:"),
user->hostname ? user->hostname : unknown);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (copy_to_clipboard_cb),
user->hostname ? user->hostname : unknown);
snprintf (buf, sizeof (buf), fmt, _("Account:"),
g_snprintf (buf, sizeof (buf), fmt, _("Account:"),
user->account ? user->account : unknown);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate",
@@ -645,13 +645,13 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
users_country = country (user->hostname);
if (users_country)
{
snprintf (buf, sizeof (buf), fmt, _ ("Country:"), users_country);
g_snprintf (buf, sizeof (buf), fmt, _ ("Country:"), users_country);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (copy_to_clipboard_cb), users_country);
}
snprintf (buf, sizeof (buf), fmt, _("Server:"),
g_snprintf (buf, sizeof (buf), fmt, _("Server:"),
user->servername ? user->servername : unknown);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate",
@@ -662,12 +662,12 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
{
char min[96];
snprintf (min, sizeof (min), _("%u minutes ago"),
g_snprintf (min, sizeof (min), _("%u minutes ago"),
(unsigned int) ((time (0) - user->lasttalk) / 60));
snprintf (buf, sizeof (buf), fmt, _("Last Msg:"), min);
g_snprintf (buf, sizeof (buf), fmt, _("Last Msg:"), min);
} else
{
snprintf (buf, sizeof (buf), fmt, _("Last Msg:"), unknown);
g_snprintf (buf, sizeof (buf), fmt, _("Last Msg:"), unknown);
}
menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
@@ -677,7 +677,7 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
if (away)
{
char *msg = strip_color (away->message ? away->message : unknown, -1, STRIP_ALL|STRIP_ESCMARKUP);
snprintf (buf, sizeof (buf), fmt, _("Away Msg:"), msg);
g_snprintf (buf, sizeof (buf), fmt, _("Away Msg:"), msg);
g_free (msg);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate",
@@ -734,7 +734,7 @@ menu_nickmenu (session *sess, GdkEventButton *event, char *nick, int num_sel)
/* more than 1 nick selected? */
if (num_sel > 1)
{
snprintf (buf, sizeof (buf), _("%d nicks selected."), num_sel);
g_snprintf (buf, sizeof (buf), _("%d nicks selected."), num_sel);
menu_quick_item (0, buf, menu, 0, 0, 0);
menu_quick_item (0, 0, menu, XCMENU_SHADED, 0, 0);
} else
@@ -935,7 +935,7 @@ open_url_cb (GtkWidget *item, char *url)
char buf[512];
/* pass this to /URL so it can handle irc:// */
snprintf (buf, sizeof (buf), "URL %s", url);
g_snprintf (buf, sizeof (buf), "URL %s", url);
handle_command (current_sess, buf, FALSE);
}
@@ -984,7 +984,7 @@ menu_chan_cycle (GtkWidget * menu, char *chan)
if (current_sess)
{
snprintf (tbuf, sizeof tbuf, "CYCLE %s", chan);
g_snprintf (tbuf, sizeof tbuf, "CYCLE %s", chan);
handle_command (current_sess, tbuf, FALSE);
}
}
@@ -996,7 +996,7 @@ menu_chan_part (GtkWidget * menu, char *chan)
if (current_sess)
{
snprintf (tbuf, sizeof tbuf, "part %s", chan);
g_snprintf (tbuf, sizeof tbuf, "part %s", chan);
handle_command (current_sess, tbuf, FALSE);
}
}
@@ -1008,7 +1008,7 @@ menu_chan_join (GtkWidget * menu, char *chan)
if (current_sess)
{
snprintf (tbuf, sizeof tbuf, "join %s", chan);
g_snprintf (tbuf, sizeof tbuf, "join %s", chan);
handle_command (current_sess, tbuf, FALSE);
}
}

View File

@@ -190,11 +190,11 @@ notify_gui_update (void)
{
lastseenminutes = (int)(time (0) - lastseen) / 60;
if (lastseenminutes < 60)
snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), lastseenminutes);
g_snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), lastseenminutes);
else if (lastseenminutes < 120)
snprintf (agobuf, sizeof (agobuf), _("An hour ago"));
g_snprintf (agobuf, sizeof (agobuf), _("An hour ago"));
else
snprintf (agobuf, sizeof (agobuf), _("%d hours ago"), lastseenminutes / 60);
g_snprintf (agobuf, sizeof (agobuf), _("%d hours ago"), lastseenminutes / 60);
seen = agobuf;
}
if (!valid) /* create new tree row if required */
@@ -219,7 +219,7 @@ notify_gui_update (void)
name = "";
server = server_get_network (servnot->server, TRUE);
snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), (int)(time (0) - lastseen) / 60);
g_snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), (int)(time (0) - lastseen) / 60);
seen = agobuf;
if (!valid) /* create new tree row if required */
@@ -380,7 +380,7 @@ fe_notify_ask (char *nick, char *networks)
gtk_table_attach_defaults (GTK_TABLE (table), wid, 1, 2, 2, 3);
label = gtk_label_new (NULL);
snprintf (buf, sizeof (buf), "<i><span size=\"smaller\">%s</span></i>", _("Comma separated list of networks is accepted."));
g_snprintf (buf, sizeof (buf), "<i><span size=\"smaller\">%s</span></i>", _("Comma separated list of networks is accepted."));
gtk_label_set_markup (GTK_LABEL (label), buf);
gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 3, 4);

View File

@@ -122,7 +122,7 @@ palette_load (void)
/* mIRC colors 0-31 are here */
for (i = 0; i < 32; i++)
{
snprintf (prefname, sizeof prefname, "color_%d", i);
g_snprintf (prefname, sizeof prefname, "color_%d", i);
cfg_get_color (cfg, prefname, &red, &green, &blue);
colors[i].red = red;
colors[i].green = green;
@@ -132,7 +132,7 @@ palette_load (void)
/* our special colors are mapped at 256+ */
for (i = 256, j = 32; j < MAX_COL+1; i++, j++)
{
snprintf (prefname, sizeof prefname, "color_%d", i);
g_snprintf (prefname, sizeof prefname, "color_%d", i);
cfg_get_color (cfg, prefname, &red, &green, &blue);
colors[j].red = red;
colors[j].green = green;
@@ -155,14 +155,14 @@ palette_save (void)
/* mIRC colors 0-31 are here */
for (i = 0; i < 32; i++)
{
snprintf (prefname, sizeof prefname, "color_%d", i);
g_snprintf (prefname, sizeof prefname, "color_%d", i);
cfg_put_color (fh, colors[i].red, colors[i].green, colors[i].blue, prefname);
}
/* our special colors are mapped at 256+ */
for (i = 256, j = 32; j < MAX_COL+1; i++, j++)
{
snprintf (prefname, sizeof prefname, "color_%d", i);
g_snprintf (prefname, sizeof prefname, "color_%d", i);
cfg_put_color (fh, colors[j].red, colors[j].green, colors[j].blue, prefname);
}

View File

@@ -109,7 +109,7 @@ open_rawlog (struct server *serv)
return;
}
snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Raw Log (%s)"), serv->servername);
g_snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Raw Log (%s)"), serv->servername);
serv->gui->rawlog_window =
mg_create_generic_tab ("RawLog", tbuf, FALSE, TRUE, close_rawlog, serv,
640, 320, &vbox, serv);

View File

@@ -1658,7 +1658,7 @@ bold_label (char *text)
char buf[128];
GtkWidget *label;
snprintf (buf, sizeof (buf), "<b>%s</b>", text);
g_snprintf (buf, sizeof (buf), "<b>%s</b>", text);
label = gtk_label_new (buf);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
@@ -1700,7 +1700,7 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
editwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (editwindow), 4);
snprintf (buf, sizeof (buf), _(DISPLAY_NAME": Edit %s"), net->name);
g_snprintf (buf, sizeof (buf), _(DISPLAY_NAME": Edit %s"), net->name);
gtk_window_set_title (GTK_WINDOW (editwindow), buf);
gtk_window_set_default_size (GTK_WINDOW (editwindow), netedit_win_width, netedit_win_height);
gtk_window_set_transient_for (GTK_WINDOW (editwindow), GTK_WINDOW (parent));

View File

@@ -631,7 +631,7 @@ setup_headlabel (GtkWidget *tab, int row, int col, char *text)
char buf[128];
char *sp;
snprintf (buf, sizeof (buf), "<b><span size=\"smaller\">%s</span></b>", text);
g_snprintf (buf, sizeof (buf), "<b><span size=\"smaller\">%s</span></b>", text);
sp = strchr (buf + 17, ' ');
if (sp)
*sp = '\n';
@@ -753,7 +753,7 @@ setup_create_italic_label (char *text)
char buf[256];
label = gtk_label_new (NULL);
snprintf (buf, sizeof (buf), "<i><span size=\"smaller\">%s</span></i>", text);
g_snprintf (buf, sizeof (buf), "<i><span size=\"smaller\">%s</span></i>", text);
gtk_label_set_markup (GTK_LABEL (label), buf);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
@@ -1221,9 +1221,9 @@ setup_create_header (GtkWidget *table, int row, char *labeltext)
char buf[128];
if (row == 0)
snprintf (buf, sizeof (buf), "<b>%s</b>", _(labeltext));
g_snprintf (buf, sizeof (buf), "<b>%s</b>", _(labeltext));
else
snprintf (buf, sizeof (buf), "\n<b>%s</b>", _(labeltext));
g_snprintf (buf, sizeof (buf), "\n<b>%s</b>", _(labeltext));
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), buf);
@@ -1790,7 +1790,7 @@ setup_add_page (const char *title, GtkWidget *book, GtkWidget *tab)
/* label */
label = gtk_label_new (NULL);
snprintf (buf, sizeof (buf), "<b><big>%s</big></b>", _(title));
g_snprintf (buf, sizeof (buf), "<b><big>%s</big></b>", _(title));
gtk_label_set_markup (GTK_LABEL (label), buf);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_misc_set_padding (GTK_MISC (label), 2, 1);

View File

@@ -42,11 +42,11 @@
enum
{
COL_PIX=0, // GdkPixbuf *
COL_NICK=1, // char *
COL_HOST=2, // char *
COL_USER=3, // struct User *
COL_GDKCOLOR=4 // GdkColor *
COL_PIX=0, /* GdkPixbuf * */
COL_NICK=1, /* char * */
COL_HOST=2, /* char * */
COL_USER=3, /* struct User * */
COL_GDKCOLOR=4 /* GdkColor * */
};
@@ -105,7 +105,7 @@ fe_userlist_numbers (session *sess)
{
if (sess->total)
{
snprintf (tbuf, sizeof (tbuf), _("%d ops, %d total"), sess->ops, sess->total);
g_snprintf (tbuf, sizeof (tbuf), _("%d ops, %d total"), sess->ops, sess->total);
tbuf[sizeof (tbuf) - 1] = 0;
gtk_label_set_text (GTK_LABEL (sess->gui->namelistinfo), tbuf);
} else

View File

@@ -91,7 +91,7 @@ fe_new_window (struct session *sess, int focus)
return;
done_intro = 1;
snprintf (buf, sizeof (buf),
g_snprintf (buf, sizeof (buf),
"\n"
" \017HexChat-Text \00310"PACKAGE_VERSION"\n"
" \017Running on \00310%s \017glib \00310%d.%d.%d\n"