[gnome-network][PATCH] netinfo bytes fix



Hi,

While playing with gnome-netstatus I noticed that gnome-netinfo displays the wrong the number of bytes sent and received.

Here is a patch. The patch also adds one decimal place of precision to the displayed number.

Ok to commit?

Jon
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-network/gnome-netinfo/ChangeLog,v
retrieving revision 1.100
diff -u -r1.100 ChangeLog
--- ChangeLog	24 Nov 2003 16:51:03 -0000	1.100
+++ ChangeLog	4 Dec 2003 23:21:13 -0000
@@ -1,3 +1,8 @@
+2003-12-04  William Jon McCann  <mccann jhu edu>
+
+	* utils.c (util_legible_bytes): Fix computation of number of bytes
+	sent and received.
+
 2003-11-24  William Jon McCann  <mccann jhu edu>
 
 	* gnome-netinfo.glade: Changed File menu to Information
Index: utils.c
===================================================================
RCS file: /cvs/gnome/gnome-network/gnome-netinfo/utils.c,v
retrieving revision 1.5
diff -u -r1.5 utils.c
--- utils.c	24 Jul 2003 21:34:16 -0000	1.5
+++ utils.c	4 Dec 2003 23:21:13 -0000
@@ -234,9 +234,10 @@
 }
 
 gchar *
-util_legible_bytes (gchar *bytes) {
+util_legible_bytes (gchar *bytes)
+{
 	unsigned long long rx, short_rx;
-	const gchar *unit = "b";
+	const gchar *unit = "B";
 	gchar *result;
 	
 	sscanf (bytes, "%lld", &rx);
@@ -259,6 +260,7 @@
 	    unit = "KiB";
 	}
 	
-	result = g_strdup_printf ("%lld %s", short_rx, unit);
+	result = g_strdup_printf ("%lld.%lld %s", short_rx / 10,
+                                  short_rx % 10, unit);
 	return result;	
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]