freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 3 commits: * src/base/ftobjs.c (FT_CMap


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 3 commits: * src/base/ftobjs.c (FT_CMap_New): Revert to zeroing.
Date: Mon, 13 Sep 2021 20:38:08 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

7 changed files:

Changes:

  • src/base/ftobjs.c
    ... ... @@ -3753,7 +3753,7 @@
    3753 3753
         face   = charmap->face;
    
    3754 3754
         memory = FT_FACE_MEMORY( face );
    
    3755 3755
     
    
    3756
    -    if ( !FT_QALLOC( cmap, clazz->size ) )
    
    3756
    +    if ( !FT_ALLOC( cmap, clazz->size ) )
    
    3757 3757
         {
    
    3758 3758
           cmap->charmap = *charmap;
    
    3759 3759
           cmap->clazz   = clazz;
    

  • src/bdf/bdfdrivr.c
    ... ... @@ -606,7 +606,7 @@ THE SOFTWARE.
    606 606
             unsigned long  n;
    
    607 607
     
    
    608 608
     
    
    609
    -        if ( FT_NEW_ARRAY( face->en_table, font->glyphs_size ) )
    
    609
    +        if ( FT_QNEW_ARRAY( face->en_table, font->glyphs_size ) )
    
    610 610
               goto Exit;
    
    611 611
     
    
    612 612
             face->default_glyph = 0;
    

  • src/cff/cffload.c
    ... ... @@ -835,7 +835,6 @@
    835 835
       {
    
    836 836
         FT_Error   error   = FT_Err_Ok;
    
    837 837
         FT_UInt    i;
    
    838
    -    FT_Long    j;
    
    839 838
         FT_UShort  max_cid = 0;
    
    840 839
     
    
    841 840
     
    
    ... ... @@ -853,9 +852,10 @@
    853 852
     
    
    854 853
         /* When multiple GIDs map to the same CID, we choose the lowest */
    
    855 854
         /* GID.  This is not described in any spec, but it matches the  */
    
    856
    -    /* behaviour of recent Acroread versions.                       */
    
    857
    -    for ( j = (FT_Long)num_glyphs - 1; j >= 0; j-- )
    
    858
    -      charset->cids[charset->sids[j]] = (FT_UShort)j;
    
    855
    +    /* behaviour of recent Acroread versions.  The loop stops when  */
    
    856
    +    /* the unsigned index wraps around after reaching zero.         */
    
    857
    +    for ( i = num_glyphs - 1; i < num_glyphs; i-- )
    
    858
    +      charset->cids[charset->sids[i]] = (FT_UShort)i;
    
    859 859
     
    
    860 860
         charset->max_cid    = max_cid;
    
    861 861
         charset->num_glyphs = num_glyphs;
    

  • src/pshinter/pshalgo.c
    ... ... @@ -305,17 +305,18 @@
    305 305
         /* now, sort the hints; they are guaranteed to not overlap */
    
    306 306
         /* so we can compare their "org_pos" field directly        */
    
    307 307
         {
    
    308
    -      FT_Int     i1, i2;
    
    308
    +      FT_UInt    i1, i2;
    
    309 309
           PSH_Hint   hint1, hint2;
    
    310 310
           PSH_Hint*  sort = table->sort;
    
    311 311
     
    
    312 312
     
    
    313 313
           /* a simple bubble sort will do, since in 99% of cases, the hints */
    
    314 314
           /* will be already sorted -- and the sort will be linear          */
    
    315
    -      for ( i1 = 1; i1 < (FT_Int)count; i1++ )
    
    315
    +      for ( i1 = 1; i1 < count; i1++ )
    
    316 316
           {
    
    317 317
             hint1 = sort[i1];
    
    318
    -        for ( i2 = i1 - 1; i2 >= 0; i2-- )
    
    318
    +        /* this loop stops when i2 wraps around after reaching 0 */
    
    319
    +        for ( i2 = i1 - 1; i2 < i1; i2-- )
    
    319 320
             {
    
    320 321
               hint2 = sort[i2];
    
    321 322
     
    

  • src/pshinter/pshrec.c
    ... ... @@ -499,23 +499,19 @@
    499 499
       ps_mask_table_merge_all( PS_Mask_Table  table,
    
    500 500
                                FT_Memory      memory )
    
    501 501
       {
    
    502
    -    FT_Int    index1, index2;
    
    502
    +    FT_UInt   index1, index2;
    
    503 503
         FT_Error  error = FT_Err_Ok;
    
    504 504
     
    
    505 505
     
    
    506
    -    /* both loops go down to 0, thus FT_Int for index1 and index2 */
    
    507
    -    for ( index1 = (FT_Int)table->num_masks - 1; index1 > 0; index1-- )
    
    506
    +    /* the inner loop stops when the unsigned index wraps around */
    
    507
    +    /* after reaching 0.                                         */
    
    508
    +    for ( index1 = table->num_masks - 1; index1 > 0; index1-- )
    
    508 509
         {
    
    509
    -      for ( index2 = index1 - 1; index2 >= 0; index2-- )
    
    510
    +      for ( index2 = index1 - 1; index2 < index1; index2-- )
    
    510 511
           {
    
    511
    -        if ( ps_mask_table_test_intersect( table,
    
    512
    -                                           (FT_UInt)index1,
    
    513
    -                                           (FT_UInt)index2 ) )
    
    512
    +        if ( ps_mask_table_test_intersect( table, index1, index2 ) )
    
    514 513
             {
    
    515
    -          error = ps_mask_table_merge( table,
    
    516
    -                                       (FT_UInt)index2,
    
    517
    -                                       (FT_UInt)index1,
    
    518
    -                                       memory );
    
    514
    +          error = ps_mask_table_merge( table, index2, index1, memory );
    
    519 515
               if ( error )
    
    520 516
                 goto Exit;
    
    521 517
     
    

  • src/psnames/psmodule.c
    ... ... @@ -325,7 +325,6 @@
    325 325
     
    
    326 326
         /* we first allocate the table */
    
    327 327
         table->num_maps = 0;
    
    328
    -    table->maps     = NULL;
    
    329 328
     
    
    330 329
         if ( !FT_QNEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
    
    331 330
         {
    

  • src/sfnt/sfobjs.c
    ... ... @@ -1209,7 +1209,7 @@
    1209 1209
               /* of `FT_Face', we map `available_sizes' indices to strike    */
    
    1210 1210
               /* indices                                                     */
    
    1211 1211
               if ( FT_NEW_ARRAY( root->available_sizes, count ) ||
    
    1212
    -               FT_NEW_ARRAY( sbit_strike_map, count ) )
    
    1212
    +               FT_QNEW_ARRAY( sbit_strike_map, count ) )
    
    1213 1213
                 goto Exit;
    
    1214 1214
     
    
    1215 1215
               bsize_idx = 0;
    


  • reply via email to

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