Suppress some warnings from MSVC.

This commit is contained in:
Giles Atkinson 2024-03-20 10:43:13 +00:00 committed by Holger Vogt
parent bfeb845222
commit cfbe1afa21
10 changed files with 27 additions and 29 deletions

View File

@ -117,7 +117,7 @@ void com_fread(wordlist *wl)
}
if (fgets(buf, sizeof buf, Open_Files[fd].fp)) {
length = strlen(buf);
length = (int)strlen(buf);
if (length > 0 && buf[length - 1] == '\n') {
--length;
if (length > 0 && buf[length - 1] == '\r') {

View File

@ -36,11 +36,11 @@ void com_strstr(wordlist *wl)
if (*s2) {
var = strstr(s1, s2); // Search for s2 in s1
if (var)
i = var - s1; // Offset to match
i = (int)(var - s1); // Offset to match
else
i = -1;
} else {
i = strlen(s1); // Length
i = (int)strlen(s1); // Length
}
tfree(s1);
tfree(s2);
@ -58,7 +58,7 @@ void com_strslice(wordlist *wl)
wl = wl->wl_next;
offset = atoi(wl->wl_word);
length = atoi(wl->wl_next->wl_word);
actual = strlen(s1);
actual = (int)strlen(s1);
if (offset < 0)
offset = actual + offset;
if (length + offset > actual)

View File

@ -667,7 +667,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
with_params = TRUE;
size = sizeof header + 10; // Allow for %u and close.
for (argc = 0; Copy_of_argv[optind + argc]; ++argc)
size += strlen(Copy_of_argv[optind + argc]);
size += (int)strlen(Copy_of_argv[optind + argc]);
size += 3 * argc; // Spaces and quotes.
if (size <= sizeof buf)
p_buf_active = buf;

View File

@ -691,16 +691,16 @@ vec_get(const char *vec_name) {
for (v = vv; v; v = v->va_next) {
struct dvec *nd;
char *vec_name, new_name[256];
char *new_vec_name, new_name[256];
if (multiple) {
snprintf(new_name, sizeof new_name, "@%s[%s]",
name, v->va_name);
vec_name = new_name;
new_vec_name = new_name;
} else {
vec_name = whole;
new_vec_name = whole;
}
nd = dvec_alloc(copy(vec_name),
nd = dvec_alloc(copy(new_vec_name),
SV_NOTYPE,
VF_REAL, /* No complex values yet... */
1, NULL);
@ -719,7 +719,7 @@ vec_get(const char *vec_name) {
fprintf(stderr,
"ERROR: can not handle string value "
"of '%s' in vec_get(%s)\nIgnoring...\n",
v->va_name, vec_name);
v->va_name, new_vec_name);
dvec_free(nd);
continue;
break;
@ -752,7 +752,7 @@ vec_get(const char *vec_name) {
fprintf(stderr,
"ERROR: can not handle mixed, string or list "
"value of '%s' in vec_get(%s)\nIgnoring...\n",
v->va_name, vec_name);
v->va_name, new_vec_name);
dvec_free(nd);
continue;
}

View File

@ -250,7 +250,8 @@ int output_paths_from_lst_file(const char *filename)
bool f_have_path = false; /* do not have a path to store */
FBTYPE fbtype;
FBOBJ fbobj;
FBOBJ fbobj = { .dbl_value = 0.0}; // Placate MS compiler.
for ( ; ; ) { /* Read items until end of file */
/* Get the next path if not found yet */
if (!f_have_path) {
@ -378,7 +379,8 @@ static int read_modpath(
bool f_have_path = false; /* do not have a path to store */
FBTYPE fbtype;
FBOBJ fbobj;
FBOBJ fbobj = { .dbl_value = 0.0};
for ( ; ; ) { /* Read items until end of file */
/* Get the next path if not found yet */
if (!f_have_path) {
@ -553,7 +555,7 @@ static int read_udnpath(
bool f_have_path = false; /* do not have a path to store */
FBTYPE fbtype;
FBOBJ fbobj;
FBOBJ fbobj = { .dbl_value = 0.0};
for ( ; ; ) { /* Read items until end of file */
/* Get the next path if not found yet */

View File

@ -108,7 +108,6 @@ int EVTload_with_event(
Evt_Node_Data_t *node_data;
Mif_Private_t cm_data;
void *value_ptr;
/* ***************************** */
/* Prepare the code model inputs */

View File

@ -147,7 +147,7 @@ void cm_bidi_bridge(ARGS)
out = 0.0; /* AtoD, no analogue output. */
svoc = 0.5;
} else {
double target, iota, interval[2], range, partial;
double target, iota, interval[2], range, partial = 0.0;
int step, step_count;
Digital_t drive, *dp;
@ -274,7 +274,6 @@ void cm_bidi_bridge(ARGS)
voc = out_low + (out_high - out_low) * voc;
target = 0.0;
partial = 0.0;
/* Calculate new value for output current. */

View File

@ -140,9 +140,9 @@ void accept_output(struct co_info *pinfo, unsigned int bit_num, Digital_t *val)
static void output(struct instance *ip, ARGS)
{
double delay;
Digital_t *out_vals; // XSPICE rotating memory
int i, j;
double delay;
Digital_t *out_vals; // XSPICE rotating memory
unsigned int i, j;
delay = PARAM(delay) - (TIME - ip->info.vtime);
if (delay <= 0) {
@ -314,7 +314,7 @@ static bool check_input(struct instance *ip, Digital_t *ovp,
{
if (ovp->state != rp->what.state ||
ovp->strength != rp->what.strength) {
if (++ip->q_index < ip->q_length) {
if (++ip->q_index < (int) ip->q_length) {
/* Record this event. */
ip->q[ip->q_index] = *rp;
@ -345,10 +345,10 @@ void ucm_d_cosim(ARGS)
{
struct instance *ip;
Digital_t *in_vals; // XSPICE rotating memory
int i, index;
unsigned int i, index;
if (INIT) {
int ins, outs, inouts;
unsigned int ins, outs, inouts;
unsigned int alloc_size;
void *handle;
void (*ifp)(struct co_info *);
@ -380,7 +380,7 @@ void ucm_d_cosim(ARGS)
cm_message_send(dlerror());
return;
}
ifp = dlsym(handle, "Cosim_setup");
ifp = (void (*)(struct co_info *))dlsym(handle, "Cosim_setup");
if (*ifp == NULL) {
cm_message_printf("ERROR: no entry function in %s", fn);
cm_message_send(dlerror());
@ -468,7 +468,7 @@ void ucm_d_cosim(ARGS)
ip = STATIC_VAR(cosim_instance);
if (!ip) {
int ports;
unsigned int ports;
/* Error state. Do nothing at all. */

View File

@ -17,8 +17,6 @@ struct pwl {
static void cm_d_osc_callback(ARGS, Mif_Callback_Reason_t reason)
{
struct panel_instance *instance;
if (reason == MIF_CB_DESTROY) {
struct pwl *table = STATIC_VAR(locdata);

View File

@ -177,8 +177,8 @@ void cm_pswitch(ARGS) /* structure holding parms,
r_off = (r_off > 1.0e12) ? 1.0e12 : r_off; /* Set maximum 'OFF' resistance */
if(INIT == 1) { /* first time through, allocate memory, set static parameters */
char *cntl_error = "\n*****ERROR*****\nPSWITCH: CONTROL voltage delta less than 1.0e-12\n";
if(INIT == 1) {
/* First time through, allocate memory, set static parameters. */
cntl_on = PARAM(cntl_on);
cntl_off = PARAM(cntl_off);