1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-25 02:32:27 -05:00

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

@ -755,8 +755,7 @@ AC_TRY_COMPILE(
], ],
AC_MSG_RESULT(no)) AC_MSG_RESULT(no))
dnl if we don\'t have this, use g_snprintf instead AC_CHECK_FUNCS(memrchr)
AC_CHECK_FUNCS(snprintf vsnprintf memrchr strtoull)
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_FUNC(gethostbyname, ,
AC_CHECK_LIB(resolv, gethostbyname, , AC_CHECK_LIB(resolv, gethostbyname, ,

View File

@ -39,17 +39,17 @@ static const char fish_base64[64] = "./0123456789abcdefghijklmnopqrstuvwxyzABCDE
static const signed char fish_unbase64[256] = { static const signed char fish_unbase64[256] = {
IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB,IB,IB,
IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB,IB,IB,
// ! " # $ % & ' ( ) * + , - . / /* ! " # $ % & ' ( ) * + , - . / */
IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB, 0, 1, IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB, 0, 1,
// 0 1 2 3 4 5 6 7 8 9 : ; < = > ? /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
2, 3, 4, 5, 6, 7, 8, 9, 10,11,IB,IB,IB,IB,IB,IB, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,IB,IB,IB,IB,IB,IB,
// @ A B C D E F G H I J K L M N O /* @ A B C D E F G H I J K L M N O */
IB,38,39,40,41,42,43,44, 45,46,47,48,49,50,51,52, IB,38,39,40,41,42,43,44, 45,46,47,48,49,50,51,52,
// P Q R S T U V W X Y Z [ \ ] ^ _ /* P Q R S T U V W X Y Z [ \ ] ^ _*/
53,54,55,56,57,58,59,60, 61,62,63,IB,IB,IB,IB,IB, 53,54,55,56,57,58,59,60, 61,62,63,IB,IB,IB,IB,IB,
// ` a b c d e f g h i j k l m n o /* ` a b c d e f g h i j k l m n o */
IB,12,13,14,15,16,17,18, 19,20,21,22,23,24,25,26, IB,12,13,14,15,16,17,18, 19,20,21,22,23,24,25,26,
// p q r s t u v w x y z { | } ~ <del> /* p q r s t u v w x y z { | } ~ <del> */
27,28,29,30,31,32,33,34, 35,36,37,IB,IB,IB,IB,IB, 27,28,29,30,31,32,33,34, 35,36,37,IB,IB,IB,IB,IB,
}; };
@ -75,11 +75,11 @@ char *fish_encrypt(const char *key, size_t keylen, const char *message) {
messagelen = strlen(message); messagelen = strlen(message);
if (messagelen == 0) return NULL; if (messagelen == 0) return NULL;
encrypted = g_malloc(((messagelen - 1) / 8) * 12 + 12 + 1); // each 8-byte block becomes 12 bytes encrypted = g_malloc(((messagelen - 1) / 8) * 12 + 12 + 1); /* each 8-byte block becomes 12 bytes */
end = encrypted; end = encrypted;
while (*message) { while (*message) {
// Read 8 bytes (a Blowfish block) /* Read 8 bytes (a Blowfish block) */
BF_LONG binary[2] = { 0, 0 }; BF_LONG binary[2] = { 0, 0 };
unsigned char c; unsigned char c;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -89,10 +89,10 @@ char *fish_encrypt(const char *key, size_t keylen, const char *message) {
} }
message += 8; message += 8;
// Encrypt block /* Encrypt block */
BF_encrypt(binary, &bfkey); BF_encrypt(binary, &bfkey);
// Emit FiSH-BASE64 /* Emit FiSH-BASE64 */
bit = 0; bit = 0;
word = 1; word = 1;
for (j = 0; j < 12; j++) { for (j = 0; j < 12; j++) {
@ -105,7 +105,7 @@ char *fish_encrypt(const char *key, size_t keylen, const char *message) {
} }
} }
// Stop if a null terminator was found /* Stop if a null terminator was found */
if (c == '\0') break; if (c == '\0') break;
} }
*end = '\0'; *end = '\0';
@ -127,7 +127,7 @@ char *fish_decrypt(const char *key, size_t keylen, const char *data) {
end = decrypted; end = decrypted;
while (*data) { while (*data) {
// Convert from FiSH-BASE64 /* Convert from FiSH-BASE64 */
BF_LONG binary[2] = { 0, 0 }; BF_LONG binary[2] = { 0, 0 };
bit = 0; bit = 0;
word = 1; word = 1;
@ -142,10 +142,10 @@ char *fish_decrypt(const char *key, size_t keylen, const char *data) {
} }
} }
// Decrypt block /* Decrypt block */
BF_decrypt(binary, &bfkey); BF_decrypt(binary, &bfkey);
// Copy to buffer /* Copy to buffer */
GET_BYTES(end, binary[0]); GET_BYTES(end, binary[0]);
GET_BYTES(end, binary[1]); GET_BYTES(end, binary[1]);
} }
@ -163,11 +163,11 @@ char *fish_encrypt_for_nick(const char *nick, const char *data) {
char *key; char *key;
char *encrypted; char *encrypted;
// Look for key /* Look for key */
key = keystore_get_key(nick); key = keystore_get_key(nick);
if (!key) return NULL; if (!key) return NULL;
// Encrypt /* Encrypt */
encrypted = fish_encrypt(key, strlen(key), data); encrypted = fish_encrypt(key, strlen(key), data);
g_free(key); g_free(key);
@ -181,11 +181,11 @@ char *fish_encrypt_for_nick(const char *nick, const char *data) {
char *fish_decrypt_from_nick(const char *nick, const char *data) { char *fish_decrypt_from_nick(const char *nick, const char *data) {
char *key; char *key;
char *decrypted; char *decrypted;
// Look for key /* Look for key */
key = keystore_get_key(nick); key = keystore_get_key(nick);
if (!key) return NULL; if (!key) return NULL;
// Decrypt /* Decrypt */
decrypted = fish_decrypt(key, strlen(key), data); decrypted = fish_decrypt(key, strlen(key), data);
g_free(key); g_free(key);

View File

@ -25,7 +25,6 @@
#ifndef FISH_H #ifndef FISH_H
#define FISH_H #define FISH_H
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <glib.h> #include <glib.h>

View File

@ -32,26 +32,26 @@
* at spaces. The prefix and command is extracted from the message, and * at spaces. The prefix and command is extracted from the message, and
* parameters_offset is set to the index of the first parameter. * parameters_offset is set to the index of the first parameter.
*/ */
bool irc_parse_message(const char *words[], gboolean irc_parse_message(const char *words[],
const char **prefix, const char **command, const char **prefix, const char **command,
size_t *parameters_offset) { size_t *parameters_offset) {
size_t w = 1; size_t w = 1;
if (prefix) *prefix = NULL; if (prefix) *prefix = NULL;
if (command) *command = NULL; if (command) *command = NULL;
// See if the message starts with a prefix (sender user) /* See if the message starts with a prefix (sender user) */
if (words[w][0] == ':') { if (words[w][0] == ':') {
if (prefix) *prefix = &words[w][1]; if (prefix) *prefix = &words[w][1];
w++; w++;
} }
// Check command /* Check command */
if (words[w][0] == '\0') return false; if (words[w][0] == '\0') return FALSE;
if (command) *command = words[w]; if (command) *command = words[w];
w++; w++;
*parameters_offset = w; *parameters_offset = w;
return true; return TRUE;
} }
@ -70,11 +70,11 @@ char *irc_prefix_get_nick(const char *prefix) {
if (!prefix) return NULL; if (!prefix) return NULL;
// Find end of nick /* Find end of nick */
end = prefix; end = prefix;
while (*end != '\0' && *end != '!' && *end != '@') end++; while (*end != '\0' && *end != '!' && *end != '@') end++;
// Allocate string /* Allocate string */
length = end - prefix; length = end - prefix;
return g_strndup (prefix, length); return g_strndup (prefix, length);
} }

View File

@ -25,12 +25,10 @@
#ifndef IRC_H #ifndef IRC_H
#define IRC_H #define IRC_H
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <glib.h> #include <glib.h>
bool irc_parse_message(const char *words[], gboolean irc_parse_message(const char *words[],
const char **prefix, const char **command, const char **prefix, const char **command,
size_t *parameters_offset); size_t *parameters_offset);
char *irc_prefix_get_nick(const char *prefix); char *irc_prefix_get_nick(const char *prefix);

View File

@ -58,7 +58,7 @@ static GKeyFile *getConfigFile() {
static const char *get_keystore_password() { static const char *get_keystore_password() {
return (keystore_password != NULL ? return (keystore_password != NULL ?
keystore_password : keystore_password :
// Silly default value... /* Silly default value... */
"blowinikey"); "blowinikey");
} }
@ -88,17 +88,17 @@ static gchar *get_nick_value(GKeyFile *keyfile, const char *nick, const char *it
* Extracts a key from the key store file. * Extracts a key from the key store file.
*/ */
char *keystore_get_key(const char *nick) { char *keystore_get_key(const char *nick) {
// Get the key /* Get the key */
GKeyFile *keyfile = getConfigFile(); GKeyFile *keyfile = getConfigFile();
gchar *value = get_nick_value(keyfile, nick, "key"); gchar *value = get_nick_value(keyfile, nick, "key");
g_key_file_free(keyfile); g_key_file_free(keyfile);
if (!value) return NULL; if (!value) return NULL;
if (strncmp(value, "+OK ", 4) != 0) { if (strncmp(value, "+OK ", 4) != 0) {
// Key is stored in plaintext /* Key is stored in plaintext */
return value; return value;
} else { } else {
// Key is encrypted /* Key is encrypted */
const char *encrypted = value+4; const char *encrypted = value+4;
const char *password = get_keystore_password(); const char *password = get_keystore_password();
char *decrypted = fish_decrypt(password, strlen(password), encrypted); char *decrypted = fish_decrypt(password, strlen(password), encrypted);
@ -110,10 +110,10 @@ char *keystore_get_key(const char *nick) {
/** /**
* Deletes a nick and the associated key in the key store file. * Deletes a nick and the associated key in the key store file.
*/ */
static bool delete_nick(GKeyFile *keyfile, const char *nick) { static gboolean delete_nick(GKeyFile *keyfile, const char *nick) {
gchar **group; gchar **group;
gchar **groups = g_key_file_get_groups(keyfile, NULL); gchar **groups = g_key_file_get_groups(keyfile, NULL);
bool ok = false; gboolean ok = FALSE;
for (group = groups; *group != NULL; group++) { for (group = groups; *group != NULL; group++) {
if (!irc_nick_cmp(*group, nick)) { if (!irc_nick_cmp(*group, nick)) {
@ -149,9 +149,9 @@ static gboolean keyfile_save_to_file (GKeyFile *keyfile, char *filename) {
/** /**
* Writes the key store file to disk. * Writes the key store file to disk.
*/ */
static bool save_keystore(GKeyFile *keyfile) { static gboolean save_keystore(GKeyFile *keyfile) {
char *filename; char *filename;
bool ok; gboolean ok;
filename = get_config_filename(); filename = get_config_filename();
#if !GLIB_CHECK_VERSION(2,40,0) #if !GLIB_CHECK_VERSION(2,40,0)
@ -167,36 +167,36 @@ static bool save_keystore(GKeyFile *keyfile) {
/** /**
* Sets a key in the key store file. * Sets a key in the key store file.
*/ */
bool keystore_store_key(const char *nick, const char *key) { gboolean keystore_store_key(const char *nick, const char *key) {
const char *password; const char *password;
char *encrypted; char *encrypted;
char *wrapped; char *wrapped;
bool ok = false; gboolean ok = FALSE;
GKeyFile *keyfile = getConfigFile(); GKeyFile *keyfile = getConfigFile();
// Remove old key /* Remove old key */
delete_nick(keyfile, nick); delete_nick(keyfile, nick);
// Add new key /* Add new key */
password = get_keystore_password(); password = get_keystore_password();
if (password) { if (password) {
// Encrypt the password /* Encrypt the password */
encrypted = fish_encrypt(password, strlen(password), key); encrypted = fish_encrypt(password, strlen(password), key);
if (!encrypted) goto end; if (!encrypted) goto end;
// Prepend "+OK " /* Prepend "+OK " */
wrapped = g_strconcat("+OK ", encrypted, NULL); wrapped = g_strconcat("+OK ", encrypted, NULL);
g_free(encrypted); g_free(encrypted);
// Store encrypted in file /* Store encrypted in file */
g_key_file_set_string(keyfile, nick, "key", wrapped); g_key_file_set_string(keyfile, nick, "key", wrapped);
g_free(wrapped); g_free(wrapped);
} else { } else {
// Store unencrypted in file /* Store unencrypted in file */
g_key_file_set_string(keyfile, nick, "key", key); g_key_file_set_string(keyfile, nick, "key", key);
} }
// Save key store file /* Save key store file */
ok = save_keystore(keyfile); ok = save_keystore(keyfile);
end: end:
@ -207,13 +207,13 @@ bool keystore_store_key(const char *nick, const char *key) {
/** /**
* Deletes a nick from the key store. * Deletes a nick from the key store.
*/ */
bool keystore_delete_nick(const char *nick) { gboolean keystore_delete_nick(const char *nick) {
GKeyFile *keyfile = getConfigFile(); GKeyFile *keyfile = getConfigFile();
// Delete entry /* Delete entry */
bool ok = delete_nick(keyfile, nick); gboolean ok = delete_nick(keyfile, nick);
// Save /* Save */
if (ok) save_keystore(keyfile); if (ok) save_keystore(keyfile);
g_key_file_free(keyfile); g_key_file_free(keyfile);

View File

@ -25,14 +25,13 @@
#ifndef KEYSTORE_H #ifndef KEYSTORE_H
#define KEYSTORE_H #define KEYSTORE_H
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <glib.h> #include <glib.h>
char *keystore_get_key(const char *nick); char *keystore_get_key(const char *nick);
bool keystore_store_key(const char *nick, const char *key); gboolean keystore_store_key(const char *nick, const char *key);
bool keystore_delete_nick(const char *nick); gboolean keystore_delete_nick(const char *nick);
#endif #endif

View File

@ -28,13 +28,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
// #pragma GCC visibility push(default)
#include "hexchat-plugin.h" #include "hexchat-plugin.h"
#define HEXCHAT_MAX_WORDS 32 #define HEXCHAT_MAX_WORDS 32
// #pragma GCC visibility pop
//#define EXPORT __attribute((visibility("default")))
//#define EXPORT
#include "fish.h" #include "fish.h"
#include "keystore.h" #include "keystore.h"
@ -81,16 +76,16 @@ int irc_nick_cmp(const char *a, const char *b) {
*/ */
static int handle_outgoing(char *word[], char *word_eol[], void *userdata) { static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
const char *own_nick; const char *own_nick;
// Encrypt the message if possible /* Encrypt the message if possible */
const char *channel = hexchat_get_info(ph, "channel"); const char *channel = hexchat_get_info(ph, "channel");
char *encrypted = fish_encrypt_for_nick(channel, word_eol[1]); char *encrypted = fish_encrypt_for_nick(channel, word_eol[1]);
if (!encrypted) return HEXCHAT_EAT_NONE; if (!encrypted) return HEXCHAT_EAT_NONE;
// Display message /* Display message */
own_nick = hexchat_get_info(ph, "nick"); own_nick = hexchat_get_info(ph, "nick");
hexchat_emit_print(ph, "Your Message", own_nick, word_eol[1], NULL); hexchat_emit_print(ph, "Your Message", own_nick, word_eol[1], NULL);
// Send message /* Send message */
hexchat_commandf(ph, "PRIVMSG %s :+OK %s", channel, encrypted); hexchat_commandf(ph, "PRIVMSG %s :+OK %s", channel, encrypted);
g_free(encrypted); g_free(encrypted);
@ -117,10 +112,10 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *
if (!irc_parse_message((const char **)word, &prefix, &command, &w)) if (!irc_parse_message((const char **)word, &prefix, &command, &w))
return HEXCHAT_EAT_NONE; return HEXCHAT_EAT_NONE;
// Topic (command 332) has an extra parameter /* Topic (command 332) has an extra parameter */
if (!strcmp(command, "332")) w++; if (!strcmp(command, "332")) w++;
// Look for encrypted data /* Look for encrypted data */
for (ew = w+1; ew < HEXCHAT_MAX_WORDS-1; ew++) { for (ew = w+1; ew < HEXCHAT_MAX_WORDS-1; ew++) {
const char *s = (ew == w+1 ? word[ew]+1 : word[ew]); const char *s = (ew == w+1 ? word[ew]+1 : word[ew]);
if (*s && (s[1] == '+' || s[1] == 'm')) { prefix_char = *(s++); } if (*s && (s[1] == '+' || s[1] == 'm')) { prefix_char = *(s++); }
@ -129,19 +124,19 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *
} }
return HEXCHAT_EAT_NONE; return HEXCHAT_EAT_NONE;
has_encrypted_data: ; has_encrypted_data: ;
// Extract sender nick and recipient nick/channel /* Extract sender nick and recipient nick/channel */
sender_nick = irc_prefix_get_nick(prefix); sender_nick = irc_prefix_get_nick(prefix);
recipient = word[w]; recipient = word[w];
// Try to decrypt with these (the keys are searched for in the key store) /* Try to decrypt with these (the keys are searched for in the key store) */
encrypted = word[ew+1]; encrypted = word[ew+1];
decrypted = fish_decrypt_from_nick(recipient, encrypted); decrypted = fish_decrypt_from_nick(recipient, encrypted);
if (!decrypted) decrypted = fish_decrypt_from_nick(sender_nick, encrypted); if (!decrypted) decrypted = fish_decrypt_from_nick(sender_nick, encrypted);
// Check for error /* Check for error */
if (!decrypted) goto decrypt_error; if (!decrypted) goto decrypt_error;
// Build unecrypted message /* Build unecrypted message */
message = g_string_sized_new (100); /* TODO: more accurate estimation of size */ message = g_string_sized_new (100); /* TODO: more accurate estimation of size */
g_string_append (message, "RECV"); g_string_append (message, "RECV");
@ -160,12 +155,12 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *
g_string_append_c (message, ' '); g_string_append_c (message, ' ');
if (uw == ew) { if (uw == ew) {
// Add the encrypted data /* Add the encrypted data */
peice = decrypted; peice = decrypted;
uw++; // Skip "OK+" uw++; /* Skip "OK+" */
if (ew == w+1) { if (ew == w+1) {
// Prefix with colon, which gets stripped out otherwise /* Prefix with colon, which gets stripped out otherwise */
g_string_append_c (message, ':'); g_string_append_c (message, ':');
} }
@ -174,7 +169,7 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *
} }
} else { } else {
// Add unencrypted data (for example, a prefix from a bouncer or bot) /* Add unencrypted data (for example, a prefix from a bouncer or bot) */
peice = word[uw]; peice = word[uw];
} }
@ -182,8 +177,8 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *
} }
g_free(decrypted); g_free(decrypted);
// Simulate unencrypted message /* Simulate unencrypted message */
//hexchat_printf(ph, "simulating: %s\n", message->str); /* hexchat_printf(ph, "simulating: %s\n", message->str); */
hexchat_command(ph, message->str); hexchat_command(ph, message->str);
g_string_free (message, TRUE); g_string_free (message, TRUE);
@ -203,23 +198,23 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
const char *nick; const char *nick;
const char *key; const char *key;
// Check syntax /* Check syntax */
if (*word[2] == '\0') { if (*word[2] == '\0') {
hexchat_printf(ph, "%s\n", usage_setkey); hexchat_printf(ph, "%s\n", usage_setkey);
return HEXCHAT_EAT_HEXCHAT; return HEXCHAT_EAT_HEXCHAT;
} }
if (*word[3] == '\0') { if (*word[3] == '\0') {
// /setkey password /* /setkey password */
nick = hexchat_get_info(ph, "channel"); nick = hexchat_get_info(ph, "channel");
key = word_eol[2]; key = word_eol[2];
} else { } else {
// /setkey #channel password /* /setkey #channel password */
nick = word[2]; nick = word[2];
key = word_eol[3]; key = word_eol[3];
} }
// Set password /* Set password */
if (keystore_store_key(nick, key)) { if (keystore_store_key(nick, key)) {
hexchat_printf(ph, "Stored key for %s\n", nick); hexchat_printf(ph, "Stored key for %s\n", nick);
} else { } else {
@ -235,7 +230,7 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
static int handle_delkey(char *word[], char *word_eol[], void *userdata) { static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
const char *nick; const char *nick;
// Check syntax /* Check syntax */
if (*word[2] == '\0' || *word[3] != '\0') { if (*word[2] == '\0' || *word[3] != '\0') {
hexchat_printf(ph, "%s\n", usage_delkey); hexchat_printf(ph, "%s\n", usage_delkey);
return HEXCHAT_EAT_HEXCHAT; return HEXCHAT_EAT_HEXCHAT;
@ -243,7 +238,7 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
nick = g_strstrip (word_eol[2]); nick = g_strstrip (word_eol[2]);
// Delete the given nick from the key store /* Delete the given nick from the key store */
if (keystore_delete_nick(nick)) { if (keystore_delete_nick(nick)) {
hexchat_printf(ph, "Deleted key for %s\n", nick); hexchat_printf(ph, "Deleted key for %s\n", nick);
} else { } else {
@ -286,7 +281,7 @@ int hexchat_plugin_init(hexchat_plugin *plugin_handle,
hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL); hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL);
hexchat_hook_server_attrs(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL); hexchat_hook_server_attrs(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL);
hexchat_hook_server_attrs(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL); hexchat_hook_server_attrs(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL);
//hexchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL); /* hexchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL); */
hexchat_hook_server_attrs(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL); hexchat_hook_server_attrs(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL);
hexchat_hook_server_attrs(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL); hexchat_hook_server_attrs(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL);

View File

@ -1885,7 +1885,7 @@ Module_hexchat_pluginpref_get(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s:get_pluginpref", &var)) if (!PyArg_ParseTuple(args, "s:get_pluginpref", &var))
return NULL; return NULL;
// This will always return numbers as integers. /* This will always return numbers as integers. */
BEGIN_XCHAT_CALLS(NONE); BEGIN_XCHAT_CALLS(NONE);
result = hexchat_pluginpref_get_str(prefph, var, retstr); result = hexchat_pluginpref_get_str(prefph, var, retstr);
END_XCHAT_CALLS(); END_XCHAT_CALLS();

View File

@ -41,7 +41,7 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
result = g_new(char, bsize); result = g_new(char, bsize);
if (total_space == 0) if (total_space == 0)
{ {
snprintf(result, bsize, "%s: none", desc); g_snprintf(result, bsize, "%s: none", desc);
return result; return result;
} }
quantity = quantities; quantity = quantities;
@ -52,11 +52,11 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
total_space = total_space / 1024; total_space = total_space / 1024;
} }
if (sysinfo_get_percent () != 0) if (sysinfo_get_percent () != 0)
snprintf(result, bsize, "%s: %.1f%s, %.1f%% free", g_snprintf(result, bsize, "%s: %.1f%s, %.1f%% free",
desc, total_space, *quantity, desc, total_space, *quantity,
percentage(free_k, total_k)); percentage(free_k, total_k));
else else
snprintf(result, bsize, "%s: %.1f%s/%.1f%s free", g_snprintf(result, bsize, "%s: %.1f%s/%.1f%s free",
desc, free_space, *quantity, total_space, *quantity); desc, free_space, *quantity, total_space, *quantity);
return result; return result;
} }

View File

@ -123,7 +123,7 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned
while ((entry = readdir(dir)) != NULL) while ((entry = readdir(dir)) != NULL)
if (strncmp(entry->d_name,"SUNW,UltraSPARC",15) == 0) if (strncmp(entry->d_name,"SUNW,UltraSPARC",15) == 0)
{ {
snprintf(buffer,bsize,"/proc/openprom/%s/ecache-size",entry->d_name); g_snprintf(buffer,bsize,"/proc/openprom/%s/ecache-size",entry->d_name);
fp2 = fopen(buffer, "r"); fp2 = fopen(buffer, "r");
if (fp2 == NULL) break; if (fp2 == NULL) break;
fscanf(fp2,"%16s",cache); fscanf(fp2,"%16s",cache);
@ -172,7 +172,7 @@ int xs_parse_os(char *user, char *host, char *kernel)
strncpy(user, usern, bsize); strncpy(user, usern, bsize);
strcpy(host, hostn); strcpy(host, hostn);
snprintf(kernel, bsize, "%s %s %s", osinfo.sysname, osinfo.release, osinfo.machine); g_snprintf(kernel, bsize, "%s %s %s", osinfo.sysname, osinfo.release, osinfo.machine);
return 0; return 0;
} }
@ -203,9 +203,9 @@ int xs_parse_sound(char *snd_card)
pos = strstr(buffer, ":"); pos = strstr(buffer, ":");
card_id = strtoll(buffer, NULL, 0); card_id = strtoll(buffer, NULL, 0);
if (card_id == 0) if (card_id == 0)
snprintf(card_buf, bsize, "%s", pos+2); g_snprintf(card_buf, bsize, "%s", pos+2);
else else
snprintf(card_buf, bsize, "%ld: %s", card_id, pos+2); g_snprintf(card_buf, bsize, "%ld: %s", card_id, pos+2);
pos = strstr(card_buf, "\n"); pos = strstr(card_buf, "\n");
*pos = '\0'; *pos = '\0';
strcat(cards, card_buf); strcat(cards, card_buf);
@ -269,11 +269,11 @@ int xs_parse_netdev(const char *device, unsigned long long *bytes_recv, unsigned
fclose(fp); fclose(fp);
pos = strstr(buffer, ":"); pos = strstr(buffer, ":");
pos++; pos++;
*bytes_recv = strtoull(pos, &pos, 0); *bytes_recv = g_ascii_strtoull (pos, &pos, 0);
for(i=0;i<7;i++) strtoull(pos, &pos, 0); for(i=0;i<7;i++) g_ascii_strtoull (pos, &pos, 0);
*bytes_sent = strtoull(pos, NULL, 0); *bytes_sent = g_ascii_strtoull (pos, NULL, 0);
return 0; return 0;
} }
@ -299,15 +299,15 @@ int xs_parse_df(const char *mount_point, char *result)
for(;isspace(*pos);pos++); for(;isspace(*pos);pos++);
if(mount_point == NULL) if(mount_point == NULL)
{ {
total_k += strtoull(pos, &pos, 0); total_k += g_ascii_strtoull (pos, &pos, 0);
strtoull(pos, &pos, 0); g_ascii_strtoull(pos, &pos, 0);
free_k += strtoull(pos, &pos, 0); free_k += g_ascii_strtoull (pos, &pos, 0);
continue; continue;
} }
total_k = strtoull(pos, &pos, 0); total_k = g_ascii_strtoull (pos, &pos, 0);
strtoull(pos, &pos, 0); g_ascii_strtoull(pos, &pos, 0);
free_k = strtoull(pos, &pos, 0); free_k = g_ascii_strtoull (pos, &pos, 0);
strtoull(pos, &pos, 0); g_ascii_strtoull (pos, &pos, 0);
for(;isspace(*pos);pos++); for(;isspace(*pos);pos++);
for(;*pos!='/';pos++); for(;*pos!='/';pos++);
for(i=0;*(buffer+i)!='\n';i++); for(i=0;*(buffer+i)!='\n';i++);
@ -327,7 +327,7 @@ int xs_parse_df(const char *mount_point, char *result)
g_free(tmp_buf); g_free(tmp_buf);
break; break;
} }
else snprintf(result, bsize, "Mount point %s not found!", mount_point); else g_snprintf(result, bsize, "Mount point %s not found!", mount_point);
} }
if(mount_point != NULL && strncasecmp(mount_point, "ALL", 3)==0) if(mount_point != NULL && strncasecmp(mount_point, "ALL", 3)==0)
@ -389,9 +389,9 @@ int xs_parse_distro(char *name)
find_match_char(buffer, "ACCEPT_KEYWORDS", keywords); find_match_char(buffer, "ACCEPT_KEYWORDS", keywords);
/* cppcheck-suppress uninitvar */ /* cppcheck-suppress uninitvar */
if (strstr(keywords, "\"") == NULL) if (strstr(keywords, "\"") == NULL)
snprintf(buffer, bsize, "Gentoo Linux (stable)"); g_snprintf(buffer, bsize, "Gentoo Linux (stable)");
else else
snprintf(buffer, bsize, "Gentoo Linux %s", keywords); g_snprintf(buffer, bsize, "Gentoo Linux %s", keywords);
} }
else if((fp = fopen("/etc/redhat-release", "r")) != NULL) else if((fp = fopen("/etc/redhat-release", "r")) != NULL)
fgets(buffer, bsize, fp); fgets(buffer, bsize, fp);
@ -406,7 +406,7 @@ int xs_parse_distro(char *name)
else if((fp = fopen("/etc/turbolinux-release", "r")) != NULL) else if((fp = fopen("/etc/turbolinux-release", "r")) != NULL)
fgets(buffer, bsize, fp); fgets(buffer, bsize, fp);
else if((fp = fopen("/etc/arch-release", "r")) != NULL) else if((fp = fopen("/etc/arch-release", "r")) != NULL)
snprintf(buffer, bsize, "ArchLinux"); g_snprintf(buffer, bsize, "ArchLinux");
else if((fp = fopen("/etc/lsb-release", "r")) != NULL) else if((fp = fopen("/etc/lsb-release", "r")) != NULL)
{ {
char id[bsize], codename[bsize], release[bsize]; char id[bsize], codename[bsize], release[bsize];
@ -419,16 +419,16 @@ int xs_parse_distro(char *name)
find_match_char(buffer, "DISTRIB_CODENAME", codename); find_match_char(buffer, "DISTRIB_CODENAME", codename);
find_match_char(buffer, "DISTRIB_RELEASE", release); find_match_char(buffer, "DISTRIB_RELEASE", release);
} }
snprintf(buffer, bsize, "%s \"%s\" %s", id, codename, release); g_snprintf(buffer, bsize, "%s \"%s\" %s", id, codename, release);
} }
else if((fp = fopen("/etc/debian_version", "r")) != NULL) else if((fp = fopen("/etc/debian_version", "r")) != NULL)
{ {
char release[bsize]; char release[bsize];
fgets(release, bsize, fp); fgets(release, bsize, fp);
snprintf(buffer, bsize, "Debian %s", release); g_snprintf(buffer, bsize, "Debian %s", release);
} }
else else
snprintf(buffer, bsize, "Unknown Distro"); g_snprintf(buffer, bsize, "Unknown Distro");
if(fp != NULL) fclose(fp); if(fp != NULL) fclose(fp);
pos=strchr(buffer, '\n'); pos=strchr(buffer, '\n');

View File

@ -99,8 +99,8 @@ int pci_find_by_class(u16 *class, char *vendor, char *device)
/* Acquire vendor & device ID if the class matches */ /* Acquire vendor & device ID if the class matches */
if(get_conf_word(d, PCI_CLASS_DEVICE) == *class) { if(get_conf_word(d, PCI_CLASS_DEVICE) == *class) {
nomatch = 0; nomatch = 0;
snprintf(vendor,7,"%04x",p->vendor_id); g_snprintf(vendor,7,"%04x",p->vendor_id);
snprintf(device,7,"%04x",p->device_id); g_snprintf(device,7,"%04x",p->device_id);
break; break;
} }
} }
@ -122,7 +122,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
fp = fopen (buffer, "r"); fp = fopen (buffer, "r");
if(fp == NULL) { if(fp == NULL) {
snprintf(fullname, bsize, "%s:%s", vendor, device); g_snprintf(fullname, bsize, "%s:%s", vendor, device);
sysinfo_print_error ("pci.ids file not found! You might want to adjust your pciids setting with /SYSINFO SET pciids (you can query its current value with /SYSINFO LIST).\n"); sysinfo_print_error ("pci.ids file not found! You might want to adjust your pciids setting with /SYSINFO SET pciids (you can query its current value with /SYSINFO LIST).\n");
return; return;
} }
@ -151,8 +151,8 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
} }
} }
if (cardfound == 1) if (cardfound == 1)
snprintf(fullname, bsize, "%s %s", vendorname, devicename); g_snprintf(fullname, bsize, "%s %s", vendorname, devicename);
else else
snprintf(fullname, bsize, "%s:%s", vendor, device); g_snprintf(fullname, bsize, "%s:%s", vendor, device);
fclose(fp); fclose(fp);
} }

View File

@ -155,7 +155,7 @@ getOsName (void)
static char * static char *
getCpuName (void) getCpuName (void)
{ {
// Get extended ids. /* Get extended ids. */
unsigned int nExIds; unsigned int nExIds;
unsigned int i; unsigned int i;
int CPUInfo[4] = {-1}; int CPUInfo[4] = {-1};

View File

@ -100,7 +100,7 @@ print_summary (int announce, char* format)
int seconds; int seconds;
sysinfo[0] = '\0'; sysinfo[0] = '\0';
snprintf (buffer, bsize, "%s", hexchat_get_info (ph, "version")); g_snprintf (buffer, bsize, "%s", hexchat_get_info (ph, "version"));
format_output ("HexChat", buffer, format); format_output ("HexChat", buffer, format);
strcat (sysinfo, "\017 "); strcat (sysinfo, "\017 ");
strncat (sysinfo, buffer, bsize - strlen (sysinfo)); strncat (sysinfo, buffer, bsize - strlen (sysinfo));
@ -112,7 +112,7 @@ print_summary (int announce, char* format)
return HEXCHAT_EAT_ALL; return HEXCHAT_EAT_ALL;
} }
snprintf (buffer, bsize, "%s", os_kernel); g_snprintf (buffer, bsize, "%s", os_kernel);
format_output ("OS", buffer, format); format_output ("OS", buffer, format);
strcat (sysinfo, "\017 "); strcat (sysinfo, "\017 ");
strncat (sysinfo, buffer, bsize - strlen (sysinfo)); strncat (sysinfo, buffer, bsize - strlen (sysinfo));
@ -142,11 +142,11 @@ print_summary (int announce, char* format)
if (giga) if (giga)
{ {
snprintf (buffer, bsize, "%u x %s (%s) @ %.2fGHz", count, cpu_model, cpu_vendor, cpu_freq); g_snprintf (buffer, bsize, "%u x %s (%s) @ %.2fGHz", count, cpu_model, cpu_vendor, cpu_freq);
} }
else else
{ {
snprintf (buffer, bsize, "%u x %s (%s) @ %.0fMHz", count, cpu_model, cpu_vendor, cpu_freq); g_snprintf (buffer, bsize, "%u x %s (%s) @ %.0fMHz", count, cpu_model, cpu_vendor, cpu_freq);
} }
format_output ("CPU", buffer, format); format_output ("CPU", buffer, format);
@ -161,7 +161,7 @@ print_summary (int announce, char* format)
} }
free_space = pretty_freespace ("Physical", &mem_free, &mem_total); free_space = pretty_freespace ("Physical", &mem_free, &mem_total);
snprintf (buffer, bsize, "%s", free_space); g_snprintf (buffer, bsize, "%s", free_space);
g_free (free_space); g_free (free_space);
format_output ("RAM", buffer, format); format_output ("RAM", buffer, format);
strcat (sysinfo, "\017 "); strcat (sysinfo, "\017 ");
@ -224,21 +224,21 @@ print_summary (int announce, char* format)
{ {
if (weeks != 0) if (weeks != 0)
{ {
snprintf (buffer, bsize, "%dw %dd %dh %dm %ds", weeks, days, hours, minutes, seconds); g_snprintf (buffer, bsize, "%dw %dd %dh %dm %ds", weeks, days, hours, minutes, seconds);
} }
else else
{ {
snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds); g_snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds);
} }
} }
else else
{ {
snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds); g_snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds);
} }
} }
else else
{ {
snprintf (buffer, bsize, "%dm %ds", minutes, seconds); g_snprintf (buffer, bsize, "%dm %ds", minutes, seconds);
} }
} }
@ -272,7 +272,7 @@ print_os (int announce, char* format)
return HEXCHAT_EAT_ALL; return HEXCHAT_EAT_ALL;
} }
snprintf (buffer, bsize, "%s@%s, %s", user, host, kernel); g_snprintf (buffer, bsize, "%s@%s, %s", user, host, kernel);
format_output ("OS", buffer, format); format_output ("OS", buffer, format);
if (announce) if (announce)
@ -336,11 +336,11 @@ print_cpu (int announce, char* format)
if (giga) if (giga)
{ {
snprintf (buffer, bsize, "%u x %s (%s) @ %.2fGHz w/ %s L2 Cache", count, model, vendor, freq, cache); g_snprintf (buffer, bsize, "%u x %s (%s) @ %.2fGHz w/ %s L2 Cache", count, model, vendor, freq, cache);
} }
else else
{ {
snprintf (buffer, bsize, "%u x %s (%s) @ %.0fMHz w/ %s L2 Cache", count, model, vendor, freq, cache); g_snprintf (buffer, bsize, "%u x %s (%s) @ %.0fMHz w/ %s L2 Cache", count, model, vendor, freq, cache);
} }
format_output ("CPU", buffer, format); format_output ("CPU", buffer, format);
@ -377,7 +377,7 @@ print_ram (int announce, char* format)
return HEXCHAT_EAT_ALL; return HEXCHAT_EAT_ALL;
} }
snprintf (string, bsize, "%s - %s", pretty_freespace ("Physical", &mem_free, &mem_total), pretty_freespace ("Swap", &swap_free, &swap_total)); g_snprintf (string, bsize, "%s - %s", pretty_freespace ("Physical", &mem_free, &mem_total), pretty_freespace ("Swap", &swap_free, &swap_total));
format_output ("RAM", string, format); format_output ("RAM", string, format);
if (announce) if (announce)
@ -452,11 +452,11 @@ print_vga (int announce, char* format)
if (xs_parse_agpbridge (agp_bridge) != 0) if (xs_parse_agpbridge (agp_bridge) != 0)
{ {
snprintf (buffer, bsize, "%s", vid_card); g_snprintf (buffer, bsize, "%s", vid_card);
} }
else else
{ {
snprintf (buffer, bsize, "%s @ %s", vid_card, agp_bridge); g_snprintf (buffer, bsize, "%s @ %s", vid_card, agp_bridge);
} }
format_output ("VGA", buffer, format); format_output ("VGA", buffer, format);
@ -547,21 +547,21 @@ print_uptime (int announce, char* format)
{ {
if (weeks != 0) if (weeks != 0)
{ {
snprintf (buffer, bsize, "%dw %dd %dh %dm %ds", weeks, days, hours, minutes, seconds); g_snprintf (buffer, bsize, "%dw %dd %dh %dm %ds", weeks, days, hours, minutes, seconds);
} }
else else
{ {
snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds); g_snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds);
} }
} }
else else
{ {
snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds); g_snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds);
} }
} }
else else
{ {
snprintf (buffer, bsize, "%dm %ds", minutes, seconds); g_snprintf (buffer, bsize, "%dm %ds", minutes, seconds);
} }
} }
@ -602,7 +602,7 @@ netdata_cb (char *word[], char *word_eol[], void *userdata)
bytes_recv /= 1024; bytes_recv /= 1024;
bytes_sent /= 1024; bytes_sent /= 1024;
snprintf (netdata, bsize, "%s: %.1f MB Received, %.1f MB Sent", word[2], (double)bytes_recv/1024.0, (double)bytes_sent/1024.0); g_snprintf (netdata, bsize, "%s: %.1f MB Received, %.1f MB Sent", word[2], (double)bytes_recv/1024.0, (double)bytes_sent/1024.0);
hexchat_pluginpref_get_str (ph, "format", format); hexchat_pluginpref_get_str (ph, "format", format);
format_output ("Netdata", netdata, format); format_output ("Netdata", netdata, format);
@ -658,24 +658,24 @@ netstream_cb (char *word[], char *word_eol[], void *userdata)
if (bytes_recv > 1024) if (bytes_recv > 1024)
{ {
bytes_recv /= 1024; bytes_recv /= 1024;
snprintf (mag_r, 5, "KB/s"); g_snprintf (mag_r, 5, "KB/s");
} }
else else
{ {
snprintf (mag_r, 5, "B/s"); g_snprintf (mag_r, 5, "B/s");
} }
if (bytes_sent > 1024) if (bytes_sent > 1024)
{ {
bytes_sent /= 1024; bytes_sent /= 1024;
snprintf (mag_s, 5, "KB/s"); g_snprintf (mag_s, 5, "KB/s");
} }
else else
{ {
snprintf (mag_s, 5, "B/s"); g_snprintf (mag_s, 5, "B/s");
} }
snprintf (netstream, bsize, "%s: Receiving %llu %s, Sending %llu %s", word[2], bytes_recv, mag_r, bytes_sent, mag_s); g_snprintf (netstream, bsize, "%s: Receiving %llu %s, Sending %llu %s", word[2], bytes_recv, mag_r, bytes_sent, mag_s);
hexchat_pluginpref_get_str (ph, "format", format); hexchat_pluginpref_get_str (ph, "format", format);
format_output ("Netstream", netstream, format); format_output ("Netstream", netstream, format);

