freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 3 commits: * tests/issue-1063/main.c: s


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 3 commits: * tests/issue-1063/main.c: s/PATH_MAX/FILENAME_MAX/.
Date: Wed, 20 Oct 2021 15:54:41 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • src/sfnt/ttload.c
    ... ... @@ -837,6 +837,8 @@
    837 837
         FT_ULong      table_pos, table_len;
    
    838 838
         FT_ULong      storage_start, storage_limit;
    
    839 839
         TT_NameTable  table;
    
    840
    +    TT_Name       names = NULL;
    
    841
    +    TT_LangTag    langTags = NULL;
    
    840 842
     
    
    841 843
         static const FT_Frame_Field  name_table_fields[] =
    
    842 844
         {
    
    ... ... @@ -917,13 +919,13 @@
    917 919
           storage_start += 2 + 4 * table->numLangTagRecords;
    
    918 920
     
    
    919 921
           /* allocate language tag records array */
    
    920
    -      if ( FT_QNEW_ARRAY( table->langTags, table->numLangTagRecords ) ||
    
    921
    -           FT_FRAME_ENTER( table->numLangTagRecords * 4 )             )
    
    922
    +      if ( FT_QNEW_ARRAY( langTags, table->numLangTagRecords ) ||
    
    923
    +           FT_FRAME_ENTER( table->numLangTagRecords * 4 )      )
    
    922 924
             goto Exit;
    
    923 925
     
    
    924 926
           /* load language tags */
    
    925 927
           {
    
    926
    -        TT_LangTag  entry = table->langTags;
    
    928
    +        TT_LangTag  entry = langTags;
    
    927 929
             TT_LangTag  limit = FT_OFFSET( entry, table->numLangTagRecords );
    
    928 930
     
    
    929 931
     
    
    ... ... @@ -943,6 +945,9 @@
    943 945
               /* mark the string as not yet loaded */
    
    944 946
               entry->string = NULL;
    
    945 947
             }
    
    948
    +
    
    949
    +        table->langTags = langTags;
    
    950
    +        langTags = NULL;
    
    946 951
           }
    
    947 952
     
    
    948 953
           FT_FRAME_EXIT();
    
    ... ... @@ -951,13 +956,13 @@
    951 956
         }
    
    952 957
     
    
    953 958
         /* allocate name records array */
    
    954
    -    if ( FT_QNEW_ARRAY( table->names, table->numNameRecords ) ||
    
    955
    -         FT_FRAME_ENTER( table->numNameRecords * 12 )         )
    
    959
    +    if ( FT_QNEW_ARRAY( names, table->numNameRecords ) ||
    
    960
    +         FT_FRAME_ENTER( table->numNameRecords * 12 )  )
    
    956 961
           goto Exit;
    
    957 962
     
    
    958 963
         /* load name records */
    
    959 964
         {
    
    960
    -      TT_Name  entry = table->names;
    
    965
    +      TT_Name  entry = names;
    
    961 966
           FT_UInt  count = table->numNameRecords;
    
    962 967
           FT_UInt  valid = 0;
    
    963 968
     
    
    ... ... @@ -1000,9 +1005,11 @@
    1000 1005
           }
    
    1001 1006
     
    
    1002 1007
           /* reduce array size to the actually used elements */
    
    1003
    -      FT_MEM_QRENEW_ARRAY( table->names,
    
    1008
    +      FT_MEM_QRENEW_ARRAY( names,
    
    1004 1009
                                table->numNameRecords,
    
    1005 1010
                                valid );
    
    1011
    +      table->names = names;
    
    1012
    +      names = NULL;
    
    1006 1013
           table->numNameRecords = valid;
    
    1007 1014
         }
    
    1008 1015
     
    
    ... ... @@ -1012,6 +1019,8 @@
    1012 1019
         face->num_names = (FT_UShort)table->numNameRecords;
    
    1013 1020
     
    
    1014 1021
       Exit:
    
    1022
    +    FT_FREE( names );
    
    1023
    +    FT_FREE( langTags );
    
    1015 1024
         return error;
    
    1016 1025
       }
    
    1017 1026
     
    
    ... ... @@ -1425,7 +1434,7 @@
    1425 1434
         FT_Memory  memory = stream->memory;
    
    1426 1435
     
    
    1427 1436
         FT_UInt        j,num_ranges;
    
    1428
    -    TT_GaspRange   gaspranges = NULL;
    
    1437
    +    TT_GaspRange   gasp_ranges = NULL;
    
    1429 1438
     
    
    1430 1439
     
    
    1431 1440
         /* the gasp table is optional */
    
    ... ... @@ -1436,8 +1445,8 @@
    1436 1445
         if ( FT_FRAME_ENTER( 4L ) )
    
    1437 1446
           goto Exit;
    
    1438 1447
     
    
    1439
    -    face->gasp.version   = FT_GET_USHORT();
    
    1440
    -    face->gasp.numRanges = FT_GET_USHORT();
    
    1448
    +    face->gasp.version = FT_GET_USHORT();
    
    1449
    +    num_ranges         = FT_GET_USHORT();
    
    1441 1450
     
    
    1442 1451
         FT_FRAME_EXIT();
    
    1443 1452
     
    
    ... ... @@ -1449,29 +1458,31 @@
    1449 1458
           goto Exit;
    
    1450 1459
         }
    
    1451 1460
     
    
    1452
    -    num_ranges = face->gasp.numRanges;
    
    1453 1461
         FT_TRACE3(( "numRanges: %u\n", num_ranges ));
    
    1454 1462
     
    
    1455
    -    if ( FT_QNEW_ARRAY( face->gasp.gaspRanges, num_ranges ) ||
    
    1456
    -         FT_FRAME_ENTER( num_ranges * 4L )                  )
    
    1463
    +    if ( FT_QNEW_ARRAY( gasp_ranges, num_ranges ) ||
    
    1464
    +         FT_FRAME_ENTER( num_ranges * 4L )        )
    
    1457 1465
           goto Exit;
    
    1458 1466
     
    
    1459
    -    gaspranges = face->gasp.gaspRanges;
    
    1460
    -
    
    1461 1467
         for ( j = 0; j < num_ranges; j++ )
    
    1462 1468
         {
    
    1463
    -      gaspranges[j].maxPPEM  = FT_GET_USHORT();
    
    1464
    -      gaspranges[j].gaspFlag = FT_GET_USHORT();
    
    1469
    +      gasp_ranges[j].maxPPEM  = FT_GET_USHORT();
    
    1470
    +      gasp_ranges[j].gaspFlag = FT_GET_USHORT();
    
    1465 1471
     
    
    1466 1472
           FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\n",
    
    1467 1473
                       j,
    
    1468
    -                  gaspranges[j].maxPPEM,
    
    1469
    -                  gaspranges[j].gaspFlag ));
    
    1474
    +                  gasp_ranges[j].maxPPEM,
    
    1475
    +                  gasp_ranges[j].gaspFlag ));
    
    1470 1476
         }
    
    1471 1477
     
    
    1478
    +    face->gasp.gaspRanges = gasp_ranges;
    
    1479
    +    gasp_ranges = NULL;
    
    1480
    +    face->gasp.numRanges = num_ranges;
    
    1481
    +
    
    1472 1482
         FT_FRAME_EXIT();
    
    1473 1483
     
    
    1474 1484
       Exit:
    
    1485
    +    FT_FREE( gasp_ranges );
    
    1475 1486
         return error;
    
    1476 1487
       }
    
    1477 1488
     
    

  • tests/issue-1063/main.c
    1
    -#include <limits.h>
    
    2 1
     #include <stdio.h>
    
    3 2
     
    
    4 3
     #include <freetype/freetype.h>
    
    ... ... @@ -19,7 +18,7 @@ main( void )
    19 18
        * command-line.
    
    20 19
        */
    
    21 20
       const char*  testdata_dir = getenv( "FREETYPE_TESTS_DATA_DIR" );
    
    22
    -  char         filepath[PATH_MAX];
    
    21
    +  char         filepath[FILENAME_MAX];
    
    23 22
     
    
    24 23
     
    
    25 24
       snprintf( filepath, sizeof( filepath ), "%s/%s",
    


  • reply via email to

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