diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/fishlim/fish.c | 36 | ||||
-rw-r--r-- | plugins/fishlim/fish.h | 1 | ||||
-rw-r--r-- | plugins/fishlim/irc.c | 14 | ||||
-rw-r--r-- | plugins/fishlim/irc.h | 4 | ||||
-rw-r--r-- | plugins/fishlim/keystore.c | 42 | ||||
-rw-r--r-- | plugins/fishlim/keystore.h | 5 | ||||
-rw-r--r-- | plugins/fishlim/plugin_hexchat.c | 49 | ||||
-rw-r--r-- | plugins/python/python.c | 2 | ||||
-rw-r--r-- | plugins/sysinfo/match.c | 6 | ||||
-rw-r--r-- | plugins/sysinfo/parse.c | 42 | ||||
-rw-r--r-- | plugins/sysinfo/pci.c | 10 | ||||
-rw-r--r-- | plugins/sysinfo/sysinfo.cpp | 2 | ||||
-rw-r--r-- | plugins/sysinfo/xsys.c | 50 |
13 files changed, 127 insertions, 136 deletions
diff --git a/plugins/fishlim/fish.c b/plugins/fishlim/fish.c index a230185d..00ecfbfa 100644 --- a/plugins/fishlim/fish.c +++ b/plugins/fishlim/fish.c @@ -39,17 +39,17 @@ static const char fish_base64[64] = "./0123456789abcdefghijklmnopqrstuvwxyzABCDE 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, 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, -// @ 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, -// 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, -// ` 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, -// 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, }; @@ -75,11 +75,11 @@ char *fish_encrypt(const char *key, size_t keylen, const char *message) { messagelen = strlen(message); 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; while (*message) { - // Read 8 bytes (a Blowfish block) + /* Read 8 bytes (a Blowfish block) */ BF_LONG binary[2] = { 0, 0 }; unsigned char c; for (i = 0; i < 8; i++) { @@ -89,10 +89,10 @@ char *fish_encrypt(const char *key, size_t keylen, const char *message) { } message += 8; - // Encrypt block + /* Encrypt block */ BF_encrypt(binary, &bfkey); - // Emit FiSH-BASE64 + /* Emit FiSH-BASE64 */ bit = 0; word = 1; 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; } *end = '\0'; @@ -127,7 +127,7 @@ char *fish_decrypt(const char *key, size_t keylen, const char *data) { end = decrypted; while (*data) { - // Convert from FiSH-BASE64 + /* Convert from FiSH-BASE64 */ BF_LONG binary[2] = { 0, 0 }; bit = 0; 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); - // Copy to buffer + /* Copy to buffer */ GET_BYTES(end, binary[0]); GET_BYTES(end, binary[1]); } @@ -163,11 +163,11 @@ char *fish_encrypt_for_nick(const char *nick, const char *data) { char *key; char *encrypted; - // Look for key + /* Look for key */ key = keystore_get_key(nick); if (!key) return NULL; - // Encrypt + /* Encrypt */ encrypted = fish_encrypt(key, strlen(key), data); 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 *key; char *decrypted; - // Look for key + /* Look for key */ key = keystore_get_key(nick); if (!key) return NULL; - // Decrypt + /* Decrypt */ decrypted = fish_decrypt(key, strlen(key), data); g_free(key); diff --git a/plugins/fishlim/fish.h b/plugins/fishlim/fish.h index d7415a5a..238f52e7 100644 --- a/plugins/fishlim/fish.h +++ b/plugins/fishlim/fish.h @@ -25,7 +25,6 @@ #ifndef FISH_H #define FISH_H -#include <stdbool.h> #include <stddef.h> #include <glib.h> diff --git a/plugins/fishlim/irc.c b/plugins/fishlim/irc.c index 9bd84769..deba545b 100644 --- a/plugins/fishlim/irc.c +++ b/plugins/fishlim/irc.c @@ -32,26 +32,26 @@ * at spaces. The prefix and command is extracted from the message, and * 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, size_t *parameters_offset) { size_t w = 1; if (prefix) *prefix = 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 (prefix) *prefix = &words[w][1]; w++; } - // Check command - if (words[w][0] == '\0') return false; + /* Check command */ + if (words[w][0] == '\0') return FALSE; if (command) *command = words[w]; w++; *parameters_offset = w; - return true; + return TRUE; } @@ -70,11 +70,11 @@ char *irc_prefix_get_nick(const char *prefix) { if (!prefix) return NULL; - // Find end of nick + /* Find end of nick */ end = prefix; while (*end != '\0' && *end != '!' && *end != '@') end++; - // Allocate string + /* Allocate string */ length = end - prefix; return g_strndup (prefix, length); } diff --git a/plugins/fishlim/irc.h b/plugins/fishlim/irc.h index 7ff72355..c5649233 100644 --- a/plugins/fishlim/irc.h +++ b/plugins/fishlim/irc.h @@ -25,12 +25,10 @@ #ifndef IRC_H #define IRC_H -#include <stdbool.h> #include <stddef.h> - #include <glib.h> -bool irc_parse_message(const char *words[], +gboolean irc_parse_message(const char *words[], const char **prefix, const char **command, size_t *parameters_offset); char *irc_prefix_get_nick(const char *prefix); diff --git a/plugins/fishlim/keystore.c b/plugins/fishlim/keystore.c index 964b4cb4..84373996 100644 --- a/plugins/fishlim/keystore.c +++ b/plugins/fishlim/keystore.c @@ -58,7 +58,7 @@ static GKeyFile *getConfigFile() { static const char *get_keystore_password() { return (keystore_password != NULL ? keystore_password : - // Silly default value... + /* Silly default value... */ "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. */ char *keystore_get_key(const char *nick) { - // Get the key + /* Get the key */ GKeyFile *keyfile = getConfigFile(); gchar *value = get_nick_value(keyfile, nick, "key"); g_key_file_free(keyfile); if (!value) return NULL; if (strncmp(value, "+OK ", 4) != 0) { - // Key is stored in plaintext + /* Key is stored in plaintext */ return value; } else { - // Key is encrypted + /* Key is encrypted */ const char *encrypted = value+4; const char *password = get_keystore_password(); 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. */ -static bool delete_nick(GKeyFile *keyfile, const char *nick) { +static gboolean delete_nick(GKeyFile *keyfile, const char *nick) { gchar **group; gchar **groups = g_key_file_get_groups(keyfile, NULL); - bool ok = false; + gboolean ok = FALSE; for (group = groups; *group != NULL; group++) { 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. */ -static bool save_keystore(GKeyFile *keyfile) { +static gboolean save_keystore(GKeyFile *keyfile) { char *filename; - bool ok; + gboolean ok; filename = get_config_filename(); #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. */ -bool keystore_store_key(const char *nick, const char *key) { +gboolean keystore_store_key(const char *nick, const char *key) { const char *password; char *encrypted; char *wrapped; - bool ok = false; + gboolean ok = FALSE; GKeyFile *keyfile = getConfigFile(); - // Remove old key + /* Remove old key */ delete_nick(keyfile, nick); - // Add new key + /* Add new key */ password = get_keystore_password(); if (password) { - // Encrypt the password + /* Encrypt the password */ encrypted = fish_encrypt(password, strlen(password), key); if (!encrypted) goto end; - // Prepend "+OK " + /* Prepend "+OK " */ wrapped = g_strconcat("+OK ", encrypted, NULL); g_free(encrypted); - // Store encrypted in file + /* Store encrypted in file */ g_key_file_set_string(keyfile, nick, "key", wrapped); g_free(wrapped); } else { - // Store unencrypted in file + /* Store unencrypted in file */ g_key_file_set_string(keyfile, nick, "key", key); } - // Save key store file + /* Save key store file */ ok = save_keystore(keyfile); end: @@ -207,13 +207,13 @@ bool keystore_store_key(const char *nick, const char *key) { /** * Deletes a nick from the key store. */ -bool keystore_delete_nick(const char *nick) { +gboolean keystore_delete_nick(const char *nick) { GKeyFile *keyfile = getConfigFile(); - // Delete entry - bool ok = delete_nick(keyfile, nick); + /* Delete entry */ + gboolean ok = delete_nick(keyfile, nick); - // Save + /* Save */ if (ok) save_keystore(keyfile); g_key_file_free(keyfile); diff --git a/plugins/fishlim/keystore.h b/plugins/fishlim/keystore.h index 3c609867..3d90606a 100644 --- a/plugins/fishlim/keystore.h +++ b/plugins/fishlim/keystore.h @@ -25,14 +25,13 @@ #ifndef KEYSTORE_H #define KEYSTORE_H -#include <stdbool.h> #include <stddef.h> #include <glib.h> char *keystore_get_key(const char *nick); -bool keystore_store_key(const char *nick, const char *key); -bool keystore_delete_nick(const char *nick); +gboolean keystore_store_key(const char *nick, const char *key); +gboolean keystore_delete_nick(const char *nick); #endif diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c index 82befceb..556a2f51 100644 --- a/plugins/fishlim/plugin_hexchat.c +++ b/plugins/fishlim/plugin_hexchat.c @@ -28,13 +28,8 @@ #include <stdlib.h> #include <string.h> -// #pragma GCC visibility push(default) #include "hexchat-plugin.h" #define HEXCHAT_MAX_WORDS 32 -// #pragma GCC visibility pop - -//#define EXPORT __attribute((visibility("default"))) -//#define EXPORT #include "fish.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) { const char *own_nick; - // Encrypt the message if possible + /* Encrypt the message if possible */ const char *channel = hexchat_get_info(ph, "channel"); char *encrypted = fish_encrypt_for_nick(channel, word_eol[1]); if (!encrypted) return HEXCHAT_EAT_NONE; - // Display message + /* Display message */ own_nick = hexchat_get_info(ph, "nick"); 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); 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)) return HEXCHAT_EAT_NONE; - // Topic (command 332) has an extra parameter + /* Topic (command 332) has an extra parameter */ if (!strcmp(command, "332")) w++; - // Look for encrypted data + /* Look for encrypted data */ for (ew = w+1; ew < HEXCHAT_MAX_WORDS-1; ew++) { const char *s = (ew == w+1 ? word[ew]+1 : word[ew]); 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; has_encrypted_data: ; - // Extract sender nick and recipient nick/channel + /* Extract sender nick and recipient nick/channel */ sender_nick = irc_prefix_get_nick(prefix); 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]; decrypted = fish_decrypt_from_nick(recipient, encrypted); if (!decrypted) decrypted = fish_decrypt_from_nick(sender_nick, encrypted); - // Check for error + /* Check for error */ if (!decrypted) goto decrypt_error; - // Build unecrypted message + /* Build unecrypted message */ message = g_string_sized_new (100); /* TODO: more accurate estimation of size */ 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, ' '); if (uw == ew) { - // Add the encrypted data + /* Add the encrypted data */ peice = decrypted; - uw++; // Skip "OK+" + uw++; /* Skip "OK+" */ 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, ':'); } @@ -174,7 +169,7 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs * } } 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]; } @@ -182,8 +177,8 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs * } g_free(decrypted); - // Simulate unencrypted message - //hexchat_printf(ph, "simulating: %s\n", message->str); + /* Simulate unencrypted message */ + /* hexchat_printf(ph, "simulating: %s\n", message->str); */ hexchat_command(ph, message->str); 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 *key; - // Check syntax + /* Check syntax */ if (*word[2] == '\0') { hexchat_printf(ph, "%s\n", usage_setkey); return HEXCHAT_EAT_HEXCHAT; } if (*word[3] == '\0') { - // /setkey password + /* /setkey password */ nick = hexchat_get_info(ph, "channel"); key = word_eol[2]; } else { - // /setkey #channel password + /* /setkey #channel password */ nick = word[2]; key = word_eol[3]; } - // Set password + /* Set password */ if (keystore_store_key(nick, key)) { hexchat_printf(ph, "Stored key for %s\n", nick); } 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) { const char *nick; - // Check syntax + /* Check syntax */ if (*word[2] == '\0' || *word[3] != '\0') { hexchat_printf(ph, "%s\n", usage_delkey); 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]); - // Delete the given nick from the key store + /* Delete the given nick from the key store */ if (keystore_delete_nick(nick)) { hexchat_printf(ph, "Deleted key for %s\n", nick); } 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_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(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, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL); diff --git a/plugins/python/python.c b/plugins/python/python.c index 903b2bed..cb3484ec 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -1885,7 +1885,7 @@ Module_hexchat_pluginpref_get(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s:get_pluginpref", &var)) return NULL; - // This will always return numbers as integers. + /* This will always return numbers as integers. */ BEGIN_XCHAT_CALLS(NONE); result = hexchat_pluginpref_get_str(prefph, var, retstr); END_XCHAT_CALLS(); diff --git a/plugins/sysinfo/match.c b/plugins/sysinfo/match.c index 5f49ae41..cfd66e37 100644 --- a/plugins/sysinfo/match.c +++ b/plugins/sysinfo/match.c @@ -41,7 +41,7 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo result = g_new(char, bsize); if (total_space == 0) { - snprintf(result, bsize, "%s: none", desc); + g_snprintf(result, bsize, "%s: none", desc); return result; } quantity = quantities; @@ -52,11 +52,11 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo total_space = total_space / 1024; } 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, percentage(free_k, total_k)); 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); return result; } diff --git a/plugins/sysinfo/parse.c b/plugins/sysinfo/parse.c index caba8a7d..3b210022 100644 --- a/plugins/sysinfo/parse.c +++ b/plugins/sysinfo/parse.c @@ -123,7 +123,7 @@ int xs_parse_cpu(char *model, char *vendor, double *freq, char *cache, unsigned while ((entry = readdir(dir)) != NULL) 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"); if (fp2 == NULL) break; fscanf(fp2,"%16s",cache); @@ -172,7 +172,7 @@ int xs_parse_os(char *user, char *host, char *kernel) strncpy(user, usern, bsize); 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; } @@ -203,9 +203,9 @@ int xs_parse_sound(char *snd_card) pos = strstr(buffer, ":"); card_id = strtoll(buffer, NULL, 0); if (card_id == 0) - snprintf(card_buf, bsize, "%s", pos+2); + g_snprintf(card_buf, bsize, "%s", pos+2); 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 = '\0'; strcat(cards, card_buf); @@ -269,11 +269,11 @@ int xs_parse_netdev(const char *device, unsigned long long *bytes_recv, unsigned fclose(fp); pos = strstr(buffer, ":"); 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; } @@ -299,15 +299,15 @@ int xs_parse_df(const char *mount_point, char *result) for(;isspace(*pos);pos++); if(mount_point == NULL) { - total_k += strtoull(pos, &pos, 0); - strtoull(pos, &pos, 0); - free_k += strtoull(pos, &pos, 0); + total_k += g_ascii_strtoull (pos, &pos, 0); + g_ascii_strtoull(pos, &pos, 0); + free_k += g_ascii_strtoull (pos, &pos, 0); continue; } - total_k = strtoull(pos, &pos, 0); - strtoull(pos, &pos, 0); - free_k = strtoull(pos, &pos, 0); - strtoull(pos, &pos, 0); + total_k = g_ascii_strtoull (pos, &pos, 0); + g_ascii_strtoull(pos, &pos, 0); + free_k = g_ascii_strtoull (pos, &pos, 0); + g_ascii_strtoull (pos, &pos, 0); for(;isspace(*pos);pos++); for(;*pos!='/';pos++); 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); 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) @@ -389,9 +389,9 @@ int xs_parse_distro(char *name) find_match_char(buffer, "ACCEPT_KEYWORDS", keywords); /* cppcheck-suppress uninitvar */ if (strstr(keywords, "\"") == NULL) - snprintf(buffer, bsize, "Gentoo Linux (stable)"); + g_snprintf(buffer, bsize, "Gentoo Linux (stable)"); 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) fgets(buffer, bsize, fp); @@ -406,7 +406,7 @@ int xs_parse_distro(char *name) else if((fp = fopen("/etc/turbolinux-release", "r")) != NULL) fgets(buffer, bsize, fp); 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) { 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_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) { char release[bsize]; fgets(release, bsize, fp); - snprintf(buffer, bsize, "Debian %s", release); + g_snprintf(buffer, bsize, "Debian %s", release); } else - snprintf(buffer, bsize, "Unknown Distro"); + g_snprintf(buffer, bsize, "Unknown Distro"); if(fp != NULL) fclose(fp); pos=strchr(buffer, '\n'); diff --git a/plugins/sysinfo/pci.c b/plugins/sysinfo/pci.c index d0f8d811..bda4888b 100644 --- a/plugins/sysinfo/pci.c +++ b/plugins/sysinfo/pci.c @@ -99,8 +99,8 @@ int pci_find_by_class(u16 *class, char *vendor, char *device) /* Acquire vendor & device ID if the class matches */ if(get_conf_word(d, PCI_CLASS_DEVICE) == *class) { nomatch = 0; - snprintf(vendor,7,"%04x",p->vendor_id); - snprintf(device,7,"%04x",p->device_id); + g_snprintf(vendor,7,"%04x",p->vendor_id); + g_snprintf(device,7,"%04x",p->device_id); break; } } @@ -122,7 +122,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device) fp = fopen (buffer, "r"); 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"); return; } @@ -151,8 +151,8 @@ void pci_find_fullname(char *fullname, char *vendor, char *device) } } if (cardfound == 1) - snprintf(fullname, bsize, "%s %s", vendorname, devicename); + g_snprintf(fullname, bsize, "%s %s", vendorname, devicename); else - snprintf(fullname, bsize, "%s:%s", vendor, device); + g_snprintf(fullname, bsize, "%s:%s", vendor, device); fclose(fp); } diff --git a/plugins/sysinfo/sysinfo.cpp b/plugins/sysinfo/sysinfo.cpp index 43ab48c0..322dac17 100644 --- a/plugins/sysinfo/sysinfo.cpp +++ b/plugins/sysinfo/sysinfo.cpp @@ -155,7 +155,7 @@ getOsName (void) static char * getCpuName (void) { - // Get extended ids. + /* Get extended ids. */ unsigned int nExIds; unsigned int i; int CPUInfo[4] = {-1}; diff --git a/plugins/sysinfo/xsys.c b/plugins/sysinfo/xsys.c index 0c32b751..be38b379 100644 --- a/plugins/sysinfo/xsys.c +++ b/plugins/sysinfo/xsys.c @@ -100,7 +100,7 @@ print_summary (int announce, char* format) int seconds; 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); strcat (sysinfo, "\017 "); strncat (sysinfo, buffer, bsize - strlen (sysinfo)); @@ -112,7 +112,7 @@ print_summary (int announce, char* format) return HEXCHAT_EAT_ALL; } - snprintf (buffer, bsize, "%s", os_kernel); + g_snprintf (buffer, bsize, "%s", os_kernel); format_output ("OS", buffer, format); strcat (sysinfo, "\017 "); strncat (sysinfo, buffer, bsize - strlen (sysinfo)); @@ -142,11 +142,11 @@ print_summary (int announce, char* format) 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 { - 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); @@ -161,7 +161,7 @@ print_summary (int announce, char* format) } 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); format_output ("RAM", buffer, format); strcat (sysinfo, "\017 "); @@ -224,21 +224,21 @@ print_summary (int announce, char* format) { 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 { - snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds); + g_snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds); } } else { - snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds); + g_snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds); } } 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; } - snprintf (buffer, bsize, "%s@%s, %s", user, host, kernel); + g_snprintf (buffer, bsize, "%s@%s, %s", user, host, kernel); format_output ("OS", buffer, format); if (announce) @@ -336,11 +336,11 @@ print_cpu (int announce, char* format) 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 { - 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); @@ -377,7 +377,7 @@ print_ram (int announce, char* format) 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); if (announce) @@ -452,11 +452,11 @@ print_vga (int announce, char* format) if (xs_parse_agpbridge (agp_bridge) != 0) { - snprintf (buffer, bsize, "%s", vid_card); + g_snprintf (buffer, bsize, "%s", vid_card); } 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); @@ -547,21 +547,21 @@ print_uptime (int announce, char* format) { 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 { - snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds); + g_snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds); } } else { - snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds); + g_snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds); } } 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_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); format_output ("Netdata", netdata, format); @@ -658,24 +658,24 @@ netstream_cb (char *word[], char *word_eol[], void *userdata) if (bytes_recv > 1024) { bytes_recv /= 1024; - snprintf (mag_r, 5, "KB/s"); + g_snprintf (mag_r, 5, "KB/s"); } else { - snprintf (mag_r, 5, "B/s"); + g_snprintf (mag_r, 5, "B/s"); } if (bytes_sent > 1024) { bytes_sent /= 1024; - snprintf (mag_s, 5, "KB/s"); + g_snprintf (mag_s, 5, "KB/s"); } 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); format_output ("Netstream", netstream, format); |