freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][master] [pshinter] Use unsigned indices.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [pshinter] Use unsigned indices.
Date: Wed, 09 Feb 2022 15:05:00 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

1 changed file:

Changes:

  • src/pshinter/pshrec.c
    ... ... @@ -150,9 +150,9 @@
    150 150
       /* test a bit value in a given mask */
    
    151 151
       static FT_Int
    
    152 152
       ps_mask_test_bit( PS_Mask  mask,
    
    153
    -                    FT_Int   idx )
    
    153
    +                    FT_UInt  idx )
    
    154 154
       {
    
    155
    -    if ( (FT_UInt)idx >= mask->num_bits )
    
    155
    +    if ( idx >= mask->num_bits )
    
    156 156
           return 0;
    
    157 157
     
    
    158 158
         return mask->bytes[idx >> 3] & ( 0x80 >> ( idx & 7 ) );
    
    ... ... @@ -406,7 +406,7 @@
    406 406
           PS_Mask  mask2  = table->masks + index2;
    
    407 407
           FT_UInt  count1 = mask1->num_bits;
    
    408 408
           FT_UInt  count2 = mask2->num_bits;
    
    409
    -      FT_Int   delta;
    
    409
    +      FT_UInt  delta;
    
    410 410
     
    
    411 411
     
    
    412 412
           if ( count2 > 0 )
    
    ... ... @@ -446,7 +446,7 @@
    446 446
           mask2->end_point = 0;
    
    447 447
     
    
    448 448
           /* number of masks to move */
    
    449
    -      delta = (FT_Int)( table->num_masks - 1 - index2 );
    
    449
    +      delta = table->num_masks - 1 - index2;
    
    450 450
           if ( delta > 0 )
    
    451 451
           {
    
    452 452
             /* move to end of table for reuse */
    
    ... ... @@ -455,7 +455,7 @@
    455 455
     
    
    456 456
             ft_memmove( mask2,
    
    457 457
                         mask2 + 1,
    
    458
    -                    (FT_UInt)delta * sizeof ( PS_MaskRec ) );
    
    458
    +                    delta * sizeof ( PS_MaskRec ) );
    
    459 459
     
    
    460 460
             mask2[delta] = dummy;
    
    461 461
           }
    
    ... ... @@ -626,7 +626,7 @@
    626 626
                                FT_Int        pos,
    
    627 627
                                FT_Int        len,
    
    628 628
                                FT_Memory     memory,
    
    629
    -                           FT_Int       *aindex )
    
    629
    +                           FT_UInt      *aindex )
    
    630 630
       {
    
    631 631
         FT_Error  error = FT_Err_Ok;
    
    632 632
         FT_UInt   flags = 0;
    
    ... ... @@ -644,9 +644,6 @@
    644 644
           len = 0;
    
    645 645
         }
    
    646 646
     
    
    647
    -    if ( aindex )
    
    648
    -      *aindex = -1;
    
    649
    -
    
    650 647
         /* now, lookup stem in the current hints table */
    
    651 648
         {
    
    652 649
           PS_Mask  mask;
    
    ... ... @@ -683,7 +680,7 @@
    683 680
             goto Exit;
    
    684 681
     
    
    685 682
           if ( aindex )
    
    686
    -        *aindex = (FT_Int)idx;
    
    683
    +        *aindex = idx;
    
    687 684
         }
    
    688 685
     
    
    689 686
       Exit:
    
    ... ... @@ -694,9 +691,9 @@
    694 691
       /* add a "hstem3/vstem3" counter to our dimension table */
    
    695 692
       static FT_Error
    
    696 693
       ps_dimension_add_counter( PS_Dimension  dim,
    
    697
    -                            FT_Int        hint1,
    
    698
    -                            FT_Int        hint2,
    
    699
    -                            FT_Int        hint3,
    
    694
    +                            FT_UInt       hint1,
    
    695
    +                            FT_UInt       hint2,
    
    696
    +                            FT_UInt       hint3,
    
    700 697
                                 FT_Memory     memory )
    
    701 698
       {
    
    702 699
         FT_Error  error   = FT_Err_Ok;
    
    ... ... @@ -723,26 +720,17 @@
    723 720
         }
    
    724 721
     
    
    725 722
         /* now, set the bits for our hints in the counter mask */
    
    726
    -    if ( hint1 >= 0 )
    
    727
    -    {
    
    728
    -      error = ps_mask_set_bit( counter, (FT_UInt)hint1, memory );
    
    729
    -      if ( error )
    
    730
    -        goto Exit;
    
    731
    -    }
    
    723
    +    error = ps_mask_set_bit( counter, hint1, memory );
    
    724
    +    if ( error )
    
    725
    +      goto Exit;
    
    732 726
     
    
    733
    -    if ( hint2 >= 0 )
    
    734
    -    {
    
    735
    -      error = ps_mask_set_bit( counter, (FT_UInt)hint2, memory );
    
    736
    -      if ( error )
    
    737
    -        goto Exit;
    
    738
    -    }
    
    727
    +    error = ps_mask_set_bit( counter, hint2, memory );
    
    728
    +    if ( error )
    
    729
    +      goto Exit;
    
    739 730
     
    
    740
    -    if ( hint3 >= 0 )
    
    741
    -    {
    
    742
    -      error = ps_mask_set_bit( counter, (FT_UInt)hint3, memory );
    
    743
    -      if ( error )
    
    744
    -        goto Exit;
    
    745
    -    }
    
    731
    +    error = ps_mask_set_bit( counter, hint3, memory );
    
    732
    +    if ( error )
    
    733
    +      goto Exit;
    
    746 734
     
    
    747 735
       Exit:
    
    748 736
         return error;
    
    ... ... @@ -871,7 +859,7 @@
    871 859
           PS_Dimension  dim;
    
    872 860
           FT_Memory     memory = hints->memory;
    
    873 861
           FT_Int        count;
    
    874
    -      FT_Int        idx[3];
    
    862
    +      FT_UInt       idx[3];
    
    875 863
     
    
    876 864
     
    
    877 865
           /* limit "dimension" to 0..1 */
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]