From 5f4b0aa798fe1276b3b07ff977c53c60ac66869c Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 6 Nov 2010 16:54:11 +0000 Subject: [PATCH] (int) cast the return value of some strlen() invocations --- ChangeLog | 9 +++++++++ src/frontend/plotting/agraf.c | 2 +- src/frontend/plotting/graf.c | 2 +- src/frontend/plotting/grid.c | 2 +- src/misc/dstring.c | 9 ++++++--- src/spicelib/parser/inp2r.c | 2 +- src/spicelib/parser/inpgmod.c | 4 ++-- 7 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5bce26d71..902e75633 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-11-06 Robert Larice + * 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 : + (int) cast the return value of some strlen() invocations + 2010-11-06 Robert Larice * src/frontend/subckt.c , * src/spicelib/parser/inppas2.c : diff --git a/src/frontend/plotting/agraf.c b/src/frontend/plotting/agraf.c index 2e22538e2..66b8ed790 100644 --- a/src/frontend/plotting/agraf.c +++ b/src/frontend/plotting/agraf.c @@ -50,7 +50,7 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s * We assumed it was 2. If it's more, shift starting position over. */ sprintf(buf, "%1.1e", 0.0); /* expect 0.0e+00 */ - shift = strlen(buf) - 7; + shift = (int) strlen(buf) - 7; margin += shift; /* Make sure the margin is correct */ diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index 26e0f6992..135ac22f8 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -868,7 +868,7 @@ getitright(char *buf, double num) if (p) { return p - 4; } else { - k = strlen(buf); + k = (int) strlen(buf); if (k > 8) return buf + 4; else /* k >= 4 */ diff --git a/src/frontend/plotting/grid.c b/src/frontend/plotting/grid.c index c1a20ae08..d49b060a9 100644 --- a/src/frontend/plotting/grid.c +++ b/src/frontend/plotting/grid.c @@ -1166,7 +1166,7 @@ drawsmithgrid(GRAPH *graph) ir[k] = pixperunit * (1 + cos(dphi[k])) / sin(dphi[k]); rr[k] = pixperunit * 0.5 * (((1 - rnorm[k]) / (1 + rnorm[k])) + 1); (void) sprintf(plab, "%g", rnorm[k]); - plen = strlen(plab); + plen = (int) strlen(plab); /* See if the label will fit on the upper xaxis */ /* wait for some k, so we don't get fooled */ diff --git a/src/misc/dstring.c b/src/misc/dstring.c index 80ff8e101..efc42b384 100644 --- a/src/misc/dstring.c +++ b/src/misc/dstring.c @@ -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.4 2010-10-28 19:32:34 rlar +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 REVISIONS: wrap tmalloc MALLOC etc, into two macros TMALLOC and TREALLOC REVISIONS: REVISIONS: Revision 1.3 2010/10/09 11:42:10 rlar @@ -82,7 +85,7 @@ char *spice_dstring_append(SPICE_DSTRINGPTR dsPtr,char *string,int length) char *end ; /* end of string */ if( length < 0){ - length = strlen(string) ; + length = (int) strlen(string) ; } newSize = length + dsPtr->length ; @@ -242,7 +245,7 @@ char *spice_dstring_print( SPICE_DSTRINGPTR dsPtr,char *format, ... ) va_start( args, format ) ; if( format ){ vsprintf( buffer + orig_length, format, args ) ; - dsPtr->length = strlen( buffer ) ; + dsPtr->length = (int) strlen(buffer) ; } else { buffer = NULL ; } diff --git a/src/spicelib/parser/inp2r.c b/src/spicelib/parser/inp2r.c index 0c8335b0e..12b9c3c9e 100644 --- a/src/spicelib/parser/inp2r.c +++ b/src/spicelib/parser/inp2r.c @@ -124,7 +124,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current) so now we splice in a "tc2=" at the location remembered above. */ /* first alocate memory for the new longer line */ - i = strlen(current->line); /* length of existing line */ + i = (int) strlen(current->line); /* length of existing line */ line = TMALLOC(char, i + 4 + 1); /* alocate enough for "tc2=" & terminating NULL */ if(line == NULL) { /* failed to allocate memory so we recover rather crudely diff --git a/src/spicelib/parser/inpgmod.c b/src/spicelib/parser/inpgmod.c index 8f41f3f02..fbd425931 100644 --- a/src/spicelib/parser/inpgmod.c +++ b/src/spicelib/parser/inpgmod.c @@ -468,7 +468,7 @@ INPfindCard( char *name, IFcardInfo *table[], int numCards ) int best; int length; - length = strlen(name); + length = (int) strlen(name); /* compare all the names in the card table to this name */ best = E_MISSING; @@ -496,7 +496,7 @@ INPfindParm( char *name, IFparm *table, int numParms ) int id, bestId; int length; - length = strlen(name); + length = (int) strlen(name); /* compare all the names in the parameter table to this name */ best = E_MISSING;