freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 3 commits: [bdf] Simplify comment colle


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 3 commits: [bdf] Simplify comment collection or lack thereof.
Date: Sat, 25 Sep 2021 02:36:44 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

4 changed files:

Changes:

  • builds/unix/configure.raw
    ... ... @@ -103,78 +103,6 @@ AC_CHECK_HEADERS([fcntl.h unistd.h])
    103 103
     # checks for typedefs, structures, and compiler characteristics
    
    104 104
     
    
    105 105
     AC_C_CONST
    
    106
    -AC_CHECK_SIZEOF([int])
    
    107
    -AC_CHECK_SIZEOF([long])
    
    108
    -AC_TYPE_LONG_LONG_INT
    
    109
    -
    
    110
    -
    
    111
    -# check whether cpp computation of size of int and long in ftconfig.h.in works
    
    112
    -
    
    113
    -AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.h.in works])
    
    114
    -orig_CPPFLAGS="${CPPFLAGS}"
    
    115
    -CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include ${CPPFLAGS}"
    
    116
    -
    
    117
    -ac_clean_files=
    
    118
    -if test ! -f ft2build.h; then
    
    119
    -  ac_clean_files=ft2build.h
    
    120
    -  touch ft2build.h
    
    121
    -fi
    
    122
    -
    
    123
    -cat > conftest.c <<\_ACEOF
    
    124
    -#include <limits.h>
    
    125
    -#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
    
    126
    -#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
    
    127
    -#define FT_UINT_MAX  UINT_MAX
    
    128
    -#define FT_ULONG_MAX ULONG_MAX
    
    129
    -#include "ftconfig.h.in"
    
    130
    -_ACEOF
    
    131
    -echo >> conftest.c "#if FT_SIZEOF_INT == "${ac_cv_sizeof_int}
    
    132
    -echo >> conftest.c "ac_cpp_ft_sizeof_int="${ac_cv_sizeof_int}
    
    133
    -echo >> conftest.c "#endif"
    
    134
    -echo >> conftest.c "#if FT_SIZEOF_LONG == "${ac_cv_sizeof_long}
    
    135
    -echo >> conftest.c "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long}
    
    136
    -echo >> conftest.c "#endif"
    
    137
    -
    
    138
    -${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh
    
    139
    -eval `cat conftest.sh`
    
    140
    -rm -f conftest.* $ac_clean_files
    
    141
    -
    
    142
    -if test x != "x${ac_cpp_ft_sizeof_int}" \
    
    143
    -   -a x != x"${ac_cpp_ft_sizeof_long}"; then
    
    144
    -  unset ft_use_autoconf_sizeof_types
    
    145
    -else
    
    146
    -  ft_use_autoconf_sizeof_types=yes
    
    147
    -fi
    
    148
    -
    
    149
    -AC_ARG_ENABLE(biarch-config,
    
    150
    -[  --enable-biarch-config  install biarch ftconfig.h to support multiple
    
    151
    -                          architectures by single file], [], [])
    
    152
    -
    
    153
    -case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in
    
    154
    -  :yes:yes:)
    
    155
    -    AC_MSG_RESULT([broken but use it])
    
    156
    -    unset ft_use_autoconf_sizeof_types
    
    157
    -    ;;
    
    158
    -  ::no:)
    
    159
    -    AC_MSG_RESULT([works but ignore it])
    
    160
    -    ft_use_autoconf_sizeof_types=yes
    
    161
    -    ;;
    
    162
    -  ::yes: | :::)
    
    163
    -    AC_MSG_RESULT([yes])
    
    164
    -    unset ft_use_autoconf_sizeof_types
    
    165
    -    ;;
    
    166
    -  *)
    
    167
    -    AC_MSG_RESULT([no])
    
    168
    -    ft_use_autoconf_sizeof_types=yes
    
    169
    -    ;;
    
    170
    -esac
    
    171
    -
    
    172
    -if test x"${ft_use_autoconf_sizeof_types}" = xyes; then
    
    173
    -  AC_DEFINE([FT_USE_AUTOCONF_SIZEOF_TYPES], [],
    
    174
    -            [Define if autoconf sizeof types should be used.])
    
    175
    -fi
    
    176
    -
    
    177
    -CPPFLAGS="${orig_CPPFLAGS}"
    
    178 106
     
    
    179 107
     AC_ARG_ENABLE([freetype-config],
    
    180 108
       AS_HELP_STRING([--enable-freetype-config], [install freetype-config]),
    

  • builds/unix/ftconfig.h.in
    ... ... @@ -42,16 +42,6 @@
    42 42
     #undef HAVE_UNISTD_H
    
    43 43
     #undef HAVE_FCNTL_H
    
    44 44
     
    
    45
    -#undef FT_USE_AUTOCONF_SIZEOF_TYPES
    
    46
    -#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
    
    47
    -
    
    48
    -#undef SIZEOF_INT
    
    49
    -#undef SIZEOF_LONG
    
    50
    -#define FT_SIZEOF_INT  SIZEOF_INT
    
    51
    -#define FT_SIZEOF_LONG SIZEOF_LONG
    
    52
    -
    
    53
    -#endif /* FT_USE_AUTOCONF_SIZEOF_TYPES */
    
    54
    -
    
    55 45
     #include <freetype/config/integer-types.h>
    
    56 46
     #include <freetype/config/public-macros.h>
    
    57 47
     #include <freetype/config/mac-support.h>
    

  • include/freetype/internal/ftstream.h
    ... ... @@ -196,9 +196,9 @@ FT_BEGIN_HEADER
    196 196
                                            FT_BYTE_U32( p, 2,  8 ) | \
    
    197 197
                                            FT_BYTE_U32( p, 3,  0 ) )
    
    198 198
     
    
    199
    -#define FT_PEEK_OFF3( p )  FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \
    
    200
    -                                     FT_BYTE_U32( p, 1,  8 ) | \
    
    201
    -                                     FT_BYTE_U32( p, 2,  0 ) )
    
    199
    +#define FT_PEEK_OFF3( p )  ( FT_INT32( FT_BYTE_U32( p, 0, 24 ) | \
    
    200
    +                                       FT_BYTE_U32( p, 1, 16 ) | \
    
    201
    +                                       FT_BYTE_U32( p, 2,  8 ) ) >> 8 )
    
    202 202
     
    
    203 203
     #define FT_PEEK_UOFF3( p )  FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \
    
    204 204
                                            FT_BYTE_U32( p, 1,  8 ) | \
    
    ... ... @@ -220,9 +220,9 @@ FT_BEGIN_HEADER
    220 220
                                               FT_BYTE_U32( p, 1,  8 ) | \
    
    221 221
                                               FT_BYTE_U32( p, 0,  0 ) )
    
    222 222
     
    
    223
    -#define FT_PEEK_OFF3_LE( p )  FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \
    
    224
    -                                        FT_BYTE_U32( p, 1,  8 ) | \
    
    225
    -                                        FT_BYTE_U32( p, 0,  0 ) )
    
    223
    +#define FT_PEEK_OFF3_LE( p )  ( FT_INT32( FT_BYTE_U32( p, 2, 24 ) | \
    
    224
    +                                          FT_BYTE_U32( p, 1, 16 ) | \
    
    225
    +                                          FT_BYTE_U32( p, 0,  8 ) ) >> 8 )
    
    226 226
     
    
    227 227
     #define FT_PEEK_UOFF3_LE( p )  FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \
    
    228 228
                                               FT_BYTE_U32( p, 1,  8 ) | \
    
    ... ... @@ -309,7 +309,6 @@ FT_BEGIN_HEADER
    309 309
     #define FT_GET_BYTE()       FT_GET_MACRO( FT_Stream_GetByte, FT_Byte )
    
    310 310
     #define FT_GET_SHORT()      FT_GET_MACRO( FT_Stream_GetUShort, FT_Short )
    
    311 311
     #define FT_GET_USHORT()     FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )
    
    312
    -#define FT_GET_OFF3()       FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )
    
    313 312
     #define FT_GET_UOFF3()      FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )
    
    314 313
     #define FT_GET_LONG()       FT_GET_MACRO( FT_Stream_GetULong, FT_Long )
    
    315 314
     #define FT_GET_ULONG()      FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
    
    ... ... @@ -337,7 +336,6 @@ FT_BEGIN_HEADER
    337 336
     #define FT_READ_CHAR( var )       FT_READ_MACRO( FT_Stream_ReadByte, FT_Char, var )
    
    338 337
     #define FT_READ_SHORT( var )      FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var )
    
    339 338
     #define FT_READ_USHORT( var )     FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )
    
    340
    -#define FT_READ_OFF3( var )       FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )
    
    341 339
     #define FT_READ_UOFF3( var )      FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )
    
    342 340
     #define FT_READ_LONG( var )       FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )
    
    343 341
     #define FT_READ_ULONG( var )      FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )
    

  • src/bdf/bdflib.c
    ... ... @@ -949,7 +949,7 @@
    949 949
         cp = font->comments + font->comments_len;
    
    950 950
     
    
    951 951
         FT_MEM_COPY( cp, comment, len );
    
    952
    -    cp[len] = '\n';
    
    952
    +    cp[len] = '\0';
    
    953 953
     
    
    954 954
         font->comments_len += len + 1;
    
    955 955
     
    
    ... ... @@ -1304,15 +1304,18 @@
    1304 1304
         /* Check for a comment. */
    
    1305 1305
         if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
    
    1306 1306
         {
    
    1307
    -      linelen -= 7;
    
    1308
    -
    
    1309
    -      s = line + 7;
    
    1310
    -      if ( *s != 0 )
    
    1307
    +      if ( p->opts->keep_comments )
    
    1311 1308
           {
    
    1312
    -        s++;
    
    1313
    -        linelen--;
    
    1309
    +        linelen -= 7;
    
    1310
    +
    
    1311
    +        s = line + 7;
    
    1312
    +        if ( *s != 0 )
    
    1313
    +        {
    
    1314
    +          s++;
    
    1315
    +          linelen--;
    
    1316
    +        }
    
    1317
    +        error = _bdf_add_comment( p->font, s, linelen );
    
    1314 1318
           }
    
    1315
    -      error = _bdf_add_comment( p->font, s, linelen );
    
    1316 1319
           goto Exit;
    
    1317 1320
         }
    
    1318 1321
     
    
    ... ... @@ -1894,13 +1897,8 @@
    1894 1897
               s++;
    
    1895 1898
               linelen--;
    
    1896 1899
             }
    
    1897
    -
    
    1898 1900
             error = _bdf_add_comment( p->font, s, linelen );
    
    1899
    -        if ( error )
    
    1900
    -          goto Exit;
    
    1901
    -        /* here font is not defined! */
    
    1902 1901
           }
    
    1903
    -
    
    1904 1902
           goto Exit;
    
    1905 1903
         }
    
    1906 1904
     
    
    ... ... @@ -2269,20 +2267,7 @@
    2269 2267
           }
    
    2270 2268
         }
    
    2271 2269
     
    
    2272
    -    if ( p->font )
    
    2273
    -    {
    
    2274
    -      /* Make sure the comments are null terminated if they exist. */
    
    2275
    -      if ( p->font->comments_len > 0 )
    
    2276
    -      {
    
    2277
    -        if ( FT_QRENEW_ARRAY( p->font->comments,
    
    2278
    -                              p->font->comments_len,
    
    2279
    -                              p->font->comments_len + 1 ) )
    
    2280
    -          goto Fail;
    
    2281
    -
    
    2282
    -        p->font->comments[p->font->comments_len] = 0;
    
    2283
    -      }
    
    2284
    -    }
    
    2285
    -    else if ( !error )
    
    2270
    +    if ( !p->font && !error )
    
    2286 2271
           error = FT_THROW( Invalid_File_Format );
    
    2287 2272
     
    
    2288 2273
         *font = p->font;
    


  • reply via email to

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