[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.
This commit is contained in:
Alexei Podtelezhnikov 2022-07-29 22:55:28 -04:00
parent fd02c369da
commit ee72e28503
4 changed files with 16 additions and 16 deletions

View File

@ -1044,7 +1044,7 @@
{
AF_Edge found = NULL;
FT_Pos best = 0xFFFFU;
FT_Int ee;
FT_UInt ee;
/* look for an edge corresponding to the segment */

View File

@ -151,9 +151,9 @@
}
else if ( axis->num_segments >= axis->max_segments )
{
FT_Int old_max = axis->max_segments;
FT_Int new_max = old_max;
FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *segment ) );
FT_UInt old_max = axis->max_segments;
FT_UInt new_max = old_max;
FT_UInt big_max = FT_INT_MAX / sizeof ( *segment );
if ( old_max >= big_max )
@ -216,9 +216,9 @@
}
else if ( axis->num_edges >= axis->max_edges )
{
FT_Int old_max = axis->max_edges;
FT_Int new_max = old_max;
FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *edge ) );
FT_UInt old_max = axis->max_edges;
FT_UInt new_max = old_max;
FT_UInt big_max = FT_INT_MAX / sizeof ( *edge );
if ( old_max >= big_max )
@ -597,7 +597,7 @@
FT_Error
af_glyph_hints_get_num_segments( AF_GlyphHints hints,
FT_Int dimension,
FT_Int* num_segments )
FT_UInt* num_segments )
{
AF_Dimension dim;
AF_AxisHints axis;
@ -623,7 +623,7 @@
FT_Error
af_glyph_hints_get_segment_offset( AF_GlyphHints hints,
FT_Int dimension,
FT_Int idx,
FT_UInt idx,
FT_Pos *offset,
FT_Bool *is_blue,
FT_Pos *blue_offset )
@ -640,7 +640,7 @@
axis = &hints->axis[dim];
if ( idx < 0 || idx >= axis->num_segments )
if ( idx >= axis->num_segments )
return FT_THROW( Invalid_Argument );
seg = &axis->segments[idx];

View File

@ -308,12 +308,12 @@ FT_BEGIN_HEADER
typedef struct AF_AxisHintsRec_
{
FT_Int num_segments; /* number of used segments */
FT_Int max_segments; /* number of allocated segments */
FT_UInt num_segments; /* number of used segments */
FT_UInt max_segments; /* number of allocated segments */
AF_Segment segments; /* segments array */
FT_Int num_edges; /* number of used edges */
FT_Int max_edges; /* number of allocated edges */
FT_UInt num_edges; /* number of used edges */
FT_UInt max_edges; /* number of allocated edges */
AF_Edge edges; /* edges array */
AF_Direction major_dir; /* either vertical or horizontal */

View File

@ -2203,7 +2203,7 @@
for ( seg = segments; seg < segment_limit; seg++ )
{
AF_Edge found = NULL;
FT_Int ee;
FT_UInt ee;
/* ignore too short segments, too wide ones, and, in this loop, */
@ -2277,7 +2277,7 @@
for ( seg = segments; seg < segment_limit; seg++ )
{
AF_Edge found = NULL;
FT_Int ee;
FT_UInt ee;
if ( seg->dir != AF_DIR_NONE )