* src/base/ftoutln.c (ft_orientation_extremum_compute): fixing infinite loop bug !
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index a0781dc..3c59e7c 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -358,14 +358,11 @@
source->n_contours != target->n_contours )
return FT_Err_Invalid_Argument;
- FT_ARRAY_COPY( target->points, source->points,
- source->n_points );
+ FT_ARRAY_COPY( target->points, source->points, source->n_points );
- FT_ARRAY_COPY( target->tags, source->tags,
- source->n_points );
+ FT_ARRAY_COPY( target->tags, source->tags, source->n_points );
- FT_ARRAY_COPY( target->contours, source->contours,
- source->n_contours );
+ FT_ARRAY_COPY( target->contours, source->contours, source->n_contours );
/* copy all flags, except the `FT_OUTLINE_OWNER' one */
is_owner = target->flags & FT_OUTLINE_OWNER;
@@ -680,10 +677,12 @@
first = points + extremum->first;
last = points + extremum->last;
+ prev = point;
+ next = point;
+
do
{
- prev = ( point == first ) ? last : point - 1;
-
+ prev = ( prev == first ) ? last : prev - 1;
if ( prev == point )
return FT_ORIENTATION_TRUETYPE; /* degenerate case */
@@ -691,8 +690,7 @@
do
{
- next = ( point == last ) ? first : point + 1;
-
+ next = ( next == last ) ? first : next + 1;
if ( next == point )
return FT_ORIENTATION_TRUETYPE; /* shouldn't happen */