graph.h, grid.c, enforce consistent string buffer size (plot "units", LABEL_CHARS)
This commit is contained in:
parent
032b1c32c4
commit
2b3220086d
|
|
@ -16,7 +16,6 @@ Modified: 2001 AlansFixes
|
||||||
#include "../display.h"
|
#include "../display.h"
|
||||||
|
|
||||||
#define RAD_TO_DEG (180.0 / M_PI)
|
#define RAD_TO_DEG (180.0 / M_PI)
|
||||||
#define LABEL_CHARS 16
|
|
||||||
|
|
||||||
typedef enum { x_axis, y_axis } Axis;
|
typedef enum { x_axis, y_axis } Axis;
|
||||||
|
|
||||||
|
|
@ -230,7 +229,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
int max;
|
int max;
|
||||||
static double dd[2];
|
static double dd[2];
|
||||||
int mult = 1;
|
int mult = 1;
|
||||||
char buf[LABEL_CHARS], *s;
|
char buf[GRAPH_UNITS_LENGTH], *s;
|
||||||
int slim, digits;
|
int slim, digits;
|
||||||
|
|
||||||
if (axis == y_axis && graph->grid.ysized) {
|
if (axis == y_axis && graph->grid.ysized) {
|
||||||
|
|
@ -495,7 +494,7 @@ drawlingrid(GRAPH *graph, char *units, int spacing, int nsp, double dst, double
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
double m, step;
|
double m, step;
|
||||||
char buf[LABEL_CHARS];
|
char buf[GRAPH_UNITS_LENGTH];
|
||||||
|
|
||||||
NG_IGNORE(onedec);
|
NG_IGNORE(onedec);
|
||||||
NG_IGNORE(mult);
|
NG_IGNORE(mult);
|
||||||
|
|
@ -563,7 +562,7 @@ loggrid(GRAPH *graph, double lo, double hi, int type, Axis axis)
|
||||||
int i, j;
|
int i, j;
|
||||||
double k;
|
double k;
|
||||||
double decs;
|
double decs;
|
||||||
char buf[LABEL_CHARS], *s;
|
char buf[GRAPH_UNITS_LENGTH], *s;
|
||||||
|
|
||||||
if (axis == x_axis && graph->grid.xsized) {
|
if (axis == x_axis && graph->grid.xsized) {
|
||||||
lmt = graph->grid.xaxis.log.lmt;
|
lmt = graph->grid.xaxis.log.lmt;
|
||||||
|
|
@ -663,7 +662,7 @@ drawloggrid(GRAPH *graph, char *units, int hmt, int lmt, int decsp, int subs, in
|
||||||
{
|
{
|
||||||
int i, j, k, m;
|
int i, j, k, m;
|
||||||
double t;
|
double t;
|
||||||
char buf[LABEL_CHARS];
|
char buf[GRAPH_UNITS_LENGTH];
|
||||||
|
|
||||||
/* Now plot every pp'th decade line, with subs lines between them. */
|
/* Now plot every pp'th decade line, with subs lines between them. */
|
||||||
if (subs > 1)
|
if (subs > 1)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ Author: 1988 Jeffrey M. Hsu
|
||||||
|
|
||||||
struct _keyed;
|
struct _keyed;
|
||||||
|
|
||||||
|
#define GRAPH_UNITS_LENGTH 16
|
||||||
|
|
||||||
/* Device-independent data structure for plots. */
|
/* Device-independent data structure for plots. */
|
||||||
|
|
||||||
|
|
@ -68,7 +69,7 @@ struct graph {
|
||||||
int circular; /* TRUE if circular plot area */
|
int circular; /* TRUE if circular plot area */
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
char units[16]; /* unit labels */
|
char units[GRAPH_UNITS_LENGTH]; /* unit labels */
|
||||||
int spacing, numspace;
|
int spacing, numspace;
|
||||||
double distance, lowlimit, highlimit;
|
double distance, lowlimit, highlimit;
|
||||||
int mult;
|
int mult;
|
||||||
|
|
@ -79,11 +80,11 @@ struct graph {
|
||||||
int digits;
|
int digits;
|
||||||
} lin;
|
} lin;
|
||||||
struct {
|
struct {
|
||||||
char units[16]; /* unit labels */
|
char units[GRAPH_UNITS_LENGTH]; /* unit labels */
|
||||||
int hmt, lmt, decsp, subs, pp;
|
int hmt, lmt, decsp, subs, pp;
|
||||||
} log;
|
} log;
|
||||||
struct {
|
struct {
|
||||||
char units[16]; /* unit labels */
|
char units[GRAPH_UNITS_LENGTH]; /* unit labels */
|
||||||
int radius, center;
|
int radius, center;
|
||||||
double mrad;
|
double mrad;
|
||||||
int lmt;
|
int lmt;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue