freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] Fix some `cppcheck` warnings.


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] Fix some `cppcheck` warnings.
Date: Sat, 24 Jul 2021 18:42:12 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

7 changed files:

Changes:

  • src/bzip2/ftbzip2.c
    ... ... @@ -327,12 +327,13 @@
    327 327
                                  FT_ULong      count )
    
    328 328
       {
    
    329 329
         FT_Error  error = FT_Err_Ok;
    
    330
    -    FT_ULong  delta;
    
    331 330
     
    
    332 331
     
    
    333 332
         for (;;)
    
    334 333
         {
    
    335
    -      delta = (FT_ULong)( zip->limit - zip->cursor );
    
    334
    +      FT_ULong  delta = (FT_ULong)( zip->limit - zip->cursor );
    
    335
    +
    
    336
    +
    
    336 337
           if ( delta >= count )
    
    337 338
             delta = count;
    
    338 339
     
    

  • src/gzip/ftgzip.c
    ... ... @@ -467,12 +467,13 @@
    467 467
                                 FT_ULong     count )
    
    468 468
       {
    
    469 469
         FT_Error  error = FT_Err_Ok;
    
    470
    -    FT_ULong  delta;
    
    471 470
     
    
    472 471
     
    
    473 472
         for (;;)
    
    474 473
         {
    
    475
    -      delta = (FT_ULong)( zip->limit - zip->cursor );
    
    474
    +      FT_ULong  delta = (FT_ULong)( zip->limit - zip->cursor );
    
    475
    +
    
    476
    +
    
    476 477
           if ( delta >= count )
    
    477 478
             delta = count;
    
    478 479
     
    

  • src/psaux/psintrp.c
    ... ... @@ -469,7 +469,7 @@
    469 469
        */
    
    470 470
       FT_LOCAL_DEF( void )
    
    471 471
       cf2_interpT2CharString( CF2_Font              font,
    
    472
    -                          CF2_Buffer            buf,
    
    472
    +                          const CF2_Buffer      buf,
    
    473 473
                               CF2_OutlineCallbacks  callbacks,
    
    474 474
                               const FT_Vector*      translation,
    
    475 475
                               FT_Bool               doingSeac,
    

  • src/psaux/psintrp.h
    ... ... @@ -65,7 +65,7 @@ FT_BEGIN_HEADER
    65 65
     
    
    66 66
       FT_LOCAL( void )
    
    67 67
       cf2_interpT2CharString( CF2_Font              font,
    
    68
    -                          CF2_Buffer            charstring,
    
    68
    +                          const CF2_Buffer      buf,
    
    69 69
                               CF2_OutlineCallbacks  callbacks,
    
    70 70
                               const FT_Vector*      translation,
    
    71 71
                               FT_Bool               doingSeac,
    

  • src/raster/ftraster.c
    ... ... @@ -2095,8 +2095,8 @@
    2095 2095
        *   Removes an old profile from a linked list.
    
    2096 2096
        */
    
    2097 2097
       static void
    
    2098
    -  DelOld( PProfileList  list,
    
    2099
    -          PProfile      profile )
    
    2098
    +  DelOld( PProfileList    list,
    
    2099
    +          const PProfile  profile )
    
    2100 2100
       {
    
    2101 2101
         PProfile  *old, current;
    
    2102 2102
     
    
    ... ... @@ -2206,8 +2206,7 @@
    2206 2206
                                     PProfile    left,
    
    2207 2207
                                     PProfile    right )
    
    2208 2208
       {
    
    2209
    -    Long   e1, e2;
    
    2210
    -    Byte*  target;
    
    2209
    +    Long  e1, e2;
    
    2211 2210
     
    
    2212 2211
         Int  dropOutControl = left->flags & 7;
    
    2213 2212
     
    
    ... ... @@ -2240,6 +2239,8 @@
    2240 2239
     
    
    2241 2240
         if ( e2 >= 0 && e1 < ras.bWidth )
    
    2242 2241
         {
    
    2242
    +      Byte*  target;
    
    2243
    +
    
    2243 2244
           Int   c1, c2;
    
    2244 2245
           Byte  f1, f2;
    
    2245 2246
     
    
    ... ... @@ -2949,11 +2950,11 @@
    2949 2950
       FT_Outline_Get_CBox( const FT_Outline*  outline,
    
    2950 2951
                            FT_BBox           *acbox )
    
    2951 2952
       {
    
    2952
    -    Long  xMin, yMin, xMax, yMax;
    
    2953
    -
    
    2954
    -
    
    2955 2953
         if ( outline && acbox )
    
    2956 2954
         {
    
    2955
    +      Long  xMin, yMin, xMax, yMax;
    
    2956
    +
    
    2957
    +
    
    2957 2958
           if ( outline->n_points == 0 )
    
    2958 2959
           {
    
    2959 2960
             xMin = 0;
    

  • src/smooth/ftgrays.c
    ... ... @@ -658,8 +658,8 @@ typedef ptrdiff_t FT_PtrDist;
    658 658
           return;
    
    659 659
         }
    
    660 660
     
    
    661
    -    fx1   = FRACT( x1 );
    
    662
    -    fx2   = FRACT( x2 );
    
    661
    +    fx1 = FRACT( x1 );
    
    662
    +    fx2 = FRACT( x2 );
    
    663 663
     
    
    664 664
         /* everything is located in a single cell.  That is easy! */
    
    665 665
         /*                                                        */
    
    ... ... @@ -1256,7 +1256,7 @@ typedef ptrdiff_t FT_PtrDist;
    1256 1256
         FT_Vector   bez_stack[16 * 2 + 1];  /* enough to accommodate bisections */
    
    1257 1257
         FT_Vector*  arc = bez_stack;
    
    1258 1258
         TPos        dx, dy;
    
    1259
    -    int         draw, split;
    
    1259
    +    int         draw;
    
    1260 1260
     
    
    1261 1261
     
    
    1262 1262
         arc[0].x = UPSCALE( to->x );
    
    ... ... @@ -1299,7 +1299,9 @@ typedef ptrdiff_t FT_PtrDist;
    1299 1299
         /* many times as there are trailing zeros in the counter.         */
    
    1300 1300
         do
    
    1301 1301
         {
    
    1302
    -      split = draw & ( -draw );  /* isolate the rightmost 1-bit */
    
    1302
    +      int  split = draw & ( -draw );  /* isolate the rightmost 1-bit */
    
    1303
    +
    
    1304
    +
    
    1303 1305
           while ( ( split >>= 1 ) )
    
    1304 1306
           {
    
    1305 1307
             gray_split_conic( arc );
    
    ... ... @@ -1466,7 +1468,8 @@ typedef ptrdiff_t FT_PtrDist;
    1466 1468
       static void
    
    1467 1469
       gray_sweep( RAS_ARG )
    
    1468 1470
       {
    
    1469
    -    int  fill = ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ? 0x100 : INT_MIN;
    
    1471
    +    int  fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
    
    1472
    +                                                                 : INT_MIN;
    
    1470 1473
         int  coverage;
    
    1471 1474
         int  y;
    
    1472 1475
     
    
    ... ... @@ -1476,13 +1479,15 @@ typedef ptrdiff_t FT_PtrDist;
    1476 1479
           PCell   cell  = ras.ycells[y - ras.min_ey];
    
    1477 1480
           TCoord  x     = ras.min_ex;
    
    1478 1481
           TArea   cover = 0;
    
    1479
    -      TArea   area;
    
    1480 1482
     
    
    1481 1483
           unsigned char*  line = ras.target.origin - ras.target.pitch * y;
    
    1482 1484
     
    
    1483 1485
     
    
    1484 1486
           for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
    
    1485 1487
           {
    
    1488
    +        TArea  area;
    
    1489
    +
    
    1490
    +
    
    1486 1491
             if ( cover != 0 && cell->x > x )
    
    1487 1492
             {
    
    1488 1493
               FT_FILL_RULE( coverage, cover, fill );
    
    ... ... @@ -1513,7 +1518,8 @@ typedef ptrdiff_t FT_PtrDist;
    1513 1518
       static void
    
    1514 1519
       gray_sweep_direct( RAS_ARG )
    
    1515 1520
       {
    
    1516
    -    int  fill = ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ? 0x100 : INT_MIN;
    
    1521
    +    int  fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
    
    1522
    +                                                                 : INT_MIN;
    
    1517 1523
         int  coverage;
    
    1518 1524
         int  y;
    
    1519 1525
     
    
    ... ... @@ -1526,11 +1532,13 @@ typedef ptrdiff_t FT_PtrDist;
    1526 1532
           PCell   cell  = ras.ycells[y - ras.min_ey];
    
    1527 1533
           TCoord  x     = ras.min_ex;
    
    1528 1534
           TArea   cover = 0;
    
    1529
    -      TArea   area;
    
    1530 1535
     
    
    1531 1536
     
    
    1532 1537
           for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
    
    1533 1538
           {
    
    1539
    +        TArea  area;
    
    1540
    +
    
    1541
    +
    
    1534 1542
             if ( cover != 0 && cell->x > x )
    
    1535 1543
             {
    
    1536 1544
               FT_FILL_RULE( coverage, cover, fill );
    

  • src/tools/apinames.c
    ... ... @@ -167,7 +167,6 @@ names_dump( FILE* out,
    167 167
       case OUTPUT_WATCOM_LBC:
    
    168 168
         {
    
    169 169
           const char*  dot;
    
    170
    -      char         temp[512];
    
    171 170
     
    
    172 171
     
    
    173 172
           if ( !dll_name )
    
    ... ... @@ -181,7 +180,8 @@ names_dump( FILE* out,
    181 180
           dot = strchr( dll_name, '.' );
    
    182 181
           if ( dot )
    
    183 182
           {
    
    184
    -        int  len = dot - dll_name;
    
    183
    +        char  temp[512];
    
    184
    +        int   len = dot - dll_name;
    
    185 185
     
    
    186 186
     
    
    187 187
             if ( len > (int)( sizeof ( temp ) - 1 ) )
    


  • reply via email to

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