freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [type1, cid, type42] Post-cleanup.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [type1, cid, type42] Post-cleanup.
Date: Sun, 10 Sep 2023 02:25:15 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 8d0897b3
    by Alexei Podtelezhnikov at 2023-09-09T22:20:00-04:00
    [type1, cid, type42] Post-cleanup.
    
    * include/freetype/internal/psaux.h (T1_FIELD_ZERO): Terminating macro.
    * src/cid/cidload.c (cid_parse_dict): Use while-loop.
    * src/type1/t1load.c (parse_dict): Ditto.
    * src/type42/t42parse.c (t42_parse_dict): Ditto.
    

4 changed files:

Changes:

  • include/freetype/internal/psaux.h
    ... ... @@ -276,7 +276,7 @@ FT_BEGIN_HEADER
    276 276
               {                                                 \
    
    277 277
                 sizeof ( _ident ) - 1,                          \
    
    278 278
                 _ident, T1CODE, _type,                          \
    
    279
    -            0,                                              \
    
    279
    +            NULL,                                           \
    
    280 280
                 FT_FIELD_OFFSET( _fname ),                      \
    
    281 281
                 FT_FIELD_SIZE( _fname ),                        \
    
    282 282
                 0, 0,                                           \
    
    ... ... @@ -297,7 +297,7 @@ FT_BEGIN_HEADER
    297 297
               {                                                      \
    
    298 298
                 sizeof ( _ident ) - 1,                               \
    
    299 299
                 _ident, T1CODE, _type,                               \
    
    300
    -            0,                                                   \
    
    300
    +            NULL,                                                \
    
    301 301
                 FT_FIELD_OFFSET( _fname ),                           \
    
    302 302
                 FT_FIELD_SIZE_DELTA( _fname ),                       \
    
    303 303
                 _max,                                                \
    
    ... ... @@ -309,7 +309,7 @@ FT_BEGIN_HEADER
    309 309
               {                                                       \
    
    310 310
                 sizeof ( _ident ) - 1,                                \
    
    311 311
                 _ident, T1CODE, _type,                                \
    
    312
    -            0,                                                    \
    
    312
    +            NULL,                                                 \
    
    313 313
                 FT_FIELD_OFFSET( _fname ),                            \
    
    314 314
                 FT_FIELD_SIZE_DELTA( _fname ),                        \
    
    315 315
                 _max, 0,                                              \
    
    ... ... @@ -359,6 +359,8 @@ FT_BEGIN_HEADER
    359 359
     #define T1_FIELD_CALLBACK( _ident, _name, _dict )       \
    
    360 360
               T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
    
    361 361
     
    
    362
    +#define T1_FIELD_ZERO  { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 }
    
    363
    +
    
    362 364
     
    
    363 365
       /*************************************************************************/
    
    364 366
       /*************************************************************************/
    

  • src/cid/cidload.c
    ... ... @@ -388,7 +388,7 @@
    388 388
         T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
    
    389 389
         T1_FIELD_CALLBACK( "FontName",        parse_font_name, 0 )
    
    390 390
     
    
    391
    -    { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 }
    
    391
    +    T1_FIELD_ZERO
    
    392 392
       };
    
    393 393
     
    
    394 394
     
    
    ... ... @@ -469,15 +469,11 @@
    469 469
                 T1_Field  keyword = (T1_Field)cid_field_records;
    
    470 470
     
    
    471 471
     
    
    472
    -            for (;;)
    
    472
    +            while ( keyword->len )
    
    473 473
                 {
    
    474
    -              FT_Byte*  name;
    
    474
    +              FT_Byte*  name = (FT_Byte*)keyword->ident;
    
    475 475
     
    
    476 476
     
    
    477
    -              name = (FT_Byte*)keyword->ident;
    
    478
    -              if ( !name )
    
    479
    -                break;
    
    480
    -
    
    481 477
                   if ( keyword->len == len              &&
    
    482 478
                        ft_memcmp( cur, name, len ) == 0 )
    
    483 479
                   {
    
    ... ... @@ -489,6 +485,7 @@
    489 485
                       return parser->root.error;
    
    490 486
                     break;
    
    491 487
                   }
    
    488
    +
    
    492 489
                   keyword++;
    
    493 490
                 }
    
    494 491
               }
    

  • src/type1/t1load.c
    ... ... @@ -2284,7 +2284,7 @@
    2284 2284
                            T1_FIELD_DICT_PRIVATE )
    
    2285 2285
     #endif
    
    2286 2286
     
    
    2287
    -    { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 }
    
    2287
    +    T1_FIELD_ZERO
    
    2288 2288
       };
    
    2289 2289
     
    
    2290 2290
     
    
    ... ... @@ -2392,15 +2392,11 @@
    2392 2392
               T1_Field  keyword = (T1_Field)t1_keywords;
    
    2393 2393
     
    
    2394 2394
     
    
    2395
    -          for (;;)
    
    2395
    +          while ( keyword->len )
    
    2396 2396
               {
    
    2397
    -            FT_Byte*  name;
    
    2397
    +            FT_Byte*  name = (FT_Byte*)keyword->ident;
    
    2398 2398
     
    
    2399 2399
     
    
    2400
    -            name = (FT_Byte*)keyword->ident;
    
    2401
    -            if ( !name )
    
    2402
    -              break;
    
    2403
    -
    
    2404 2400
                 if ( keyword->len == len              &&
    
    2405 2401
                      ft_memcmp( cur, name, len ) == 0 )
    
    2406 2402
                 {
    

  • src/type42/t42parse.c
    ... ... @@ -99,7 +99,7 @@
    99 99
         T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings, 0 )
    
    100 100
         T1_FIELD_CALLBACK( "sfnts",       t42_parse_sfnts,       0 )
    
    101 101
     
    
    102
    -    { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 }
    
    102
    +    T1_FIELD_ZERO
    
    103 103
       };
    
    104 104
     
    
    105 105
     
    
    ... ... @@ -1195,8 +1195,6 @@
    1195 1195
       {
    
    1196 1196
         T42_Parser  parser     = &loader->parser;
    
    1197 1197
         FT_Byte*    limit;
    
    1198
    -    FT_Int      n_keywords = (FT_Int)( sizeof ( t42_keywords ) /
    
    1199
    -                                         sizeof ( t42_keywords[0] ) );
    
    1200 1198
     
    
    1201 1199
     
    
    1202 1200
         parser->root.cursor = base;
    
    ... ... @@ -1273,16 +1271,13 @@
    1273 1271
     
    
    1274 1272
             if ( len > 0 && len < 22 && parser->root.cursor < limit )
    
    1275 1273
             {
    
    1276
    -          int  i;
    
    1274
    +          T1_Field  keyword = (T1_Field)t42_keywords;
    
    1277 1275
     
    
    1278 1276
     
    
    1279 1277
               /* now compare the immediate name to the keyword table */
    
    1280
    -
    
    1281
    -          /* loop through all known keywords */
    
    1282
    -          for ( i = 0; i < n_keywords; i++ )
    
    1278
    +          while ( keyword->len )
    
    1283 1279
               {
    
    1284
    -            T1_Field  keyword = (T1_Field)&t42_keywords[i];
    
    1285
    -            FT_Byte   *name   = (FT_Byte*)keyword->ident;
    
    1280
    +            FT_Byte*  name = (FT_Byte*)keyword->ident;
    
    1286 1281
     
    
    1287 1282
     
    
    1288 1283
                 if ( !name )
    
    ... ... @@ -1299,6 +1294,8 @@
    1299 1294
                     return parser->root.error;
    
    1300 1295
                   break;
    
    1301 1296
                 }
    
    1297
    +
    
    1298
    +            keyword++;
    
    1302 1299
               }
    
    1303 1300
             }
    
    1304 1301
           }
    


  • reply via email to

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