Rewrite code with Visual Studio complaints.

This commit is contained in:
Giles Atkinson 2022-09-08 17:10:45 +01:00 committed by Holger Vogt
parent 56d07aab31
commit 06131d8107
2 changed files with 20 additions and 15 deletions

View File

@ -356,10 +356,11 @@ static int examine_device(MIFinstance *inst, const char **family)
}
}
for (i = 0, dot = inst->MIFname;
(dot = strchr(dot, '.'));
dot += 1, ++i)
;
for (i = 0, dot = strchr(inst->MIFname, '.'); dot; dot += 1, ++i) {
dot = strchr(dot, '.');
if (dot == NULL)
break;
}
return i;
}
@ -388,7 +389,8 @@ static const char *scan_devices(Evt_Node_Info_t *event_node,
}
}
if ((left = event_node->num_outputs)) {
left = event_node->num_outputs;
if (left) {
Evt_Node_Info_t *node;
Evt_Output_Info_t *oip;
int i, my_index;
@ -432,9 +434,10 @@ static struct bridge *find_bridge(Evt_Node_Info_t *event_node,
static const char * const dirs[] = {"in", "out", "inout"};
struct bridge *bridge;
Mif_Dir_t direction;
char *setup = NULL;
const char *format = NULL;
const char *type_name, *family, *s_family, *deep;
char *setup, *vcc_parm, *dot;
char *vcc_parm, *dot;
double vcc = 0.0;
int max = 0, ok = 0;
struct variable *cvar = NULL;
@ -473,7 +476,8 @@ static struct bridge *find_bridge(Evt_Node_Info_t *event_node,
*/
snprintf(buff, sizeof buff, "%s", deep);
while ((dot = strrchr(buff, '.'))) {
dot = strrchr(buff, '.');
while (dot) {
if (!ok) {
snprintf(dot + 1, sizeof buff - (size_t)(dot - buff), vcc_parm);
vcc = nupa_get_param(buff, &ok);
@ -481,6 +485,7 @@ static struct bridge *find_bridge(Evt_Node_Info_t *event_node,
if (ok)
break;
*dot = '\0';
dot = strrchr(buff, '.');
}
if (!ok) {

View File

@ -737,7 +737,6 @@ void
EVTsave(wordlist *wl)
{
int i;
Mif_Boolean_t save;
wordlist *w;
CKTcircuit *ckt;
Evt_Node_Info_t **node_table;
@ -761,12 +760,14 @@ EVTsave(wordlist *wl)
/* Deal with "all" and "none". */
save = MIF_FALSE;
if (wl->wl_next == NULL &&
(!strcmp("none", wl->wl_word) ||
(save = !strcmp("all", wl->wl_word)))) {
set_all(ckt, save);
return;
if (wl->wl_next == NULL) {
if (!strcmp("none", wl->wl_word)) {
set_all(ckt, MIF_FALSE);
return;
} else if (!strcmp("all", wl->wl_word)) {
set_all(ckt, MIF_TRUE);
return;
}
}
set_all(ckt, MIF_FALSE); /* Clear previous settings. */
@ -780,7 +781,6 @@ EVTsave(wordlist *wl)
w->wl_word);
return;
}
// node_table[i]->save = MIF_FALSE;
node_table[i]->save = MIF_TRUE;
}
}