View File

@ -220,7 +220,7 @@ cfg_put_str (int fh, char *var, char *value)
char buf[512]; char buf[512];
int len; int len;
snprintf (buf, sizeof buf, "%s = %s\n", var, value); g_snprintf (buf, sizeof buf, "%s = %s\n", var, value);
len = strlen (buf); len = strlen (buf);
return (write (fh, buf, len) == len); 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]; char buf[400];
int len; 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); len = strlen (buf);
return (write (fh, buf, len) == len); return (write (fh, buf, len) == len);
} }
@ -245,7 +245,7 @@ cfg_put_int (int fh, int value, char *var)
if (value == -1) if (value == -1)
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); len = strlen (buf);
return (write (fh, buf, len) == len); return (write (fh, buf, len) == len);
} }
@ -843,7 +843,7 @@ load_default_config(void)
#ifdef WIN32 #ifdef WIN32
if (portable_mode () || SHGetKnownFolderPath (&FOLDERID_Downloads, 0, NULL, &roaming_path_wide) != S_OK) 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 else
{ {

View File

@ -368,10 +368,10 @@ chanopt_save_one_channel (chanopt_in_memory *co, int fh)
char buf[256]; char buf[256];
guint8 val; 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)); 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)); write (fh, buf, strlen (buf));
i = 0; 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); val = G_STRUCT_MEMBER (guint8, co, chanopt[i].offset);
if (val != SET_DEFAULT) 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)); write (fh, buf, strlen (buf));
} }
i++; 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) if (!g_ascii_strcasecmp (msg, "VERSION") && !prefs.hex_irc_hide_version)
{ {
#ifdef WIN32 #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)); get_cpu_arch (), get_sys_str (1));
#else #else
snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" / %s", g_snprintf (outbuf, sizeof (outbuf), "VERSION HexChat "PACKAGE_VERSION" / %s",
get_sys_str (1)); get_sys_str (1));
#endif #endif
serv->p_nctcp (serv, nick, outbuf); serv->p_nctcp (serv, nick, outbuf);

View File

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

View File

@ -705,7 +705,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
do do
{ {
n++; 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); while (g_access (buf, F_OK) == 0);
@ -865,7 +865,7 @@ dcc_connect_finished (GIOChannel *source, GIOCondition condition, struct DCC *dc
return TRUE; return TRUE;
dcc->dccstat = STAT_ACTIVE; 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) switch (dcc->type)
{ {
@ -984,7 +984,7 @@ dcc_wingate_proxy_traverse (GIOChannel *source, GIOCondition condition, struct D
struct proxy_state *proxy = dcc->proxy; struct proxy_state *proxy = dcc->proxy;
if (proxy->phase == 0) 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), "%s %d\r\n", net_ip(dcc->addr),
dcc->port); dcc->port);
proxy->bufferused = 0; proxy->bufferused = 0;
@ -1282,16 +1282,16 @@ dcc_http_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
char auth_data2[68]; char auth_data2[68];
int n, n2; 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); net_ip(dcc->addr), dcc->port);
if (prefs.hex_net_proxy_auth) 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); prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass);
base64_encode (auth_data, auth_data2, n2); 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->buffersize = n;
proxy->bufferused = 0; proxy->bufferused = 0;
memcpy (proxy->buffer, buf, proxy->buffersize); memcpy (proxy->buffer, buf, proxy->buffersize);
@ -1402,12 +1402,12 @@ dcc_connect (struct DCC *dcc)
} }
/* possible problems with filenames containing spaces? */ /* possible problems with filenames containing spaces? */
if (dcc->type == TYPE_RECV) 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 SEND %s %u %d %" G_GUINT64_FORMAT " %d", dcc->file, "DCC SEND %s %u %d %" G_GUINT64_FORMAT " %d", dcc->file,
dcc->addr, dcc->port, dcc->size, dcc->pasvid); dcc->addr, dcc->port, dcc->size, dcc->pasvid);
else 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->addr, dcc->port, dcc->pasvid);
dcc->serv->p_ctcp (dcc->serv, dcc->nick, tbuf); 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->lasttime = dcc->starttime = time (0);
dcc->fastsend = prefs.hex_dcc_fast_send; 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) switch (dcc->type)
{ {
@ -1898,7 +1898,7 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas
if (passive) if (passive)
{ {
dcc->pasvid = new_id(); 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" :
"DCC SEND %s 199 0 %" G_GUINT64_FORMAT " %d", "DCC SEND %s 199 0 %" G_GUINT64_FORMAT " %d",
file_part (dcc->file), file_part (dcc->file),
@ -1906,7 +1906,7 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas
} }
else 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 :
"DCC SEND %s %u %d %" G_GUINT64_FORMAT, "DCC SEND %s %u %d %" G_GUINT64_FORMAT,
file_part (dcc->file), dcc->addr, file_part (dcc->file), dcc->addr,
@ -2309,11 +2309,11 @@ dcc_chat (struct session *sess, char *nick, int passive)
if (passive) if (passive)
{ {
dcc->pasvid = new_id (); 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); dcc->port, dcc->pasvid);
} else } 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->addr, dcc->port);
} }
dcc->serv->p_ctcp (dcc->serv, nick, outbuf); dcc->serv->p_ctcp (dcc->serv, nick, outbuf);
@ -2339,7 +2339,7 @@ dcc_resume (struct DCC *dcc)
{ {
dcc->resume_sent = 1; dcc->resume_sent = 1;
/* filename contains spaces? Quote them! */ /* 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 RESUME %s %d %" G_GUINT64_FORMAT, "DCC RESUME %s %d %" G_GUINT64_FORMAT,
dcc->file, dcc->port, dcc->resumable); dcc->file, dcc->port, dcc->resumable);
@ -2416,7 +2416,7 @@ dcc_add_chat (session *sess, char *nick, int port, guint32 addr, int pasvid)
else else
{ {
char buff[128]; 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); 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) 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); fe_confirm (tbuf, dcc_confirm_send, dcc_deny_send, dcc);
} }
else if (prefs.hex_dcc_auto_recv == 2) 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); fe_dcc_add (dcc);
} }
sprintf (tbuf, "%" G_GUINT64_FORMAT, size); 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, EMIT_SIGNAL (XP_TE_DCCSENDOFFER, sess->server->front_session, nick,
file, tbuf, tbuf + 24, 0); 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 */ /* Checking if dcc is passive and if filename contains spaces */
if (dcc->pasvid) 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" :
"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); file_part (dcc->file), port, dcc->resumable, dcc->pasvid);
else 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 :
"DCC ACCEPT %s %d %" G_GUINT64_FORMAT, "DCC ACCEPT %s %d %" G_GUINT64_FORMAT,
file_part (dcc->file), port, dcc->resumable); file_part (dcc->file), port, dcc->resumable);

