add `int' casts to some strlen() expressions, and center labels on a xlog scale
This commit is contained in:
parent
1779d62558
commit
75b6eeb94a
10
ChangeLog
10
ChangeLog
|
|
@ -1,3 +1,13 @@
|
|||
2010-11-06 Robert Larice
|
||||
* src/frontend/postcoms.c ,
|
||||
* src/frontend/plotting/agraf.c ,
|
||||
* src/frontend/plotting/graf.c ,
|
||||
* src/frontend/plotting/grid.c ,
|
||||
* src/misc/dstring.c ,
|
||||
* src/spicelib/parser/inp2r.c ,
|
||||
* src/spicelib/parser/inpgmod.c :
|
||||
add `int' casts to some strlen() expressions, and center labels on a xlog scale
|
||||
|
||||
2010-11-06 Robert Larice
|
||||
* src/frontend/outitf.c ,
|
||||
* src/frontend/plotting/grid.c ,
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
|
|||
for (i = 0; i < omaxy + margin; i++)
|
||||
out_send("-");
|
||||
out_send("\n");
|
||||
i = (omaxy + margin - strlen(plot->pl_title)) / 2;
|
||||
i = (omaxy + margin - (int) strlen(plot->pl_title)) / 2;
|
||||
while (i-- > 0)
|
||||
out_send(" ");
|
||||
(void) strcpy(buf, plot->pl_title);
|
||||
|
|
@ -256,7 +256,7 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
|
|||
out_send("\n");
|
||||
(void) sprintf(buf, "%s %s", plot->pl_name, plot->pl_date);
|
||||
buf[maxy + margin] = '\0';
|
||||
i = (omaxy + margin - strlen(buf)) / 2;
|
||||
i = (omaxy + margin - (int) strlen(buf)) / 2;
|
||||
while (i-- > 0)
|
||||
out_send(" ");
|
||||
out_send(buf);
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ gr_pmsg(char *text)
|
|||
/* MW. grid.xlabel may be NULL */
|
||||
if (currentgraph->grid.xlabel)
|
||||
DevDrawText(text, currentgraph->viewport.width
|
||||
- (strlen(currentgraph->grid.xlabel) + 3)
|
||||
- (int) (strlen(currentgraph->grid.xlabel) + 3)
|
||||
* currentgraph->fontwidth,
|
||||
currentgraph->absolute.height - currentgraph->fontheight);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -512,11 +512,11 @@ drawlingrid(GRAPH *graph, char *units, int spacing, int nsp, double dst, double
|
|||
|
||||
if (axis == x_axis)
|
||||
DevDrawText(buf, graph->viewportxoff + i -
|
||||
strlen(buf) / 2 * graph->fontwidth,
|
||||
((int) strlen(buf) * graph->fontwidth) / 2 ,
|
||||
(int) (graph->fontheight * 2.5));
|
||||
else
|
||||
DevDrawText(buf, graph->viewportxoff -
|
||||
graph->fontwidth * (strlen(buf)),
|
||||
graph->fontwidth * (int) strlen(buf),
|
||||
graph->viewportyoff + i -
|
||||
graph->fontheight / 2);
|
||||
|
||||
|
|
@ -679,11 +679,12 @@ drawloggrid(GRAPH *graph, char *units, int hmt, int lmt, int decsp, int subs, in
|
|||
else
|
||||
(void) sprintf(buf, "10^%d", j);
|
||||
if (axis == x_axis)
|
||||
DevDrawText(buf, graph->viewportxoff + i - strlen(buf) / 2,
|
||||
DevDrawText(buf, graph->viewportxoff + i -
|
||||
((int) strlen(buf) * graph->fontwidth) / 2,
|
||||
(int) (graph->fontheight * 2.5));
|
||||
else
|
||||
DevDrawText(buf, graph->viewportxoff - graph->fontwidth *
|
||||
(strlen(buf) + 1),
|
||||
(int) (strlen(buf) + 1),
|
||||
graph->viewportyoff + i -
|
||||
graph->fontheight / 2);
|
||||
|
||||
|
|
@ -969,7 +970,7 @@ adddeglabel(GRAPH *graph, int deg, int x, int y, int cx, int cy, int lx, int ly)
|
|||
if (sqrt((double) (x - cx) * (x - cx) + (y - cy) * (y - cy)) < MINDIST)
|
||||
return;
|
||||
(void) sprintf(buf, "%d", deg);
|
||||
w = graph->fontwidth * (strlen(buf) + 1);
|
||||
w = graph->fontwidth * (int) (strlen(buf) + 1);
|
||||
h = graph->fontheight * 1.5;
|
||||
angle = atan2((double) (y - ly), (double) (x - lx));
|
||||
d = fabs(cos(angle)) * w / 2 + fabs(sin(angle)) * h / 2 + LOFF;
|
||||
|
|
@ -978,7 +979,7 @@ adddeglabel(GRAPH *graph, int deg, int x, int y, int cx, int cy, int lx, int ly)
|
|||
y = y + d * sin(angle) - h / 2;
|
||||
|
||||
DevDrawText(buf, x, y);
|
||||
DevDrawText("o", x + strlen(buf) * graph->fontwidth,
|
||||
DevDrawText("o", x + (int) strlen(buf) * graph->fontwidth,
|
||||
y + graph->fontheight / 2);
|
||||
return;
|
||||
}
|
||||
|
|
@ -996,10 +997,11 @@ addradlabel(GRAPH *graph, int lab, double theta, int x, int y)
|
|||
|
||||
(void) sprintf(buf, "%d", lab);
|
||||
if (theta == M_PI) {
|
||||
y = y - graph->fontheight - 2;
|
||||
x = x - graph->fontwidth * strlen(buf) - 3;
|
||||
} else
|
||||
x = x - graph->fontwidth * strlen(buf) - 3;
|
||||
y -= graph->fontheight + 2;
|
||||
x -= graph->fontwidth * (int) strlen(buf) + 3;
|
||||
} else {
|
||||
x -= graph->fontwidth * (int) strlen(buf) + 3;
|
||||
}
|
||||
DevDrawText(buf, x, y);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1369,7 +1371,7 @@ arcset(GRAPH *graph, double rad, double prevrad, double irad, double iprevrad, d
|
|||
SetColor(1);
|
||||
|
||||
x = centx + xoffset + (int)radoff - 2 * (int)rad -
|
||||
gi_fntwidth * strlen(plab) - 2;
|
||||
gi_fntwidth * (int) strlen(plab) - 2;
|
||||
if ((x > pxmin) && (x < pxmax)) {
|
||||
if ((yoffset > - gr_radius) && (yoffset < gr_radius))
|
||||
DevDrawText(plab, x, centy + yoffset - gi_fntheight - 1);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ com_print(wordlist *wl)
|
|||
printnum(numbuf, v->v_realdata[i]);
|
||||
(void) strcpy(buf, numbuf);
|
||||
out_send(buf);
|
||||
ll += strlen(buf);
|
||||
ll += (int) strlen(buf);
|
||||
ll = (ll + 7) / 8;
|
||||
ll = ll * 8 + 1;
|
||||
if (ll > 60) {
|
||||
|
|
@ -206,7 +206,7 @@ com_print(wordlist *wl)
|
|||
numbuf,
|
||||
numbuf2);
|
||||
out_send(buf);
|
||||
ll += strlen(buf);
|
||||
ll += (int) strlen(buf);
|
||||
ll = (ll + 7) / 8;
|
||||
ll = ll * 8 + 1;
|
||||
if (ll > 60) {
|
||||
|
|
@ -270,7 +270,7 @@ nextpage:
|
|||
out_send("\n");
|
||||
out_send(buf2);
|
||||
(void) sprintf(buf, "%s %s", p->pl_name, p->pl_date);
|
||||
j = (width - strlen(buf)) / 2;
|
||||
j = (width - (int) strlen(buf)) / 2;
|
||||
out_send(buf);
|
||||
out_send("\n");
|
||||
for (i = 0; i < width; i++)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ DESCRIPTION:This file contains the routines for manipulating dynamic strings.
|
|||
CONTENTS:
|
||||
DATE: Wed Mar 24 18:38:28 CDT 2010
|
||||
REVISIONS: $Log$
|
||||
REVISIONS: Revision 1.5 2010-11-06 16:54:11 rlar
|
||||
REVISIONS: Revision 1.6 2010-11-06 20:17:20 rlar
|
||||
REVISIONS: add `int' casts to some strlen() expressions, and center labels on a xlog scale
|
||||
REVISIONS:
|
||||
REVISIONS: Revision 1.5 2010/11/06 16:54:11 rlar
|
||||
REVISIONS: (int) cast the return value of some strlen() invocations
|
||||
REVISIONS:
|
||||
REVISIONS: Revision 1.4 2010/10/28 19:32:34 rlar
|
||||
|
|
@ -169,7 +172,7 @@ static int spice_format_length( va_list args, char *fmt )
|
|||
case 's':
|
||||
s = va_arg(args, char *) ;
|
||||
if( s ){
|
||||
len += strlen(s) ;
|
||||
len += (int) strlen(s) ;
|
||||
}
|
||||
found_special = TRUE ;
|
||||
break ;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current)
|
|||
}
|
||||
|
||||
/* copy first part of line */
|
||||
i -= strlen(t);
|
||||
i -= (int) strlen(t);
|
||||
strncpy(line, current->line, (size_t) i);
|
||||
line[i] = '\0'; /* terminate */
|
||||
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ INPfindParm( char *name, IFparm *table, int numParms )
|
|||
bestMatch = 0;
|
||||
for ( test = 0; test < numParms; test++ ) {
|
||||
match = cimatch( name, table[test].keyword );
|
||||
if ( (match == length) && (match == strlen(table[test].keyword)) ) {
|
||||
if ( (match == length) && (match == (int) strlen(table[test].keyword)) ) {
|
||||
/* exact match */
|
||||
best = test;
|
||||
/* all done */
|
||||
|
|
|
|||
Loading…
Reference in New Issue