[gnome-nettool/gnome-3-0: 3/6] Fixed garbage in translated string for loopback
- From: GermÃn Poà CaamaÃo <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nettool/gnome-3-0: 3/6] Fixed garbage in translated string for loopback
- Date: Mon, 2 Jan 2012 00:30:23 +0000 (UTC)
commit 134d70ccd4061b6a7c47ff5aea64e74a05327f39
Author: GermÃn Poo-CaamaÃo <gpoo gnome org>
Date: Sat Dec 31 18:52:21 2011 -0800
Fixed garbage in translated string for loopback
Fixed Bug #599582
Signed-off-by: GermÃn Poo-CaamaÃo <gpoo gnome org>
src/info.c | 15 +++++++++------
src/info.h | 1 -
2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/info.c b/src/info.c
index 7b7e0b8..2d8af75 100644
--- a/src/info.c
+++ b/src/info.c
@@ -352,7 +352,7 @@ info_get_nic_information (const gchar *nic, Netinfo *info)
{
GtkTreeModel *model;
GtkTreeIter iter;
- gchar dst[INFO_ADDRSTRLEN];
+ gchar *dst;
InfoIpAddr *ip;
gint prefix;
struct in_addr addr, subnet;
@@ -447,7 +447,7 @@ info_get_nic_information (const gchar *nic, Netinfo *info)
/* Get the Hardware Address */
if (netload.flags & (1L << GLIBTOP_NETLOAD_HWADDRESS)) {
- g_sprintf (dst, "%02x:%02x:%02x:%02x:%02x:%02x",
+ dst = g_strdup_printf ("%02x:%02x:%02x:%02x:%02x:%02x",
(int) ((guchar *) &netload.hwaddress)[0],
(int) ((guchar *) &netload.hwaddress)[1],
(int) ((guchar *) &netload.hwaddress)[2],
@@ -455,14 +455,15 @@ info_get_nic_information (const gchar *nic, Netinfo *info)
(int) ((guchar *) &netload.hwaddress)[4],
(int) ((guchar *) &netload.hwaddress)[5]);
} else {
- g_sprintf (dst, NOT_AVAILABLE);
+ dst = g_strdup_printf ("%s", NOT_AVAILABLE);
}
gtk_label_set_text (GTK_LABEL (info->hw_address), dst);
+ g_free (dst);
/* Get the interface's Maximum Transfer Unit */
- g_sprintf (dst, "%d", netload.mtu);
+ dst = g_strdup_printf ("%d", netload.mtu);
gtk_label_set_text (GTK_LABEL (info->mtu), dst);
- bzero (dst, strlen(dst));
+ g_free (dst);
/* Get Flags to determine other properties */
@@ -476,7 +477,9 @@ info_get_nic_information (const gchar *nic, Netinfo *info)
/* Is this a loopback device? */
if (netload.if_flags & (1L << GLIBTOP_IF_FLAGS_LOOPBACK)) {
- gtk_label_set_text (GTK_LABEL (info->hw_address), _("Loopback"));
+ dst = g_strdup_printf ("%s", _("Loopback"));
+ gtk_label_set_text (GTK_LABEL (info->hw_address), dst);
+ g_free (dst);
ip->ip_bcast = g_strdup ("");
info_setup_configure_button (info, FALSE);
} else {
diff --git a/src/info.h b/src/info.h
index 58486a9..f4a977b 100644
--- a/src/info.h
+++ b/src/info.h
@@ -20,7 +20,6 @@
#include "nettool.h"
-#define INFO_ADDRSTRLEN 128
#define NOT_AVAILABLE _("not available")
#define DELAY_STATS 1000 /* 1 second */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]