From 451f88c5e15b389cdc6142f285f6f95fac4e2fbb Mon Sep 17 00:00:00 2001 From: rlar Date: Fri, 24 Jun 2011 15:26:52 +0000 Subject: [PATCH] swallow type conversion warnings --- ChangeLog | 21 +++++++++++++++++---- src/frontend/com_ahelp.c | 4 ++-- src/frontend/inpcom.c | 12 ++++++------ src/frontend/numparam/mystring.c | 8 ++++---- src/frontend/numparam/xpressn.c | 2 +- src/frontend/trannoise/wallace.c | 2 +- src/main.c | 6 +++--- src/spicelib/parser/inp2r.c | 4 ++-- src/xspice/icm/analog/file_source/cfunc.mod | 2 +- 9 files changed, 37 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ecd51a74..a25ec33eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-06-24 Robert Larice + * src/main.c , + * src/frontend/com_ahelp.c , + * src/frontend/inpcom.c , + * src/frontend/numparam/mystring.c , + * src/frontend/numparam/xpressn.c , + * src/frontend/trannoise/wallace.c , + * src/spicelib/parser/inp2r.c , + * src/xspice/icm/analog/file_source/cfunc.mod : + swallow type conversion warnings + 2011-06-24 Robert Larice * src/ciderlib/oned/oneprint.c , * src/ciderlib/twod/twoprint.c : @@ -12,11 +23,13 @@ tiny rewrite, round to nearest integer and reset errno for strtol() 2011-06-23 Holger Vogt - * /xspice/icm/analog/modpath.lst, - /xspice/icm/analog/file_source/cfunc.mod, - /xspice/icm/analog/file_source/ifspec.ifs: + * src/xspice/icm/analog/modpath.lst , + * src/xspice/icm/analog/file_source/cfunc.mod , + * src/xspice/icm/analog/file_source/ifspec.ifs : code model with input from file added (T. Sailer) - example/xspice/fstest.sp, sine.m: test of 'filesource' + * examples/xspice/fstest.sp , + * examples/xspice/sine.m : + test of 'filesource' * inpcom.c: bug no. 3317928, patched by Robert 2011-06-23 Robert Larice diff --git a/src/frontend/com_ahelp.c b/src/frontend/com_ahelp.c index aa9119686..76cd7964f 100644 --- a/src/frontend/com_ahelp.c +++ b/src/frontend/com_ahelp.c @@ -20,9 +20,9 @@ com_ahelp(wordlist *wl) int i, n; /* assert: number of commands must be less than 512 */ struct comm *cc[512]; - int env = 0; + unsigned int env = 0; struct comm *com; - int level; + unsigned int level; char slevel[256]; if (wl) { diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 07f69e70f..4e11bc6da 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -2589,8 +2589,8 @@ inp_do_macro_param_replace( int fcn_number, char *params[] ) *param_ptr = '\0'; { - int curr_str_len = curr_str ? strlen(curr_str) : 0; - int len = strlen(curr_ptr) + strlen(params[i]) + 1; + size_t curr_str_len = curr_str ? strlen(curr_str) : 0; + size_t len = strlen(curr_ptr) + strlen(params[i]) + 1; if ( str_has_arith_char( params[i] ) ) { curr_str = TREALLOC(char, curr_str, curr_str_len + len + 2); sprintf( curr_str + curr_str_len, "%s(%s)", curr_ptr, params[i] ); @@ -2708,8 +2708,8 @@ if ( *str_ptr == ')' ) *str_ptr = ' '; keep = *fcn_name; *fcn_name = '\0'; { - int curr_str_len = curr_str ? strlen(curr_str) : 0; - int len = strlen(str) + strlen(macro_str) + 3; + size_t curr_str_len = curr_str ? strlen(curr_str) : 0; + size_t len = strlen(str) + strlen(macro_str) + 3; curr_str = TREALLOC(char, curr_str, curr_str_len + len); sprintf( curr_str + curr_str_len, "%s(%s)", str, macro_str ); } @@ -2723,8 +2723,8 @@ if ( *str_ptr == ')' ) *str_ptr = ' '; } else { if ( str != NULL ) { - int curr_str_len = strlen(curr_str); - int len = strlen(str) + 1; + size_t curr_str_len = strlen(curr_str); + size_t len = strlen(str) + 1; curr_str = TREALLOC(char, curr_str, curr_str_len + len); sprintf( curr_str + curr_str_len, "%s", str ); } diff --git a/src/frontend/numparam/mystring.c b/src/frontend/numparam/mystring.c index 096c52e1e..cf0057912 100644 --- a/src/frontend/numparam/mystring.c +++ b/src/frontend/numparam/mystring.c @@ -184,7 +184,7 @@ char upcase (char c) { if ((c >= 'a') && (c <= 'z')) - return c + 'A' - 'a'; + return (char) (c + 'A' - 'a'); else return c; } @@ -364,7 +364,7 @@ nadd ( SPICE_DSTRINGPTR dstr_p, long n) } for (j = k - 1; j >= 0; j--) { - load_str[0] = d[j] + '0'; + load_str[0] = (char) ('0' + d[j]); spice_dstring_append( dstr_p, load_str, 1 ) ; } } @@ -392,7 +392,7 @@ naddll (SPICE_DSTRINGPTR dstr_p, long long n) while (n > 0) { - d[k] = n % 10; + d[k] = (int) (n % 10); k++; n = n / 10; } @@ -409,7 +409,7 @@ naddll (SPICE_DSTRINGPTR dstr_p, long long n) } for (j = k - 1; j >= 0; j--) { - load_str[0] = d[j] + '0'; + load_str[0] = (char) ('0' + d[j]); spice_dstring_append( dstr_p, load_str, 1 ) ; } } diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index c6edf48bc..3bb621aec 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -1601,7 +1601,7 @@ insertnumber (tdico * dico, int i, char *s, SPICE_DSTRINGPTR ustr_p) s+i, u, id ); /* swallow everything on failure */ - return i + strlen(s+i); + return i + (int) strlen(s+i); } bool diff --git a/src/frontend/trannoise/wallace.c b/src/frontend/trannoise/wallace.c index ea8337597..10c076c5d 100644 --- a/src/frontend/trannoise/wallace.c +++ b/src/frontend/trannoise/wallace.c @@ -79,7 +79,7 @@ void initw(void) unsigned long int coa, cob, s; /* initialize the uniform generator */ - srand(getpid()); + srand((unsigned int) getpid()); // srand(17); TausSeed(); diff --git a/src/main.c b/src/main.c index 09165aca7..b8ad75083 100644 --- a/src/main.c +++ b/src/main.c @@ -847,7 +847,7 @@ main(int argc, char **argv) } cp_program = ft_sim->simulator; - srand(getpid()); + srand((unsigned int) getpid()); TausSeed(); /* --- Process command line options --- */ @@ -1115,7 +1115,7 @@ bot: initnorm (0, 0); if (!cp_getvar("rndseed", CP_NUM, &rseed)) { time_t acttime = time(NULL); - rseed = (int) acttime; + rseed = (unsigned int) acttime; } initnorm (rseed, 2); fprintf (cp_out, "SoS %f, seed value: %ld\n", renormalize(), rseed); @@ -1125,7 +1125,7 @@ bot: unsigned int rseed = 66; if (!cp_getvar("rndseed", CP_NUM, &rseed)) { time_t acttime = time(NULL); - rseed = (int) acttime; + rseed = (unsigned int) acttime; } srand(rseed); initw(); diff --git a/src/spicelib/parser/inp2r.c b/src/spicelib/parser/inp2r.c index c7cb8faac..18ecab15a 100644 --- a/src/spicelib/parser/inp2r.c +++ b/src/spicelib/parser/inp2r.c @@ -79,7 +79,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current) for(s = line; NULL != (s = strstr(s, "tc")); ) { char *p; - int left_length; + size_t left_length; s += 2; @@ -106,7 +106,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current) while(*s && !isspace(*s)) s++; - left_length = s - current->line; + left_length = (size_t) (s - current->line); /* skip any additional white space */ while(isspace(*s)) diff --git a/src/xspice/icm/analog/file_source/cfunc.mod b/src/xspice/icm/analog/file_source/cfunc.mod index 0e8f7746a..9e99328e9 100644 --- a/src/xspice/icm/analog/file_source/cfunc.mod +++ b/src/xspice/icm/analog/file_source/cfunc.mod @@ -128,7 +128,7 @@ void cm_filesource(ARGS) /* structure holding parms, inputs, outputs, etc. if (INIT == 1) { /* Allocate storage for internal state */ cm_analog_alloc(0, 2 * sizeof(double)); - cm_analog_alloc(1, 2 * size * sizeof(double)); + cm_analog_alloc(1, size * (int) (2 * sizeof(double))); cm_analog_alloc(2, sizeof(struct filesource_state)); } timeinterval = (double *)cm_analog_get_ptr(0, 0);