diff options
author | Bill Meier <wmeier@newsguy.com> | 2009-03-19 17:49:11 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2009-03-19 17:49:11 +0000 |
commit | 27024a1d5a68dada122f48278e3e03b3265b42be (patch) | |
tree | dce7e8db6fd72a6884fca77c99fdfbd2750ab015 /gtk/sctp_graph_dlg.c | |
parent | fa9e9a5e336bddcaabeff751034161c46e38a2f6 (diff) |
As suggested by Jakub Zawadzki: actually use sizeof(...) rather than a numeric constant in various places;
svn path=/trunk/; revision=27800
Diffstat (limited to 'gtk/sctp_graph_dlg.c')
-rw-r--r-- | gtk/sctp_graph_dlg.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/gtk/sctp_graph_dlg.c b/gtk/sctp_graph_dlg.c index 3c5410e683..e30ef8cb14 100644 --- a/gtk/sctp_graph_dlg.c +++ b/gtk/sctp_graph_dlg.c @@ -415,8 +415,8 @@ static void sctp_graph_draw(struct sctp_udata *u_data) else distance=5; - g_snprintf(label_string, 15, "%d", 0); - memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), 15); + g_snprintf(label_string, sizeof(label_string), "%d", 0); + memcpy(label_string,(gchar *)g_locale_to_utf8(label_string, -1 , NULL, NULL, NULL), sizeof(label_string)); layout = gtk_widget_create_pango_layout(u_data->io->draw_area, label_string); pango_layout_get_pixel_size(layout, &label_width, &label_height); @@ -428,9 +428,9 @@ 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); + 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), 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); @@ -490,11 +490,11 @@ 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,u_data->io->draw_area->style->black_gc, @@ -533,8 +533,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); @@ -547,9 +547,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, @@ -590,12 +590,12 @@ 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, @@ -1070,7 +1070,7 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda } } - g_snprintf(label_string, 30, "(%.6lf, %u)", x_value, y_value); + g_snprintf(label_string, sizeof(label_string), "(%.6lf, %u)", x_value, y_value); label_set = TRUE; |