View File

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

View File

@ -38,14 +38,6 @@
#include "history.h" #include "history.h"
#ifndef HAVE_SNPRINTF
#define snprintf g_snprintf
#endif
#ifndef HAVE_VSNPRINTF
#define vsnprintf _vsnprintf
#endif
#ifdef SOCKS #ifdef SOCKS
#ifdef __sgi #ifdef __sgi
#include <sys/time.h> #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); EMIT_SIGNAL (XP_TE_IDENTD, current_sess, inet_ntoa (addr.sin_addr), username, NULL, NULL, 0);
#endif #endif
inet_ntop (AF_INET, &addr.sin_addr, ipbuf, sizeof (ipbuf)); 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); PrintText (current_sess, outbuf);
recv (read_sok, buf, sizeof (buf) - 1, 0); recv (read_sok, buf, sizeof (buf) - 1, 0);
@ -91,7 +91,7 @@ identd (char *username)
p = strchr (buf, ','); p = strchr (buf, ',');
if (p) 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); atoi (buf), atoi (p + 1), username);
outbuf[sizeof (outbuf) - 1] = 0; /* ensure null termination */ outbuf[sizeof (outbuf) - 1] = 0; /* ensure null termination */
send (read_sok, outbuf, strlen (outbuf), 0); send (read_sok, outbuf, strlen (outbuf), 0);
@ -155,7 +155,7 @@ identd_ipv6 (char *username)
identd_ipv6_is_running = FALSE; identd_ipv6_is_running = FALSE;
inet_ntop (AF_INET6, &addr.sin6_addr, ipbuf, sizeof (ipbuf)); 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); PrintText (current_sess, outbuf);
recv (read_sok, buf, sizeof (buf) - 1, 0); recv (read_sok, buf, sizeof (buf) - 1, 0);
@ -164,7 +164,7 @@ identd_ipv6 (char *username)
p = strchr (buf, ','); p = strchr (buf, ',');
if (p) 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 */ outbuf[sizeof (outbuf) - 1] = 0; /* ensure null termination */
send (read_sok, outbuf, strlen (outbuf), 0); send (read_sok, outbuf, strlen (outbuf), 0);
} }

