freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] * src/sfnt/ttpost.c (load_format_20): M


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] * src/sfnt/ttpost.c (load_format_20): Micro-optimize.
Date: Thu, 07 Sep 2023 03:01:28 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 4904d1eb
    by Alexei Podtelezhnikov at 2023-09-06T22:58:46-04:00
    * src/sfnt/ttpost.c (load_format_20): Micro-optimize.
    

1 changed file:

Changes:

  • src/sfnt/ttpost.c
    ... ... @@ -204,8 +204,8 @@
    204 204
         /* now load the name strings */
    
    205 205
         if ( num_names )
    
    206 206
         {
    
    207
    -      FT_ULong   p;
    
    208
    -      FT_Byte*   strings;
    
    207
    +      FT_Byte*   p;
    
    208
    +      FT_Byte*   p_end;
    
    209 209
     
    
    210 210
     
    
    211 211
           post_len -= (FT_ULong)num_glyphs * 2;
    
    ... ... @@ -214,25 +214,27 @@
    214 214
                                         post_len + 1 ) )
    
    215 215
             goto Fail;
    
    216 216
     
    
    217
    -      strings = (FT_Byte*)( name_strings + num_names );
    
    218
    -      if ( FT_STREAM_READ( strings, post_len ) )
    
    217
    +      p = (FT_Byte*)( name_strings + num_names );
    
    218
    +      if ( FT_STREAM_READ( p, post_len ) )
    
    219 219
             goto Fail;
    
    220 220
     
    
    221
    +      p_end = p + post_len;
    
    222
    +
    
    221 223
           /* convert from Pascal- to C-strings and set pointers */
    
    222
    -      for ( p = 0, n = 0; p < post_len && n < num_names; n++ )
    
    224
    +      for ( n = 0; p < p_end && n < num_names; n++ )
    
    223 225
           {
    
    224
    -        FT_UInt  len = strings[p];
    
    226
    +        FT_UInt  len = *p;
    
    225 227
     
    
    226 228
     
    
    227 229
             /* all names in Adobe Glyph List are shorter than 40 characters */
    
    228 230
             if ( len >= 40U )
    
    229 231
               FT_TRACE4(( "load_format_20: unusual %u-char name found\n", len ));
    
    230 232
     
    
    231
    -        strings[p]      = 0;
    
    232
    -        name_strings[n] = strings + p + 1;
    
    233
    -        p              += len + 1;
    
    233
    +        *p++            = 0;
    
    234
    +        name_strings[n] = p;
    
    235
    +        p              += len;
    
    234 236
           }
    
    235
    -      strings[post_len] = 0;
    
    237
    +      *p_end = 0;
    
    236 238
     
    
    237 239
           /* deal with missing or insufficient string data */
    
    238 240
           if ( n < num_names )
    
    ... ... @@ -241,7 +243,7 @@
    241 243
                         num_names - n ));
    
    242 244
     
    
    243 245
             for ( ; n < num_names; n++ )
    
    244
    -          name_strings[n] = strings + post_len;
    
    246
    +          name_strings[n] = p_end;
    
    245 247
           }
    
    246 248
         }
    
    247 249
     
    


  • reply via email to

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