aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/sctp_byte_graph_dlg.c
diff options
context:
space:
mode:
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2009-03-19 17:49:11 +0000
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2009-03-19 17:49:11 +0000
commit96f7521cb2a0ee2a04a779d4cff8b7fd95669070 (patch)
treedce7e8db6fd72a6884fca77c99fdfbd2750ab015 /gtk/sctp_byte_graph_dlg.c
parent67b516aa1f1a5cef8b9449e98fbf4d8aab9361e7 (diff)
As suggested by Jakub Zawadzki: actually use sizeof(...) rather than a numeric constant in various places;
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27800 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk/sctp_byte_graph_dlg.c')
-rw-r--r--gtk/sctp_byte_graph_dlg.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gtk/sctp_byte_graph_dlg.c b/gtk/sctp_byte_graph_dlg.c
index e47d6caa53..9445a093fc 100644
--- a/gtk/sctp_byte_graph_dlg.c
+++ b/gtk/sctp_byte_graph_dlg.c
@@ -359,7 +359,7 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
else
distance = 5;
- g_snprintf(label_string, 15, "%d", 0);
+ g_snprintf(label_string, sizeof(label_string), "%d", 0);
memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
layout = gtk_widget_create_pango_layout(u_data->io->draw_area, label_string);
pango_layout_get_pixel_size(layout, &label_width, &label_height);
@@ -371,8 +371,8 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
if (u_data->io->offset != 0)
{
- g_snprintf(label_string, 15, "%u", u_data->io->x1_tmp_sec);
- memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
+ g_snprintf(label_string, sizeof(label_string), "%u", u_data->io->x1_tmp_sec);
+ memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
pango_layout_set_text(layout, label_string, -1);
pango_layout_get_pixel_size(layout, &lwidth, NULL);
@@ -428,13 +428,13 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
if (i >= u_data->io->min_x && i % 1000000 != 0)
{
length = 5;
- g_snprintf(label_string, 15, "%d", i%1000000);
+ g_snprintf(label_string, sizeof(label_string), "%d", i%1000000);
if (j % w == 0)
{
length = 10;
- memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
+ memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
pango_layout_set_text(layout, label_string, -1);
pango_layout_get_pixel_size(layout, &lwidth, NULL);
gdk_draw_layout(u_data->io->pixmap,
@@ -475,8 +475,8 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
(guint32)(LEFT_BORDER + u_data->io->offset + (i - u_data->io->min_x) * u_data->io->x_interval),
u_data->io->pixmap_height - BOTTOM_BORDER + 10);
- g_snprintf(label_string, 15, "%d", sec);
- memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
+ g_snprintf(label_string, sizeof(label_string), "%d", sec);
+ memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
pango_layout_set_text(layout, label_string, -1);
pango_layout_get_pixel_size(layout, &lwidth, NULL);
gdk_draw_layout(u_data->io->pixmap,u_data->io->draw_area->style->black_gc,
@@ -487,9 +487,9 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
}
}
- g_strlcpy(label_string, "sec", 15);
+ g_strlcpy(label_string, "sec", sizeof(label_string));
- memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
+ memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
pango_layout_set_text(layout, label_string, -1);
pango_layout_get_pixel_size(layout, &lwidth, NULL);
gdk_draw_layout(u_data->io->pixmap,
@@ -543,13 +543,13 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
if (i >= u_data->io->min_y)
{
length = 5;
- g_snprintf(label_string, 15, "%d", i);
+ g_snprintf(label_string, sizeof(label_string), "%d", i);
if (i%distance == 0 || (distance <= 5 && u_data->io->y_interval > 10))
{
length = 10;
- memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15);
+ memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string));
pango_layout_set_text(layout, label_string, -1);
pango_layout_get_pixel_size(layout, &lwidth, NULL);
gdk_draw_layout(u_data->io->pixmap,u_data->io->draw_area->style->black_gc,
@@ -999,7 +999,7 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda
}
}
cf_goto_frame(&cfile, tmptsn->frame_number);
- g_snprintf(label_string, 30, "(%.6f, %u)", x_value, y_value);
+ g_snprintf(label_string, sizeof(label_string), "(%.6f, %u)", x_value, y_value);
label_set = TRUE;
gdk_draw_line(u_data->io->pixmap,text_color, (gint)(event->x-2), (gint)(event->y), (gint)(event->x+2), (gint)(event->y));