View File

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

View File

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

View File

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

View File

@ -1926,7 +1926,7 @@ hexchat_pluginpref_set_int (hexchat_plugin *pl, const char *var, int value)
{ {
char buffer[12]; 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); 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); len = strlen (raw);
if (len < sizeof (tbuf) - 3) 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); tcp_send_len (serv, tbuf, len);
} else } else
{ {
@ -590,7 +590,7 @@ process_numeric (session * sess, int n,
char *tim; char *tim;
char outbuf[64]; char outbuf[64];
snprintf (outbuf, sizeof (outbuf), g_snprintf (outbuf, sizeof (outbuf),
"%02ld:%02ld:%02ld", idle / 3600, (idle / 60) % 60, "%02ld:%02ld:%02ld", idle / 3600, (idle / 60) % 60,
idle % 60); idle % 60);
if (timestamp == 0) if (timestamp == 0)

View File

@ -281,7 +281,7 @@ tcp_sendf (server *serv, const char *fmt, ...)
int len; int len;
va_start (args, fmt); 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); va_end (args);
send_buf[sizeof (send_buf) - 1] = '\0'; 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 */ 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) if (g_sess)
EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0); EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
else 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, X509_NAME_oneline (X509_get_issuer_name (ctx->current_cert), issuer,
sizeof (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); 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); EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
return (TRUE); /* always ok */ return (TRUE); /* always ok */
@ -634,7 +634,7 @@ ssl_do_connect (server * serv)
if ((err = ERR_get_error ()) > 0) if ((err = ERR_get_error ()) > 0)
{ {
ERR_error_string (err, err_buf); 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, EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL,
NULL, NULL, 0); NULL, NULL, 0);
@ -660,59 +660,59 @@ ssl_do_connect (server * serv)
if (!_SSL_get_cert_info (&cert_info, serv->ssl)) 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, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); NULL, 0);
snprintf (buf, sizeof (buf), " Subject:"); g_snprintf (buf, sizeof (buf), " Subject:");
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); NULL, 0);
for (i = 0; cert_info.subject_word[i]; i++) 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, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); NULL, 0);
} }
snprintf (buf, sizeof (buf), " Issuer:"); g_snprintf (buf, sizeof (buf), " Issuer:");
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); NULL, 0);
for (i = 0; cert_info.issuer_word[i]; i++) 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, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); 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); cert_info.algorithm, cert_info.algorithm_bits);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); NULL, 0);
/*if (cert_info.rsa_tmp_bits) /*if (cert_info.rsa_tmp_bits)
{ {
snprintf (buf, sizeof (buf), g_snprintf (buf, sizeof (buf),
" Public key algorithm uses ephemeral key with %d bits", " Public key algorithm uses ephemeral key with %d bits",
cert_info.rsa_tmp_bits); cert_info.rsa_tmp_bits);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); 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*/); cert_info.sign_algorithm/*, cert_info.sign_algorithm_bits*/);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); 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); cert_info.notbefore, cert_info.notafter);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); NULL, 0);
} else } 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, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); NULL, 0);
} }
chiper_info = _SSL_get_cipher_info (serv->ssl); /* static buffer */ 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, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL,
0); 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->version, chiper_info->chiper,
chiper_info->chiper_bits); chiper_info->chiper_bits);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL,
@ -727,7 +727,7 @@ ssl_do_connect (server * serv)
int hostname_err; int hostname_err;
if ((hostname_err = _SSL_check_hostname(cert, serv->hostname)) != 0) 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" : ""); hostname_err, serv->accept_invalid_cert ? " -- Ignored" : "");
if (serv->accept_invalid_cert) if (serv->accept_invalid_cert)
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0);
@ -736,7 +736,7 @@ ssl_do_connect (server * serv)
} }
break; 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); */ /* 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_GET_ISSUER_CERT_LOCALLY:
case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: 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: case X509_V_ERR_CERT_HAS_EXPIRED:
if (serv->accept_invalid_cert) 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), X509_verify_cert_error_string (verify_error),
verify_error); verify_error);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
@ -753,7 +753,7 @@ ssl_do_connect (server * serv)
break; break;
} }
default: default:
snprintf (buf, sizeof (buf), "%s.? (%d)", g_snprintf (buf, sizeof (buf), "%s.? (%d)",
X509_verify_cert_error_string (verify_error), X509_verify_cert_error_string (verify_error),
verify_error); verify_error);
conn_fail: conn_fail:
@ -775,7 +775,7 @@ conn_fail:
{ {
if (serv->ssl->session && serv->ssl->session->time + SSLTMOUT < time (NULL)) 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, EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, buf, NULL,
NULL, NULL, 0); NULL, NULL, 0);
server_cleanup (serv); /* ->connecting = FALSE */ server_cleanup (serv); /* ->connecting = FALSE */
@ -970,11 +970,11 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
} }
} }
#else #else
snprintf (outbuf, sizeof (outbuf), "%s/auth/xchat_auth", g_snprintf (outbuf, sizeof (outbuf), "%s/auth/xchat_auth",
g_get_home_dir ()); g_get_home_dir ());
if (access (outbuf, X_OK) == 0) 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); g_get_home_dir (), prefs.hex_irc_user_name);
handle_command (serv->server_session, outbuf, FALSE); 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) if (buf[1] == 90)
return 0; 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); proxy_error (print_fd, buf);
return 1; 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[0] != 5 || buf[1] != 0)
{ {
if (buf[1] == 2) 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 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); proxy_error (print_fd, buf);
return 1; return 1;
} }
@ -1334,7 +1334,7 @@ traverse_wingate (int print_fd, int sok, char *serverAddr, int port)
{ {
char buf[128]; 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); send (sok, buf, strlen (buf), 0);
return 0; return 0;
@ -1422,16 +1422,16 @@ traverse_http (int print_fd, int sok, char *serverAddr, int port)
char auth_data2[252]; char auth_data2[252];
int n, n2; 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); serverAddr, port);
if (prefs.hex_net_proxy_auth) 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); prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass);
base64_encode (auth_data, auth_data2, n2); 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); send (sok, buf, n, 0);
n = http_read_line (print_fd, sok, buf, sizeof (buf)); 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); local_ip = net_resolve (ns_local, prefs.hex_net_bind_host, 0, &real_hostname);
if (local_ip != NULL) 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)); write (serv->childwrite, buf, strlen (buf));
net_bind (ns_local, serv->sok4, serv->sok6); net_bind (ns_local, serv->sok4, serv->sok6);
bound = 1; bound = 1;
@ -1567,7 +1567,7 @@ server_child (server * serv)
/* first resolve where we want to connect to */ /* first resolve where we want to connect to */
if (proxy_type > 0) 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)); write (serv->childwrite, buf, strlen (buf));
ip = net_resolve (ns_server, proxy_host, proxy_port, &real_hostname); ip = net_resolve (ns_server, proxy_host, proxy_port, &real_hostname);
g_free (proxy_host); g_free (proxy_host);
@ -1601,7 +1601,7 @@ server_child (server * serv)
connect_port = port; 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); real_hostname, ip, connect_port);
write (serv->childwrite, buf, strlen (buf)); write (serv->childwrite, buf, strlen (buf));
@ -1615,7 +1615,7 @@ server_child (server * serv)
if (error != 0) 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)); write (serv->childwrite, buf, strlen (buf));
} else } else
{ {
@ -1627,11 +1627,11 @@ server_child (server * serv)
case 0: /* success */ case 0: /* success */
#ifdef USE_MSPROXY #ifdef USE_MSPROXY
if (!serv->dont_use_proxy && (proxy_type == 5)) 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); serv->msp_state.seq_sent);
else else
#endif #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)); write (serv->childwrite, buf, strlen (buf));
break; break;
case 1: /* socks traversal failed */ case 1: /* socks traversal failed */
@ -1640,7 +1640,7 @@ server_child (server * serv)
} }
} else } 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)); write (serv->childwrite, buf, strlen (buf));
} }
} }

