explicit `int' casts for some ptrdiff_t expressions, where an `int' seems to be big enough

This commit is contained in:
rlar 2011-07-09 19:45:22 +00:00
parent 3227d3c170
commit 0892d04c8a
7 changed files with 23 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2011-07-09 Robert Larice
* src/frontend/gens.c ,
* src/frontend/subckt.c ,
* src/frontend/numparam/xpressn.c ,
* src/maths/sparse/spfactor.c ,
* src/spicelib/parser/inpgtok.c ,
* src/xspice/cm/cm.c :
explicit `int' casts for some ptrdiff_t expressions, where an `int' seems to be big enough
2011-07-09 Robert Larice
* src/ngsconvert.c ,
* src/misc/misc_time.c :

View File

@ -215,10 +215,10 @@ dgen_next(dgen **dgx)
if (p[-1] == ':') {
head_match = 1;
subckt_len = p - word - 1;
subckt_len = (int)(p - word) - 1;
} else {
head_match = 0;
subckt_len = p - word;
subckt_len = (int)(p - word);
}
if (subckt_len == 0) {

View File

@ -1590,7 +1590,7 @@ insertnumber (tdico * dico, int i, char *s, SPICE_DSTRINGPTR ustr_p)
(snprintf(buf, sizeof(buf), "%-17s", u) == ACT_CHARACTS))
{
memcpy(p, buf, ACT_CHARACTS);
return p - s + ACT_CHARACTS;
return (int)(p - s) + ACT_CHARACTS;
}
message

View File

@ -779,8 +779,8 @@ bxx_rewind(struct bxx_buffer *t)
static void
bxx_extend(struct bxx_buffer *t, int howmuch)
{
int pos = t->dst - t->buffer;
int len = t->limit - t->buffer;
int pos = (int)(t->dst - t->buffer);
int len = (int)(t->limit - t->buffer);
/* round up */
howmuch += (bxx_chunksize - 1);
@ -801,11 +801,11 @@ bxx_printf(struct bxx_buffer *t, const char *fmt, ...)
for (;;) {
int ret;
int size = t->limit - t->dst;
va_start(ap, fmt);
int size = (int)(t->limit - t->dst);
va_start(ap, fmt);
ret = vsnprintf(t->dst, (size_t) size, fmt, ap);
va_end(ap);
if(ret == -1) {
if(ret == -1) {
bxx_extend(t, bxx_chunksize);
} else if(ret >= size) {
bxx_extend(t, ret - size + 1);

View File

@ -1132,7 +1132,7 @@ RealNumber PivotMag;
* N-1 bottles of beer on the wall.
*/
}
I = pMarkowitzProduct - Matrix->MarkowitzProd + 1;
I = (int)(pMarkowitzProduct - Matrix->MarkowitzProd) + 1;
/* Assure that I is valid. */
if (I < Step) break; /* while (Singletons-- > 0) */
@ -1552,7 +1552,7 @@ RealNumber Magnitude, LargestInCol, LargestOffDiagonal;
/* Just passing through. */
}
I = pMarkowitzProduct - Matrix->MarkowitzProd;
I = (int)(pMarkowitzProduct - Matrix->MarkowitzProd);
/* Assure that I is valid; if I < Step, terminate search. */
if (I < Step) break; /* Endless for loop */

View File

@ -95,7 +95,7 @@ int INPgetTok(char **line, char **token, int gobble)
}
diffpoints = point - *line;
diffpoints = (int)(point - *line);
if ((diffpoints < 1) && *point)
diffpoints = 1; /* Weird items, 1 char */
*token = TMALLOC(char, 1 + diffpoints);
@ -193,7 +193,7 @@ int INPgetNetTok(char **line, char **token, int gobble)
}
/* now copy found token into *token */
diffpoints = point - *line;
diffpoints = (int)(point - *line);
if ((diffpoints < 1) && *point)
diffpoints = 1; /* Weird items, 1 char */
*token = TMALLOC(char, 1 + diffpoints);

View File

@ -245,7 +245,7 @@ int cm_analog_integrate(
/* Compute byte offset from start of state0 vector */
char_state0 = (char *) ckt->CKTstate0;
char_state = (char *) integral;
byte_index = char_state - char_state0;
byte_index = (int) (char_state - char_state0);
/* Check to be sure argument address is in range of state0 vector */
if((byte_index < 0) ||
@ -338,7 +338,7 @@ int cm_analog_converge(
/* Compute byte offset from start of state0 vector */
char_state0 = (char *) ckt->CKTstate0;
char_state = (char *) state;
byte_index = char_state - char_state0;
byte_index = (int) (char_state - char_state0);
/* Check to be sure argument address is in range of state0 vector */
if((byte_index < 0) ||