/* Add nodes */
for (j = 0; j < NUMNODES; j++) {
- sprintf(name, "%d", j);
+ snprintf(name, sizeof(name), "%d", j);
node[j] = agnode(g, name, 1);
agbindrec(node[j], "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data
}
exit(0);
}
if (lpCmdLine[0] == 0)
- sprintf (
- cmd, "%s -e \"load('dotty.lefty');%sdotty.init();dotty.createviewandgraph(null,'file',null,null);txtview('off');\"",
- path, lneato
- );
+ snprintf(cmd, sizeof(cmd), "%s -e \"load('dotty.lefty');%sdotty.init();"
+ "dotty.createviewandgraph(null,'file',null,null);"
+ "txtview('off');\"", path, lneato);
else
- sprintf (
- cmd, "%s -e \"load('dotty.lefty');%sdotty.init();dotty.createviewandgraph('%Ns','file',null,null);txtview('off');\"",
- path, lneato, lpCmdLine
- );
+ snprintf(cmd, sizeof(cmd), "%s -e \"load('dotty.lefty');%sdotty.init();"
+ "dotty.createviewandgraph('%Ns','file',null,null);"
+ "txtview('off');\"", path, lneato, lpCmdLine);
CreateProcess (
NULL, // No module name (use command line).
if (infd == -1)
buf[0] = '%', buf[1] = 'd', buf[2] = '\000';
else
- sprintf (buf, "%d", infd);
+ snprintf(buf, sizeof(buf), "%d", infd);
s1++;
if (bufi + strlen (buf) >= CMDINCR)
return NULL;
if (outfd == -1)
buf[0] = '%', buf[1] = 'd', buf[2] = '\000';
else
- sprintf (buf, "%d", outfd);
+ snprintf(buf, sizeof(buf), "%d", outfd);
s1++;
if (bufi + strlen (buf) >= CMDINCR)
return NULL;
if ((to = Tfinds (edge, "attr")))
writeattr (ioi, to, buf);
if (flag) {
- sprintf (buf, "\t\tid = %d", i);
+ snprintf(buf, sizeof(buf), "\t\tid = %d", i);
IOwriteline (ioi, buf);
}
IOwriteline (ioi, "\t]");
entries[0] = Tgetstring (meo);
break;
case T_INTEGER:
- sprintf (buf, "%d", (int) Tgetnumber (meo));
+ snprintf(buf, sizeof(buf), "%d", (int) Tgetnumber (meo));
entries[0] = &buf[0];
break;
case T_REAL:
- sprintf (buf, "%f", Tgetnumber (meo));
+ snprintf(buf, sizeof(buf), "%f", Tgetnumber (meo));
entries[0] = &buf[0];
break;
}
case T_INTEGER:
if (bufi + 50 > bufn)
growbufp (bufi + 50);
- sprintf (buf2, "%ld", Tgetinteger (ao));
+ snprintf(buf2, sizeof(buf2), "%ld", Tgetinteger (ao));
for (s = buf2; *s; s++)
bufp[bufi++] = *s;
break;
case T_REAL:
if (bufi + 50 > bufn)
growbufp (bufi + 50);
- sprintf (buf2, "%f", Tgetreal (ao));
+ snprintf(buf2, sizeof(buf2), "%f", Tgetreal (ao));
for (s = buf2; *s; s++)
bufp[bufi++] = *s;
break;
s = Tgetstring (so);
break;
case T_INTEGER:
- sprintf (buf2, "%ld", Tgetinteger (so));
+ snprintf(buf2, sizeof(buf2), "%ld", Tgetinteger (so));
s = &buf2[0];
break;
case T_REAL:
- sprintf (buf2, "%f", Tgetreal (so));
+ snprintf(buf2, sizeof(buf2), "%f", Tgetreal (so));
s = &buf2[0];
break;
}
for (majorp = ptymajor; *majorp; majorp++) {
for (minorp = ptyminor; *minorp; minorp++) {
- sprintf (pty, "/dev/pty%c%c", *majorp, *minorp);
+ snprintf(pty, sizeof(pty), "/dev/pty%c%c", *majorp, *minorp);
if ((fd[0] = open (pty, O_RDWR)) >= 0) {
- sprintf (tty, "/dev/tty%c%c", *majorp, *minorp);
+ snprintf(tty, sizeof(tty), "/dev/tty%c%c", *majorp, *minorp);
if ((fd[1] = open (tty, O_RDWR)) >= 0) {
#ifndef HAVE_TERMIOS_H
ioctl (fd[1], TCGETA, &tio);
close (p1[0]), close (p2[1]);
for (s = cmd; *s; s++)
if (strncmp(s, "%d", 2) == 0) {
- sprintf (cmd2, cmd, p2[0], p1[1]);
+ snprintf(cmd2, sizeof(cmd2), cmd, p2[0], p1[1]);
execl (shell, shbname, "-c", cmd2, NULL);
panic2 (POS, "pipeopen", "child cannot exec: %s\n", cmd2);
}
exit(0);
}
if (lpCmdLine[0] == 0)
- sprintf (cmd, "%s -e \"load('dotty.lefty');dotty.protogt.lserver='neato';dotty.simple(null);\"", path);
+ snprintf(cmd, sizeof(cmd), "%s -e \"load('dotty.lefty');"
+ "dotty.protogt.lserver='neato';dotty.simple(null);\"", path);
else
- sprintf (cmd, "%s -e \"load('dotty.lefty');dotty.protogt.lserver='neato';dotty.simple('%Ns');\"", path, lpCmdLine);
+ snprintf(cmd, sizeof(cmd), "%s -e \"load('dotty.lefty');"
+ "dotty.protogt.lserver='neato';dotty.simple('%Ns');\"", path,
+ lpCmdLine);
handle = WinExec (cmd, SW_SHOW);
exit (0);
sel_edge = edgeCnt;
sel_graph = 1;
- sprintf(buf, "%d Nodes and %d edges selected", nodeCnt, edgeCnt);
+ snprintf(buf, sizeof(buf), "%d Nodes and %d edges selected", nodeCnt,
+ edgeCnt);
gtk_label_set_text((GtkLabel *) glade_xml_get_widget(xml, "label124"),
buf);
gtk_entry_set_text((GtkEntry *) glade_xml_get_widget(xml, "txtAttr"),
gtk_color_button_get_color((GtkColorButton *)
glade_xml_get_widget(xml, widget_name),
&color);
- sprintf(buf, "#%02x%02x%02x",
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x",
(int) ((float) color.red / 65535.0 * 255.0),
(int) ((float) color.green / 65535.0 * 255.0),
(int) ((float) color.blue / 65535.0 * 255.0));
value = (int) gtk_toggle_button_get_active((GtkToggleButton *)
glade_xml_get_widget(xml,
widget_name));
- sprintf(buf, "%d", value);
+ snprintf(buf, sizeof(buf), "%d", value);
agattr(g, AGRAPH, attribute, buf);
return 1;
}
value = (float) gtk_spin_button_get_value((GtkSpinButton *)
glade_xml_get_widget(xml,
widget_name));
- sprintf(buf, "%f", value);
+ snprintf(buf, sizeof(buf), "%f", value);
agattr(g, AGRAPH, attribute, buf);
return 1;
}
value = (float) gtk_range_get_value((GtkRange *)
glade_xml_get_widget(xml,
widget_name));
- sprintf(buf, "%f", value);
+ snprintf(buf, sizeof(buf), "%f", value);
agattr(g, AGRAPH, attribute, buf);
return 1;
}
gtk_combo_box_get_active((GtkComboBox *)
glade_xml_get_widget(xml, widget_name));
- sprintf(buf, "%d", value);
+ snprintf(buf, sizeof(buf), "%d", value);
agattr(g, AGRAPH, attribute, buf);
/* printf ("%s %f \n",attribute,value); */
return 1;
} else if (opts.n_outgraphs)
{
refreshViewport(0);
- sprintf(buf, "<%d>", ++count);
+ snprintf(buf, sizeof(buf), "<%d>", ++count);
if (opts.outgraphs[0] != view->g[view->activeGraph])
add_graph_to_viewport(opts.outgraphs[0], buf);
if (opts.n_outgraphs > 1)
if ((AGTYPE(obj) == AGNODE) && (pos = agattrsym(obj, "pos"))) {
sscanf(agxget(obj, pos), "%lf,%lf", &x, &y);
- sprintf(buf, "%lf,%lf", x - dx, y - dy);
+ snprintf(buf, sizeof(buf), "%lf,%lf", x - dx, y - dy);
agxset(obj, pos, buf);
}
}
{
char buf[50];
- sprintf(buf, "Camera:%i", c->index);
+ snprintf(buf, sizeof(buf), "Camera:%i", c->index);
gtk_label_set_text((GtkLabel *)
glade_xml_get_widget(xml, "dlgcameralabel1"), buf);
gtk_spin_button_set_value((GtkSpinButton *)
(GLfloat) PANEL_PADDING)) -
(GLfloat) CAMERA_BUTTON_HEIGHT;
x = PANEL_PADDING;
- sprintf(buf, "CAM%i", ind + 1);
+ snprintf(buf, sizeof(buf), "CAM%i", ind + 1);
b = glCompButtonNew((GLfloat) x, (GLfloat) y,
(GLfloat) CAMERA_BUTTON_WIDTH,
(GLfloat) CAMERA_BUTTON_HEIGHT, buf, '\0', 0,
psym = agattr(g, AGNODE, "prev", "");
if (setall)
- sprintf(dflt, "%.3lf", HUGE);
+ snprintf(dflt, sizeof(dflt), "%.3lf", HUGE);
for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
dist = getdist(v);
if (dist) {
dist--;
- sprintf(buf, "%.3lf", dist);
+ snprintf(buf, sizeof(buf), "%.3lf", dist);
agxset(v, sym, buf);
if (doPath && (prev = getprev(v)))
agxset(v, psym, agnameof(prev));
if (oldmax > maxdist)
maxdist = oldmax;
}
- sprintf(buf, "%.3lf", maxdist);
+ snprintf(buf, sizeof(buf), "%.3lf", maxdist);
agxset(g, sym, buf);
} else {
- sprintf(buf, "%.3lf", maxdist);
+ snprintf(buf, sizeof(buf), "%.3lf", maxdist);
agattr(g, AGRAPH, "maxdist", buf);
}
}
else if (ap->sort == WVAL) {
d = atof (ap->u.value);
- sprintf (buf, "%.04f", d/72.0);
+ snprintf(buf, sizeof(buf), "%.04f", d/72.0);
agsafeset (np, "width", buf, "");
}
else if (ap->sort == HVAL) {
d = atof (ap->u.value);
- sprintf (buf, "%.04f", d/72.0);
+ snprintf(buf, sizeof(buf), "%.04f", d/72.0);
agsafeset (np, "height", buf, "");
}
else if (ap->sort == TYPE) {
Agraph_t *subg;
if (isAnonGraph((char *) id)) {
static int anon_id = 1;
- sprintf(buf, "%%%d", anon_id++);
+ snprintf(buf, sizeof(buf), "%%%d", anon_id++);
id = buf;
}
subg = agsubg(G, (char *) id, 1);
char buf[SMALLBUF];
do {
- sprintf(buf, "G_%d", graphIdCounter++);
+ snprintf(buf, sizeof(buf), "G_%d", graphIdCounter++);
} while (idexists(ids, buf));
return addid(ids, buf);
}
char buf[SMALLBUF];
do {
- sprintf(buf, "N_%d", nodeIdCounter++);
+ snprintf(buf, sizeof(buf), "N_%d", nodeIdCounter++);
} while (idexists(ids, buf));
return addid(ids, buf);
}
s = Defcolor[1];
b = Defcolor[2];
}
- sprintf(buf, "%f %f %f", h, s, b);
+ snprintf(buf, sizeof(buf), "%f %f %f", h, s, b);
agset(n, "color", buf);
}
free (nlist);
bb.LL.y += delta.y;
bb.UR.x += delta.x;
bb.UR.y += delta.y;
- sprintf(buf, "%d,%d,%d,%d", bb.LL.x, bb.LL.y, bb.UR.x, bb.UR.y);
+ snprintf(buf, sizeof(buf), "%d,%d,%d,%d", bb.LL.x, bb.LL.y, bb.UR.x, bb.UR.y);
agxset(g, G_bb->index, buf);
}
}
Agraph_t *subg;
if (isAnonGraph((char *) id)) {
static int anon_id = 1;
- sprintf(buf, "%%%d", anon_id++);
+ snprintf(buf, sizeof(buf), "%%%d", anon_id++);
id = buf;
}
subg = agsubg(G, (char *) id, 1);
else
return NULL;
- sprintf(buffer, "%s %s %s %s", types[0], types[1], types[2], types[3]);
+ snprintf(buffer, sizeof(buffer), "%s %s %s %s", types[0], types[1],
+ types[2], types[3]);
return strdup(buffer);
}
} else {
char name[32];
Agraph_t *G = agraphof(n);;
- sprintf(name, "cluster_%d", (st->Comp)++);
+ snprintf(name, sizeof(name), "cluster_%d", (st->Comp)++);
subg = agsubg(G, name, TRUE);
agbindrec(subg, "scc_graph", sizeof(Agraphinfo_t), TRUE);
setrep(subg, agnode(map, name, TRUE));
} else {
char name[32];
Agraph_t *G = agraphof(n);;
- sprintf(name, "cluster_%d", (st->Comp)++);
+ snprintf(name, sizeof(name), "cluster_%d", (st->Comp)++);
subg = agsubg(G, name, TRUE);
agbindrec(subg, "scc_graph", sizeof(Agraphinfo_t), TRUE);
setrep(subg, agnode(map, name, TRUE));
char gname[SMALLBUF];
static int id = 0;
- sprintf(gname, "_clone_%d", id++);
+ snprintf(gname, sizeof(gname), "_clone_%d", id++);
clone = agsubg(ing, gname,1);
agbindrec(clone, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
- sprintf(gname, "_clone_%d", id++);
+ snprintf(gname, sizeof(gname), "_clone_%d", id++);
xclone = agopen(gname, ing->desc,NULL);
for (n = agfstnode(ing); n; n = agnxtnode(ing, n)) {
agsubnode(clone,n,1);
char gname[SMALLBUF];
static int id = 0;
- sprintf(gname, "_span_%d", id++);
+ snprintf(gname, sizeof(gname), "_span_%d", id++);
tree = agsubg(g, gname,1);
agbindrec(tree, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
char name[SMALLBUF];
Agraph_t *subg;
- sprintf(name, "_block_%d", state->blockCount++);
+ snprintf(name, sizeof(name), "_block_%d", state->blockCount++);
subg = agsubg(g, name,1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
return subg;
block_t *bp;
Agnode_t* n;
- sprintf(name, "_block_%d", state->blockCount++);
+ snprintf(name, sizeof(name), "_block_%d", state->blockCount++);
subg = agsubg(g, name, 1);
bp = mkBlock(subg);
s = buf;
switch (ocolor->type) {
case HSVA_DOUBLE :
- sprintf (buf, "%.03f %.03f %.03f %.03f",
+ snprintf(buf, sizeof(buf), "%.03f %.03f %.03f %.03f",
ocolor->u.HSVA[0], ocolor->u.HSVA[1], ocolor->u.HSVA[2], ocolor->u.HSVA[3]);
break;
case RGBA_BYTE :
- sprintf (buf, "#%02x%02x%02x%02x",
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x",
ocolor->u.rgba[0], ocolor->u.rgba[1], ocolor->u.rgba[2], ocolor->u.rgba[3]);
break;
case RGBA_WORD:
rgba_wordToByte (ocolor->u.rrggbbaa, rgba);
- sprintf (buf, "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2], rgba[3]);
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2],
+ rgba[3]);
break;
case RGBA_DOUBLE:
rgba_dblToByte (ocolor->u.RGBA, rgba);
- sprintf (buf, "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2], rgba[3]);
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2],
+ rgba[3]);
break;
case COLOR_STRING:
s = ocolor->u.string;
tok = "none";
} else {
colorxlate(name, &color, RGBA_BYTE);
- sprintf(buf, "#%02x%02x%02x",
- color.u.rgba[0], color.u.rgba[1], color.u.rgba[2]);
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x",
+ color.u.rgba[0], color.u.rgba[1], color.u.rgba[2]);
tok = buf;
}
}
if (c < sizeof(nnames) / sizeof(char *))
return nnames[c];
- sprintf(name, "%d", c);
+ snprintf(name, sizeof(name), "%d", c);
return name;
}
static char buf[50];
if (ND_node_type(n)) {
- sprintf(buf, "%p", n);
+ snprintf(buf, sizeof(buf), "%p", n);
return buf;
}
else
char buf[BUFSIZ];
if (prefix) agputs(prefix, f);
- sprintf(buf, "%d", i);
+ snprintf(buf, sizeof(buf), "%d", i);
agputs(buf, f);
}
char buf[BUFSIZ];
if (prefix) agputs(prefix, f);
- sprintf(buf, "%.5g", v);
+ snprintf(buf, sizeof(buf), "%.5g", v);
agputs(buf, f);
}
char buf[BUFSIZ];
if (f->n_flds == 0) {
- sprintf(buf, "%.5g,%.5g,%.5g,%.5g ",
+ snprintf(buf, sizeof(buf), "%.5g,%.5g,%.5g,%.5g ",
f->b.LL.x + ND_coord(n).x,
YDIR(f->b.LL.y + ND_coord(n).y),
f->b.UR.x + ND_coord(n).x,
char buf[BUFSIZ];
pointf pt;
- sprintf(buf, "%.5g,%.5g,%.5g,%.5g", GD_bb(g).LL.x, YDIR(GD_bb(g).LL.y),
- GD_bb(g).UR.x, YDIR(GD_bb(g).UR.y));
+ snprintf(buf, sizeof(buf), "%.5g,%.5g,%.5g,%.5g", GD_bb(g).LL.x,
+ YDIR(GD_bb(g).LL.y), GD_bb(g).UR.x, YDIR(GD_bb(g).UR.y));
agxset(g, bbsym, buf);
if (GD_label(g) && GD_label(g)->text[0]) {
pt = GD_label(g)->pos;
- sprintf(buf, "%.5g,%.5g", pt.x, YDIR(pt.y));
+ snprintf(buf, sizeof(buf), "%.5g,%.5g", pt.x, YDIR(pt.y));
agxset(g, lpsym, buf);
pt = GD_label(g)->dimen;
- sprintf(buf, "%.2f", PS2INCH(pt.x));
+ snprintf(buf, sizeof(buf), "%.2f", PS2INCH(pt.x));
agxset (g, lwsym, buf);
- sprintf(buf, "%.2f", PS2INCH(pt.y));
+ snprintf(buf, sizeof(buf), "%.2f", PS2INCH(pt.y));
agxset (g, lhsym, buf);
}
for (c = 1; c <= GD_n_cluster(g); c++)
}
agset(n, "pos", agxbuse(&xb));
} else {
- sprintf(buf, "%.5g,%.5g", ND_coord(n).x, YDIR(ND_coord(n).y));
+ snprintf(buf, sizeof(buf), "%.5g,%.5g", ND_coord(n).x,
+ YDIR(ND_coord(n).y));
agset(n, "pos", buf);
}
- sprintf(buf, "%.5g", PS2INCH(ND_ht(n)));
+ snprintf(buf, sizeof(buf), "%.5g", PS2INCH(ND_ht(n)));
agxset(n, N_height, buf);
- sprintf(buf, "%.5g", PS2INCH(ND_lw(n) + ND_rw(n)));
+ snprintf(buf, sizeof(buf), "%.5g", PS2INCH(ND_lw(n) + ND_rw(n)));
agxset(n, N_width, buf);
if (ND_xlabel(n) && ND_xlabel(n)->set) {
ptf = ND_xlabel(n)->pos;
- sprintf(buf, "%.5g,%.5g", ptf.x, YDIR(ptf.y));
+ snprintf(buf, sizeof(buf), "%.5g,%.5g", ptf.x, YDIR(ptf.y));
agset(n, "xlp", buf);
}
if (strcmp(ND_shape(n)->name, "record") == 0) {
agxbputc(&xb, ';');
if (ED_spl(e)->list[i].sflag) {
s_arrows = 1;
- sprintf(buf, "s,%.5g,%.5g ",
+ snprintf(buf, sizeof(buf), "s,%.5g,%.5g ",
ED_spl(e)->list[i].sp.x,
YDIR(ED_spl(e)->list[i].sp.y));
agxbput(&xb, buf);
}
if (ED_spl(e)->list[i].eflag) {
e_arrows = 1;
- sprintf(buf, "e,%.5g,%.5g ",
+ snprintf(buf, sizeof(buf), "e,%.5g,%.5g ",
ED_spl(e)->list[i].ep.x,
YDIR(ED_spl(e)->list[i].ep.y));
agxbput(&xb, buf);
agset(e, "pos", agxbuse(&xb));
if (ED_label(e)) {
ptf = ED_label(e)->pos;
- sprintf(buf, "%.5g,%.5g", ptf.x, YDIR(ptf.y));
+ snprintf(buf, sizeof(buf), "%.5g,%.5g", ptf.x, YDIR(ptf.y));
agset(e, "lp", buf);
}
if (ED_xlabel(e) && ED_xlabel(e)->set) {
ptf = ED_xlabel(e)->pos;
- sprintf(buf, "%.5g,%.5g", ptf.x, YDIR(ptf.y));
+ snprintf(buf, sizeof(buf), "%.5g,%.5g", ptf.x, YDIR(ptf.y));
agset(e, "xlp", buf);
}
if (ED_head_label(e)) {
ptf = ED_head_label(e)->pos;
- sprintf(buf, "%.5g,%.5g", ptf.x, YDIR(ptf.y));
+ snprintf(buf, sizeof(buf), "%.5g,%.5g", ptf.x, YDIR(ptf.y));
agset(e, "head_lp", buf);
}
if (ED_tail_label(e)) {
ptf = ED_tail_label(e)->pos;
- sprintf(buf, "%.5g,%.5g", ptf.x, YDIR(ptf.y));
+ snprintf(buf, sizeof(buf), "%.5g,%.5g", ptf.x, YDIR(ptf.y));
agset(e, "tail_lp", buf);
}
}
if (!strcmp(line, "setlinewidth")) { /* a hack to handle the user-defined (PS) style spec in proc3d.dot */
long n = atol(p);
- sprintf(buf,
+ snprintf(buf, sizeof(buf),
"oldlinethick = linethick;linethick = %ld * scalethickness / %.0f\n",
n, Fontscale / Scale);
skip = 1;
if (Show_boxes) {
char buf[BUFSIZ];
if (Flip)
- sprintf(buf, M2, Offset.x, Offset.y, Offset.x, Offset.y);
+ snprintf(buf, sizeof(buf), M2, Offset.x, Offset.y, Offset.x, Offset.y);
else
- sprintf(buf, M1, Offset.y, Offset.x, Offset.y, Offset.x,
+ snprintf(buf, sizeof(buf), M1, Offset.y, Offset.x, Offset.y, Offset.x,
-Offset.x, -Offset.y);
Show_boxes[0] = strdup(buf);
}
Show_boxes = ALLOC(newcnt+2,Show_boxes,char*);
for (bi = 0; bi < boxn; bi++) {
ll = boxes[bi].LL, ur = boxes[bi].UR;
- sprintf(buf, "%d %d %d %d pathbox", (int)ll.x, (int)ll.y, (int)ur.x, (int)ur.y);
+ snprintf(buf, sizeof(buf), "%d %d %d %d pathbox", (int)ll.x, (int)ll.y,
+ (int)ur.x, (int)ur.y);
Show_boxes[bi+1+Show_cnt] = strdup (buf);
}
Show_cnt = newcnt;
Show_boxes[li++] = strdup ("%% spline");
Show_boxes[li++] = strdup ("gsave 1 0 0 setrgbcolor newpath");
for (i = 0; i < spl.pn; i++) {
- sprintf(buf, "%f %f %s", spl.ps[i].x, spl.ps[i].y,
+ snprintf(buf, sizeof(buf), "%f %f %s", spl.ps[i].x, spl.ps[i].y,
(i == 0) ? "moveto" : ((i % 3 == 0) ? "curveto" : ""));
Show_boxes[li++] = strdup (buf);
}
Show_boxes[li++] = strdup ("%% line");
Show_boxes[li++] = strdup ("gsave 0 0 1 setrgbcolor newpath");
for (i = 0; i < pl.pn; i++) {
- sprintf(buf, "%f %f %s", pl.ps[i].x, pl.ps[i].y,
+ snprintf(buf, sizeof(buf), "%f %f %s", pl.ps[i].x, pl.ps[i].y,
(i == 0 ? "moveto" : "lineto"));
Show_boxes[li++] = strdup (buf);
}
hd.y = (int)p.ps[(bi+1) % p.pn].y;
if ((tl.x == hd.x) && (tl.y == hd.y)) pfx = "%%";
else pfx ="";
- sprintf(buf, "%s%d %d %d %d makevec", pfx, tl.x, tl.y, hd.x, hd.y);
+ snprintf(buf, sizeof(buf), "%s%d %d %d %d makevec", pfx, tl.x, tl.y, hd.x,
+ hd.y);
Show_boxes[li++] = strdup (buf);
}
Show_boxes[li++] = strdup ("grestore");
Show_boxes[li++] = strdup ("gsave 0 1 0 setrgbcolor");
for (bi = 0; bi < boxn; bi++) {
ll = boxes[bi].LL, ur = boxes[bi].UR;
- sprintf(buf, "newpath\n%d %d moveto", (int)ll.x, (int)ll.y);
+ snprintf(buf, sizeof(buf), "newpath\n%d %d moveto", (int)ll.x, (int)ll.y);
Show_boxes[li++] = strdup (buf);
- sprintf(buf, "%d %d lineto", (int)ll.x, (int)ur.y);
+ snprintf(buf, sizeof(buf), "%d %d lineto", (int)ll.x, (int)ur.y);
Show_boxes[li++] = strdup (buf);
- sprintf(buf, "%d %d lineto", (int)ur.x, (int)ur.y);
+ snprintf(buf, sizeof(buf), "%d %d lineto", (int)ur.x, (int)ur.y);
Show_boxes[li++] = strdup (buf);
- sprintf(buf, "%d %d lineto", (int)ur.x, (int)ll.y);
+ snprintf(buf, sizeof(buf), "%d %d lineto", (int)ur.x, (int)ll.y);
Show_boxes[li++] = strdup (buf);
Show_boxes[li++] = strdup ("closepath stroke");
}
Show_boxes[li++] = strdup ("%% self list");
Show_boxes[li++] = strdup ("dbgstart");
for (bi = 0; bi < pn; bi++) {
- sprintf(buf, "%.5g %.5g point", ps[bi].x, ps[bi].y);
+ snprintf(buf, sizeof(buf), "%.5g %.5g point", ps[bi].x, ps[bi].y);
Show_boxes[li++] = strdup (buf);
}
Show_boxes[li++] = strdup ("grestore");
for (n = agfstnode(g); n; n = agnxtnode(g,n)) {
if (maxphase >= 1) {
- sprintf(buf, "%d", ND_rank(n));
+ snprintf(buf, sizeof(buf), "%d", ND_rank(n));
ag_xset(n,rk,buf);
}
if (maxphase >= 2) {
- sprintf(buf, "%d", ND_order(n));
+ snprintf(buf, sizeof(buf), "%d", ND_order(n));
ag_xset(n,order,buf);
}
}
static char buf[20];
if (ND_node_type(n) == NORMAL)
return agnameof(n);
- sprintf(buf, "V%p", n);
+ snprintf(buf, sizeof(buf), "V%p", n);
return buf;
}
static char buf[1000];
if (ND_node_type(v)) {
if (ND_ranktype(v) == CLUSTER)
- sprintf (buf, "v%s_%p", agnameof(ND_clust(v)), v);
+ snprintf(buf, sizeof(buf), "v%s_%p", agnameof(ND_clust(v)), v);
else
- sprintf (buf, "v_%p", v);
+ snprintf(buf, sizeof(buf), "v_%p", v);
} else
- sprintf (buf, "%s", agnameof(v));
+ snprintf(buf, sizeof(buf), "%s", agnameof(v));
return buf;
}
static void dumpg (graph_t* g)
u = rk->v[j];
if ((e = (edge_t*)ND_alg(u))) {
if (!lg) lg = agopen ("lg", Agstrictdirected, 0);
- sprintf (buf, "%d", j);
+ snprintf(buf, sizeof(buf), "%d", j);
n = agnode(lg, buf, 1);
agbindrec(n, "info", sizeof(info_t), 1);
lo = ND_order(aghead(ND_out(u).list[0]));
}
}
if (!e) {
- sprintf (buf, "_weak_%d", id++);
+ snprintf(buf, sizeof(buf), "_weak_%d", id++);
v = makeXnode(g, buf);
e = agedge(g, v, t, 0, 1);
f = agedge(g, v, h, 0, 1);
/* Create component based on port nodes */
subg = 0;
if ((pp = PORTS(g))) {
- sprintf(name, "cc%s_%d", agnameof(g), c_cnt++ + C_cnt);
+ snprintf(name, sizeof(name), "cc%s_%d", agnameof(g), c_cnt++ + C_cnt);
subg = agsubg(g, name,1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
GD_alg(subg) = NEW(gdata);
if (ND_pinned(n) != P_PIN)
continue;
if (!subg) {
- sprintf(name, "cc%s_%d", agnameof(g), c_cnt++ + C_cnt);
+ snprintf(name, sizeof(name), "cc%s_%d", agnameof(g), c_cnt++ + C_cnt);
subg = agsubg(g, name,1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
GD_alg(subg) = NEW(gdata);
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (MARK(n))
continue;
- sprintf(name, "cc%s+%d", agnameof(g), c_cnt++ + C_cnt);
+ snprintf(name, sizeof(name), "cc%s+%d", agnameof(g), c_cnt++ + C_cnt);
subg = agsubg(g, name,1);
agbindrec(subg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
GD_alg(subg) = NEW(gdata);
* doesn't yet include margins, scaling or page sizes because
* those depend on the renderer being used. */
if (GD_drawing(g)->landscape)
- sprintf(buf, "%d %d %d %d",
- ROUND(GD_bb(g).LL.y), ROUND(GD_bb(g).LL.x),
- ROUND(GD_bb(g).UR.y), ROUND(GD_bb(g).UR.x));
+ snprintf(buf, sizeof(buf), "%d %d %d %d",
+ ROUND(GD_bb(g).LL.y), ROUND(GD_bb(g).LL.x),
+ ROUND(GD_bb(g).UR.y), ROUND(GD_bb(g).UR.x));
else
- sprintf(buf, "%d %d %d %d",
- ROUND(GD_bb(g).LL.x), ROUND(GD_bb(g).LL.y),
- ROUND(GD_bb(g).UR.x), ROUND(GD_bb(g).UR.y));
+ snprintf(buf, sizeof(buf), "%d %d %d %d",
+ ROUND(GD_bb(g).LL.x), ROUND(GD_bb(g).LL.y),
+ ROUND(GD_bb(g).UR.x), ROUND(GD_bb(g).UR.y));
agsafeset(g, "bb", buf, "");
return 0;
size_t len;
if (job->graph_index)
- sprintf(gidx, ".%d", job->graph_index + 1);
+ snprintf(gidx, sizeof(gidx), ".%d", job->graph_index + 1);
else
gidx[0] = '\0';
if (!(fn = job->input_filename))
for (np = agfstnode(g); np; np = agnxtnode(g, np))
CCUNMARK(np);
- sprintf(name, "_cc_%d", id++);
+ snprintf(name, sizeof(name), "_cc_%d", id++);
cg = openSubg(g, name);
cc_dfs(g, cg, n);
symbols[0].type = T_node;
tchk[V_this][1] = Y(V);
bp->n_nstmts = inp->n_nstmts;
- sprintf (label, "_nd%d", i);
+ snprintf(label, sizeof(label), "_nd%d", i);
bp->node_stmts = mkStmts(prog, src, inp->node_stmts,
inp->n_nstmts, label, tmps);
if (getErrorErrors())
symbols[0].type = T_edge;
tchk[V_this][1] = Y(E);
bp->n_estmts = inp->n_estmts;
- sprintf (label, "_eg%d", i);
+ snprintf(label, sizeof(label), "_eg%d", i);
bp->edge_stmts = mkStmts(prog, src, inp->edge_stmts,
inp->n_estmts, label, tmps);
if (getErrorErrors())
}
i /= 3;
- sprintf(fmt, "%%%dx%%%dx%%%dx", i, i, i);
+ snprintf(fmt, sizeof(fmt), "%%%dx%%%dx%%%dx", i, i, i);
if (sscanf(spec+1, fmt, &red, &green, &blue) != 3) {
return 0;
}
rc = inkpot_get_rgba_i ( inkpot, rgba );
if (rc == INKPOT_SUCCESS) {
- len = sprintf(buf, "%04x%04x%04x%04x", rgba[0], rgba[1], rgba[2], rgba[3]);
+ len = snprintf(buf, sizeof(buf), "%04x%04x%04x%04x", rgba[0], rgba[1],
+ rgba[2], rgba[3]);
assert(len==16);
inkpot->write_disc.writer(inkpot->write_closure, buf, len);
}
rc = inkpot_get_rgba_i ( inkpot, rgba );
if (rc == INKPOT_SUCCESS) {
- len = sprintf(buf, "%04x%04x%04x", rgba[0], rgba[1], rgba[2]);
+ len = snprintf(buf, sizeof(buf), "%04x%04x%04x", rgba[0], rgba[1],
+ rgba[2]);
assert(len==12);
inkpot->write_disc.writer(inkpot->write_closure, buf, len);
}
rc = inkpot_get_rgba_i ( inkpot, rgba );
if (rc == INKPOT_SUCCESS) {
- len = sprintf(buf, "%02x%02x%02x%02x", rgba[0]>>8, rgba[1]>>8, rgba[2]>>8, rgba[3]>>8);
+ len = snprintf(buf, sizeof(buf), "%02x%02x%02x%02x", rgba[0]>>8,
+ rgba[1]>>8, rgba[2]>>8, rgba[3]>>8);
assert(len==8);
inkpot->write_disc.writer(inkpot->write_closure, buf, len);
}
rc = inkpot_get_rgba_i ( inkpot, rgba );
if (rc == INKPOT_SUCCESS) {
- len = sprintf(buf, "%02x%02x%02x", rgba[0]>>8, rgba[1]>>8, rgba[2]>>8);
+ len = snprintf(buf, "%02x%02x%02x", rgba[0]>>8, rgba[1]>>8, rgba[2]>>8);
assert(len==6);
inkpot->write_disc.writer(inkpot->write_closure, buf, len);
}
node_t *n;
edge_t *e;
for (n = agfstnode(cg); n; n = agnxtnode(cg, n)) {
- sprintf(buf, "%d", ND_rank(n));
+ snprintf(buf, sizeof(buf), "%d", ND_rank(n));
agxset(n, rksym, buf);
for (e = agfstedge(cg, n); e; e = agnxtedge(cg, e, n)) {
- sprintf(buf, "%d", ED_minlen(e));
+ snprintf(buf, sizeof(buf), "%d", ED_minlen(e));
agxset(e, mlsym, buf);
}
}
pointf b = pts[rtr->tris[3*i+1]];
pointf c = pts[rtr->tris[3*i+2]];
psTri (a, b,c);
- sprintf (buf, "%d", i);
+ snprintf(buf, sizeof(buf), "%d", i);
psTxt (buf, nodes[i].ctr);
}
for (i=rtr->tn;i < n; i++) {
- sprintf (buf, "%d", i);
+ snprintf(buf, sizeof(buf), "%d", i);
psTxt (buf, nodes[i].ctr);
}
psColor ("1 0 0");
#else
seed = (unsigned) getpid() ^ (unsigned) time(NULL);
#endif
- sprintf(smallbuf, "%ld", seed);
+ snprintf(smallbuf, sizeof(smallbuf), "%ld", seed);
agset(G, "start", smallbuf);
}
*seedp = seed;
if ((Ndim >= 3) && N_z) {
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
- sprintf(buf, "%lf", POINTS_PER_INCH * (ND_pos(n)[2]));
+ snprintf(buf, sizeof(buf), "%lf", POINTS_PER_INCH * (ND_pos(n)[2]));
agxset(n, N_z, buf);
}
}
if (N_fontsize) {
char* str = agxget(n, N_fontsize);
if (*str == '\0') {
- sprintf (buf, "%.03f", ND_ht(n)*0.7);
+ snprintf(buf, sizeof(buf), "%.03f", ND_ht(n)*0.7);
agxset(n, N_fontsize, buf);
}
}
#ifdef GVIEWER
if (Gviewer){
char lab[100];
- sprintf(lab,"maxent. alpha=%10.2g, iter=%d",stress_maxent_data_get_alpha(sm->data), iter);
+ snprintf(lab, sizeof(lab), "maxent. alpha=%10.2g, iter=%d",
+ stress_maxent_data_get_alpha(sm->data), iter);
gviewer_set_label(lab);
}
#endif
#ifdef GVIEWER
if (Gviewer){
char lab[100];
- sprintf(lab,"pmds(k), iter=%d", iter);
+ snprintf(lab, sizeof(lab), "pmds(k), iter=%d", iter);
gviewer_set_label(lab);
}
#endif
#ifdef GVIEWER
if (Gviewer){
char lab[100];
- sprintf(lab,"sfdp, iter=%d", iter);
+ snprintf(lab, sizeof(lab), "sfdp, iter=%d", iter);
gviewer_set_label(lab);
gviewer_reset_graph_coord(A, dim, x);
drawScene();
#ifdef GVIEWER
if (Gviewer){
char lab[100];
- sprintf(lab,"sfdp, adaptive_cooling = %d iter=%d", adaptive_cooling, iter);
+ snprintf(lab, sizeof(lab), "sfdp, adaptive_cooling = %d iter=%d",
+ adaptive_cooling, iter);
gviewer_set_label(lab);
gviewer_reset_graph_coord(A, dim, x);
drawScene();
} else {
g = agopen ("G", Agdirected, 0);
}
- sprintf (buf, "%f", 1.0);
+ snprintf(buf, sizeof(buf), "%f", 1.0);
label_string = strcpy(label_string, name);
label_string = strcat(label_string, ". ");
- sprintf (buf, "%d", A->m);
+ snprintf(buf, sizeof(buf), "%d", A->m);
label_string = strcat(label_string, buf);
label_string = strcat(label_string, " nodes, ");
- sprintf (buf, "%d", A->nz);
+ snprintf(buf, sizeof(buf), "%d", A->nz);
label_string = strcat(label_string, buf);
/* label_string = strcat(label_string, " edges. Created by Yifan Hu");*/
label_string = strcat(label_string, " edges.");
sym3 = agattr(g, AGEDGE, "wt", "");
}
for (i = 0; i < A->m; i++) {
- sprintf (buf, "%d", i);
+ snprintf(buf, sizeof(buf), "%d", i);
n = mkNode (g, buf);
ND_id(n) = i;
arr[i] = n;
if (val){
switch (A->type){
case MATRIX_TYPE_REAL:
- sprintf (buf, "%f", ((real*)A->a)[j]);
+ snprintf(buf, sizeof(buf), "%f", ((real*)A->a)[j]);
break;
case MATRIX_TYPE_INTEGER:
- sprintf (buf, "%d", ((int*)A->a)[j]);
+ snprintf(buf, sizeof(buf), "%d", ((int*)A->a)[j]);
break;
case MATRIX_TYPE_COMPLEX:/* take real part as weight */
- sprintf (buf, "%f", ((real*)A->a)[2*j]);
+ snprintf(buf, sizeof(buf), "%f", ((real*)A->a)[2*j]);
break;
}
if (with_color) {
if (i != ja[j]){
- sprintf (buf2, "%s", hue2rgb(.65*color[j], cstring));
+ snprintf(buf2, sizeof(buf2), "%s", hue2rgb(.65*color[j], cstring));
} else {
- sprintf (buf2, "#000000");
+ snprintf(buf2, sizeof(buf2), "#000000");
}
}
} else {
- sprintf (buf, "%f", 1.);
+ snprintf(buf, sizeof(buf), "%f", 1.);
if (with_color) {
if (i != ja[j]){
- sprintf (buf2, "%s", hue2rgb(.65*color[j], cstring));
+ snprintf(buf2, sizeof(buf2), "%s", hue2rgb(.65*color[j], cstring));
} else {
- sprintf (buf2, "#000000");
+ snprintf(buf2, sizeof(buf2), "#000000");
}
}
}
e = agedge (g, n, h, NULL, 1);
if (with_color) {
agxset (e, sym2, buf2);
- sprintf (buf2, "%f", color[j]);
+ snprintf(buf2, sizeof(buf2), "%f", color[j]);
agxset (e, sym3, buf2);
}
}
sym2 = agattr(g, AGEDGE, "color", "");
for (n = agfstnode (g); n; n = agnxtnode (g, n)) {
for (ep = agfstedge(g, n); ep; ep = agnxtedge(g, ep, n)) {
- sprintf (buf2, "%s", hue2rgb(0.65*drand(), cstring));
+ snprintf(buf2, sizeof(buf2), "%s", hue2rgb(0.65*drand(), cstring));
agxset (ep, sym2, buf2);
}
}
for (i = 0; i < nnodes; i++) (*clusters)[i]++;/* make into 1 based */
for (n = agfstnode (g); n; n = agnxtnode (g, n)) {
i = ND_id(n);
- sprintf(scluster,"%d",(*clusters)[i]);
+ snprintf(scluster, sizeof(scluster), "%d", (*clusters)[i]);
agxset(n,clust_sym,scluster);
}
MIN_GRPS = 1;
tok = "none";
} else {
// colorxlate(name, &color, RGBA_BYTE);
- sprintf(buf, "#%02x%02x%02x",
- color.u.rgba[0], color.u.rgba[1], color.u.rgba[2]);
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x",
+ color.u.rgba[0], color.u.rgba[1], color.u.rgba[2]);
tok = buf;
}
}
static char buf [10];
if (rgba[3] == 0xFF)
- sprintf (buf, "#%02x%02x%02x", rgba[0], rgba[1], rgba[2]);
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x", rgba[0], rgba[1], rgba[2]);
else
- sprintf (buf, "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2], rgba[3]);
+ snprintf(buf, sizeof(buf), "#%02x%02x%02x%02x", rgba[0], rgba[1], rgba[2],
+ rgba[3]);
return buf;
}
if (job->obj->penwidth != penwidth[job->obj->emit_state]) {
penwidth[job->obj->emit_state] = job->obj->penwidth;
agxbput (&xbuf, "setlinewidth(");
- sprintf (buf, "%.3f", job->obj->penwidth);
+ snprintf(buf, sizeof(buf), "%.3f", job->obj->penwidth);
xdot_trim_zeros (buf, 0);
agxbprint(&xbuf, "%s)", buf);
xdot_str (job, "S ", agxbuse(&xbuf));
{
char buf[BUFSIZ];
- sprintf (buf, "%.03f", v);
+ snprintf(buf, sizeof(buf), "%.03f", v);
xdot_trim_zeros (buf, 1);
xdot_str_xbuf (xb, buf, color2str (clr->u.rgba));
}
cr = cairo_create(gs->surface); /* temp context for gs */
- sprintf(width_height, "-g%dx%d", us->x + us->w, us->y + us->h);
- sprintf(dpi, "-r%d", us->dpi);
- sprintf(cairo_context, "-sCairoContext=%p", cr);
+ snprintf(width_height, sizeof(width_height), "-g%dx%d", us->x + us->w,
+ us->y + us->h);
+ snprintf(dpi, sizeof(dpi), "-r%d", us->dpi);
+ snprintf(cairo_context, sizeof(cairo_context), "-sCairoContext=%p", cr);
rc = gsapi_init_with_args(instance, GS_ARGC, gs_args);
im = gdImageCreate(w, h);
if (im == NULL) {
char buf[255];
- sprintf(buf, "GD unable to allocate %d X %d image", w, h);
+ snprintf(buf, sizeof(buf), "GD unable to allocate %d X %d image", w, h);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
}
im = gdImageCreateTrueColor(w, h);
if (im == NULL) {
char buf[255];
- sprintf(buf, "GD unable to allocate %d X %d image", w, h);
+ snprintf(buf, sizeof(buf), "GD unable to allocate %d X %d image", w, h);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
}
static char buf[32];
switch (AGTYPE(obj)) {
- case AGRAPH: sprintf(buf,"graph%p",obj); break;
- case AGNODE: sprintf(buf,"node%p",obj); break;
+ case AGRAPH: snprintf(buf, sizeof(buf), "graph%p", obj); break;
+ case AGNODE: snprintf(buf, sizeof(buf), "node%p", obj); break;
case AGINEDGE:
- case AGOUTEDGE: sprintf(buf,"edge%p",obj); break;
+ case AGOUTEDGE: snprintf(buf, sizeof(buf), "edge%p", obj); break;
}
return buf;
}
* doesn't yet include margins, scaling or page sizes because
* those depend on the renderer being used. */
if (GD_drawing(g)->landscape)
- sprintf(buf, "%d %d %d %d",
+ snprintf(buf, sizeof(buf), "%d %d %d %d",
ROUND(GD_bb(g).LL.y), ROUND(GD_bb(g).LL.x),
ROUND(GD_bb(g).UR.y), ROUND(GD_bb(g).UR.x));
else
- sprintf(buf, "%d %d %d %d",
+ snprintf(buf, sizeof(buf), "%d %d %d %d",
ROUND(GD_bb(g).LL.x), ROUND(GD_bb(g).LL.y),
ROUND(GD_bb(g).UR.x), ROUND(GD_bb(g).UR.y));
if (!(a = agattr(g, AGRAPH, "bb", NULL)))
if (npts != 1)
Tcl_DStringStartSublist(result);
for (i = 0; i < npts; i++) {
- sprintf(buf, "%g", p[i].x);
+ snprintf(buf, sizeof(buf), "%g", p[i].x);
Tcl_DStringAppendElement(result, buf);
- sprintf(buf, "%g", p[i].y);
+ snprintf(buf, sizeof(buf), "%g", p[i].y);
Tcl_DStringAppendElement(result, buf);
}
if (npts != 1)
/* TBL_ENTRY((tblHeader_pt)vgpaneTable, (ubyte_pt)vgp));*/
if (vgp->triangle_cmd) {
- sprintf(vbuf, "vgpane%lu",
+ snprintf(vbuf, sizeof(vbuf), "vgpane%lu",
(uint64_t) (((ubyte_pt) vgp - (vgpaneTable->bodyPtr))
/ (vgpaneTable->entrySize)));
expandPercentsEval(vgp->interp, vgp->triangle_cmd, vbuf, 3, pqr);
{
char buf[30];
- sprintf(buf, "%g", p.x);
+ snprintf(buf, sizeof(buf), "%g", p.x);
Tcl_AppendElement(interp, buf);
- sprintf(buf, "%g", p.y);
+ snprintf(buf, sizeof(buf), "%g", p.y);
Tcl_AppendElement(interp, buf);
}
/* determine the polygons (if any) that contain the point */
for (i = 0; i < vgp->Npoly; i++) {
if (in_poly(vgp->poly[i].boundary, p)) {
- sprintf(vbuf, "%d", vgp->poly[i].id);
+ snprintf(vbuf, sizeof(vbuf), "%d", vgp->poly[i].id);
Tcl_AppendElement(interp, vbuf);
}
}
if (result != TCL_OK)
return result;
- sprintf(vbuf, "%d", polyid);
+ snprintf(vbuf, sizeof(vbuf), "%d", polyid);
Tcl_AppendResult(interp, vbuf, (char *) NULL);
return TCL_OK;
} else if ((c == 'l') && (strncmp(argv[1], "list", length) == 0)) {
/* return list of polygon ids */
for (i = 0; i < vgp->Npoly; i++) {
- sprintf(vbuf, "%d", vgp->poly[i].id);
+ snprintf(vbuf, sizeof(vbuf), "%d", vgp->poly[i].id);
Tcl_AppendElement(interp, vbuf);
}
return TCL_OK;
return;
}
- sprintf(buffer, "%.15g %.15g moveto\n",
+ snprintf(buffer, sizeof(buffer), "%.15g %.15g moveto\n",
pointPtr[0], Tk_CanvasPsY(canvas, pointPtr[1]));
Tcl_AppendResult(interp, buffer, (char *) NULL);
*/
for (i = numPoints - 2, pointPtr += 2; i > 0; i -= 3, pointPtr += 6) {
- sprintf(buffer, "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
+ snprintf(buffer, sizeof(buffer),
+ "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
pointPtr[0], Tk_CanvasPsY(canvas, pointPtr[1]),
pointPtr[2], Tk_CanvasPsY(canvas, pointPtr[3]),
pointPtr[4], Tk_CanvasPsY(canvas, pointPtr[5]));
gvParseArgs(Gvc, argc, argv);
char expected_stderr[100];
- sprintf(expected_stderr, "dot - graphviz version %s (%s)\n",
- PACKAGE_VERSION, BUILDDATE);
+ snprintf(expected_stderr, sizeof(expected_stderr),
+ "dot - graphviz version %s (%s)\n", PACKAGE_VERSION, BUILDDATE);
cr_assert_stderr_eq_str(expected_stderr);
}
gvParseArgs(Gvc, argc, argv);
char expected_stderr[100];
- sprintf(expected_stderr, "dot - graphviz version %s (%s)\n",
- PACKAGE_VERSION, BUILDDATE);
+ snprintf(expected_stderr, sizeof(expected_stderr),
+ "dot - graphviz version %s (%s)\n", PACKAGE_VERSION, BUILDDATE);
cr_assert_stderr_eq_str(expected_stderr);
}
gvParseArgs(Gvc, argc, argv);
char expected_stderr[2000];
- sprintf(expected_stderr, "Error: dot: option -r unrecognized\n"
- "\n"
- "%s", usage_info);
+ snprintf(expected_stderr, sizeof(expected_stderr),
+ "Error: dot: option -r unrecognized\n\n%s", usage_info);
cr_assert_stderr_eq_str(expected_stderr);
}
gvParseArgs(Gvc, argc, argv);
char expected_stderr[100];
- sprintf(expected_stderr, "dot - graphviz version %s (%s)\n",
- PACKAGE_VERSION, BUILDDATE);
+ snprintf(expected_stderr, sizeof(expected_stderr),
+ "dot - graphviz version %s (%s)\n", PACKAGE_VERSION, BUILDDATE);
cr_assert_stderr_eq_str(expected_stderr);
}