View File

@ -319,9 +319,9 @@ scrollback_load (session *sess)
if (buf[0] == 'T') if (buf[0] == 'T')
{ {
if (sizeof (time_t) == 4) if (sizeof (time_t) == 4)
stamp = strtoul (buf + 2, NULL, 10); stamp = g_ascii_strtoull (buf + 2, NULL, 10);
else 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, ' '); text = strchr (buf + 3, ' ');
if (text && text[1]) if (text && text[1])
{ {
@ -383,7 +383,7 @@ log_close (session *sess)
{ {
currenttime = time (NULL); currenttime = time (NULL);
write (sess->logfd, obuf, 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))); ctime (&currenttime)));
close (sess->logfd); close (sess->logfd);
sess->logfd = -1; sess->logfd = -1;
@ -570,11 +570,11 @@ log_create_pathname (char *servname, char *channame, char *netname)
/* create final path/filename */ /* create final path/filename */
if (logmask_is_fullpath ()) if (logmask_is_fullpath ())
{ {
snprintf (fname, sizeof (fname), "%s", fnametime); g_snprintf (fname, sizeof (fname), "%s", fnametime);
} }
else /* relative path */ 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 */ /* create all the subdirectories */
@ -606,7 +606,7 @@ log_open_file (char *servname, char *channame, char *netname)
return -1; return -1;
currenttime = time (NULL); currenttime = time (NULL);
write (fd, buf, write (fd, buf,
snprintf (buf, sizeof (buf), _("**** BEGIN LOGGING AT %s\n"), g_snprintf (buf, sizeof (buf), _("**** BEGIN LOGGING AT %s\n"),
ctime (&currenttime))); ctime (&currenttime)));
return fd; 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 Each XP_TE_* signal is hard coded to call text_emit which calls
display_event which decodes the data 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 it always 'knows' that format of the string (basically is preparses much
of the work) of the work)
@ -1584,7 +1584,7 @@ pevent_make_pntevts ()
g_free (pntevts[i]); g_free (pntevts[i]);
if (pevt_build_string (pntevts_text[i], &(pntevts[i]), &m) != 0) 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); _("Error parsing event %s.\nLoading default."), te[i].name);
fe_message (out, FE_MSG_WARN); fe_message (out, FE_MSG_WARN);
g_free (pntevts_text[i]); g_free (pntevts_text[i]);
@ -1725,7 +1725,7 @@ pevent_check_all_loaded ()
if (pntevts_text[i] == NULL) if (pntevts_text[i] == NULL)
{ {
/*printf ("%s\n", te[i].name); /*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); */ gtkutil_simpledialog(out); */
/* make-te.c sets this 128 flag (DON'T call gettext() flag) */ /* make-te.c sets this 128 flag (DON'T call gettext() flag) */
if (te[i].num_args & 128) 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') 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); fe_message (o, FE_MSG_WARN);
goto err; 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)) 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; a = tbuf;
stripcolor_args &= ~ARG_FLAG(1); /* don't strip color from this argument */ 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++) 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)); "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])); "event_text=%s\n\n", pntevts_text[i]));
} }
@ -2373,9 +2373,9 @@ sound_save ()
{ {
if (sound_files[i] && sound_files[i][0]) 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)); "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])); "sound=%s\n\n", sound_files[i]));
} }
} }

View File

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

View File

@ -94,7 +94,7 @@ chanlist_update_caption (server *serv)
{ {
gchar tbuf[256]; gchar tbuf[256];
snprintf (tbuf, sizeof tbuf, g_snprintf (tbuf, sizeof tbuf,
_("Displaying %d/%d users on %d/%d channels."), _("Displaying %d/%d users on %d/%d channels."),
serv->gui->chanlist_users_shown_count, serv->gui->chanlist_users_shown_count,
serv->gui->chanlist_users_found_count, serv->gui->chanlist_users_found_count,
@ -456,7 +456,7 @@ chanlist_join (GtkWidget * wid, server *serv)
{ {
if (serv->connected && (strcmp (chan, "*") != 0)) 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); handle_command (serv->server_session, tbuf, FALSE);
} else } else
gdk_beep (); gdk_beep ();
@ -482,7 +482,7 @@ chanlist_filereq_done (server *serv, char *file)
if (fh == -1) if (fh == -1)
return; 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)); serv->servername, ctime (&t));
write (fh, buf, strlen (buf)); write (fh, buf, strlen (buf));
@ -494,7 +494,7 @@ chanlist_filereq_done (server *serv, char *file)
COL_CHANNEL, &chan, COL_CHANNEL, &chan,
COL_USERS, &users, COL_USERS, &users,
COL_TOPIC, &topic, -1); 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 (chan);
g_free (topic); g_free (topic);
write (fh, buf, strlen (buf)); write (fh, buf, strlen (buf));
@ -717,7 +717,7 @@ chanlist_opengui (server *serv, int do_refresh)
return; 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)); server_get_network (serv, TRUE));
serv->gui->chanlist_pending_rows = NULL; 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); per = (float) ((dcc->ack * 100.00) / dcc->size);
proper_unit (dcc->size, size, sizeof (size)); proper_unit (dcc->size, size, sizeof (size));
proper_unit (dcc->pos, pos, sizeof (pos)); 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);
snprintf (perc, sizeof (perc), "%.0f%%", per); g_snprintf (perc, sizeof (perc), "%.0f%%", per);
if (dcc->cps != 0) if (dcc->cps != 0)
{ {
to_go = (dcc->size - dcc->ack) / dcc->cps; 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); to_go / 3600, (to_go / 60) % 60, to_go % 60);
} else } else
strcpy (eta, "--:--:--"); strcpy (eta, "--:--:--");
@ -252,14 +252,14 @@ dcc_prepare_row_recv (struct DCC *dcc, GtkListStore *store, GtkTreeIter *iter,
proper_unit (dcc->resumable, pos, sizeof (pos)); proper_unit (dcc->resumable, pos, sizeof (pos));
else else
proper_unit (dcc->pos, pos, sizeof (pos)); 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 */ /* percentage recv'ed */
per = (float) ((dcc->pos * 100.00) / dcc->size); 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) if (dcc->cps != 0)
{ {
to_go = (dcc->size - dcc->pos) / dcc->cps; 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); to_go / 3600, (to_go / 60) % 60, to_go % 60);
} else } else
strcpy (eta, "--:--:--"); strcpy (eta, "--:--:--");
@ -525,7 +525,7 @@ resume_clicked (GtkWidget * wid, gpointer none)
fe_message (_("That file is not resumable."), FE_MSG_ERROR); fe_message (_("That file is not resumable."), FE_MSG_ERROR);
break; break;
case 1: case 1:
snprintf (buf, sizeof (buf), g_snprintf (buf, sizeof (buf),
_( "Cannot access file: %s\n" _( "Cannot access file: %s\n"
"%s.\n" "%s.\n"
"Resuming not possible."), dcc->destfile, "Resuming not possible."), dcc->destfile,
@ -606,7 +606,7 @@ browse_folder (char *dir)
#else #else
char buf[512]; char buf[512];
snprintf (buf, sizeof (buf), "file://%s", dir); g_snprintf (buf, sizeof (buf), "file://%s", dir);
fe_open_url (buf); fe_open_url (buf);
#endif #endif
} }
@ -639,7 +639,7 @@ dcc_details_populate (struct DCC *dcc)
gtk_label_set_text (GTK_LABEL (dccfwin.file_label), dcc->file); gtk_label_set_text (GTK_LABEL (dccfwin.file_label), dcc->file);
/* address and port */ /* 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); 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]; char buf[64];
label = gtk_label_new (NULL); 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_label_set_markup (GTK_LABEL (label), buf);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0); 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); 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 */ /* fall back */
if (pango_font_description_get_size (style->font_desc) == 0) 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); fe_message (buf, FE_MSG_ERROR);
pango_font_description_free (style->font_desc); pango_font_description_free (style->font_desc);
style->font_desc = pango_font_description_from_string ("sans 11"); 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) if (per > 1.0)
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); 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); serv->lag_sent ? "+" : "", lag / 1000, (lag/100) % 10);
while (list) while (list)
@ -797,8 +797,8 @@ fe_set_throttle (server *serv)
sess = list->data; sess = list->data;
if (sess->server == serv) if (sess->server == serv)
{ {
snprintf (tbuf, sizeof (tbuf) - 1, _("%d bytes"), serv->sendq_len); g_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 (tip, sizeof (tip) - 1, _("Network send queue: %d bytes"), serv->sendq_len);
g_free (sess->res->queue_tip); g_free (sess->res->queue_tip);
sess->res->queue_tip = g_strdup (tip); sess->res->queue_tip = g_strdup (tip);

View File

@ -849,7 +849,7 @@ key_save_kbs (void)
0x180, XOF_DOMODE); 0x180, XOF_DOMODE);
if (fd < 0) if (fd < 0)
return 1; 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) while (list)
{ {
@ -857,17 +857,17 @@ key_save_kbs (void)
accel_text = gtk_accelerator_name (kb->keyval, kb->mod); 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)); write (fd, buf, strlen (buf));
g_free (accel_text); g_free (accel_text);
if (kb->data1 && kb->data1[0]) 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 else
write (fd, "D1!\n", 4); write (fd, "D1!\n", 4);
if (kb->data2 && kb->data2[0]) 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 else
write (fd, "D2!\n", 4); write (fd, "D2!\n", 4);
@ -1813,9 +1813,9 @@ replace_handle (GtkWidget *t)
memcpy (outbuf, text, xlen); memcpy (outbuf, text, xlen);
outbuf[xlen] = 0; outbuf[xlen] = 0;
if (postfix_pnt == NULL) if (postfix_pnt == NULL)
snprintf (word, sizeof (word), "%s", pop->cmd); g_snprintf (word, sizeof (word), "%s", pop->cmd);
else 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)); g_strlcat (outbuf, word, sizeof(outbuf));
SPELL_ENTRY_SET_TEXT (t, outbuf); SPELL_ENTRY_SET_TEXT (t, outbuf);
SPELL_ENTRY_SET_POS (t, -1); SPELL_ENTRY_SET_POS (t, -1);

