Corrected two somewhat related errors. When "getcell" finds a

name conflict and renames a cell, the name was not pointing to
the new name and immediately caused a crash condition.  However,
it got to that point by believing that cell "path/x" and "path/x.mag"
were different files.  The name was stripped of the extension but
the full file path was not, causing the confusion.
This commit is contained in:
Tim Edwards 2021-05-23 20:59:00 -04:00
parent e6f17735b8
commit 82fada3af6
1 changed files with 7 additions and 2 deletions

View File

@ -4273,6 +4273,11 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx)
if ((clen > 4) && !strcmp(cellnameptr + clen - 4, ".mag"))
*(cellnameptr + clen - 4) = '\0';
/* Same for fullpathname */
clen = strlen(fullpathname);
if ((clen > 4) && !strcmp(fullpathname + clen - 4, ".mag"))
*(fullpathname + clen - 4) = '\0';
/* Check for illegal characters in the cellname */
if (CmdIllegalChars(cellnameptr, "", "Cell name"))
{
@ -4307,8 +4312,8 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx)
def = DBCellLookDef(newcellname);
uniqchar++;
}
TxError("Renaming cell to \"%s\" to avoid conflict.", newcellname);
def = DBCellNewDef(cellnameptr);
TxError("Renaming cell to \"%s\" to avoid conflict.\n", newcellname);
def = DBCellNewDef(newcellname);
StrDup(&def->cd_file, fullpathname);
freeMagic(newcellname);
}