freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 3 commits: [truetype, type1] Use FT_DUP


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 3 commits: [truetype, type1] Use FT_DUP to duplicate data.
Date: Mon, 20 May 2024 03:07:00 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • d7cf931a
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-19T22:48:13-04:00
    [truetype, type1] Use FT_DUP to duplicate data.
    
    * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use concise FT_DUP.
    * src/truetype/ttgxvar.c (TT_Get_MM_Var): Ditto.
    * src/type1/t1load.c (parse_subrs): Ditto.
    
  • 026fd5d4
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-19T22:54:57-04:00
    [cache] Use FT_DUP to duplicate data.
    
    * src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Use concise FT_MEM_DUP.
    
  • b25265fe
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-19T22:58:23-04:00
    [bdf] Use concise macros.
    
    * src/bdf/bdflib.c (bdf_create_property): Use FT_STRDUP.
    (bdf_parse_glyphs_, bdf_parse_start_): Use FT_DUP for brevity.
    

5 changed files:

Changes:

  • src/bdf/bdflib.c
    ... ... @@ -864,15 +864,9 @@
    864 864
     
    
    865 865
         p = font->user_props + font->nuser_props;
    
    866 866
     
    
    867
    -    n = ft_strlen( name ) + 1;
    
    868
    -    if ( n > FT_LONG_MAX )
    
    869
    -      return FT_THROW( Invalid_Argument );
    
    870
    -
    
    871
    -    if ( FT_QALLOC( p->name, n ) )
    
    867
    +    if ( FT_STRDUP( p->name, name ) )
    
    872 868
           goto Exit;
    
    873 869
     
    
    874
    -    FT_MEM_COPY( (char *)p->name, name, n );
    
    875
    -
    
    876 870
         p->format     = format;
    
    877 871
         p->builtin    = 0;
    
    878 872
         p->value.atom = NULL;  /* nothing is ever stored here */
    
    ... ... @@ -1442,11 +1436,9 @@
    1442 1436
             goto Exit;
    
    1443 1437
           }
    
    1444 1438
     
    
    1445
    -      if ( FT_QALLOC( p->glyph_name, slen + 1 ) )
    
    1439
    +      if ( FT_DUP( p->glyph_name, s, slen + 1 ) )
    
    1446 1440
             goto Exit;
    
    1447 1441
     
    
    1448
    -      FT_MEM_COPY( p->glyph_name, s, slen + 1 );
    
    1449
    -
    
    1450 1442
           p->flags |= BDF_GLYPH_;
    
    1451 1443
     
    
    1452 1444
           FT_TRACE4(( DBGMSG1, lineno, s ));
    
    ... ... @@ -2051,9 +2043,8 @@
    2051 2043
           /* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */
    
    2052 2044
           FT_FREE( p->font->name );
    
    2053 2045
     
    
    2054
    -      if ( FT_QALLOC( p->font->name, slen + 1 ) )
    
    2046
    +      if ( FT_DUP( p->font->name, s, slen + 1 ) )
    
    2055 2047
             goto Exit;
    
    2056
    -      FT_MEM_COPY( p->font->name, s, slen + 1 );
    
    2057 2048
     
    
    2058 2049
           /* If the font name is an XLFD name, set the spacing to the one in  */
    
    2059 2050
           /* the font name.  If there is no spacing fall back on the default. */
    

  • src/cache/ftcsbits.c
    ... ... @@ -53,8 +53,7 @@
    53 53
     
    
    54 54
         size = (FT_ULong)pitch * bitmap->rows;
    
    55 55
     
    
    56
    -    if ( !FT_QALLOC( sbit->buffer, size ) )
    
    57
    -      FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );
    
    56
    +    FT_MEM_DUP( sbit->buffer, bitmap->buffer, size );
    
    58 57
     
    
    59 58
         return error;
    
    60 59
       }
    

  • src/truetype/ttgload.c
    ... ... @@ -418,11 +418,9 @@
    418 418
           /* and thus allocate the bytecode array size by ourselves     */
    
    419 419
           if ( n_ins )
    
    420 420
           {
    
    421
    -        if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) )
    
    421
    +        if ( FT_DUP( exec->glyphIns, p, n_ins ) )
    
    422 422
               return error;
    
    423 423
     
    
    424
    -        FT_MEM_COPY( exec->glyphIns, p, (FT_Long)n_ins );
    
    425
    -
    
    426 424
             exec->glyphSize  = n_ins;
    
    427 425
           }
    
    428 426
         }
    

  • src/truetype/ttgxvar.c
    ... ... @@ -2722,9 +2722,8 @@
    2722 2722
           FT_UInt  n;
    
    2723 2723
     
    
    2724 2724
     
    
    2725
    -      if ( FT_ALLOC( mmvar, ttface->blend->mmvar_len ) )
    
    2725
    +      if ( FT_DUP( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len ) )
    
    2726 2726
             goto Exit;
    
    2727
    -      FT_MEM_COPY( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len );
    
    2728 2727
     
    
    2729 2728
           axis_flags =
    
    2730 2729
             (FT_UShort*)( (char*)mmvar + mmvar_size );
    

  • src/type1/t1load.c
    ... ... @@ -1877,9 +1877,8 @@
    1877 1877
             }
    
    1878 1878
     
    
    1879 1879
             /* t1_decrypt() shouldn't write to base -- make temporary copy */
    
    1880
    -        if ( FT_QALLOC( temp, size ) )
    
    1880
    +        if ( FT_DUP( temp, base, size ) )
    
    1881 1881
               goto Fail;
    
    1882
    -        FT_MEM_COPY( temp, base, size );
    
    1883 1882
             psaux->t1_decrypt( temp, size, 4330 );
    
    1884 1883
             size -= (FT_ULong)t1face->type1.private_dict.lenIV;
    
    1885 1884
             error = T1_Add_Table( table,
    
    ... ... @@ -2091,9 +2090,8 @@
    2091 2090
               }
    
    2092 2091
     
    
    2093 2092
               /* t1_decrypt() shouldn't write to base -- make temporary copy */
    
    2094
    -          if ( FT_QALLOC( temp, size ) )
    
    2093
    +          if ( FT_DUP( temp, base, size ) )
    
    2095 2094
                 goto Fail;
    
    2096
    -          FT_MEM_COPY( temp, base, size );
    
    2097 2095
               psaux->t1_decrypt( temp, size, 4330 );
    
    2098 2096
               size -= (FT_ULong)t1face->type1.private_dict.lenIV;
    
    2099 2097
               error = T1_Add_Table( code_table,
    


  • reply via email to

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