Skip to content

Commit

Permalink
Workaround for possible -Wstringop-overflow= false positive (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Jul 19, 2021
1 parent 000efae commit e43996c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
21 changes: 11 additions & 10 deletions src/ttf2pt1/pt1.c
Original file line number Diff line number Diff line change
Expand Up @@ -4993,7 +4993,8 @@ printseg(

double
fdotsegdist2(
double seg[2][2 /*X,Y*/],
double** seg,
// double seg[2][2 /*X,Y*/],
double dot[2 /*X,Y*/]
)
{
Expand Down Expand Up @@ -5216,13 +5217,13 @@ fdotcurvdist2(
/* the nearest segment must include the nearest dot */
if(id1==0) {
dots[d].seg = 0;
dots[d].dist2 = fdotsegdist2(&cvd[0], dots[d].p);
dots[d].dist2 = fdotsegdist2((double**)&cvd[0], dots[d].p);
} else if(id1==NAPSECT) {
dots[d].seg = NAPSECT-1;
dots[d].dist2 = fdotsegdist2(&cvd[NAPSECT-1], dots[d].p);
dots[d].dist2 = fdotsegdist2((double**)&cvd[NAPSECT-1], dots[d].p);
} else {
dist1 = fdotsegdist2(&cvd[id1], dots[d].p);
dist2 = fdotsegdist2(&cvd[id1-1], dots[d].p);
dist1 = fdotsegdist2((double**)&cvd[id1], dots[d].p);
dist2 = fdotsegdist2((double**)&cvd[id1-1], dots[d].p);
if(dist2 < dist1) {
dots[d].seg = id1-1;
dots[d].dist2 = dist2;
Expand Down Expand Up @@ -5469,7 +5470,7 @@ fjointsin2(
d[0][axis] = -( d[1][axis] *= scale1 );
d[2][axis] *= scale2;
}
return fdotsegdist2(d, d[2]);
return fdotsegdist2((double**)d, d[2]);
}

#if 0
Expand Down Expand Up @@ -5661,7 +5662,7 @@ fanalyzege(
dots[1][i] = ge->fpoints[i][2];
dots[2][i] = fcvval(ge, i, 0.5);
}
avsd2 = fdotsegdist2(dots, dots[2]);
avsd2 = fdotsegdist2((double**)dots, dots[2]);
if(avsd2 <= CVEPS2) {
gex->flags |= GEXF_FLAT;
}
Expand Down Expand Up @@ -5821,7 +5822,7 @@ fanalyzejoint(
dots[1][i] = nge->fpoints[i][2];
dots[2][i] = ge->fpoints[i][2];
}
if( fdotsegdist2(dots, dots[2]) <= CVEPS2)
if( fdotsegdist2((double**)dots, dots[2]) <= CVEPS2)
gex->flags |= GEXF_JLINE;
}
}
Expand Down Expand Up @@ -6201,7 +6202,7 @@ fconcisecontour(
}
ndots++;
for(i=0; i<ndots; i++) {
avsd2 = fdotsegdist2(apcv, dots[i].p);
avsd2 = fdotsegdist2((double**)apcv, dots[i].p);
if(avsd2 > CVEPS2)
break;
}
Expand Down Expand Up @@ -6229,7 +6230,7 @@ fconcisecontour(
}
ndots++;
for(i=0; i<ndots; i++) {
avsd2 = fdotsegdist2(apcv, dots[i].p);
avsd2 = fdotsegdist2((double**)apcv, dots[i].p);
if(avsd2 > CVEPS2)
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/ttf2pt1/pt1.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ void print_kerning( FILE *afm_file);
int fcrossrayscv( double curve[4][2], double *max1, double *max2);
int fcrossraysge( GENTRY *ge1, GENTRY *ge2, double *max1, double *max2,
double crossdot[2][2]);
double fdotsegdist2( double seg[2][2], double dot[2]);
// double fdotsegdist2( double seg[2][2], double dot[2]);
double fdotsegdist2( double** seg, double dot[2]);
double fdotcurvdist2( double curve[4][2], struct dot_dist *dots, int ndots, double *maxp);
void fapproxcurve( double cv[4][2], struct dot_dist *dots, int ndots);

0 comments on commit e43996c

Please sign in to comment.