stats_tree: g_sprintf()-->g_snprintf(); cleanup #includes.

Change-Id: I862fed818cd1f14584b082f87b1d4d305cf78687
Reviewed-on: https://code.wireshark.org/review/5970
Reviewed-by: Bill Meier <wmeier@newsguy.com>
This commit is contained in:
Bill Meier 2014-12-21 23:52:47 -05:00
parent 94eeaf10f2
commit 971d4e4ad1
1 changed files with 5 additions and 6 deletions

View File

@ -32,7 +32,6 @@
#include "config.h"
#include <glib.h>
#include <glib/gprintf.h>
#include <stdlib.h>
@ -1196,10 +1195,10 @@ stats_tree_format_as_str(const stats_tree* st, st_format_type format_type,
s = g_string_new("\n");
g_string_append(s,separator);
g_string_append_printf(s,"\n%s:\n",st->cfg->name);
g_sprintf (fmt,"%%-%us",maxnamelen);
g_snprintf (fmt,(gulong)sizeof(fmt),"%%-%us",maxnamelen);
g_string_append_printf(s,fmt,stats_tree_get_column_name(0));
for (count = 1; count<st->num_columns; count++) {
g_sprintf (fmt," %%-%us",stats_tree_get_column_size(count)+1);
g_snprintf (fmt,(gulong)sizeof(fmt)," %%-%us",stats_tree_get_column_size(count)+1);
g_string_append_printf(s,fmt,stats_tree_get_column_name(count));
}
memset (separator, '-', sep_length);
@ -1270,7 +1269,7 @@ WS_DLL_PUBLIC void stats_tree_format_node_as_str(const stat_node *node,
{
case ST_FORMAT_YAML:
if (indent) {
g_sprintf(fmt, "%%%ds%%s%%s", indent*4-2);
g_snprintf(fmt, (gulong)sizeof(fmt), "%%%ds%%s%%s", indent*4-2);
}
else {
strcpy(fmt, "%s%s%s");
@ -1311,10 +1310,10 @@ WS_DLL_PUBLIC void stats_tree_format_node_as_str(const stat_node *node,
g_string_append (s,"\n");
break;
case ST_FORMAT_PLAIN:
g_sprintf (fmt,"%%%ds%%-%us",indent,maxnamelen-indent);
g_snprintf (fmt,(gulong)sizeof(fmt),"%%%ds%%-%us",indent,maxnamelen-indent);
g_string_append_printf(s,fmt,"",values[0]);
for (count = 1; count<num_columns; count++) {
g_sprintf (fmt," %%-%us",stats_tree_get_column_size(count)+1);
g_snprintf (fmt,(gulong)sizeof(fmt)," %%-%us",stats_tree_get_column_size(count)+1);
g_string_append_printf(s,fmt,values[count]);
}
g_string_append (s,"\n");