summary refs log tree commit diff stats
path: root/plugins/sysinfo
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/sysinfo')
-rw-r--r--plugins/sysinfo/match.c6
-rw-r--r--plugins/sysinfo/parse.c42
-rw-r--r--plugins/sysinfo/pci.c10
-rw-r--r--plugins/sysinfo/sysinfo.cpp2
-rw-r--r--plugins/sysinfo/xsys.c50
5 files changed, 55 insertions, 55 deletions
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);