mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-08-22 06:07:34 +02:00
Fix five latent bugs surfaced while porting to WASM
These bugs all exist in stock Magic but were tolerated by the K&R-loose
native build. The strict WASM call_indirect type checks turned them up.
* cif/CIFhier.c: ASSERT in cifFlatMaskHints accessed
oldproprec->prop_value.prop_type, but prop_type is a top-level member
of PropertyRecord. Changed to oldproprec->prop_type.
* extflat/EFargs.c: efLoadSearchPath was assigning a pointer to a
string literal ("." in RO data), which callers later try to free or
StrDup. Replaced with StrDup(path, ".") so the pointer always lives
on the heap.
* router/rtrVia.c: rtrFollowName called RtrMilestonePrint("#"), but
the function takes no arguments.
* sim/SimSelect.c: SimAddLabels called DBWLabelChanged with five
arguments, but its real signature is (CellDef *, Label *, int).
Replaced with the equivalent DBWAreaChanged call.
* windows/windView.c: extern declaration of DBMovePoint had return
type void, but the function actually returns bool.
This commit is contained in:
+1
-1
@@ -284,7 +284,7 @@ cifFlatMaskHints(
|
|||||||
oldproprec = (PropertyRecord *)DBPropGet(mhd->mh_def, name, &propfound);
|
oldproprec = (PropertyRecord *)DBPropGet(mhd->mh_def, name, &propfound);
|
||||||
if (propfound)
|
if (propfound)
|
||||||
{
|
{
|
||||||
ASSERT(oldproprec->prop_value.prop_type == PROPERTY_TYPE_PLANE,
|
ASSERT(oldproprec->prop_type == PROPERTY_TYPE_PLANE,
|
||||||
"cifFlatMaskHints");
|
"cifFlatMaskHints");
|
||||||
plane = oldproprec->prop_value.prop_plane;
|
plane = oldproprec->prop_value.prop_plane;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -367,7 +367,7 @@ efLoadSearchPath(path)
|
|||||||
PaVisitFiles(DOT_MAGIC_PATH, ".magicrc", pv);
|
PaVisitFiles(DOT_MAGIC_PATH, ".magicrc", pv);
|
||||||
PaVisitFree(pv);
|
PaVisitFree(pv);
|
||||||
if (*path == NULL)
|
if (*path == NULL)
|
||||||
*path = ".";
|
StrDup(path, ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
+1
-1
@@ -159,7 +159,7 @@ rtrFollowName(name, firstInNet, area)
|
|||||||
{
|
{
|
||||||
if ( firstInNet )
|
if ( firstInNet )
|
||||||
{
|
{
|
||||||
RtrMilestonePrint("#");
|
RtrMilestonePrint();
|
||||||
(void) DBSrLabelLoc(EditCellUse, name, rtrFollowLocFunc, (ClientData) area);
|
(void) DBSrLabelLoc(EditCellUse, name, rtrFollowLocFunc, (ClientData) area);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+1
-2
@@ -640,8 +640,7 @@ SimAddLabels(
|
|||||||
pos = SimPutLabel(rootuse, &selectBox, GEO_CENTER,
|
pos = SimPutLabel(rootuse, &selectBox, GEO_CENTER,
|
||||||
current->tl_simLabel, TT_SPACE);
|
current->tl_simLabel, TT_SPACE);
|
||||||
DBReComputeBbox(rootuse);
|
DBReComputeBbox(rootuse);
|
||||||
DBWLabelChanged(rootuse, current->tl_simLabel, &selectBox,
|
DBWAreaChanged(rootuse, &selectBox, DBW_ALLWINDOWS, &DBAllButSpaceBits);
|
||||||
pos, DBW_ALLWINDOWS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -316,7 +316,7 @@ void
|
|||||||
WindTranslate(origx, origy)
|
WindTranslate(origx, origy)
|
||||||
int origx, origy;
|
int origx, origy;
|
||||||
{
|
{
|
||||||
extern void DBMovePoint();
|
extern bool DBMovePoint();
|
||||||
MagWindow *w2;
|
MagWindow *w2;
|
||||||
Rect newArea;
|
Rect newArea;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user