Cleanup of a number of uninitialized variable issues flagged by

the compiler.  Some are obscure functions (plot verstatec hasn't
been used in years) but others (like SPICE distributed junctions)
are potentially significant sources of unexpected crashes on
systems that don't zero uninitialized memory.
This commit is contained in:
Tim Edwards 2019-06-07 14:13:50 -04:00
parent 53078588ae
commit 547f0448d9
8 changed files with 14 additions and 11 deletions

View File

@ -365,9 +365,8 @@ CalmaWrite(rootDef, f)
*/ */
bool bool
calmaDumpStructure(def, cellstart, outf, calmaDefHash, filename) calmaDumpStructure(def, outf, calmaDefHash, filename)
CellDef *def; CellDef *def;
off_t cellstart;
FILE *outf; FILE *outf;
HashTable *calmaDefHash; HashTable *calmaDefHash;
char *filename; char *filename;
@ -593,10 +592,9 @@ syntaxerror:
*/ */
void void
calmaFullDump(def, fi, cellstart, outf, filename) calmaFullDump(def, fi, outf, filename)
CellDef *def; CellDef *def;
FILE *fi; FILE *fi;
off_t cellstart;
FILE *outf; FILE *outf;
char *filename; char *filename;
{ {
@ -659,7 +657,7 @@ calmaFullDump(def, fi, cellstart, outf, filename)
} }
HashSetValue(he, StrDup(NULL, uniqlibname)); HashSetValue(he, StrDup(NULL, uniqlibname));
while (calmaDumpStructure(def, cellstart, outf, &calmaDefHash, filename)) while (calmaDumpStructure(def, outf, &calmaDefHash, filename))
if (SigInterruptPending) if (SigInterruptPending)
goto done; goto done;
calmaSkipExact(CALMA_ENDLIB); calmaSkipExact(CALMA_ENDLIB);
@ -813,7 +811,7 @@ calmaProcessDef(def, outf)
he = HashLookOnly(&calmaLibHash, retfilename); he = HashLookOnly(&calmaLibHash, retfilename);
if (he == NULL) if (he == NULL)
calmaFullDump(def, fi, cellstart, outf, retfilename); calmaFullDump(def, fi, outf, retfilename);
fclose(fi); fclose(fi);
def->cd_flags |= CDVENDORGDS; def->cd_flags |= CDVENDORGDS;

View File

@ -2159,9 +2159,9 @@ drcSpacing(argc, argv)
} }
else else
{ {
runlength = distance;
layers2 = argv[3]; layers2 = argv[3];
distance = atoi(argv[4]); distance = atoi(argv[4]);
runlength = distance;
adjacency = argv[5]; adjacency = argv[5];
why = drcWhyDup(argv[6]); why = drcWhyDup(argv[6]);
} }

View File

@ -182,6 +182,7 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM)
// For parameter an followed by parameter pn, // For parameter an followed by parameter pn,
// process both at the same time // process both at the same time
sdM = getCurDevMult();
if (plist->parm_next && plist->parm_next->parm_type[0] == if (plist->parm_next && plist->parm_next->parm_type[0] ==
'p' && plist->parm_next->parm_type[1] == 'p' && plist->parm_next->parm_type[1] ==
plist->parm_type[1]) plist->parm_type[1])
@ -228,6 +229,7 @@ spcHierWriteParams(hc, dev, scale, l, w, sdM)
// For parameter pn followed by parameter an, // For parameter pn followed by parameter an,
// process both at the same time // process both at the same time
sdM = getCurDevMult();
if (plist->parm_next && plist->parm_next->parm_type[0] == if (plist->parm_next && plist->parm_next->parm_type[0] ==
'a' && plist->parm_next->parm_type[1] == 'a' && plist->parm_next->parm_type[1] ==
plist->parm_type[1]) plist->parm_type[1])

View File

@ -2335,6 +2335,7 @@ spcdevVisit(dev, hierName, scale, trans)
name, esSpiceF); name, esSpiceF);
fprintf(esSpiceF, " %s", EFDevTypes[dev->dev_type]); fprintf(esSpiceF, " %s", EFDevTypes[dev->dev_type]);
sdM = getCurDevMult();
spcWriteParams(dev, hierName, scale, l, w, sdM); spcWriteParams(dev, hierName, scale, l, w, sdM);
break; break;
@ -3796,8 +3797,8 @@ devDistJunctVisit(dev, hierName, scale, trans)
return 0; return 0;
} }
w = (int)((float)w * scale);
EFGetLengthAndWidth(dev, &l, &w); EFGetLengthAndWidth(dev, &l, &w);
w = (int)((float)w * scale);
for (i = 1; i<dev->dev_nterm; i++) for (i = 1; i<dev->dev_nterm; i++)
{ {

View File

@ -196,6 +196,7 @@ PlotFreeRaster(raster)
* have been created with PlotNewRaster. * have been created with PlotNewRaster.
*/ */
{ {
if (raster == NULL) return;
freeMagic((char *) raster->ras_bits); freeMagic((char *) raster->ras_bits);
freeMagic((char *) raster); freeMagic((char *) raster);
} }

View File

@ -1084,7 +1084,7 @@ PlotVersatec(scx, layers, xMask, user_scale)
Raster *raster = NULL; Raster *raster = NULL;
/* CMYK color separated raster buffers. */ /* CMYK color separated raster buffers. */
Raster *kRaster, *cRaster, *mRaster, *yRaster; Raster *kRaster = NULL, *cRaster = NULL, *mRaster = NULL, *yRaster = NULL;
haveColorMessage = FALSE; haveColorMessage = FALSE;
GeoTransRect(&scx->scx_trans, &scx->scx_area, &rootClip); GeoTransRect(&scx->scx_trans, &scx->scx_area, &rootClip);

View File

@ -310,6 +310,7 @@ RtrChannelObstacles(use, ch)
scx.scx_area.r_ytop += w * RtrGridSpacing + down; scx.scx_area.r_ytop += w * RtrGridSpacing + down;
scx.scx_use = use; scx.scx_use = use;
scx.scx_trans = GeoIdentityTransform; scx.scx_trans = GeoIdentityTransform;
TTMaskZero(&allObs);
TTMaskSetMask3(&allObs, &RtrMetalObstacles, &RtrPolyObstacles); TTMaskSetMask3(&allObs, &RtrMetalObstacles, &RtrPolyObstacles);
(void) DBTreeSrTiles(&scx, &allObs, 0, rtrChannelObstacleMark, (ClientData) ch); (void) DBTreeSrTiles(&scx, &allObs, 0, rtrChannelObstacleMark, (ClientData) ch);

View File

@ -1232,8 +1232,8 @@ selACPaintFunc2(tile, selACarg)
Rect rrect, orect; Rect rrect, orect;
int np, i, j; int np, i, j;
ttype = (selACarg->ttype & TT_SIDE) ? ((ttype & TT_RIGHTMASK) >> 14) : ttype = (selACarg->ttype & TT_SIDE) ? ((selACarg->ttype & TT_RIGHTMASK) >> 14) :
ttype & TT_LEFTMASK; selACarg->ttype & TT_LEFTMASK;
if (type & TT_DIAGONAL) if (type & TT_DIAGONAL)
rtype = (type & TT_SIDE) ? SplitRightType(tile) : rtype = (type & TT_SIDE) ? SplitRightType(tile) :