4 x warning: suggest explicit braces to avoid ambiguous 'else'

Give compiler the extra braces it recommends.

DBio.c edited as my original change was caught out by the incorrect
indention of the 'else' keyword and my modification would have caused a
NULL deref.   Exactly the kind of issue this warning is trying to prevent.

CmdTZ.c:417:20: warning: suggest explicit braces to avoid ambiguous 'else'
DBio.c:1422:12: warning: suggest explicit braces to avoid ambiguous 'else'
DBpaint2.c:285:12: warning: suggest explicit braces to avoid ambiguous 'else'
DBpaint2.c:384:12: warning: suggest explicit braces to avoid ambiguous 'else'

GCC14 -Wall cleanup series [-Wdangling-else]
This commit is contained in:
Darryl L. Miles
2024-10-09 21:12:55 -04:00
committed by Tim Edwards
parent 7dfdf5aa63
commit 9225fa6cf1
3 changed files with 9 additions and 2 deletions
+3 -2
View File
@@ -1420,9 +1420,10 @@ dbReadOpen(cellDef, setFileName, dereference, errptr)
pptr = strrchr(sptr, '.');
if (pptr != NULL)
{
if (strcmp(pptr, DBSuffix)) pptr = NULL;
else
*pptr = '\0';
else *pptr = '\0';
}
/* If dereferencing, then use search paths first */
if (!dereference)
+4
View File
@@ -283,6 +283,7 @@ DBPaintValid(cellDef, rect, mask, dinfo)
for (t = TT_SELECTBASE; t < DBNumUserLayers; t++)
if (TTMaskHasType(&mmask, t))
{
if (DBIsContact(t))
{
tMask = DBResidueMask(t);
@@ -310,6 +311,7 @@ DBPaintValid(cellDef, rect, mask, dinfo)
(t << 14) : t) : t);
DBPaint(cellDef, rect, tloc);
}
}
}
/*
@@ -382,6 +384,7 @@ DBEraseValid(cellDef, rect, mask, dinfo)
for (t = TT_SELECTBASE; t < DBNumUserLayers; t++)
if (TTMaskHasType(&mmask, t))
{
if (DBIsContact(t))
{
tMask = DBResidueMask(t);
@@ -409,4 +412,5 @@ DBEraseValid(cellDef, rect, mask, dinfo)
(t << 14) : t) : t);
DBErase(cellDef, rect, tloc);
}
}
}