From fdd4d4e0fad4546091a9efc1dc9434cd88bb7dee Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 25 Apr 2020 17:24:14 -0400 Subject: [PATCH] Corrected an error in the PCB netlisting which could cause nets to get scrambled (in particular, regular nets could get merged into global nets such as Vdd and Gnd by accident). --- VERSION | 2 +- netlist.c | 21 ++++++++++++++------- undo.c | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index 53354b6..559683c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.10.22 +3.10.23 diff --git a/netlist.c b/netlist.c index c4b7dba..108c25d 100644 --- a/netlist.c +++ b/netlist.c @@ -5886,10 +5886,12 @@ Boolean writepcb(struct Ptab **ptableptr, objectptr cschem, CalllistPtr cfrom, } /* Step 4C: Run routine recursively on the subcircuit */ + /* If it had a "pcb:" info label that was handled, then ignore */ /* Fprintf(stdout, "Recursive call of writepcb() to %s\n", calls->callobj->name); */ - outputcall = writepcb(ptableptr, calls->callobj, calls, newprefix, mode); + + outputcall = writepcb(ptableptr, calls->callobj, calls, newprefix, mode); /* Step 4D: Pop the translation table */ /* (Don't pop global nets (designated by negative net number)) */ @@ -5924,10 +5926,15 @@ Boolean writepcb(struct Ptab **ptableptr, objectptr cschem, CalllistPtr cfrom, hidx = *ptableptr; while (hidx != NULL) { if (hidx->nets != NULL) { - for (i = 0; i < hidx->nets->numnets; i++) - if (*(hidx->nets->netidx + i) == ports->netid) - break; - if (i < hidx->nets->numnets) break; + /* Global nets were not translated, do not iterate through list */ + if (*(hidx->nets->netidx) >= 0) { + for (i = 0; i < hidx->nets->numnets; i++) + if (*(hidx->nets->netidx + i) == ports->netid) + break; + if (i < hidx->nets->numnets) break; + } else { + if (*(hidx->nets->netidx) == ports->netid) break; + } } hidx = hidx->next; } @@ -5955,7 +5962,7 @@ Boolean writepcb(struct Ptab **ptableptr, objectptr cschem, CalllistPtr cfrom, tmpstr->next = hidx->pins; hidx->pins = tmpstr; - /* diagnositic information */ + /* diagnostic information */ { struct Pnet *locnet = hidx->nets; int ctr = 0; @@ -5965,7 +5972,7 @@ Boolean writepcb(struct Ptab **ptableptr, objectptr cschem, CalllistPtr cfrom, } /* Fprintf(stdout, "Logged level-%d net %d (local net %d) pin %s\n", ctr, *(locnet->netidx), *(hidx->nets->netidx + i), - tmpstr->string); */ + tmpstr->string); */ } } } diff --git a/undo.c b/undo.c index 67fa1da..e1c2c01 100644 --- a/undo.c +++ b/undo.c @@ -1660,7 +1660,7 @@ void free_undo_data(Undoptr thisrecord, u_char mode) } else { /* MODE_REDO */ uobj = (objectptr)thisrecord->undodata; - reset(uobj, DESTROY); + if (uobj) reset(uobj, DESTROY); } break; -- 2.11.4.GIT