aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/summary_dlg.c
diff options
context:
space:
mode:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2008-02-29 13:33:37 +0000
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2008-02-29 13:33:37 +0000
commit7a584a56579c776f6b137c1c080f75937cb71229 (patch)
tree5ccaf4cba154244912a56e39003f8ac1bbd169f1 /gtk/summary_dlg.c
parenteb0937aabde308fa2f7a705546b3af26ed221d1e (diff)
Next attempt to cleanup some string functions, including:
strncpy -> g_strlcpy, strncat -> g_strlcat git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24504 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk/summary_dlg.c')
-rw-r--r--gtk/summary_dlg.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c
index 3747a6ffc1..6ba19f1577 100644
--- a/gtk/summary_dlg.c
+++ b/gtk/summary_dlg.c
@@ -279,7 +279,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
if (summary.dfilter) {
g_snprintf(string_buff2, SUM_STR_MAX, "%i", summary.filtered_count);
} else {
- strncpy(string_buff2, string_buff, SUM_STR_MAX);
+ g_strlcpy(string_buff2, string_buff, SUM_STR_MAX);
}
g_snprintf(string_buff3, SUM_STR_MAX, "%i", summary.marked_count);
add_string_to_list(list, "Packets", string_buff, string_buff2, string_buff3);
@@ -288,17 +288,17 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
if (seconds > 0) {
g_snprintf(string_buff, SUM_STR_MAX, "%.3f sec", seconds);
} else {
- strncpy(string_buff, "", SUM_STR_MAX);
+ string_buff[0] = '\0';
}
if (summary.dfilter && disp_seconds > 0) {
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f sec", disp_seconds);
} else {
- strncpy(string_buff2, "", SUM_STR_MAX);
+ string_buff2[0] = '\0';
}
if (summary.marked_count && marked_seconds > 0) {
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f sec", marked_seconds);
} else {
- strncpy(string_buff3, "", SUM_STR_MAX);
+ string_buff3[0] = '\0';
}
add_string_to_list(list, "Between first and last packet", string_buff, string_buff2, string_buff3);
@@ -306,17 +306,17 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
if (seconds > 0) {
g_snprintf(string_buff, SUM_STR_MAX, "%.3f", summary.packet_count/seconds);
} else {
- strncpy(string_buff, "", SUM_STR_MAX);
+ string_buff[0] = '\0';
}
if(summary.dfilter && disp_seconds > 0) {
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", summary.filtered_count/disp_seconds);
} else {
- strncpy(string_buff2, "", SUM_STR_MAX);
+ string_buff2[0] = '\0';
}
if(summary.marked_count && marked_seconds > 0) {
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f", summary.marked_count/marked_seconds);
} else {
- strncpy(string_buff3, "", SUM_STR_MAX);
+ string_buff3[0] = '\0';
}
add_string_to_list(list, "Avg. packets/sec", string_buff, string_buff2, string_buff3);
@@ -326,21 +326,21 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
(float) ((gint64) summary.bytes)/summary.packet_count);
} else {
- strncpy(string_buff, "", SUM_STR_MAX);
+ string_buff[0] = '\0';
}
if (summary.dfilter && summary.filtered_count > 1) {
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f bytes",
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
(float) ((gint64) summary.filtered_bytes)/summary.filtered_count);
} else {
- strncpy(string_buff2, "", SUM_STR_MAX);
+ string_buff2[0] = '\0';
}
if (summary.marked_count > 1) {
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f bytes",
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
(float) ((gint64) summary.marked_bytes)/summary.marked_count);
} else {
- strncpy(string_buff3, "", SUM_STR_MAX);
+ string_buff3[0] = '\0';
}
add_string_to_list(list, "Avg. packet size", string_buff, string_buff2, string_buff3);
@@ -349,12 +349,12 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
if (summary.dfilter && summary.filtered_count > 0) {
g_snprintf(string_buff2, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.filtered_bytes);
} else {
- strncpy(string_buff2, "", SUM_STR_MAX);
+ string_buff2[0] = '\0';
}
if (summary.marked_count) {
g_snprintf(string_buff3, SUM_STR_MAX, "%" G_GINT64_MODIFIER "u", summary.marked_bytes);
} else {
- strncpy(string_buff3, "", SUM_STR_MAX);
+ string_buff3[0] = '\0';
}
add_string_to_list(list, "Bytes", string_buff, string_buff2, string_buff3);
@@ -363,19 +363,19 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
g_snprintf(string_buff, SUM_STR_MAX, "%.3f", ((gint64) summary.bytes)/seconds);
} else {
- strncpy(string_buff, "", SUM_STR_MAX);
+ string_buff[0] = '\0';
}
if (summary.dfilter && disp_seconds > 0) {
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", ((gint64) summary.filtered_bytes)/disp_seconds);
} else {
- strncpy(string_buff2, "", SUM_STR_MAX);
+ string_buff2[0] = '\0';
}
if (summary.marked_count && marked_seconds > 0) {
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f", ((gint64) summary.marked_bytes)/marked_seconds);
} else {
- strncpy(string_buff3, "", SUM_STR_MAX);
+ string_buff3[0] = '\0';
}
add_string_to_list(list, "Avg. bytes/sec", string_buff, string_buff2, string_buff3);
@@ -385,21 +385,21 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
((gint64) summary.bytes) * 8.0 / (seconds * 1000.0 * 1000.0));
} else {
- strncpy(string_buff, "", SUM_STR_MAX);
+ string_buff[0] = '\0';
}
if (summary.dfilter && disp_seconds > 0) {
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f",
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
((gint64) summary.filtered_bytes) * 8.0 / (disp_seconds * 1000.0 * 1000.0));
} else {
- strncpy(string_buff2, "", SUM_STR_MAX);
+ string_buff2[0] = '\0';
}
if (summary.marked_count && marked_seconds > 0) {
g_snprintf(string_buff3, SUM_STR_MAX, "%.3f",
/* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
((gint64) summary.marked_bytes) * 8.0 / (marked_seconds * 1000.0 * 1000.0));
} else {
- strncpy(string_buff3, "", SUM_STR_MAX);
+ string_buff3[0] = '\0';
}
add_string_to_list(list, "Avg. MBit/sec", string_buff, string_buff2, string_buff3);