freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] Use NULL for pointers only.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] Use NULL for pointers only.
Date: Fri, 24 Sep 2021 03:16:43 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

5 changed files:

Changes:

  • include/freetype/freetype.h
    ... ... @@ -2100,7 +2100,7 @@ FT_BEGIN_HEADER
    2100 2100
        *
    
    2101 2101
        *   pathname ::
    
    2102 2102
        *     A pointer to an 8-bit file pathname, which must be a C~string (i.e.,
    
    2103
    -   *     no NULL bytes except at the very end).  The pointer is not owned by
    
    2103
    +   *     no null bytes except at the very end).  The pointer is not owned by
    
    2104 2104
        *     FreeType.
    
    2105 2105
        *
    
    2106 2106
        *   stream ::
    
    ... ... @@ -2189,7 +2189,7 @@ FT_BEGIN_HEADER
    2189 2189
        * @note:
    
    2190 2190
        *   The `pathname` string should be recognizable as such by a standard
    
    2191 2191
        *   `fopen` call on your system; in particular, this means that `pathname`
    
    2192
    -   *   must not contain NULL bytes.  If that is not sufficient to address all
    
    2192
    +   *   must not contain null bytes.  If that is not sufficient to address all
    
    2193 2193
        *   file name possibilities (for example, to handle wide character file
    
    2194 2194
        *   names on Windows in UTF-16 encoding) you might use @FT_Open_Face to
    
    2195 2195
        *   pass a memory array or a stream object instead.
    

  • src/bdf/bdflib.c
    ... ... @@ -170,7 +170,7 @@
    170 170
     
    
    171 171
       /* An auxiliary macro to parse properties, to be used in conditionals. */
    
    172 172
       /* It behaves like `strncmp' but also tests the following character    */
    
    173
    -  /* whether it is a whitespace or NULL.                                 */
    
    173
    +  /* whether it is a whitespace or null.                                 */
    
    174 174
       /* `property' is a constant string of length `n' to compare with.      */
    
    175 175
     #define _bdf_strncmp( name, property, n )      \
    
    176 176
               ( ft_strncmp( name, property, n ) || \
    
    ... ... @@ -346,7 +346,7 @@
    346 346
         unsigned long  i, u;
    
    347 347
     
    
    348 348
     
    
    349
    -    if ( list == 0 || list->used == 0 || n == 0 )
    
    349
    +    if ( list == NULL || list->used == 0 || n == 0 )
    
    350 350
           return;
    
    351 351
     
    
    352 352
         if ( n >= list->used )
    
    ... ... @@ -377,7 +377,7 @@
    377 377
     
    
    378 378
         *alen = 0;
    
    379 379
     
    
    380
    -    if ( list == 0 || list->used == 0 )
    
    380
    +    if ( list == NULL || list->used == 0 )
    
    381 381
           return 0;
    
    382 382
     
    
    383 383
         dp = list->field[0];
    
    ... ... @@ -436,7 +436,7 @@
    436 436
         /* In the original code, if the `separators' parameter is NULL or */
    
    437 437
         /* empty, the list is split into individual bytes.  We don't need */
    
    438 438
         /* this, so an error is signaled.                                 */
    
    439
    -    if ( separators == 0 || *separators == 0 )
    
    439
    +    if ( separators == NULL || *separators == 0 )
    
    440 440
         {
    
    441 441
           error = FT_THROW( Invalid_Argument );
    
    442 442
           goto Exit;
    
    ... ... @@ -504,7 +504,7 @@
    504 504
         if ( final_empty )
    
    505 505
           list->field[list->used++] = (char*)empty;
    
    506 506
     
    
    507
    -    list->field[list->used] = 0;
    
    507
    +    list->field[list->used] = NULL;
    
    508 508
     
    
    509 509
       Exit:
    
    510 510
         return error;
    
    ... ... @@ -529,7 +529,7 @@
    529 529
         FT_Error          error  = FT_Err_Ok;
    
    530 530
     
    
    531 531
     
    
    532
    -    if ( callback == 0 )
    
    532
    +    if ( callback == NULL )
    
    533 533
         {
    
    534 534
           error = FT_THROW( Invalid_Argument );
    
    535 535
           goto Exit;
    
    ... ... @@ -697,7 +697,7 @@
    697 697
         unsigned long  v;
    
    698 698
     
    
    699 699
     
    
    700
    -    if ( s == 0 || *s == 0 )
    
    700
    +    if ( s == NULL || *s == 0 )
    
    701 701
           return 0;
    
    702 702
     
    
    703 703
         for ( v = 0; sbitset( ddigits, *s ); s++ )
    
    ... ... @@ -722,7 +722,7 @@
    722 722
         long  v, neg;
    
    723 723
     
    
    724 724
     
    
    725
    -    if ( s == 0 || *s == 0 )
    
    725
    +    if ( s == NULL || *s == 0 )
    
    726 726
           return 0;
    
    727 727
     
    
    728 728
         /* Check for a minus sign. */
    
    ... ... @@ -755,7 +755,7 @@
    755 755
         unsigned short  v;
    
    756 756
     
    
    757 757
     
    
    758
    -    if ( s == 0 || *s == 0 )
    
    758
    +    if ( s == NULL || *s == 0 )
    
    759 759
           return 0;
    
    760 760
     
    
    761 761
         for ( v = 0; sbitset( ddigits, *s ); s++ )
    
    ... ... @@ -780,7 +780,7 @@
    780 780
         short  v, neg;
    
    781 781
     
    
    782 782
     
    
    783
    -    if ( s == 0 || *s == 0 )
    
    783
    +    if ( s == NULL || *s == 0 )
    
    784 784
           return 0;
    
    785 785
     
    
    786 786
         /* Check for a minus. */
    
    ... ... @@ -883,7 +883,7 @@
    883 883
         size_t*  propid;
    
    884 884
     
    
    885 885
     
    
    886
    -    if ( name == 0 || *name == 0 )
    
    886
    +    if ( name == NULL || *name == 0 )
    
    887 887
           return 0;
    
    888 888
     
    
    889 889
         if ( ( propid = ft_hash_str_lookup( name, &(font->proptbl) ) ) == NULL )
    
    ... ... @@ -974,7 +974,7 @@
    974 974
         FT_UNUSED( lineno );        /* only used in debug mode */
    
    975 975
     
    
    976 976
     
    
    977
    -    if ( font == 0 || font->name == 0 || font->name[0] == 0 )
    
    977
    +    if ( font == NULL || font->name == NULL || font->name[0] == 0 )
    
    978 978
         {
    
    979 979
           error = FT_THROW( Invalid_Argument );
    
    980 980
           goto Exit;
    
    ... ... @@ -1182,7 +1182,7 @@
    1182 1182
         {
    
    1183 1183
         case BDF_ATOM:
    
    1184 1184
           fp->value.atom = 0;
    
    1185
    -      if ( value != 0 && value[0] )
    
    1185
    +      if ( value && value[0] )
    
    1186 1186
           {
    
    1187 1187
             if ( FT_STRDUP( fp->value.atom, value ) )
    
    1188 1188
               goto Exit;
    
    ... ... @@ -1496,7 +1496,7 @@
    1496 1496
           {
    
    1497 1497
             /* Unencoded glyph.  Check whether it should */
    
    1498 1498
             /* be added or not.                          */
    
    1499
    -        if ( p->opts->keep_unencoded != 0 )
    
    1499
    +        if ( p->opts->keep_unencoded )
    
    1500 1500
             {
    
    1501 1501
               /* Allocate the next unencoded glyph. */
    
    1502 1502
               if ( font->unencoded_used == font->unencoded_size )
    
    ... ... @@ -1677,7 +1677,7 @@
    1677 1677
     
    
    1678 1678
           /* If the BDF_CORRECT_METRICS flag is set, then adjust the SWIDTH */
    
    1679 1679
           /* value if necessary.                                            */
    
    1680
    -      if ( p->opts->correct_metrics != 0 )
    
    1680
    +      if ( p->opts->correct_metrics )
    
    1681 1681
           {
    
    1682 1682
             /* Determine the point size of the glyph. */
    
    1683 1683
             unsigned short  sw = (unsigned short)FT_MulDiv(
    
    ... ... @@ -1884,7 +1884,7 @@
    1884 1884
         /* comments before the STARTFONT line for some reason.                */
    
    1885 1885
         if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
    
    1886 1886
         {
    
    1887
    -      if ( p->opts->keep_comments != 0 && p->font != 0 )
    
    1887
    +      if ( p->opts->keep_comments && p->font )
    
    1888 1888
           {
    
    1889 1889
             linelen -= 7;
    
    1890 1890
     
    
    ... ... @@ -1917,7 +1917,7 @@
    1917 1917
           }
    
    1918 1918
     
    
    1919 1919
           p->flags = BDF_START_;
    
    1920
    -      font = p->font = 0;
    
    1920
    +      font = p->font = NULL;
    
    1921 1921
     
    
    1922 1922
           if ( FT_NEW( font ) )
    
    1923 1923
             goto Exit;
    
    ... ... @@ -2176,7 +2176,7 @@
    2176 2176
         if ( FT_NEW( p ) )
    
    2177 2177
           goto Exit;
    
    2178 2178
     
    
    2179
    -    p->opts   = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts );
    
    2179
    +    p->opts   = (bdf_options_t*)( opts ? opts : &_bdf_opts );
    
    2180 2180
         p->minlb  = 32767;
    
    2181 2181
         p->size   = stream->size;
    
    2182 2182
         p->memory = memory;  /* only during font creation */
    
    ... ... @@ -2188,7 +2188,7 @@
    2188 2188
         if ( error )
    
    2189 2189
           goto Fail;
    
    2190 2190
     
    
    2191
    -    if ( p->font != 0 )
    
    2191
    +    if ( p->font )
    
    2192 2192
         {
    
    2193 2193
           /* If the font is not proportional, set the font's monowidth */
    
    2194 2194
           /* field to the width of the font bounding box.              */
    
    ... ... @@ -2269,9 +2269,9 @@
    2269 2269
           }
    
    2270 2270
         }
    
    2271 2271
     
    
    2272
    -    if ( p->font != 0 )
    
    2272
    +    if ( p->font )
    
    2273 2273
         {
    
    2274
    -      /* Make sure the comments are NULL terminated if they exist. */
    
    2274
    +      /* Make sure the comments are null terminated if they exist. */
    
    2275 2275
           if ( p->font->comments_len > 0 )
    
    2276 2276
           {
    
    2277 2277
             if ( FT_QRENEW_ARRAY( p->font->comments,
    
    ... ... @@ -2316,7 +2316,7 @@
    2316 2316
         FT_Memory        memory;
    
    2317 2317
     
    
    2318 2318
     
    
    2319
    -    if ( font == 0 )
    
    2319
    +    if ( font == NULL )
    
    2320 2320
           return;
    
    2321 2321
     
    
    2322 2322
         memory = font->memory;
    
    ... ... @@ -2385,7 +2385,7 @@
    2385 2385
         size_t*  propid;
    
    2386 2386
     
    
    2387 2387
     
    
    2388
    -    if ( font == 0 || font->props_size == 0 || name == 0 || *name == 0 )
    
    2388
    +    if ( font == NULL || font->props_size == 0 || name == NULL || *name == 0 )
    
    2389 2389
           return 0;
    
    2390 2390
     
    
    2391 2391
         propid = ft_hash_str_lookup( name, (FT_Hash)font->internal );
    

  • src/cff/cffload.c
    ... ... @@ -400,7 +400,7 @@
    400 400
     
    
    401 401
       /* Allocate a table containing pointers to an index's elements. */
    
    402 402
       /* The `pool' argument makes this function convert the index    */
    
    403
    -  /* entries to C-style strings (this is, NULL-terminated).       */
    
    403
    +  /* entries to C-style strings (this is, null-terminated).       */
    
    404 404
       static FT_Error
    
    405 405
       cff_index_get_pointers( CFF_Index   idx,
    
    406 406
                               FT_Byte***  table,
    

  • src/cff/cffobjs.c
    ... ... @@ -689,13 +689,13 @@
    689 689
     
    
    690 690
             /* In Multiple Master CFFs, two SIDs hold the Normalize Design  */
    
    691 691
             /* Vector (NDV) and Convert Design Vector (CDV) charstrings,    */
    
    692
    -        /* which may contain NULL bytes in the middle of the data, too. */
    
    692
    +        /* which may contain null bytes in the middle of the data, too. */
    
    693 693
             /* We thus access `cff->strings' directly.                      */
    
    694 694
             for ( idx = 1; idx < cff->num_strings; idx++ )
    
    695 695
             {
    
    696 696
               FT_Byte*    s1    = cff->strings[idx - 1];
    
    697 697
               FT_Byte*    s2    = cff->strings[idx];
    
    698
    -          FT_PtrDist  s1len = s2 - s1 - 1; /* without the final NULL byte */
    
    698
    +          FT_PtrDist  s1len = s2 - s1 - 1; /* without the final null byte */
    
    699 699
               FT_PtrDist  l;
    
    700 700
     
    
    701 701
     
    

  • src/winfonts/winfnt.c
    ... ... @@ -885,7 +885,7 @@
    885 885
           }
    
    886 886
           family_size = font->header.file_size - font->header.face_name_offset;
    
    887 887
           /* Some broken fonts don't delimit the face name with a final */
    
    888
    -      /* NULL byte -- the frame is erroneously one byte too small.  */
    
    888
    +      /* null byte -- the frame is erroneously one byte too small.  */
    
    889 889
           /* We thus allocate one more byte, setting it explicitly to   */
    
    890 890
           /* zero.                                                      */
    
    891 891
           if ( FT_QALLOC( font->family_name, family_size + 1 ) )
    


  • reply via email to

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