View File

@ -158,9 +158,9 @@ joind_show_dialog (server *serv)
gtk_widget_show (vbox2); gtk_widget_show (vbox2);
gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0); 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)); 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); label = gtk_label_new (buf);
gtk_widget_show (label); gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0); 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_widget_show (entry1);
gtk_box_pack_start (GTK_BOX (hbox2), entry1, TRUE, TRUE, 8); 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.")); _("If you know the name of the channel you want to join, enter it here."));
label = gtk_label_new (buf); label = gtk_label_new (buf);
gtk_widget_show (label); gtk_widget_show (label);
@ -212,7 +212,7 @@ joind_show_dialog (server *serv)
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton3), radiobutton1_group); gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton3), radiobutton1_group);
radiobutton1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton3)); 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.")); _("Retrieving the Channel-List may take a minute or two."));
label = gtk_label_new (buf); label = gtk_label_new (buf);
gtk_widget_show (label); gtk_widget_show (label);

View File

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

View File

@ -393,9 +393,9 @@ toggle_cb (GtkWidget *item, char *pref_name)
char buf[256]; char buf[256];
if (GTK_CHECK_MENU_ITEM (item)->active) 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 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); handle_command (current_sess, buf, FALSE);
} }
@ -586,7 +586,7 @@ menu_nickinfo_cb (GtkWidget *menu, session *sess)
return; return;
/* issue a /WHOIS */ /* 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); handle_command (sess, buf, FALSE);
/* and hide the output */ /* and hide the output */
sess->server->skip_next_whois = 1; 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 */ /* let the translators tweak this if need be */
fmt = _("<tt><b>%-11s</b></tt> %s"); 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) if (user->realname)
{ {
real = strip_color (user->realname, -1, STRIP_ALL|STRIP_ESCMARKUP); 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); g_free (real);
} else } 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); item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate", g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (copy_to_clipboard_cb), G_CALLBACK (copy_to_clipboard_cb),
user->realname ? user->realname : unknown); user->realname ? user->realname : unknown);
snprintf (buf, sizeof (buf), fmt, _("User:"), g_snprintf (buf, sizeof (buf), fmt, _("User:"),
user->hostname ? user->hostname : unknown); user->hostname ? user->hostname : unknown);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0); item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate", g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (copy_to_clipboard_cb), G_CALLBACK (copy_to_clipboard_cb),
user->hostname ? user->hostname : unknown); user->hostname ? user->hostname : unknown);
snprintf (buf, sizeof (buf), fmt, _("Account:"), g_snprintf (buf, sizeof (buf), fmt, _("Account:"),
user->account ? user->account : unknown); user->account ? user->account : unknown);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0); item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate", 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); users_country = country (user->hostname);
if (users_country) 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); item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate", g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (copy_to_clipboard_cb), users_country); 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); user->servername ? user->servername : unknown);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0); item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate", g_signal_connect (G_OBJECT (item), "activate",
@ -662,12 +662,12 @@ menu_create_nickinfo_menu (struct User *user, GtkWidget *submenu)
{ {
char min[96]; 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)); (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 } 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); 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) if (away)
{ {
char *msg = strip_color (away->message ? away->message : unknown, -1, STRIP_ALL|STRIP_ESCMARKUP); 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); g_free (msg);
item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0); item = menu_quick_item (0, buf, submenu, XCMENU_MARKUP, 0, 0);
g_signal_connect (G_OBJECT (item), "activate", 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? */ /* more than 1 nick selected? */
if (num_sel > 1) 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, buf, menu, 0, 0, 0);
menu_quick_item (0, 0, menu, XCMENU_SHADED, 0, 0); menu_quick_item (0, 0, menu, XCMENU_SHADED, 0, 0);
} else } else
@ -935,7 +935,7 @@ open_url_cb (GtkWidget *item, char *url)
char buf[512]; char buf[512];
/* pass this to /URL so it can handle irc:// */ /* 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); handle_command (current_sess, buf, FALSE);
} }
@ -984,7 +984,7 @@ menu_chan_cycle (GtkWidget * menu, char *chan)
if (current_sess) if (current_sess)
{ {
snprintf (tbuf, sizeof tbuf, "CYCLE %s", chan); g_snprintf (tbuf, sizeof tbuf, "CYCLE %s", chan);
handle_command (current_sess, tbuf, FALSE); handle_command (current_sess, tbuf, FALSE);
} }
} }
@ -996,7 +996,7 @@ menu_chan_part (GtkWidget * menu, char *chan)
if (current_sess) if (current_sess)
{ {
snprintf (tbuf, sizeof tbuf, "part %s", chan); g_snprintf (tbuf, sizeof tbuf, "part %s", chan);
handle_command (current_sess, tbuf, FALSE); handle_command (current_sess, tbuf, FALSE);
} }
} }
@ -1008,7 +1008,7 @@ menu_chan_join (GtkWidget * menu, char *chan)
if (current_sess) if (current_sess)
{ {
snprintf (tbuf, sizeof tbuf, "join %s", chan); g_snprintf (tbuf, sizeof tbuf, "join %s", chan);
handle_command (current_sess, tbuf, FALSE); handle_command (current_sess, tbuf, FALSE);
} }
} }

View File

@ -190,11 +190,11 @@ notify_gui_update (void)
{ {
lastseenminutes = (int)(time (0) - lastseen) / 60; lastseenminutes = (int)(time (0) - lastseen) / 60;
if (lastseenminutes < 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) else if (lastseenminutes < 120)
snprintf (agobuf, sizeof (agobuf), _("An hour ago")); g_snprintf (agobuf, sizeof (agobuf), _("An hour ago"));
else else
snprintf (agobuf, sizeof (agobuf), _("%d hours ago"), lastseenminutes / 60); g_snprintf (agobuf, sizeof (agobuf), _("%d hours ago"), lastseenminutes / 60);
seen = agobuf; seen = agobuf;
} }
if (!valid) /* create new tree row if required */ if (!valid) /* create new tree row if required */
@ -219,7 +219,7 @@ notify_gui_update (void)
name = ""; name = "";
server = server_get_network (servnot->server, TRUE); 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; seen = agobuf;
if (!valid) /* create new tree row if required */ 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); gtk_table_attach_defaults (GTK_TABLE (table), wid, 1, 2, 2, 3);
label = gtk_label_new (NULL); 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_label_set_markup (GTK_LABEL (label), buf);
gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 3, 4); 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 */ /* mIRC colors 0-31 are here */
for (i = 0; i < 32; i++) 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); cfg_get_color (cfg, prefname, &red, &green, &blue);
colors[i].red = red; colors[i].red = red;
colors[i].green = green; colors[i].green = green;
@ -132,7 +132,7 @@ palette_load (void)
/* our special colors are mapped at 256+ */ /* our special colors are mapped at 256+ */
for (i = 256, j = 32; j < MAX_COL+1; i++, j++) 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); cfg_get_color (cfg, prefname, &red, &green, &blue);
colors[j].red = red; colors[j].red = red;
colors[j].green = green; colors[j].green = green;
@ -155,14 +155,14 @@ palette_save (void)
/* mIRC colors 0-31 are here */ /* mIRC colors 0-31 are here */
for (i = 0; i < 32; i++) 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); cfg_put_color (fh, colors[i].red, colors[i].green, colors[i].blue, prefname);
} }
/* our special colors are mapped at 256+ */ /* our special colors are mapped at 256+ */
for (i = 256, j = 32; j < MAX_COL+1; i++, j++) 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); 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; 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 = serv->gui->rawlog_window =
mg_create_generic_tab ("RawLog", tbuf, FALSE, TRUE, close_rawlog, serv, mg_create_generic_tab ("RawLog", tbuf, FALSE, TRUE, close_rawlog, serv,
640, 320, &vbox, serv); 640, 320, &vbox, serv);

