Corrected an issue causing MASKHINTS values to fail to be written

back to the file, instead resulting in a property key only and no
value;  this in turn produces an error when read back in.  Another
cycle of reading and writing causes the property to disappear
altogether.

Also:  Corrected another related error that claims to have truncated
the mask hints when in fact everything was working normally.
This commit is contained in:
R. Timothy Edwards 2026-04-02 14:45:08 -04:00
parent 05561b90f3
commit 5d35ae38b5
3 changed files with 18 additions and 10 deletions

View File

@ -1 +1 @@
8.3.630 8.3.631

View File

@ -2681,14 +2681,13 @@ CmdDoProperty(
} }
} }
if (proplen > 0) if (proplen > 0)
{
proprec = (PropertyRecord *)mallocMagic( proprec = (PropertyRecord *)mallocMagic(
sizeof(PropertyRecord) + sizeof(PropertyRecord) +
(proplen - 2) * sizeof(int)); (proplen - 2) * sizeof(int));
proprec->prop_type = proptype;
proprec->prop_len = proplen;
}
} }
proprec->prop_type = proptype;
proprec->prop_len = proplen;
/* Second pass */ /* Second pass */
value = cmd->tx_argv[argstart + 1]; value = cmd->tx_argv[argstart + 1];
for (proplen = 0; proplen < proprec->prop_len; proplen++) for (proplen = 0; proplen < proprec->prop_len; proplen++)

View File

@ -2594,7 +2594,16 @@ dbReadProperties(cellDef, line, len, f, scalen, scaled)
while (isspace(*pptr) && (*pptr != '\0')) pptr++; while (isspace(*pptr) && (*pptr != '\0')) pptr++;
if (!isspace(*pptr)) if (!isspace(*pptr))
{ {
sscanf(pptr, "%d", &ival); if (sscanf(pptr, "%d", &ival) != 1)
{
TxError("Mask-hint \"%s\" has non-integer values!",
pptr);
DBFreePaintPlane(proprec->prop_value.prop_plane);
TiFreePlane(proprec->prop_value.prop_plane);
freeMagic((char *)proprec);
proprec = (PropertyRecord *)NULL;
break;
}
if (scalen > 1) ival *= scalen; if (scalen > 1) ival *= scalen;
if (scaled > 1) ival /= scaled; if (scaled > 1) ival /= scaled;
switch (numvals) switch (numvals)
@ -2622,11 +2631,11 @@ dbReadProperties(cellDef, line, len, f, scalen, scaled)
} }
while (!isspace(*pptr) && (*pptr != '\0')) pptr++; while (!isspace(*pptr) && (*pptr != '\0')) pptr++;
} }
if (numvals == 0) }
{ if (numvals != 0)
TxError("Mask-hint property number of values is not" {
TxError("Mask-hint property number of values is not"
" divisible by four. Truncated.\n"); " divisible by four. Truncated.\n");
}
} }
(void) DBPropPut(cellDef, propertyname, proprec); (void) DBPropPut(cellDef, propertyname, proprec);
} }