freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 3 commits: Fix clang14 compiler warning


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] 3 commits: Fix clang14 compiler warnings.
Date: Fri, 29 Jul 2022 22:33:53 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

  • 38dc768a
    by Werner Lemberg at 2022-07-29T21:53:28+02:00
    Fix clang14 compiler warnings.
    
    * include/freetype/internal/ftstream.h (FT_GET_SHORT_LE, FT_GET_USHORT_LE):
    Fix type.
    
    * src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Always return boolean
    value.
    (tt_face_get_colorline_stops): Fix type of `var_index_base`.
    
  • a3749a64
    by Werner Lemberg at 2022-07-29T22:21:12+02:00
    Fix compilation if `TT_CONFIG_OPTION_GX_VAR_SUPPORT` is not set.
    
    * src/sfnt/ttcolr.c: Protect relevant code with
    `TT_CONFIG_OPTION_GX_VAR_SUPPORT`.
    
  • 2af6903b
    by Werner Lemberg at 2022-07-29T22:57:18+02:00
    * src/base/ftglyph.c (FT_Get_Glyph): Set `*aglyph` to NULL in case of error.
    

4 changed files:

Changes:

  • include/freetype/ftglyph.h
    ... ... @@ -355,7 +355,7 @@ FT_BEGIN_HEADER
    355 355
        *
    
    356 356
        * @output:
    
    357 357
        *   aglyph ::
    
    358
    -   *     A handle to the glyph object.
    
    358
    +   *     A handle to the glyph object.  `NULL` in case of error.
    
    359 359
        *
    
    360 360
        * @return:
    
    361 361
        *   FreeType error code.  0~means success.
    
    ... ... @@ -385,7 +385,7 @@ FT_BEGIN_HEADER
    385 385
        *
    
    386 386
        * @output:
    
    387 387
        *   target ::
    
    388
    -   *     A handle to the target glyph object.  0~in case of error.
    
    388
    +   *     A handle to the target glyph object.  `NULL` in case of error.
    
    389 389
        *
    
    390 390
        * @return:
    
    391 391
        *   FreeType error code.  0~means success.
    
    ... ... @@ -671,7 +671,7 @@ FT_BEGIN_HEADER
    671 671
        *
    
    672 672
        * @input:
    
    673 673
        *   glyph ::
    
    674
    -   *     A handle to the target glyph object.
    
    674
    +   *     A handle to the target glyph object.  Can be `NULL`.
    
    675 675
        */
    
    676 676
       FT_EXPORT( void )
    
    677 677
       FT_Done_Glyph( FT_Glyph  glyph );
    

  • include/freetype/internal/ftstream.h
    ... ... @@ -314,8 +314,8 @@ FT_BEGIN_HEADER
    314 314
     #define FT_GET_ULONG()      FT_GET_MACRO( FT_Stream_GetULong, FT_UInt32 )
    
    315 315
     #define FT_GET_TAG4()       FT_GET_MACRO( FT_Stream_GetULong, FT_UInt32 )
    
    316 316
     
    
    317
    -#define FT_GET_SHORT_LE()   FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Int32 )
    
    318
    -#define FT_GET_USHORT_LE()  FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UInt32 )
    
    317
    +#define FT_GET_SHORT_LE()   FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Int16 )
    
    318
    +#define FT_GET_USHORT_LE()  FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UInt16 )
    
    319 319
     #define FT_GET_LONG_LE()    FT_GET_MACRO( FT_Stream_GetULongLE, FT_Int32 )
    
    320 320
     #define FT_GET_ULONG_LE()   FT_GET_MACRO( FT_Stream_GetULongLE, FT_UInt32 )
    
    321 321
     #endif
    

  • src/base/ftglyph.c
    ... ... @@ -682,7 +682,10 @@
    682 682
       Exit2:
    
    683 683
         /* if an error occurred, destroy the glyph */
    
    684 684
         if ( error )
    
    685
    +    {
    
    685 686
           FT_Done_Glyph( glyph );
    
    687
    +      *aglyph = NULL;
    
    688
    +    }
    
    686 689
         else
    
    687 690
           *aglyph = glyph;
    
    688 691
     
    

  • src/sfnt/ttcolr.c
    ... ... @@ -30,11 +30,14 @@
    30 30
     #include <freetype/internal/ftcalc.h>
    
    31 31
     #include <freetype/internal/ftdebug.h>
    
    32 32
     #include <freetype/internal/ftstream.h>
    
    33
    -#include <freetype/internal/services/svmm.h>
    
    34 33
     #include <freetype/tttags.h>
    
    35 34
     #include <freetype/ftcolor.h>
    
    36 35
     #include <freetype/config/integer-types.h>
    
    37 36
     
    
    37
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    38
    +#include <freetype/internal/services/svmm.h>
    
    39
    +#endif
    
    40
    +
    
    38 41
      /* the next two code lines are a temporary hack, to be removed together */
    
    39 42
      /* with `VARIABLE_COLRV1_ENABLED` and related code as soon as variable  */
    
    40 43
      /* 'COLR' support is complete and tested                                */
    
    ... ... @@ -131,9 +134,11 @@
    131 134
          */
    
    132 135
         FT_Byte*  paints_start_v1;
    
    133 136
     
    
    137
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    134 138
         /* Item Variation Store for variable 'COLR' v1. */
    
    135 139
         GX_ItemVarStoreRec    var_store;
    
    136 140
         GX_DeltaSetIdxMapRec  delta_set_idx_map;
    
    141
    +#endif
    
    137 142
     
    
    138 143
         /* The memory that backs up the `COLR' table. */
    
    139 144
         void*     table;
    
    ... ... @@ -169,10 +174,10 @@
    169 174
         FT_ULong  base_glyph_offset, layer_offset;
    
    170 175
         FT_ULong  base_glyphs_offset_v1, num_base_glyphs_v1;
    
    171 176
         FT_ULong  layer_offset_v1, num_layers_v1, clip_list_offset;
    
    172
    -    FT_ULong  var_idx_map_offset, var_store_offset;
    
    173 177
         FT_ULong  table_size;
    
    178
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    174 179
         FT_ULong  colr_offset_in_stream;
    
    175
    -
    
    180
    +#endif
    
    176 181
     
    
    177 182
         /* `COLR' always needs `CPAL' */
    
    178 183
         if ( !face->cpal )
    
    ... ... @@ -182,7 +187,9 @@
    182 187
         if ( error )
    
    183 188
           goto NoColr;
    
    184 189
     
    
    190
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    185 191
         colr_offset_in_stream = FT_STREAM_POS();
    
    192
    +#endif
    
    186 193
     
    
    187 194
         if ( table_size < COLR_HEADER_SIZE )
    
    188 195
           goto InvalidTable;
    
    ... ... @@ -275,6 +282,7 @@
    275 282
           else
    
    276 283
             colr->clip_list = 0;
    
    277 284
     
    
    285
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    278 286
           colr->var_store.dataCount     = 0;
    
    279 287
           colr->var_store.varData       = NULL;
    
    280 288
           colr->var_store.axisCount     = 0;
    
    ... ... @@ -285,11 +293,12 @@
    285 293
           colr->delta_set_idx_map.outerIndex = NULL;
    
    286 294
           colr->delta_set_idx_map.innerIndex = NULL;
    
    287 295
     
    
    288
    -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    289 296
           if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR &&
    
    290 297
                VARIABLE_COLRV1_ENABLED                         )
    
    291 298
           {
    
    292
    -        FT_Service_MultiMasters  mm  = (FT_Service_MultiMasters)face->mm;
    
    299
    +        FT_ULong  var_idx_map_offset, var_store_offset;
    
    300
    +
    
    301
    +        FT_Service_MultiMasters  mm = (FT_Service_MultiMasters)face->mm;
    
    293 302
     
    
    294 303
     
    
    295 304
             var_idx_map_offset = FT_NEXT_ULONG( p );
    
    ... ... @@ -557,8 +566,6 @@
    557 566
                                       FT_UInt           num_deltas,
    
    558 567
                                       FT_ItemVarDelta*  deltas )
    
    559 568
       {
    
    560
    -    FT_Error  error = FT_Err_Ok;
    
    561
    -
    
    562 569
         FT_UInt   outer_index    = 0;
    
    563 570
         FT_UInt   inner_index    = 0;
    
    564 571
         FT_ULong  loop_var_index = var_index_base;
    
    ... ... @@ -597,8 +604,7 @@
    597 604
           {
    
    598 605
             /* TODO: Direct lookup case not implemented or tested yet. */
    
    599 606
             FT_ASSERT( 0 );
    
    600
    -        error = FT_THROW( Unimplemented_Feature );
    
    601
    -        return error;
    
    607
    +        return 0;
    
    602 608
           }
    
    603 609
     
    
    604 610
           deltas[i] = mm->get_item_delta( FT_FACE( face ), &colr->var_store,
    
    ... ... @@ -617,12 +623,17 @@
    617 623
                   FT_Byte*        p,
    
    618 624
                   FT_COLR_Paint*  apaint )
    
    619 625
       {
    
    620
    -    FT_Byte*         paint_base      = p;
    
    621
    -    FT_Byte*         child_table_p   = NULL;
    
    622
    -    FT_Bool          do_read_var     = FALSE;
    
    623
    -    FT_ULong         var_index_base  = 0;
    
    626
    +    FT_Byte*  paint_base    = p;
    
    627
    +    FT_Byte*  child_table_p = NULL;
    
    628
    +    FT_Bool   do_read_var   = FALSE;
    
    629
    +
    
    630
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    631
    +    FT_ULong         var_index_base = 0;
    
    624 632
         /* Longest varIndexBase offset is 5 in the spec. */
    
    625
    -    FT_ItemVarDelta  item_deltas[6]  = { 0, 0, 0, 0, 0, 0 };
    
    633
    +    FT_ItemVarDelta  item_deltas[6] = { 0, 0, 0, 0, 0, 0 };
    
    634
    +#else
    
    635
    +    FT_UNUSED( face );
    
    636
    +#endif
    
    626 637
     
    
    627 638
     
    
    628 639
         if ( !p || !colr || !colr->table )
    
    ... ... @@ -1062,9 +1073,6 @@
    1062 1073
                   (FT_PaintFormat_Internal)apaint->format ==
    
    1063 1074
                     FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER )
    
    1064 1075
         {
    
    1065
    -      FT_UInt  num_deltas = 0;
    
    1066
    -
    
    1067
    -
    
    1068 1076
           apaint->u.rotate.paint.p                     = child_table_p;
    
    1069 1077
           apaint->u.rotate.paint.insert_root_transform = 0;
    
    1070 1078
     
    
    ... ... @@ -1091,6 +1099,9 @@
    1091 1099
                    FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) &&
    
    1092 1100
                VARIABLE_COLRV1_ENABLED                              )
    
    1093 1101
           {
    
    1102
    +        FT_UInt  num_deltas = 0;
    
    1103
    +
    
    1104
    +
    
    1094 1105
             var_index_base = FT_NEXT_ULONG( p );
    
    1095 1106
     
    
    1096 1107
             if ( (FT_PaintFormat_Internal)apaint->format ==
    
    ... ... @@ -1517,8 +1528,7 @@
    1517 1528
         Colr*  colr = (Colr*)face->colr;
    
    1518 1529
     
    
    1519 1530
         FT_Byte*  p;
    
    1520
    -    FT_Long   var_index_base;
    
    1521
    -    FT_Int    item_deltas[2];
    
    1531
    +    FT_ULong  var_index_base;
    
    1522 1532
     
    
    1523 1533
     
    
    1524 1534
         if ( !colr || !colr->table )
    
    ... ... @@ -1552,6 +1562,9 @@
    1552 1562
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    1553 1563
           if ( VARIABLE_COLRV1_ENABLED )
    
    1554 1564
           {
    
    1565
    +        FT_Int  item_deltas[2];
    
    1566
    +
    
    1567
    +
    
    1555 1568
             if ( !get_deltas_for_var_index_base( face, colr,
    
    1556 1569
                                                  var_index_base,
    
    1557 1570
                                                  2,
    
    ... ... @@ -1561,6 +1574,8 @@
    1561 1574
             color_stop->stop_offset += (FT_Fixed)item_deltas[0] << 2;
    
    1562 1575
             color_stop->color.alpha += item_deltas[1];
    
    1563 1576
           }
    
    1577
    +#else
    
    1578
    +      FT_UNUSED( var_index_base );
    
    1564 1579
     #endif
    
    1565 1580
         }
    
    1566 1581
     
    


  • reply via email to

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