freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 2 commits: * src/cff/cffparse.c (cff_pa


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 2 commits: * src/cff/cffparse.c (cff_parser_run): Fix variable type.
Date: Sun, 05 Mar 2023 04:53:57 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 51c17054
    by Alexei Podtelezhnikov at 2023-03-04T23:32:50-05:00
    * src/cff/cffparse.c (cff_parser_run): Fix variable type.
    
  • de600220
    by Alexei Podtelezhnikov at 2023-03-04T23:49:49-05:00
    [cff] Clean up CharString number encoding.
    
    * src/cff/cffparser.c (cff_parser_run): Work with signed numbers.
    

1 changed file:

Changes:

  • src/cff/cffparse.c
    ... ... @@ -1267,7 +1267,7 @@
    1267 1267
             FT_Fixed*      stack;
    
    1268 1268
             FT_ListNode    node;
    
    1269 1269
             CFF_T2_String  t2;
    
    1270
    -        FT_Fixed       t2_size;
    
    1270
    +        FT_PtrDist     t2_size;
    
    1271 1271
             FT_Byte*       q;
    
    1272 1272
     
    
    1273 1273
     
    
    ... ... @@ -1334,8 +1334,7 @@
    1334 1334
     
    
    1335 1335
             while ( stack < decoder.top )
    
    1336 1336
             {
    
    1337
    -          FT_ULong  num;
    
    1338
    -          FT_Bool   neg;
    
    1337
    +          FT_Long  num = *stack;
    
    1339 1338
     
    
    1340 1339
     
    
    1341 1340
               if ( (FT_UInt)( parser->top - parser->stack ) >= parser->stackSize )
    
    ... ... @@ -1343,65 +1342,35 @@
    1343 1342
     
    
    1344 1343
               *parser->top++ = q;
    
    1345 1344
     
    
    1346
    -          if ( *stack < 0 )
    
    1347
    -          {
    
    1348
    -            num = (FT_ULong)NEG_LONG( *stack );
    
    1349
    -            neg = 1;
    
    1350
    -          }
    
    1351
    -          else
    
    1352
    -          {
    
    1353
    -            num = (FT_ULong)*stack;
    
    1354
    -            neg = 0;
    
    1355
    -          }
    
    1356
    -
    
    1357 1345
               if ( num & 0xFFFFU )
    
    1358 1346
               {
    
    1359
    -            if ( neg )
    
    1360
    -              num = (FT_ULong)-num;
    
    1361
    -
    
    1362 1347
                 *q++ = 255;
    
    1363
    -            *q++ = ( num & 0xFF000000U ) >> 24;
    
    1364
    -            *q++ = ( num & 0x00FF0000U ) >> 16;
    
    1365
    -            *q++ = ( num & 0x0000FF00U ) >>  8;
    
    1366
    -            *q++ =   num & 0x000000FFU;
    
    1348
    +            *q++ = (FT_Byte)( ( num >> 24 ) & 0xFF );
    
    1349
    +            *q++ = (FT_Byte)( ( num >> 16 ) & 0xFF );
    
    1350
    +            *q++ = (FT_Byte)( ( num >>  8 ) & 0xFF );
    
    1351
    +            *q++ = (FT_Byte)( ( num       ) & 0xFF );
    
    1367 1352
               }
    
    1368 1353
               else
    
    1369 1354
               {
    
    1370 1355
                 num >>= 16;
    
    1371 1356
     
    
    1372
    -            if ( neg )
    
    1357
    +            if ( -107 <= num && num <= 107 )
    
    1358
    +              *q++ = (FT_Byte)( num + 139 );
    
    1359
    +            else if ( 108 <= num && num <= 1131 )
    
    1373 1360
                 {
    
    1374
    -              if ( num <= 107 )
    
    1375
    -                *q++ = (FT_Byte)( 139 - num );
    
    1376
    -              else if ( num <= 1131 )
    
    1377
    -              {
    
    1378
    -                *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 251 );
    
    1379
    -                *q++ = (FT_Byte)( ( num - 108 ) & 0xFF );
    
    1380
    -              }
    
    1381
    -              else
    
    1382
    -              {
    
    1383
    -                num = (FT_ULong)-num;
    
    1384
    -
    
    1385
    -                *q++ = 28;
    
    1386
    -                *q++ = (FT_Byte)( num >> 8 );
    
    1387
    -                *q++ = (FT_Byte)( num & 0xFF );
    
    1388
    -              }
    
    1361
    +              *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 247 );
    
    1362
    +              *q++ = (FT_Byte)( ( num - 108 ) & 0xFF );
    
    1363
    +            }
    
    1364
    +            else if ( -1131 <= num && num <= -108 )
    
    1365
    +            {
    
    1366
    +              *q++ = (FT_Byte)( ( ( 108 - num ) >> 8 ) + 251 );
    
    1367
    +              *q++ = (FT_Byte)( ( 108 - num ) & 0xFF );
    
    1389 1368
                 }
    
    1390 1369
                 else
    
    1391 1370
                 {
    
    1392
    -              if ( num <= 107 )
    
    1393
    -                *q++ = (FT_Byte)( num + 139 );
    
    1394
    -              else if ( num <= 1131 )
    
    1395
    -              {
    
    1396
    -                *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 247 );
    
    1397
    -                *q++ = (FT_Byte)( ( num - 108 ) & 0xFF );
    
    1398
    -              }
    
    1399
    -              else
    
    1400
    -              {
    
    1401
    -                *q++ = 28;
    
    1402
    -                *q++ = (FT_Byte)( num >> 8 );
    
    1403
    -                *q++ = (FT_Byte)( num & 0xFF );
    
    1404
    -              }
    
    1371
    +              *q++ = 28;
    
    1372
    +              *q++ = (FT_Byte)( num >> 8 );
    
    1373
    +              *q++ = (FT_Byte)( num & 0xFF );
    
    1405 1374
                 }
    
    1406 1375
               }
    
    1407 1376
     
    


  • reply via email to

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