Remove some compiler warnings

This commit is contained in:
Holger Vogt 2021-04-10 20:11:47 +02:00
parent 2536b78acb
commit e91ec306ba
3 changed files with 12 additions and 6 deletions

View File

@ -93,7 +93,7 @@ inp_nutsource(FILE *fp, bool comfile, char *filename)
ld = dd;
continue;
}
(void) strncpy(name, dd->line, BSIZE_SP);
(void) strncpy(name, dd->line, BSIZE_SP - 1);
s = skip_ws(name);
t = skip_non_ws(s);
*t = '\0';

View File

@ -246,9 +246,9 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam
/* Pass 1. */
if (numsaves && !saveall) {
for (i = 0; i < numsaves; i++)
if (!savesused[i])
for (j = 0; j < numNames; j++)
for (i = 0; i < numsaves; i++) {
if (!savesused[i]) {
for (j = 0; j < numNames; j++) {
if (name_eq(saves[i].name, dataNames[j])) {
addDataDesc(run, dataNames[j], dataType, j, initmem);
savesused[i] = TRUE;
@ -262,6 +262,9 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam
saves[i].used = 1;
break;
}
}
}
}
} else {
for (i = 0; i < numNames; i++)
if (!refName || !name_eq(dataNames[i], refName))

View File

@ -83,8 +83,11 @@ pvec(struct dvec *d)
if (d->v_numdims > 1) {
dimstring(d->v_dims, d->v_numdims, buf3);
size_t icopy = BSIZE_SP - 11;
snprintf(buf2, icopy, ", dims = [%s]", buf3);
size_t icopy = BSIZE_SP - 1;
size_t len = (size_t)snprintf(buf2, icopy, ", dims = [%s]", buf3);
if (len > icopy) {
fprintf(stderr, "Warning: Potential buffer overflow while setting a vector dimension");
}
strcat(buf, buf2);
}