Alexei Podtelezhnikov pushed to branch master
at FreeType / FreeType
Commits:
-
fd02c369
by Alexei Podtelezhnikov
at 2022-07-29T22:54:38-04:00
* src/autofit/afhints.h: Remove dead code.
-
ee72e285
by Alexei Podtelezhnikov
at 2022-07-29T22:55:28-04:00
[autofit] Use unsigned accounting for hints.
* src/autofit/afhints.h (AF_AxisHintsRec): Use unsigned types.
* src/autofit/afhints.c (af_axis_hints_new_{segment,edge},
af_glyph_hints_get_num_segments, af_glyph_hints_get_segment_offset):
Updated accordingly.
* src/autofit/aflatin.c (af_cjk_hints_compute_edges): Ditto.
* src/autofit/afcjk.c (af_cjk_hints_compute_edges): Ditto.
4 changed files:
Changes:
src/autofit/afcjk.c
... |
... |
@@ -1044,7 +1044,7 @@ |
1044
|
1044
|
{
|
1045
|
1045
|
AF_Edge found = NULL;
|
1046
|
1046
|
FT_Pos best = 0xFFFFU;
|
1047
|
|
- FT_Int ee;
|
|
1047
|
+ FT_UInt ee;
|
1048
|
1048
|
|
1049
|
1049
|
|
1050
|
1050
|
/* look for an edge corresponding to the segment */
|
src/autofit/afhints.c
... |
... |
@@ -151,9 +151,9 @@ |
151
|
151
|
}
|
152
|
152
|
else if ( axis->num_segments >= axis->max_segments )
|
153
|
153
|
{
|
154
|
|
- FT_Int old_max = axis->max_segments;
|
155
|
|
- FT_Int new_max = old_max;
|
156
|
|
- FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *segment ) );
|
|
154
|
+ FT_UInt old_max = axis->max_segments;
|
|
155
|
+ FT_UInt new_max = old_max;
|
|
156
|
+ FT_UInt big_max = FT_INT_MAX / sizeof ( *segment );
|
157
|
157
|
|
158
|
158
|
|
159
|
159
|
if ( old_max >= big_max )
|
... |
... |
@@ -216,9 +216,9 @@ |
216
|
216
|
}
|
217
|
217
|
else if ( axis->num_edges >= axis->max_edges )
|
218
|
218
|
{
|
219
|
|
- FT_Int old_max = axis->max_edges;
|
220
|
|
- FT_Int new_max = old_max;
|
221
|
|
- FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *edge ) );
|
|
219
|
+ FT_UInt old_max = axis->max_edges;
|
|
220
|
+ FT_UInt new_max = old_max;
|
|
221
|
+ FT_UInt big_max = FT_INT_MAX / sizeof ( *edge );
|
222
|
222
|
|
223
|
223
|
|
224
|
224
|
if ( old_max >= big_max )
|
... |
... |
@@ -597,7 +597,7 @@ |
597
|
597
|
FT_Error
|
598
|
598
|
af_glyph_hints_get_num_segments( AF_GlyphHints hints,
|
599
|
599
|
FT_Int dimension,
|
600
|
|
- FT_Int* num_segments )
|
|
600
|
+ FT_UInt* num_segments )
|
601
|
601
|
{
|
602
|
602
|
AF_Dimension dim;
|
603
|
603
|
AF_AxisHints axis;
|
... |
... |
@@ -623,7 +623,7 @@ |
623
|
623
|
FT_Error
|
624
|
624
|
af_glyph_hints_get_segment_offset( AF_GlyphHints hints,
|
625
|
625
|
FT_Int dimension,
|
626
|
|
- FT_Int idx,
|
|
626
|
+ FT_UInt idx,
|
627
|
627
|
FT_Pos *offset,
|
628
|
628
|
FT_Bool *is_blue,
|
629
|
629
|
FT_Pos *blue_offset )
|
... |
... |
@@ -640,7 +640,7 @@ |
640
|
640
|
|
641
|
641
|
axis = &hints->axis[dim];
|
642
|
642
|
|
643
|
|
- if ( idx < 0 || idx >= axis->num_segments )
|
|
643
|
+ if ( idx >= axis->num_segments )
|
644
|
644
|
return FT_THROW( Invalid_Argument );
|
645
|
645
|
|
646
|
646
|
seg = &axis->segments[idx];
|
src/autofit/afhints.h
... |
... |
@@ -21,8 +21,6 @@ |
21
|
21
|
|
22
|
22
|
#include "aftypes.h"
|
23
|
23
|
|
24
|
|
-#define xxAF_SORT_SEGMENTS
|
25
|
|
-
|
26
|
24
|
FT_BEGIN_HEADER
|
27
|
25
|
|
28
|
26
|
/*
|
... |
... |
@@ -310,15 +308,12 @@ FT_BEGIN_HEADER |
310
|
308
|
|
311
|
309
|
typedef struct AF_AxisHintsRec_
|
312
|
310
|
{
|
313
|
|
- FT_Int num_segments; /* number of used segments */
|
314
|
|
- FT_Int max_segments; /* number of allocated segments */
|
|
311
|
+ FT_UInt num_segments; /* number of used segments */
|
|
312
|
+ FT_UInt max_segments; /* number of allocated segments */
|
315
|
313
|
AF_Segment segments; /* segments array */
|
316
|
|
-#ifdef AF_SORT_SEGMENTS
|
317
|
|
- FT_Int mid_segments;
|
318
|
|
-#endif
|
319
|
314
|
|
320
|
|
- FT_Int num_edges; /* number of used edges */
|
321
|
|
- FT_Int max_edges; /* number of allocated edges */
|
|
315
|
+ FT_UInt num_edges; /* number of used edges */
|
|
316
|
+ FT_UInt max_edges; /* number of allocated edges */
|
322
|
317
|
AF_Edge edges; /* edges array */
|
323
|
318
|
|
324
|
319
|
AF_Direction major_dir; /* either vertical or horizontal */
|
src/autofit/aflatin.c
... |
... |
@@ -2203,7 +2203,7 @@ |
2203
|
2203
|
for ( seg = segments; seg < segment_limit; seg++ )
|
2204
|
2204
|
{
|
2205
|
2205
|
AF_Edge found = NULL;
|
2206
|
|
- FT_Int ee;
|
|
2206
|
+ FT_UInt ee;
|
2207
|
2207
|
|
2208
|
2208
|
|
2209
|
2209
|
/* ignore too short segments, too wide ones, and, in this loop, */
|
... |
... |
@@ -2277,7 +2277,7 @@ |
2277
|
2277
|
for ( seg = segments; seg < segment_limit; seg++ )
|
2278
|
2278
|
{
|
2279
|
2279
|
AF_Edge found = NULL;
|
2280
|
|
- FT_Int ee;
|
|
2280
|
+ FT_UInt ee;
|
2281
|
2281
|
|
2282
|
2282
|
|
2283
|
2283
|
if ( seg->dir != AF_DIR_NONE )
|
|