freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] 2 commits: [ftbench] Fix clang wa


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype-demos][master] 2 commits: [ftbench] Fix clang warnings.
Date: Mon, 15 Nov 2021 16:16:39 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType Demo Programs

Commits:

11 changed files:

Changes:

  • src/ftbench.c
    ... ... @@ -16,6 +16,7 @@
    16 16
     
    
    17 17
     #include <stdlib.h>
    
    18 18
     #include <stdio.h>
    
    19
    +#include <limits.h>
    
    19 20
     #include <string.h>
    
    20 21
     #include <time.h>
    
    21 22
     #include <ft2build.h>
    
    ... ... @@ -148,9 +149,9 @@
    148 149
       static int    preload;
    
    149 150
       static char*  filename;
    
    150 151
     
    
    151
    -  static unsigned int  first_index = 0U;
    
    152
    -  static unsigned int  last_index  = ~0U;
    
    153
    -  static int           incr_index  = 1;
    
    152
    +  static int  first_index = 0;
    
    153
    +  static int  last_index  = INT_MAX;
    
    154
    +  static int  incr_index  = 1;
    
    154 155
     
    
    155 156
     #define FOREACH( i )  for ( i = first_index ;                          \
    
    156 157
                                 ( first_index <= i && i <= last_index ) || \
    
    ... ... @@ -316,8 +317,7 @@
    316 317
                  FT_Face    face,
    
    317 318
                  void*      user_data )
    
    318 319
       {
    
    319
    -    unsigned int  i;
    
    320
    -    int           done = 0;
    
    320
    +    int  i, done = 0;
    
    321 321
     
    
    322 322
         FT_UNUSED( user_data );
    
    323 323
     
    
    ... ... @@ -326,7 +326,7 @@
    326 326
     
    
    327 327
         FOREACH( i )
    
    328 328
         {
    
    329
    -      if ( !FT_Load_Glyph( face, i, load_flags ) )
    
    329
    +      if ( !FT_Load_Glyph( face, (FT_UInt)i, load_flags ) )
    
    330 330
             done++;
    
    331 331
         }
    
    332 332
     
    
    ... ... @@ -344,7 +344,7 @@
    344 344
         int        done = 0;
    
    345 345
         FT_Fixed*  advances;
    
    346 346
         FT_ULong   flags = *((FT_ULong*)user_data);
    
    347
    -    FT_UInt    start, count;
    
    347
    +    FT_Int     start, count;
    
    348 348
     
    
    349 349
     
    
    350 350
         if ( incr_index > 0 )
    
    ... ... @@ -362,7 +362,9 @@
    362 362
     
    
    363 363
         TIMER_START( timer );
    
    364 364
     
    
    365
    -    FT_Get_Advances( face, start, count, (FT_Int32)flags, advances );
    
    365
    +    FT_Get_Advances( face,
    
    366
    +                     (FT_UInt)start, (FT_UInt)count,
    
    367
    +                     (FT_Int32)flags, advances );
    
    366 368
         done += (int)count;
    
    367 369
     
    
    368 370
         TIMER_STOP( timer );
    
    ... ... @@ -378,15 +380,14 @@
    378 380
                    FT_Face    face,
    
    379 381
                    void*      user_data )
    
    380 382
       {
    
    381
    -    unsigned int  i;
    
    382
    -    int           done = 0;
    
    383
    +    int  i, done = 0;
    
    383 384
     
    
    384 385
         FT_UNUSED( user_data );
    
    385 386
     
    
    386 387
     
    
    387 388
         FOREACH( i )
    
    388 389
         {
    
    389
    -      if ( FT_Load_Glyph( face, i, load_flags ) )
    
    390
    +      if ( FT_Load_Glyph( face, (FT_UInt)i, load_flags ) )
    
    390 391
             continue;
    
    391 392
     
    
    392 393
           TIMER_START( timer );
    
    ... ... @@ -404,15 +405,14 @@
    404 405
                      FT_Face    face,
    
    405 406
                      void*      user_data )
    
    406 407
       {
    
    407
    -    unsigned int  i;
    
    408
    -    int           done = 0;
    
    408
    +    int  i, done = 0;
    
    409 409
     
    
    410 410
         FT_UNUSED( user_data );
    
    411 411
     
    
    412 412
     
    
    413 413
         FOREACH( i )
    
    414 414
         {
    
    415
    -      if ( FT_Load_Glyph( face, i, load_flags ) )
    
    415
    +      if ( FT_Load_Glyph( face, (FT_UInt)i, load_flags ) )
    
    416 416
             continue;
    
    417 417
     
    
    418 418
           TIMER_START( timer );
    
    ... ... @@ -430,10 +430,10 @@
    430 430
                    FT_Face    face,
    
    431 431
                    void*      user_data )
    
    432 432
       {
    
    433
    -    FT_Glyph      glyph;
    
    434
    -    FT_Stroker    stroker;
    
    435
    -    unsigned int  i;
    
    436
    -    int           done = 0;
    
    433
    +    FT_Glyph    glyph;
    
    434
    +    FT_Stroker  stroker;
    
    435
    +
    
    436
    +    int  i, done = 0;
    
    437 437
     
    
    438 438
         FT_UNUSED( user_data );
    
    439 439
     
    
    ... ... @@ -446,7 +446,7 @@
    446 446
     
    
    447 447
         FOREACH( i )
    
    448 448
         {
    
    449
    -      if ( FT_Load_Glyph( face, i, load_flags ) )
    
    449
    +      if ( FT_Load_Glyph( face, (FT_UInt)i, load_flags ) )
    
    450 450
             continue;
    
    451 451
     
    
    452 452
           if ( FT_Get_Glyph( face->glyph, &glyph ) )
    
    ... ... @@ -469,16 +469,16 @@
    469 469
                       FT_Face    face,
    
    470 470
                       void*      user_data )
    
    471 471
       {
    
    472
    -    FT_Glyph      glyph;
    
    473
    -    unsigned int  i;
    
    474
    -    int           done = 0;
    
    472
    +    FT_Glyph  glyph;
    
    473
    +
    
    474
    +    int  i, done = 0;
    
    475 475
     
    
    476 476
         FT_UNUSED( user_data );
    
    477 477
     
    
    478 478
     
    
    479 479
         FOREACH( i )
    
    480 480
         {
    
    481
    -      if ( FT_Load_Glyph( face, i, load_flags ) )
    
    481
    +      if ( FT_Load_Glyph( face, (FT_UInt)i, load_flags ) )
    
    482 482
             continue;
    
    483 483
     
    
    484 484
           TIMER_START( timer );
    
    ... ... @@ -499,17 +499,17 @@
    499 499
                      FT_Face    face,
    
    500 500
                      void*      user_data )
    
    501 501
       {
    
    502
    -    FT_Glyph      glyph;
    
    503
    -    FT_BBox       bbox;
    
    504
    -    unsigned int  i;
    
    505
    -    int           done = 0;
    
    502
    +    FT_Glyph  glyph;
    
    503
    +    FT_BBox   bbox;
    
    504
    +
    
    505
    +    int  i, done = 0;
    
    506 506
     
    
    507 507
         FT_UNUSED( user_data );
    
    508 508
     
    
    509 509
     
    
    510 510
         FOREACH( i )
    
    511 511
         {
    
    512
    -      if ( FT_Load_Glyph( face, i, load_flags ) )
    
    512
    +      if ( FT_Load_Glyph( face, (FT_UInt)i, load_flags ) )
    
    513 513
             continue;
    
    514 514
     
    
    515 515
           if ( FT_Get_Glyph( face->glyph, &glyph ) )
    
    ... ... @@ -532,10 +532,10 @@
    532 532
                      FT_Face    face,
    
    533 533
                      void*      user_data )
    
    534 534
       {
    
    535
    -    FT_BBox       bbox;
    
    536
    -    unsigned int  i;
    
    537
    -    int           done  = 0;
    
    538
    -    FT_Matrix     rot30 = { 0xDDB4, -0x8000, 0x8000, 0xDDB4 };
    
    535
    +    FT_BBox    bbox;
    
    536
    +    FT_Matrix  rot30 = { 0xDDB4, -0x8000, 0x8000, 0xDDB4 };
    
    537
    +
    
    538
    +    int  i, done = 0;
    
    539 539
     
    
    540 540
         FT_UNUSED( user_data );
    
    541 541
     
    
    ... ... @@ -545,7 +545,7 @@
    545 545
           FT_Outline*  outline;
    
    546 546
     
    
    547 547
     
    
    548
    -      if ( FT_Load_Glyph( face, i, load_flags ) )
    
    548
    +      if ( FT_Load_Glyph( face, (FT_UInt)i, load_flags ) )
    
    549 549
             continue;
    
    550 550
     
    
    551 551
           outline = &face->glyph->outline;
    
    ... ... @@ -626,9 +626,9 @@
    626 626
                         FT_Face    face,
    
    627 627
                         void*      user_data )
    
    628 628
       {
    
    629
    -    FT_Glyph      glyph;
    
    630
    -    unsigned int  i;
    
    631
    -    int           done = 0;
    
    629
    +    FT_Glyph  glyph;
    
    630
    +
    
    631
    +    int  i, done = 0;
    
    632 632
     
    
    633 633
         FT_UNUSED( face );
    
    634 634
         FT_UNUSED( user_data );
    
    ... ... @@ -646,7 +646,7 @@
    646 646
         {
    
    647 647
           if ( !FTC_ImageCache_Lookup( image_cache,
    
    648 648
                                        &font_type,
    
    649
    -                                   i,
    
    649
    +                                   (FT_UInt)i,
    
    650 650
                                        &glyph,
    
    651 651
                                        NULL ) )
    
    652 652
             done++;
    
    ... ... @@ -663,9 +663,9 @@
    663 663
                        FT_Face    face,
    
    664 664
                        void*      user_data )
    
    665 665
       {
    
    666
    -    FTC_SBit      glyph;
    
    667
    -    unsigned int  i;
    
    668
    -    int           done = 0;
    
    666
    +    FTC_SBit  glyph;
    
    667
    +
    
    668
    +    int  i, done = 0;
    
    669 669
     
    
    670 670
         FT_UNUSED( face );
    
    671 671
         FT_UNUSED( user_data );
    
    ... ... @@ -683,7 +683,7 @@
    683 683
         {
    
    684 684
           if ( !FTC_SBitCache_Lookup( sbit_cache,
    
    685 685
                                       &font_type,
    
    686
    -                                  i,
    
    686
    +                                  (FT_UInt)i,
    
    687 687
                                       &glyph,
    
    688 688
                                       NULL ) )
    
    689 689
             done++;
    
    ... ... @@ -747,8 +747,7 @@
    747 747
       {
    
    748 748
         FT_Face  bench_face;
    
    749 749
     
    
    750
    -    unsigned int  i;
    
    751
    -    int           done = 0;
    
    750
    +    int  i, done = 0;
    
    752 751
     
    
    753 752
         FT_UNUSED( face );
    
    754 753
         FT_UNUSED( user_data );
    
    ... ... @@ -760,7 +759,7 @@
    760 759
         {
    
    761 760
           FOREACH( i )
    
    762 761
           {
    
    763
    -        if ( !FT_Load_Glyph( bench_face, i, load_flags ) )
    
    762
    +        if ( !FT_Load_Glyph( bench_face, (FT_UInt)i, load_flags ) )
    
    764 763
               done++;
    
    765 764
           }
    
    766 765
     
    
    ... ... @@ -782,7 +781,6 @@
    782 781
                    bcharset_t*  charset )
    
    783 782
       {
    
    784 783
         FT_ULong  charcode;
    
    785
    -    FT_UInt   gindex;
    
    786 784
         int       i = 0;
    
    787 785
     
    
    788 786
     
    
    ... ... @@ -793,27 +791,33 @@
    793 791
     
    
    794 792
         if ( face->charmap )
    
    795 793
         {
    
    796
    -      charcode = FT_Get_First_Char( face, &gindex );
    
    794
    +      FT_UInt  idx;
    
    795
    +
    
    796
    +
    
    797
    +      charcode = FT_Get_First_Char( face, &idx );
    
    797 798
     
    
    798 799
           /* certain fonts contain a broken charmap that will map character */
    
    799 800
           /* codes to out-of-bounds glyph indices.  Take care of that here. */
    
    800 801
           /*                                                                */
    
    801
    -      while ( gindex && i < face->num_glyphs )
    
    802
    +      while ( idx && i < face->num_glyphs )
    
    802 803
           {
    
    804
    +        FT_Int  gindex = (FT_Int)idx;
    
    805
    +
    
    806
    +
    
    803 807
             if ( ( first_index <= gindex && gindex <= last_index ) ||
    
    804 808
                  ( first_index >= gindex && gindex >= last_index ) )
    
    805 809
               charset->code[i++] = charcode;
    
    806
    -        charcode = FT_Get_Next_Char( face, charcode, &gindex );
    
    810
    +        charcode = FT_Get_Next_Char( face, charcode, &idx );
    
    807 811
           }
    
    808 812
         }
    
    809 813
         else
    
    810 814
         {
    
    811
    -      unsigned int  j;
    
    815
    +      int  j;
    
    812 816
     
    
    813 817
     
    
    814 818
           /* no charmap, do an identity mapping */
    
    815 819
           FOREACH( j )
    
    816
    -        charset->code[i++] = j;
    
    820
    +        charset->code[i++] = (FT_ULong)j;
    
    817 821
         }
    
    818 822
     
    
    819 823
         charset->size = i;
    
    ... ... @@ -1134,12 +1138,12 @@
    1134 1138
     
    
    1135 1139
           case 'i':
    
    1136 1140
             {
    
    1137
    -          unsigned int  fi, li;
    
    1141
    +          int  fi, li;
    
    1138 1142
     
    
    1139
    -          if ( sscanf( optarg, "%u%*[,:-]%u", &fi, &li ) == 2 )
    
    1143
    +          if ( sscanf( optarg, "%d%*[,:-]%d", &fi, &li ) == 2 )
    
    1140 1144
               {
    
    1141
    -            first_index = fi;
    
    1142
    -            last_index  = li;
    
    1145
    +            first_index = fi < 0 ? 0 : fi;
    
    1146
    +            last_index  = li < 0 ? 0 : li;
    
    1143 1147
               }
    
    1144 1148
             }
    
    1145 1149
             break;
    
    ... ... @@ -1238,11 +1242,11 @@
    1238 1242
         if ( get_face( &face ) )
    
    1239 1243
           goto Exit;
    
    1240 1244
     
    
    1241
    -    if ( first_index >= (unsigned int)face->num_glyphs )
    
    1242
    -      first_index = (unsigned int)face->num_glyphs - 1;
    
    1243
    -    if ( last_index  >= (unsigned int)face->num_glyphs )
    
    1244
    -      last_index  = (unsigned int)face->num_glyphs - 1;
    
    1245
    -    incr_index  = last_index > first_index ? 1 : -1;
    
    1245
    +    if ( first_index >= face->num_glyphs )
    
    1246
    +      first_index = face->num_glyphs - 1;
    
    1247
    +    if ( last_index >= face->num_glyphs )
    
    1248
    +      last_index = face->num_glyphs - 1;
    
    1249
    +    incr_index = last_index > first_index ? 1 : -1;
    
    1246 1250
     
    
    1247 1251
         if ( size )
    
    1248 1252
         {
    
    ... ... @@ -1300,7 +1304,7 @@
    1300 1304
                  max_time );
    
    1301 1305
     
    
    1302 1306
         printf( "\n"
    
    1303
    -            "glyph indices: from %u to %u\n"
    
    1307
    +            "glyph indices: from %d to %d\n"
    
    1304 1308
                 "face size: %uppem\n"
    
    1305 1309
                 "font preloading into memory: %s\n",
    
    1306 1310
                 first_index,
    

  • src/ftcommon.c
    ... ... @@ -466,7 +466,7 @@
    466 466
     
    
    467 467
         for ( ; count--; spans++ )
    
    468 468
           for ( dst = dst_line + spans->x, w = spans->len; w--; dst++ )
    
    469
    -        *dst = ( spans->coverage << 24 ) | color;
    
    469
    +        *dst = (FT_UInt32)( spans->coverage << 24 ) | color;
    
    470 470
       }
    
    471 471
     
    
    472 472
     
    
    ... ... @@ -1172,7 +1172,7 @@
    1172 1172
         strbuf_reset( buf );
    
    1173 1173
         FTDemo_Get_Info( handle, buf );
    
    1174 1174
         grWriteCellString( display->bitmap,
    
    1175
    -                       display->bitmap->width - 8 * strbuf_len( buf ),
    
    1175
    +                       display->bitmap->width - 8 * (int)strbuf_len( buf ),
    
    1176 1176
                            line * HEADER_HEIGHT,
    
    1177 1177
                            strbuf_value( buf ), display->fore_color );
    
    1178 1178
     
    

  • src/ftdump.c
    ... ... @@ -149,8 +149,8 @@
    149 149
         if ( head )
    
    150 150
         {
    
    151 151
           char    buf[11];
    
    152
    -      time_t  created  = head->Created [1];
    
    153
    -      time_t  modified = head->Modified[1];
    
    152
    +      time_t  created  = (time_t)head->Created [1];
    
    153
    +      time_t  modified = (time_t)head->Modified[1];
    
    154 154
     
    
    155 155
     
    
    156 156
           /* ignore most of upper bits until 2176 and adjust epoch */
    
    ... ... @@ -536,8 +536,8 @@
    536 536
           else if ( !FT_Get_BDF_Charset_ID( face, &encoding, &registry ) )
    
    537 537
             printf( ", charset %s-%s", registry, encoding );
    
    538 538
           else if ( !FT_Get_WinFNT_Header( face, &header ) )
    
    539
    -        printf( header.charset < 10 ? ", charset %hu"
    
    540
    -                                    : ", charset %hu <%hX>",
    
    539
    +        printf( header.charset < 10 ? ", charset %hhu"
    
    540
    +                                    : ", charset %hhu <%hhX>",
    
    541 541
                     header.charset, header.charset );
    
    542 542
     
    
    543 543
           printf ( "\n" );
    
    ... ... @@ -566,7 +566,7 @@
    566 566
           }
    
    567 567
           else if ( coverage == 1 )
    
    568 568
           {
    
    569
    -        FT_ULong  next, last = ~1;
    
    569
    +        FT_ULong  next, last = ~1U;
    
    570 570
             FT_UInt   gindex;
    
    571 571
     
    
    572 572
             const char*  f1 = "";
    

  • src/ftgrid.c
    ... ... @@ -1053,7 +1053,7 @@
    1053 1053
     
    
    1054 1054
         /* The floating scale is reversibly adjusted after decomposing it into */
    
    1055 1055
         /* fraction and exponent. Direct bit manipulation is less portable.    */
    
    1056
    -    frc = 8 * frexpf( status.scale, &exp );
    
    1056
    +    frc = (int)( 8 * frexpf( status.scale, &exp ) );
    
    1057 1057
     
    
    1058 1058
         frc  = ( frc & 3 ) | ( exp << 2 );
    
    1059 1059
         frc += step;
    

  • src/ftlint.c
    ... ... @@ -97,14 +97,16 @@
    97 97
           for ( d0 = d1 = 0, j = 0; j < bitmap->width; j++, b++ )
    
    98 98
           {
    
    99 99
             d1 -= *b;
    
    100
    -        s2 += d1 >= d0 ? d1 - d0 : d0 - d1;  /* second derivative sum */
    
    101
    -        s1 += d1 >= 0 ? d1 : -d1;            /*  first derivative sum */
    
    100
    +        /* second derivative sum */
    
    101
    +        s2 += (unsigned long)( d1 >= d0 ? d1 - d0 : d0 - d1 );
    
    102
    +        /*  first derivative sum */
    
    103
    +        s1 += (unsigned long)( d1 >= 0 ? d1 : -d1 );
    
    102 104
             d0  = d1;
    
    103 105
             d1  = *b;
    
    104 106
           }
    
    105
    -      s2 += d1 > d0 ? d1 - d0 : d0 - d1;
    
    106
    -      s2 += d1;
    
    107
    -      s1 += d1;
    
    107
    +      s2 += (unsigned long)( d1 > d0 ? d1 - d0 : d0 - d1 );
    
    108
    +      s2 += (unsigned long)d1;
    
    109
    +      s1 += (unsigned long)d1;
    
    108 110
         }
    
    109 111
     
    
    110 112
         printf( "%.4lf ", s1 ? (double)s2 / s1 : 2.0 );
    
    ... ... @@ -116,14 +118,16 @@
    116 118
           for ( d0 = d1 = 0, i = 0; i < bitmap->rows; i++, b += bitmap->pitch )
    
    117 119
           {
    
    118 120
             d1 -= *b;
    
    119
    -        s2 += d1 >= d0 ? d1 - d0 : d0 - d1;  /* second derivative sum */
    
    120
    -        s1 += d1 >= 0 ? d1 : -d1;            /*  first derivative sum */
    
    121
    +        /* second derivative sum */
    
    122
    +        s2 += (unsigned long)( d1 >= d0 ? d1 - d0 : d0 - d1 );
    
    123
    +        /*  first derivative sum */
    
    124
    +        s1 += (unsigned long)( d1 >= 0 ? d1 : -d1 );
    
    121 125
             d0  = d1;
    
    122 126
             d1  = *b;
    
    123 127
           }
    
    124
    -      s2 += d1 > d0 ? d1 - d0 : d0 - d1;
    
    125
    -      s2 += d1;
    
    126
    -      s1 += d1;
    
    128
    +      s2 += (unsigned long)( d1 > d0 ? d1 - d0 : d0 - d1 );
    
    129
    +      s2 += (unsigned long)d1;
    
    130
    +      s1 += (unsigned long)d1;
    
    127 131
         }
    
    128 132
     
    
    129 133
         printf( "%.4lf ", s1 ? (double)s2 / s1 : 2.0 );
    

  • src/ftmulti.c
    ... ... @@ -261,7 +261,7 @@
    261 261
             }
    
    262 262
           }
    
    263 263
     
    
    264
    -      num_shown_axes = idx + 1;
    
    264
    +      num_shown_axes = (unsigned int)( idx + 1 );
    
    265 265
         }
    
    266 266
         else
    
    267 267
         {
    
    ... ... @@ -270,7 +270,7 @@
    270 270
     
    
    271 271
           /* show all axes */
    
    272 272
           for ( i = 0; i < used_num_axis; i++ )
    
    273
    -        shown_axes[i] = i;
    
    273
    +        shown_axes[i] = (int)i;
    
    274 274
     
    
    275 275
           num_shown_axes = used_num_axis;
    
    276 276
         }
    
    ... ... @@ -282,7 +282,8 @@
    282 282
       Clear_Display( void )
    
    283 283
       {
    
    284 284
         memset( bit->buffer, 0, (size_t)bit->rows *
    
    285
    -                            ( bit->pitch < 0 ? -bit->pitch : bit->pitch ) );
    
    285
    +                            (size_t)( bit->pitch < 0 ? -bit->pitch
    
    286
    +                                                     : bit->pitch ) );
    
    286 287
       }
    
    287 288
     
    
    288 289
     
    

  • src/ftpngout.c
    ... ... @@ -84,7 +84,8 @@
    84 84
         png_init_io( png_ptr, fp );
    
    85 85
     
    
    86 86
         /* Write header (8 bit colour depth) */
    
    87
    -    png_set_IHDR( png_ptr, info_ptr, width, height,
    
    87
    +    png_set_IHDR( png_ptr, info_ptr,
    
    88
    +                  (png_uint_32)width, (png_uint_32)height,
    
    88 89
                       8, color_type, PNG_INTERLACE_NONE,
    
    89 90
                       PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE );
    
    90 91
     
    

  • src/ftsdf.c
    1
    +/****************************************************************************/
    
    2
    +/*                                                                          */
    
    3
    +/*  The FreeType project -- a free and portable quality TrueType renderer.  */
    
    4
    +/*                                                                          */
    
    5
    +/*  Copyright (C) 2021 by                                                   */
    
    6
    +/*  D. Turner, R.Wilhelm, W. Lemberg, and Anuj Verma                        */
    
    7
    +/*                                                                          */
    
    8
    +/*                                                                          */
    
    9
    +/*  FTSdf - a simple font viewer for FreeType's SDF output.                 */
    
    10
    +/*                                                                          */
    
    11
    +/*  Press ? when running this program to have a list of key-bindings.       */
    
    12
    +/*                                                                          */
    
    13
    +/****************************************************************************/
    
    14
    +
    
    1 15
     
    
    2 16
     #include <freetype/ftmodapi.h>
    
    3 17
     
    
    ... ... @@ -31,7 +45,7 @@
    31 45
         FT_Face  face;
    
    32 46
         FT_Int   ptsize;
    
    33 47
         FT_Int   glyph_index;
    
    34
    -    FT_Int   scale;
    
    48
    +    FT_UInt  scale;
    
    35 49
         FT_Int   spread;
    
    36 50
         FT_Int   x_offset;
    
    37 51
         FT_Int   y_offset;
    
    ... ... @@ -89,8 +103,8 @@
    89 103
                                   &status.overlaps ) );
    
    90 104
     
    
    91 105
         /* Set pixel size and load the glyph index. */
    
    92
    -    FT_CALL( FT_Set_Pixel_Sizes( status.face, 0, status.ptsize ) );
    
    93
    -    FT_CALL( FT_Load_Glyph( status.face, status.glyph_index,
    
    106
    +    FT_CALL( FT_Set_Pixel_Sizes( status.face, 0, (FT_UInt)status.ptsize ) );
    
    107
    +    FT_CALL( FT_Load_Glyph( status.face, (FT_UInt)status.glyph_index,
    
    94 108
                                 FT_LOAD_DEFAULT ) );
    
    95 109
     
    
    96 110
         /* This is just to measure the generation time. */
    
    ... ... @@ -209,7 +223,7 @@
    209 223
     
    
    210 224
     
    
    211 225
         sprintf( header_string,
    
    212
    -             "Glyph Index: %d, Pt Size: %d, Spread: %d, Scale: %d",
    
    226
    +             "Glyph Index: %d, Pt Size: %d, Spread: %d, Scale: %u",
    
    213 227
                  status.glyph_index,
    
    214 228
                  status.ptsize,
    
    215 229
                  status.spread,
    
    ... ... @@ -258,7 +272,7 @@
    258 272
         grEvent  event;
    
    259 273
     
    
    260 274
         int  ret   = 0;
    
    261
    -    int  speed = 10 * status.scale;
    
    275
    +    int  speed = 10 * (int)status.scale;
    
    262 276
     
    
    263 277
     
    
    264 278
         grListenSurface( display->surface, 0, &event );
    
    ... ... @@ -393,7 +407,7 @@
    393 407
     
    
    394 408
     
    
    395 409
       /* Clamp value `x` between `lower_limit` and `upper_limit`. */
    
    396
    -  float
    
    410
    +  static float
    
    397 411
       clamp( float  x,
    
    398 412
              float  lower_limit,
    
    399 413
              float  upper_limit )
    
    ... ... @@ -413,7 +427,7 @@
    413 427
       /* This implementation is taken from Wikipedia.                     */
    
    414 428
       /*                                                                  */
    
    415 429
       /*   https://en.wikipedia.org/wiki/Smoothstep                       */
    
    416
    -  float
    
    430
    +  static float
    
    417 431
       smoothstep( float  edge0,
    
    418 432
                   float  edge1,
    
    419 433
                   float  x )
    
    ... ... @@ -456,10 +470,10 @@
    456 470
         center.y = display->bitmap->rows  / 2;
    
    457 471
     
    
    458 472
         /* compute draw region around `center` */
    
    459
    -    draw_region.xMin = center.x - ( bitmap->width * status.scale) / 2;
    
    460
    -    draw_region.xMax = center.x + ( bitmap->width * status.scale) / 2;
    
    461
    -    draw_region.yMin = center.y - ( bitmap->rows  * status.scale) / 2;
    
    462
    -    draw_region.yMax = center.y + ( bitmap->rows  * status.scale) / 2;
    
    473
    +    draw_region.xMin = center.x - ( bitmap->width * status.scale ) / 2;
    
    474
    +    draw_region.xMax = center.x + ( bitmap->width * status.scale ) / 2;
    
    475
    +    draw_region.yMin = center.y - ( bitmap->rows  * status.scale ) / 2;
    
    476
    +    draw_region.yMax = center.y + ( bitmap->rows  * status.scale ) / 2;
    
    463 477
     
    
    464 478
         /* add position offset so that we can move the image */
    
    465 479
         draw_region.xMin += status.x_offset;
    
    ... ... @@ -509,23 +523,25 @@
    509 523
     
    
    510 524
         /* Finally loop over all pixels inside the draw region        */
    
    511 525
         /* and copy pixels from the sample region to the draw region. */
    
    512
    -    for ( FT_Int  j = draw_region.yMax - 1, y = sample_region.yMin;
    
    526
    +    for ( FT_UInt  j = (FT_UInt)( draw_region.yMax - 1 ),
    
    527
    +                   y = (FT_UInt)sample_region.yMin;
    
    513 528
               j >= draw_region.yMin;
    
    514 529
               j--, y++ )
    
    515 530
         {
    
    516
    -      for ( FT_Int  i = draw_region.xMin, x = sample_region.xMin;
    
    531
    +      for ( FT_UInt  i = (FT_UInt)draw_region.xMin,
    
    532
    +                     x = (FT_UInt)sample_region.xMin;
    
    517 533
                 i < draw_region.xMax;
    
    518 534
                 i++, x++ )
    
    519 535
           {
    
    520
    -        FT_UInt  display_index = j * display->bitmap->width + i;
    
    536
    +        FT_UInt  display_index = j * (FT_UInt)display->bitmap->width + i;
    
    521 537
             float    min_dist;
    
    522 538
     
    
    523 539
     
    
    524 540
             if ( status.nearest_filtering )
    
    525 541
             {
    
    526 542
               FT_UInt  bitmap_index = ( y / status.scale ) * bitmap->width +
    
    527
    -                                    x / status.scale;
    
    528
    -          FT_Byte  pixel_value  = buffer[bitmap_index];
    
    543
    +                                  x / status.scale;
    
    544
    +          FT_Byte  pixel_value = buffer[bitmap_index];
    
    529 545
     
    
    530 546
     
    
    531 547
               /* If nearest filtering then simply take the value of the */
    

  • src/ftstring.c
    ... ... @@ -217,7 +217,7 @@
    217 217
     
    
    218 218
         outline = &((FT_OutlineGlyph)*glyph)->outline;
    
    219 219
     
    
    220
    -    FT_Outline_New( handle->library, points, contours, outline );
    
    220
    +    FT_Outline_New( handle->library, points, (FT_Int)contours, outline );
    
    221 221
         outline->n_points = outline->n_contours = 0;
    
    222 222
     
    
    223 223
         FT_Stroker_Export( handle->stroker, outline );
    

  • src/ftview.c
    ... ... @@ -430,7 +430,7 @@
    430 430
         slot = face->glyph;
    
    431 431
     
    
    432 432
         error = FT_Palette_Select( face,
    
    433
    -                               handle->current_font->palette_index,
    
    433
    +                               (FT_UShort)handle->current_font->palette_index,
    
    434 434
                                    &palette );
    
    435 435
         if ( error )
    
    436 436
           palette = NULL;
    

  • src/strbuf.c
    ... ... @@ -171,9 +171,9 @@
    171 171
           return (int)available;
    
    172 172
         }
    
    173 173
     
    
    174
    -    sb->pos += ret;
    
    174
    +    sb->pos += (unsigned)ret;
    
    175 175
     
    
    176
    -    return (int)ret;
    
    176
    +    return ret;
    
    177 177
       }
    
    178 178
     
    
    179 179
     
    


  • reply via email to

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