View File

@ -1658,7 +1658,7 @@ bold_label (char *text)
char buf[128]; char buf[128];
GtkWidget *label; GtkWidget *label;
snprintf (buf, sizeof (buf), "<b>%s</b>", text); g_snprintf (buf, sizeof (buf), "<b>%s</b>", text);
label = gtk_label_new (buf); label = gtk_label_new (buf);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); 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); editwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (editwindow), 4); 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_title (GTK_WINDOW (editwindow), buf);
gtk_window_set_default_size (GTK_WINDOW (editwindow), netedit_win_width, netedit_win_height); 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)); 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 buf[128];
char *sp; 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, ' '); sp = strchr (buf + 17, ' ');
if (sp) if (sp)
*sp = '\n'; *sp = '\n';
@ -753,7 +753,7 @@ setup_create_italic_label (char *text)
char buf[256]; char buf[256];
label = gtk_label_new (NULL); 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_markup (GTK_LABEL (label), buf);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); 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]; char buf[128];
if (row == 0) if (row == 0)
snprintf (buf, sizeof (buf), "<b>%s</b>", _(labeltext)); g_snprintf (buf, sizeof (buf), "<b>%s</b>", _(labeltext));
else 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); label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), buf); gtk_label_set_markup (GTK_LABEL (label), buf);
@ -1790,7 +1790,7 @@ setup_add_page (const char *title, GtkWidget *book, GtkWidget *tab)
/* label */ /* label */
label = gtk_label_new (NULL); 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_label_set_markup (GTK_LABEL (label), buf);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_misc_set_padding (GTK_MISC (label), 2, 1); gtk_misc_set_padding (GTK_MISC (label), 2, 1);

View File

@ -42,11 +42,11 @@
enum enum
{ {
COL_PIX=0, // GdkPixbuf * COL_PIX=0, /* GdkPixbuf * */
COL_NICK=1, // char * COL_NICK=1, /* char * */
COL_HOST=2, // char * COL_HOST=2, /* char * */
COL_USER=3, // struct User * COL_USER=3, /* struct User * */
COL_GDKCOLOR=4 // GdkColor * COL_GDKCOLOR=4 /* GdkColor * */
}; };
@ -105,7 +105,7 @@ fe_userlist_numbers (session *sess)
{ {
if (sess->total) 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; tbuf[sizeof (tbuf) - 1] = 0;
gtk_label_set_text (GTK_LABEL (sess->gui->namelistinfo), tbuf); gtk_label_set_text (GTK_LABEL (sess->gui->namelistinfo), tbuf);
} else } else

View File

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