The 'label' argument to draw_tick is used as a printf-type format string,
so callers must pass "%s" to safely use an arbitrary string as a label.
Also, hist_draw_bar was doing its own snprintf, but this commit changes it
to take advantage of that provided by draw_tick.
- draw_tick (ch, TICK_ABSCISSA, x + (interval_size/2 ),
+ draw_tick (ch, TICK_ABSCISSA, x + (interval_size/2 ), "%s",
cat_labels[i]);
for(sc = 0 ; sc < SUB_CATAGORIES ; ++sc )
cat_labels[i]);
for(sc = 0 ; sc < SUB_CATAGORIES ; ++sc )
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Draw tick mark on x axis */
/* Draw tick mark on x axis */
- draw_tick(ch, TICK_ABSCISSA, box_centre - ch->data_left, name);
+ draw_tick(ch, TICK_ABSCISSA, box_centre - ch->data_left, "%s", name);
pl_restorestate_r(ch->lp);
pl_restorestate_r(ch->lp);
void draw_tick(struct chart *chart,
enum tick_orientation orientation,
double position,
void draw_tick(struct chart *chart,
enum tick_orientation orientation,
double position,
- const char *label, ...);
+ const char *label, ...)
+ PRINTF_FORMAT (4, 5);
/* Write the title on a chart*/
/* Write the title on a chart*/
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
pl_restorestate_r(ch->lp);
pl_restorestate_r(ch->lp);
- {
- char buf[5];
- snprintf(buf,5,"%g",(upper + lower) / 2.0);
- draw_tick(ch, TICK_ABSCISSA,
- x_pos + width / 2.0, buf);
- }
+ draw_tick (ch, TICK_ABSCISSA,
+ x_pos + width / 2.0, "%g", (upper + lower) / 2.0);