fix: load_wire() was using storeobject() for storing data, causing unwanted modify=1 flag (this has various side effects including changing window title)

This commit is contained in:
Stefan Frederik 2020-11-30 22:48:08 +01:00
parent 3f6a9ab1f8
commit c8dc48f916
2 changed files with 16 additions and 10 deletions

View File

@ -34,6 +34,7 @@ void set_modify(int mod)
{
static int prev = -1;
modified = mod;
dbg(1, "set_modify(): %d\n", mod);
if(mod != prev) {
prev = mod;
if(has_x && strcmp(get_cell(xctx->sch[xctx->currsch],1), "systemlib/font")) {

View File

@ -495,19 +495,25 @@ static void load_text(FILE *fd)
static void load_wire(FILE *fd)
{
xWire *ptr;
int i;
double x1,y1,x2,y2;
char *ptr=NULL;
check_wire_storage();
ptr = xctx->wire;
i = xctx->wires;
dbg(3, "load_wire(): start\n");
if(fscanf(fd, "%lf %lf %lf %lf",&x1, &y1, &x2, &y2 )<4) {
if(fscanf(fd, "%lf %lf %lf %lf",&ptr[i].x1, &ptr[i].y1, &ptr[i].x2, &ptr[i].y2 )<4) {
fprintf(errfp,"WARNING: missing fields for WIRE object, ignoring\n");
read_line(fd, 0);
} else {
load_ascii_string( &ptr, fd);
ORDER(x1, y1, x2, y2);
storeobject(-1, x1,y1,x2,y2,WIRE,0,0,ptr);
return;
}
my_free(883, &ptr);
ptr[i].prop_ptr = NULL;
ptr[i].end1 = ptr[i].end2 = ptr[i].bus = ptr[i].sel = 0;
load_ascii_string( &ptr[i].prop_ptr, fd);
ORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2);
if(!strcmp(get_tok_value(ptr[i].prop_ptr, "bus", 0), "true") ) ptr[i].bus = 1;
ptr[i].node = NULL;
xctx->wires++;
}
static void load_inst(int k, FILE *fd)
@ -701,8 +707,7 @@ static void load_line(FILE *fd)
check_line_storage(c);
i=xctx->lines[c];
ptr=xctx->line[c];
if(fscanf(fd, "%lf %lf %lf %lf ",&ptr[i].x1, &ptr[i].y1,
&ptr[i].x2, &ptr[i].y2) < 4) {
if(fscanf(fd, "%lf %lf %lf %lf ",&ptr[i].x1, &ptr[i].y1, &ptr[i].x2, &ptr[i].y2) < 4) {
fprintf(errfp,"WARNING: missing fields for LINE object, ignoring\n");
read_line(fd, 0);
return;