Generate correctly instance coordinates in GDS driver.
* Bug: In gds_drive.c, the XY GDSII record for storing the instances coordinates was using two longs (8 bytes each) instead of int (4 bytes). Now use a coord_t to force them to be 32 bits integers. * Bug: In gds_parse.c, symmetric bug to the above. Read 32 bits integers for XY of instances instead of 64 bits integers.
This commit is contained in:
parent
10a7b7e755
commit
131bc65f4b
|
@ -490,18 +490,22 @@ FILE *fp;
|
|||
}
|
||||
|
||||
entete(XY, sizeof(coord_t));
|
||||
if (islittle()) {
|
||||
long X = swapl(inst->X);
|
||||
long Y = swapl(inst->Y);
|
||||
coord_t xy;
|
||||
xy.X = inst->X;
|
||||
xy.Y = inst->Y;
|
||||
|
||||
numb = fwrite((char *)&X, sizeof(long), 1, fp);
|
||||
if (islittle()) {
|
||||
xy.X = swapi(xy.X);
|
||||
xy.Y = swapi(xy.Y);
|
||||
|
||||
numb = fwrite((char *)&xy.X, sizeof(int32_t), 1, fp);
|
||||
controle(1);
|
||||
numb = fwrite((char *)&Y, sizeof(long), 1, fp);
|
||||
numb = fwrite((char *)&xy.Y, sizeof(int32_t), 1, fp);
|
||||
controle(1);
|
||||
} else {
|
||||
numb = fwrite((char *)&inst->X, sizeof(long), 1, fp);
|
||||
numb = fwrite((char *)&xy.X, sizeof(int32_t), 1, fp);
|
||||
controle(1);
|
||||
numb = fwrite((char *)&inst->Y, sizeof(long), 1, fp);
|
||||
numb = fwrite((char *)&xy.Y, sizeof(int32_t), 1, fp);
|
||||
controle(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -832,7 +832,7 @@ char gds_real[sizeof(mag_type)];
|
|||
short ref_x_axis, abs_mag, abs_ang;
|
||||
ushort strans;
|
||||
double mag, angle;
|
||||
long x, y;
|
||||
int32_t x, y;
|
||||
char sym;
|
||||
char poubelle[TRASHSIZE];
|
||||
int FLAG = 0;
|
||||
|
@ -846,14 +846,14 @@ int FLAG = 0;
|
|||
}
|
||||
switch (infobuf.gdscode) {
|
||||
case XY :
|
||||
lecture1(&x, sizeof(long));
|
||||
lecture1(&x, sizeof(int32_t));
|
||||
if (islittle())
|
||||
x = swapl(x);
|
||||
x = (long)(pv_scale * (double)x);
|
||||
lecture1(&y, sizeof(long));
|
||||
x = (int32_t)(pv_scale * (double)x);
|
||||
lecture1(&y, sizeof(int32_t));
|
||||
if (islittle())
|
||||
y = swapl(y);
|
||||
y = (long)(pv_scale * (double)y);
|
||||
y = (int32_t)(pv_scale * (double)y);
|
||||
break;
|
||||
case STRANS :
|
||||
lecture1(&strans, sizeof(ushort));
|
||||
|
@ -988,8 +988,8 @@ FILE *fp;
|
|||
coord_tab[0].X = swapl(coord_tab[0].X);
|
||||
coord_tab[0].Y = swapl(coord_tab[0].Y);
|
||||
}
|
||||
coord_tab[0].X = (long)(pv_scale * (double)coord_tab[0].X);
|
||||
coord_tab[0].Y = (long)(pv_scale * (double)coord_tab[0].Y);
|
||||
coord_tab[0].X = (int32_t)(pv_scale * (double)coord_tab[0].X);
|
||||
coord_tab[0].Y = (int32_t)(pv_scale * (double)coord_tab[0].Y);
|
||||
XYFLAG = 1;
|
||||
break;
|
||||
case TEXTTYPE :
|
||||
|
|
Loading…
Reference in New Issue