diff options
Diffstat (limited to 'src/pshinter/pshrec.c')
-rw-r--r-- | src/pshinter/pshrec.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c index a108734d4..1177c11e6 100644 --- a/src/pshinter/pshrec.c +++ b/src/pshinter/pshrec.c @@ -499,23 +499,19 @@ ps_mask_table_merge_all( PS_Mask_Table table, FT_Memory memory ) { - FT_Int index1, index2; + FT_UInt index1, index2; FT_Error error = FT_Err_Ok; - /* both loops go down to 0, thus FT_Int for index1 and index2 */ - for ( index1 = (FT_Int)table->num_masks - 1; index1 > 0; index1-- ) + /* the inner loop stops when the unsigned index wraps around */ + /* after reaching 0. */ + for ( index1 = table->num_masks - 1; index1 > 0; index1-- ) { - for ( index2 = index1 - 1; index2 >= 0; index2-- ) + for ( index2 = index1 - 1; index2 < index1; index2-- ) { - if ( ps_mask_table_test_intersect( table, - (FT_UInt)index1, - (FT_UInt)index2 ) ) + if ( ps_mask_table_test_intersect( table, index1, index2 ) ) { - error = ps_mask_table_merge( table, - (FT_UInt)index2, - (FT_UInt)index1, - memory ); + error = ps_mask_table_merge( table, index2, index1, memory ); if ( error ) goto Exit; |