mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 06:03:09 +00:00
FreeType: Update to version 2.13.2
Remove freetype's copy of zlib again, as we don't use it.
This commit is contained in:
parent
541674d106
commit
54c4c8dfa5
@ -204,7 +204,7 @@ License: OFL-1.1
|
||||
|
||||
Files: ./thirdparty/freetype/
|
||||
Comment: The FreeType Project
|
||||
Copyright: 1996-2022, David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
Copyright: 1996-2023, David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
License: FTL
|
||||
|
||||
Files: ./thirdparty/glad/
|
||||
|
4
thirdparty/README.md
vendored
4
thirdparty/README.md
vendored
@ -178,14 +178,14 @@ Files extracted from upstream source:
|
||||
## freetype
|
||||
|
||||
- Upstream: https://www.freetype.org
|
||||
- Version: 2.13.1 (e4586d960f339cf75e2e0b34aee30a0ed8353c0d, 2023)
|
||||
- Version: 2.13.2 (920c5502cc3ddda88f6c7d85ee834ac611bb11cc, 2023)
|
||||
- License: FreeType License (BSD-like)
|
||||
|
||||
Files extracted from upstream source:
|
||||
|
||||
- `src/` folder, minus the `dlg` and `tools` subfolders
|
||||
* These files can be removed: `.dat`, `.diff`, `.mk`, `.rc`, `README*`
|
||||
* In `src/gzip/`, remove zlib files (everything but `ftgzip.c` and `ftzconf.h`)
|
||||
* In `src/gzip/`, keep only `ftgzip.c`
|
||||
- `include/` folder, minus the `dlg` subfolder
|
||||
- `LICENSE.TXT` and `docs/FTL.TXT`
|
||||
|
||||
|
@ -5222,7 +5222,7 @@ FT_BEGIN_HEADER
|
||||
*/
|
||||
#define FREETYPE_MAJOR 2
|
||||
#define FREETYPE_MINOR 13
|
||||
#define FREETYPE_PATCH 1
|
||||
#define FREETYPE_PATCH 2
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -332,9 +332,9 @@ FT_BEGIN_HEADER
|
||||
* Based on geometric considerations we use the following inequality to
|
||||
* identify a degenerate matrix.
|
||||
*
|
||||
* 50 * abs(xx*yy - xy*yx) < xx^2 + xy^2 + yx^2 + yy^2
|
||||
* 32 * abs(xx*yy - xy*yx) < xx^2 + xy^2 + yx^2 + yy^2
|
||||
*
|
||||
* Value 50 is heuristic.
|
||||
* Value 32 is heuristic.
|
||||
*/
|
||||
FT_BASE( FT_Bool )
|
||||
FT_Matrix_Check( const FT_Matrix* matrix );
|
||||
|
@ -1394,14 +1394,6 @@ FT_BEGIN_HEADER
|
||||
* vert_metrics_offset ::
|
||||
* The file offset of the 'vmtx' table.
|
||||
*
|
||||
* sph_found_func_flags ::
|
||||
* Flags identifying special bytecode functions (used by the v38
|
||||
* implementation of the bytecode interpreter).
|
||||
*
|
||||
* sph_compatibility_mode ::
|
||||
* This flag is set if we are in ClearType backward compatibility mode
|
||||
* (used by the v38 implementation of the bytecode interpreter).
|
||||
*
|
||||
* ebdt_start ::
|
||||
* The file offset of the sbit data table (CBDT, bdat, etc.).
|
||||
*
|
||||
@ -1597,13 +1589,6 @@ FT_BEGIN_HEADER
|
||||
FT_ULong horz_metrics_offset;
|
||||
FT_ULong vert_metrics_offset;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
/* since 2.4.12 */
|
||||
FT_ULong sph_found_func_flags; /* special functions found */
|
||||
/* for this face */
|
||||
FT_Bool sph_compatibility_mode;
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
/* since 2.7 */
|
||||
FT_ULong ebdt_start; /* either `CBDT', `EBDT', or `bdat' */
|
||||
|
6
thirdparty/freetype/src/autofit/afcjk.c
vendored
6
thirdparty/freetype/src/autofit/afcjk.c
vendored
@ -1634,7 +1634,7 @@
|
||||
|
||||
stem_edge->pos = base_edge->pos + fitted_width;
|
||||
|
||||
FT_TRACE5(( " CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f,"
|
||||
FT_TRACE5(( " CJKLINK: edge %td @%d (opos=%.2f) linked to %.2f,"
|
||||
" dist was %.2f, now %.2f\n",
|
||||
stem_edge - hints->axis[dim].edges, stem_edge->fpos,
|
||||
(double)stem_edge->opos / 64,
|
||||
@ -1858,7 +1858,7 @@
|
||||
continue;
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE5(( " CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f,"
|
||||
FT_TRACE5(( " CJKBLUE: edge %td @%d (opos=%.2f) snapped to %.2f,"
|
||||
" was %.2f\n",
|
||||
edge1 - edges, edge1->fpos, (double)edge1->opos / 64,
|
||||
(double)blue->fit / 64, (double)edge1->pos / 64 ));
|
||||
@ -1922,7 +1922,7 @@
|
||||
/* this should not happen, but it's better to be safe */
|
||||
if ( edge2->blue_edge )
|
||||
{
|
||||
FT_TRACE5(( "ASSERTION FAILED for edge %ld\n", edge2-edges ));
|
||||
FT_TRACE5(( "ASSERTION FAILED for edge %td\n", edge2 - edges ));
|
||||
|
||||
af_cjk_align_linked_edge( hints, dim, edge2, edge );
|
||||
edge->flags |= AF_EDGE_DONE;
|
||||
|
38
thirdparty/freetype/src/autofit/aflatin.c
vendored
38
thirdparty/freetype/src/autofit/aflatin.c
vendored
@ -1022,7 +1022,7 @@
|
||||
{
|
||||
*a = *b;
|
||||
FT_TRACE5(( "blue zone overlap:"
|
||||
" adjusting %s %ld to %ld\n",
|
||||
" adjusting %s %td to %ld\n",
|
||||
a_is_top ? "overshoot" : "reference",
|
||||
blue_sorted[i] - axis->blues,
|
||||
*a ));
|
||||
@ -2960,7 +2960,7 @@
|
||||
|
||||
stem_edge->pos = base_edge->pos + fitted_width;
|
||||
|
||||
FT_TRACE5(( " LINK: edge %ld (opos=%.2f) linked to %.2f,"
|
||||
FT_TRACE5(( " LINK: edge %td (opos=%.2f) linked to %.2f,"
|
||||
" dist was %.2f, now %.2f\n",
|
||||
stem_edge - hints->axis[dim].edges,
|
||||
(double)stem_edge->opos / 64, (double)stem_edge->pos / 64,
|
||||
@ -3085,13 +3085,13 @@
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( !anchor )
|
||||
FT_TRACE5(( " BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f,"
|
||||
" was %.2f (anchor=edge %ld)\n",
|
||||
FT_TRACE5(( " BLUE_ANCHOR: edge %td (opos=%.2f) snapped to %.2f,"
|
||||
" was %.2f (anchor=edge %td)\n",
|
||||
edge1 - edges,
|
||||
(double)edge1->opos / 64, (double)blue->fit / 64,
|
||||
(double)edge1->pos / 64, edge - edges ));
|
||||
else
|
||||
FT_TRACE5(( " BLUE: edge %ld (opos=%.2f) snapped to %.2f,"
|
||||
FT_TRACE5(( " BLUE: edge %td (opos=%.2f) snapped to %.2f,"
|
||||
" was %.2f\n",
|
||||
edge1 - edges,
|
||||
(double)edge1->opos / 64, (double)blue->fit / 64,
|
||||
@ -3141,7 +3141,7 @@
|
||||
/* this should not happen, but it's better to be safe */
|
||||
if ( edge2->blue_edge )
|
||||
{
|
||||
FT_TRACE5(( " ASSERTION FAILED for edge %ld\n", edge2 - edges ));
|
||||
FT_TRACE5(( " ASSERTION FAILED for edge %td\n", edge2 - edges ));
|
||||
|
||||
af_latin_align_linked_edge( hints, dim, edge2, edge );
|
||||
edge->flags |= AF_EDGE_DONE;
|
||||
@ -3209,7 +3209,7 @@
|
||||
anchor = edge;
|
||||
edge->flags |= AF_EDGE_DONE;
|
||||
|
||||
FT_TRACE5(( " ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " ANCHOR: edge %td (opos=%.2f) and %td (opos=%.2f)"
|
||||
" snapped to %.2f and %.2f\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
edge2 - edges, (double)edge2->opos / 64,
|
||||
@ -3238,7 +3238,7 @@
|
||||
|
||||
if ( edge2->flags & AF_EDGE_DONE )
|
||||
{
|
||||
FT_TRACE5(( " ADJUST: edge %ld (pos=%.2f) moved to %.2f\n",
|
||||
FT_TRACE5(( " ADJUST: edge %td (pos=%.2f) moved to %.2f\n",
|
||||
edge - edges, (double)edge->pos / 64,
|
||||
(double)( edge2->pos - cur_len ) / 64 ));
|
||||
|
||||
@ -3279,7 +3279,7 @@
|
||||
edge->pos = cur_pos1 - cur_len / 2;
|
||||
edge2->pos = cur_pos1 + cur_len / 2;
|
||||
|
||||
FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " STEM: edge %td (opos=%.2f) linked to %td (opos=%.2f)"
|
||||
" snapped to %.2f and %.2f\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
edge2 - edges, (double)edge2->opos / 64,
|
||||
@ -3310,7 +3310,7 @@
|
||||
edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
|
||||
edge2->pos = edge->pos + cur_len;
|
||||
|
||||
FT_TRACE5(( " STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " STEM: edge %td (opos=%.2f) linked to %td (opos=%.2f)"
|
||||
" snapped to %.2f and %.2f\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
edge2 - edges, (double)edge2->opos / 64,
|
||||
@ -3333,7 +3333,7 @@
|
||||
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
|
||||
FT_TRACE5(( " BOUND: edge %td (pos=%.2f) moved to %.2f\n",
|
||||
edge - edges,
|
||||
(double)edge->pos / 64,
|
||||
(double)edge[-1].pos / 64 ));
|
||||
@ -3435,7 +3435,7 @@
|
||||
if ( delta < 64 + 16 )
|
||||
{
|
||||
af_latin_align_serif_edge( hints, edge->serif, edge );
|
||||
FT_TRACE5(( " SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " SERIF: edge %td (opos=%.2f) serif to %td (opos=%.2f)"
|
||||
" aligned to %.2f\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
edge->serif - edges, (double)edge->serif->opos / 64,
|
||||
@ -3445,9 +3445,9 @@
|
||||
{
|
||||
edge->pos = FT_PIX_ROUND( edge->opos );
|
||||
anchor = edge;
|
||||
FT_TRACE5(( " SERIF_ANCHOR: edge %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " SERIF_ANCHOR: edge %td (opos=%.2f)"
|
||||
" snapped to %.2f\n",
|
||||
edge-edges,
|
||||
edge - edges,
|
||||
(double)edge->opos / 64, (double)edge->pos / 64 ));
|
||||
}
|
||||
else
|
||||
@ -3474,8 +3474,8 @@
|
||||
after->pos - before->pos,
|
||||
after->opos - before->opos );
|
||||
|
||||
FT_TRACE5(( " SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f"
|
||||
" from %ld (opos=%.2f)\n",
|
||||
FT_TRACE5(( " SERIF_LINK1: edge %td (opos=%.2f) snapped to %.2f"
|
||||
" from %td (opos=%.2f)\n",
|
||||
edge - edges, (double)edge->opos / 64,
|
||||
(double)edge->pos / 64,
|
||||
before - edges, (double)before->opos / 64 ));
|
||||
@ -3484,7 +3484,7 @@
|
||||
{
|
||||
edge->pos = anchor->pos +
|
||||
( ( edge->opos - anchor->opos + 16 ) & ~31 );
|
||||
FT_TRACE5(( " SERIF_LINK2: edge %ld (opos=%.2f)"
|
||||
FT_TRACE5(( " SERIF_LINK2: edge %td (opos=%.2f)"
|
||||
" snapped to %.2f\n",
|
||||
edge - edges,
|
||||
(double)edge->opos / 64, (double)edge->pos / 64 ));
|
||||
@ -3505,7 +3505,7 @@
|
||||
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
|
||||
FT_TRACE5(( " BOUND: edge %td (pos=%.2f) moved to %.2f\n",
|
||||
edge - edges,
|
||||
(double)edge->pos / 64,
|
||||
(double)edge[-1].pos / 64 ));
|
||||
@ -3526,7 +3526,7 @@
|
||||
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE5(( " BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
|
||||
FT_TRACE5(( " BOUND: edge %td (pos=%.2f) moved to %.2f\n",
|
||||
edge - edges,
|
||||
(double)edge->pos / 64,
|
||||
(double)edge[1].pos / 64 ));
|
||||
|
84
thirdparty/freetype/src/base/ftcalc.c
vendored
84
thirdparty/freetype/src/base/ftcalc.c
vendored
@ -749,65 +749,43 @@
|
||||
FT_BASE_DEF( FT_Bool )
|
||||
FT_Matrix_Check( const FT_Matrix* matrix )
|
||||
{
|
||||
FT_Matrix m;
|
||||
FT_Fixed val[4];
|
||||
FT_Fixed nonzero_minval, maxval;
|
||||
FT_Fixed temp1, temp2;
|
||||
FT_UInt i;
|
||||
FT_Fixed xx, xy, yx, yy;
|
||||
FT_Fixed val;
|
||||
FT_Int shift;
|
||||
FT_ULong temp1, temp2;
|
||||
|
||||
|
||||
if ( !matrix )
|
||||
return 0;
|
||||
|
||||
val[0] = FT_ABS( matrix->xx );
|
||||
val[1] = FT_ABS( matrix->xy );
|
||||
val[2] = FT_ABS( matrix->yx );
|
||||
val[3] = FT_ABS( matrix->yy );
|
||||
xx = matrix->xx;
|
||||
xy = matrix->xy;
|
||||
yx = matrix->yx;
|
||||
yy = matrix->yy;
|
||||
val = FT_ABS( xx ) | FT_ABS( xy ) | FT_ABS( yx ) | FT_ABS( yy );
|
||||
|
||||
/*
|
||||
* To avoid overflow, we ensure that each value is not larger than
|
||||
*
|
||||
* int(sqrt(2^31 / 4)) = 23170 ;
|
||||
*
|
||||
* we also check that no value becomes zero if we have to scale.
|
||||
*/
|
||||
|
||||
maxval = 0;
|
||||
nonzero_minval = FT_LONG_MAX;
|
||||
|
||||
for ( i = 0; i < 4; i++ )
|
||||
{
|
||||
if ( val[i] > maxval )
|
||||
maxval = val[i];
|
||||
if ( val[i] && val[i] < nonzero_minval )
|
||||
nonzero_minval = val[i];
|
||||
}
|
||||
|
||||
/* we only handle 32bit values */
|
||||
if ( maxval > 0x7FFFFFFFL )
|
||||
/* we only handle non-zero 32-bit values */
|
||||
if ( !val || val > 0x7FFFFFFFL )
|
||||
return 0;
|
||||
|
||||
if ( maxval > 23170 )
|
||||
/* Scale matrix to avoid the temp1 overflow, which is */
|
||||
/* more stringent than avoiding the temp2 overflow. */
|
||||
|
||||
shift = FT_MSB( val ) - 12;
|
||||
|
||||
if ( shift > 0 )
|
||||
{
|
||||
FT_Fixed scale = FT_DivFix( maxval, 23170 );
|
||||
|
||||
|
||||
if ( !FT_DivFix( nonzero_minval, scale ) )
|
||||
return 0; /* value range too large */
|
||||
|
||||
m.xx = FT_DivFix( matrix->xx, scale );
|
||||
m.xy = FT_DivFix( matrix->xy, scale );
|
||||
m.yx = FT_DivFix( matrix->yx, scale );
|
||||
m.yy = FT_DivFix( matrix->yy, scale );
|
||||
xx >>= shift;
|
||||
xy >>= shift;
|
||||
yx >>= shift;
|
||||
yy >>= shift;
|
||||
}
|
||||
else
|
||||
m = *matrix;
|
||||
|
||||
temp1 = FT_ABS( m.xx * m.yy - m.xy * m.yx );
|
||||
temp2 = m.xx * m.xx + m.xy * m.xy + m.yx * m.yx + m.yy * m.yy;
|
||||
temp1 = 32U * (FT_ULong)FT_ABS( xx * yy - xy * yx );
|
||||
temp2 = (FT_ULong)( xx * xx ) + (FT_ULong)( xy * xy ) +
|
||||
(FT_ULong)( yx * yx ) + (FT_ULong)( yy * yy );
|
||||
|
||||
if ( temp1 == 0 ||
|
||||
temp2 / temp1 > 50 )
|
||||
if ( temp1 <= temp2 )
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@ -1092,9 +1070,6 @@
|
||||
{
|
||||
FT_UInt i;
|
||||
FT_Int64 temp;
|
||||
#ifndef FT_INT64
|
||||
FT_Int64 halfUnit;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FT_INT64
|
||||
@ -1139,13 +1114,10 @@
|
||||
FT_Add64( &temp, &multResult, &temp );
|
||||
}
|
||||
|
||||
/* Round value. */
|
||||
halfUnit.hi = 0;
|
||||
halfUnit.lo = 0x8000;
|
||||
FT_Add64( &temp, &halfUnit, &temp );
|
||||
/* Shift and round value. */
|
||||
return (FT_Int32)( ( ( temp.hi << 16 ) | ( temp.lo >> 16 ) )
|
||||
+ ( 1 & ( temp.lo >> 15 ) ) );
|
||||
|
||||
return (FT_Int32)( ( (FT_Int32)( temp.hi & 0xFFFF ) << 16 ) |
|
||||
( temp.lo >> 16 ) );
|
||||
|
||||
#endif /* !FT_INT64 */
|
||||
|
||||
|
3
thirdparty/freetype/src/base/ftobjs.c
vendored
3
thirdparty/freetype/src/base/ftobjs.c
vendored
@ -1747,7 +1747,8 @@
|
||||
FT_Memory memory = library->memory;
|
||||
|
||||
|
||||
args.flags = 0;
|
||||
args.driver = NULL;
|
||||
args.flags = 0;
|
||||
|
||||
if ( driver_name )
|
||||
{
|
||||
|
8
thirdparty/freetype/src/base/ftstream.c
vendored
8
thirdparty/freetype/src/base/ftstream.c
vendored
@ -141,7 +141,9 @@
|
||||
if ( read_bytes > count )
|
||||
read_bytes = count;
|
||||
|
||||
FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
|
||||
/* Allow "reading" zero bytes without UB even if buffer is NULL */
|
||||
if ( count )
|
||||
FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
|
||||
}
|
||||
|
||||
stream->pos = pos + read_bytes;
|
||||
@ -178,7 +180,9 @@
|
||||
if ( read_bytes > count )
|
||||
read_bytes = count;
|
||||
|
||||
FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
|
||||
/* Allow "reading" zero bytes without UB even if buffer is NULL */
|
||||
if ( count )
|
||||
FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
|
||||
}
|
||||
|
||||
stream->pos += read_bytes;
|
||||
|
9
thirdparty/freetype/src/cff/cffload.c
vendored
9
thirdparty/freetype/src/cff/cffload.c
vendored
@ -1361,14 +1361,15 @@
|
||||
for ( i = 0; i < numBlends; i++ )
|
||||
{
|
||||
const FT_Int32* weight = &blend->BV[1];
|
||||
FT_UInt32 sum;
|
||||
FT_Fixed sum;
|
||||
|
||||
|
||||
/* convert inputs to 16.16 fixed-point */
|
||||
sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000;
|
||||
/* convert inputs to 16.16 fixed point */
|
||||
sum = cff_parse_fixed( parser, &parser->stack[i + base] );
|
||||
|
||||
for ( j = 1; j < blend->lenBV; j++ )
|
||||
sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++;
|
||||
sum += FT_MulFix( cff_parse_fixed( parser, &parser->stack[delta++] ),
|
||||
*weight++ );
|
||||
|
||||
/* point parser stack to new value on blend_stack */
|
||||
parser->stack[i + base] = subFont->blend_top;
|
||||
|
22
thirdparty/freetype/src/cff/cffparse.c
vendored
22
thirdparty/freetype/src/cff/cffparse.c
vendored
@ -499,6 +499,24 @@
|
||||
{
|
||||
if ( **d == 30 )
|
||||
return cff_parse_real( *d, parser->limit, scaling, NULL );
|
||||
else if ( **d == 255 )
|
||||
{
|
||||
FT_Fixed val = ( ( ( (FT_UInt32)*( d[0] + 1 ) << 24 ) |
|
||||
( (FT_UInt32)*( d[0] + 2 ) << 16 ) |
|
||||
( (FT_UInt32)*( d[0] + 3 ) << 8 ) |
|
||||
(FT_UInt32)*( d[0] + 4 ) ) );
|
||||
|
||||
if ( scaling )
|
||||
{
|
||||
if ( FT_ABS( val ) > power_ten_limits[scaling] )
|
||||
{
|
||||
FT_TRACE4(( "!!!OVERFLOW:!!!" ));
|
||||
return val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
|
||||
}
|
||||
val *= power_tens[scaling];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_Long val = cff_parse_integer( *d, parser->limit );
|
||||
@ -506,7 +524,7 @@
|
||||
|
||||
if ( scaling )
|
||||
{
|
||||
if ( FT_ABS( val ) > power_ten_limits[scaling] )
|
||||
if ( ( FT_ABS( val ) << 16 ) > power_ten_limits[scaling] )
|
||||
{
|
||||
val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
|
||||
goto Overflow;
|
||||
@ -536,7 +554,7 @@
|
||||
|
||||
|
||||
/* read a floating point number, either integer or real */
|
||||
static FT_Fixed
|
||||
FT_LOCAL_DEF( FT_Fixed )
|
||||
cff_parse_fixed( CFF_Parser parser,
|
||||
FT_Byte** d )
|
||||
{
|
||||
|
4
thirdparty/freetype/src/cff/cffparse.h
vendored
4
thirdparty/freetype/src/cff/cffparse.h
vendored
@ -76,6 +76,10 @@ FT_BEGIN_HEADER
|
||||
cff_parse_num( CFF_Parser parser,
|
||||
FT_Byte** d );
|
||||
|
||||
FT_LOCAL( FT_Fixed )
|
||||
cff_parse_fixed( CFF_Parser parser,
|
||||
FT_Byte** d );
|
||||
|
||||
FT_LOCAL( FT_Error )
|
||||
cff_parser_init( CFF_Parser parser,
|
||||
FT_UInt code,
|
||||
|
192
thirdparty/freetype/src/gzip/adler32.c
vendored
192
thirdparty/freetype/src/gzip/adler32.c
vendored
@ -1,192 +0,0 @@
|
||||
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
||||
* Copyright (C) 1995-2011, 2016 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#include "zutil.h"
|
||||
|
||||
#ifndef Z_FREETYPE
|
||||
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
||||
#endif
|
||||
|
||||
#define BASE 65521U /* largest prime smaller than 65536 */
|
||||
#define NMAX 5552
|
||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
||||
|
||||
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
|
||||
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
|
||||
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
|
||||
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
|
||||
#define DO16(buf) DO8(buf,0); DO8(buf,8);
|
||||
|
||||
/* use NO_DIVIDE if your processor does not do division in hardware --
|
||||
try it both ways to see which is faster */
|
||||
#ifdef NO_DIVIDE
|
||||
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
|
||||
(thank you to John Reiser for pointing this out) */
|
||||
# define CHOP(a) \
|
||||
do { \
|
||||
unsigned long tmp = a >> 16; \
|
||||
a &= 0xffffUL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
} while (0)
|
||||
# define MOD28(a) \
|
||||
do { \
|
||||
CHOP(a); \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
# define MOD(a) \
|
||||
do { \
|
||||
CHOP(a); \
|
||||
MOD28(a); \
|
||||
} while (0)
|
||||
# define MOD63(a) \
|
||||
do { /* this assumes a is not negative */ \
|
||||
z_off64_t tmp = a >> 32; \
|
||||
a &= 0xffffffffL; \
|
||||
a += (tmp << 8) - (tmp << 5) + tmp; \
|
||||
tmp = a >> 16; \
|
||||
a &= 0xffffL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
tmp = a >> 16; \
|
||||
a &= 0xffffL; \
|
||||
a += (tmp << 4) - tmp; \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
#else
|
||||
# define MOD(a) a %= BASE
|
||||
# define MOD28(a) a %= BASE
|
||||
# define MOD63(a) a %= BASE
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
uLong ZEXPORT adler32_z(
|
||||
uLong adler,
|
||||
const Bytef *buf,
|
||||
z_size_t len)
|
||||
{
|
||||
unsigned long sum2;
|
||||
unsigned n;
|
||||
|
||||
/* split Adler-32 into component sums */
|
||||
sum2 = (adler >> 16) & 0xffff;
|
||||
adler &= 0xffff;
|
||||
|
||||
/* in case user likes doing a byte at a time, keep it fast */
|
||||
if (len == 1) {
|
||||
adler += buf[0];
|
||||
if (adler >= BASE)
|
||||
adler -= BASE;
|
||||
sum2 += adler;
|
||||
if (sum2 >= BASE)
|
||||
sum2 -= BASE;
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
/* initial Adler-32 value (deferred check for len == 1 speed) */
|
||||
if (buf == Z_NULL)
|
||||
return 1L;
|
||||
|
||||
/* in case short lengths are provided, keep it somewhat fast */
|
||||
if (len < 16) {
|
||||
while (len--) {
|
||||
adler += *buf++;
|
||||
sum2 += adler;
|
||||
}
|
||||
if (adler >= BASE)
|
||||
adler -= BASE;
|
||||
MOD28(sum2); /* only added so many BASE's */
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
/* do length NMAX blocks -- requires just one modulo operation */
|
||||
while (len >= NMAX) {
|
||||
len -= NMAX;
|
||||
n = NMAX / 16; /* NMAX is divisible by 16 */
|
||||
do {
|
||||
DO16(buf); /* 16 sums unrolled */
|
||||
buf += 16;
|
||||
} while (--n);
|
||||
MOD(adler);
|
||||
MOD(sum2);
|
||||
}
|
||||
|
||||
/* do remaining bytes (less than NMAX, still just one modulo) */
|
||||
if (len) { /* avoid modulos if none remaining */
|
||||
while (len >= 16) {
|
||||
len -= 16;
|
||||
DO16(buf);
|
||||
buf += 16;
|
||||
}
|
||||
while (len--) {
|
||||
adler += *buf++;
|
||||
sum2 += adler;
|
||||
}
|
||||
MOD(adler);
|
||||
MOD(sum2);
|
||||
}
|
||||
|
||||
/* return recombined sums */
|
||||
return adler | (sum2 << 16);
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
uLong ZEXPORT adler32(
|
||||
uLong adler,
|
||||
const Bytef *buf,
|
||||
uInt len)
|
||||
{
|
||||
return adler32_z(adler, buf, len);
|
||||
}
|
||||
|
||||
#ifndef Z_FREETYPE
|
||||
|
||||
/* ========================================================================= */
|
||||
local uLong adler32_combine_(
|
||||
uLong adler1,
|
||||
uLong adler2,
|
||||
z_off64_t len2)
|
||||
{
|
||||
unsigned long sum1;
|
||||
unsigned long sum2;
|
||||
unsigned rem;
|
||||
|
||||
/* for negative len, return invalid adler32 as a clue for debugging */
|
||||
if (len2 < 0)
|
||||
return 0xffffffffUL;
|
||||
|
||||
/* the derivation of this formula is left as an exercise for the reader */
|
||||
MOD63(len2); /* assumes len2 >= 0 */
|
||||
rem = (unsigned)len2;
|
||||
sum1 = adler1 & 0xffff;
|
||||
sum2 = rem * sum1;
|
||||
MOD(sum2);
|
||||
sum1 += (adler2 & 0xffff) + BASE - 1;
|
||||
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
||||
if (sum1 >= BASE) sum1 -= BASE;
|
||||
if (sum1 >= BASE) sum1 -= BASE;
|
||||
if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
|
||||
if (sum2 >= BASE) sum2 -= BASE;
|
||||
return sum1 | (sum2 << 16);
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
uLong ZEXPORT adler32_combine(
|
||||
uLong adler1,
|
||||
uLong adler2,
|
||||
z_off_t len2)
|
||||
{
|
||||
return adler32_combine_(adler1, adler2, len2);
|
||||
}
|
||||
|
||||
uLong ZEXPORT adler32_combine64(
|
||||
uLong adler1,
|
||||
uLong adler2,
|
||||
z_off64_t len2)
|
||||
{
|
||||
return adler32_combine_(adler1, adler2, len2);
|
||||
}
|
||||
|
||||
#endif /* !Z_FREETYPE */
|
1135
thirdparty/freetype/src/gzip/crc32.c
vendored
1135
thirdparty/freetype/src/gzip/crc32.c
vendored
File diff suppressed because it is too large
Load Diff
9446
thirdparty/freetype/src/gzip/crc32.h
vendored
9446
thirdparty/freetype/src/gzip/crc32.h
vendored
File diff suppressed because it is too large
Load Diff
547
thirdparty/freetype/src/gzip/ftzconf.h
vendored
547
thirdparty/freetype/src/gzip/ftzconf.h
vendored
@ -1,547 +0,0 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
* Even better than compiling with -DZ_PREFIX would be to use configure to set
|
||||
* this permanently in zconf.h using "./configure --zprefix".
|
||||
*/
|
||||
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
||||
# define Z_PREFIX_SET
|
||||
|
||||
/* all linked symbols and init macros */
|
||||
# define _dist_code z__dist_code
|
||||
# define _length_code z__length_code
|
||||
# define _tr_align z__tr_align
|
||||
# define _tr_flush_bits z__tr_flush_bits
|
||||
# define _tr_flush_block z__tr_flush_block
|
||||
# define _tr_init z__tr_init
|
||||
# define _tr_stored_block z__tr_stored_block
|
||||
# define _tr_tally z__tr_tally
|
||||
# define adler32 z_adler32
|
||||
# define adler32_combine z_adler32_combine
|
||||
# define adler32_combine64 z_adler32_combine64
|
||||
# define adler32_z z_adler32_z
|
||||
# ifndef Z_SOLO
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define compressBound z_compressBound
|
||||
# endif
|
||||
# define crc32 z_crc32
|
||||
# define crc32_combine z_crc32_combine
|
||||
# define crc32_combine64 z_crc32_combine64
|
||||
# define crc32_combine_gen z_crc32_combine_gen
|
||||
# define crc32_combine_gen64 z_crc32_combine_gen64
|
||||
# define crc32_combine_op z_crc32_combine_op
|
||||
# define crc32_z z_crc32_z
|
||||
# define deflate z_deflate
|
||||
# define deflateBound z_deflateBound
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define deflateGetDictionary z_deflateGetDictionary
|
||||
# define deflateInit z_deflateInit
|
||||
# define deflateInit2 z_deflateInit2
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflatePending z_deflatePending
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateResetKeep z_deflateResetKeep
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateSetHeader z_deflateSetHeader
|
||||
# define deflateTune z_deflateTune
|
||||
# define deflate_copyright z_deflate_copyright
|
||||
# define get_crc_table z_get_crc_table
|
||||
# ifndef Z_SOLO
|
||||
# define gz_error z_gz_error
|
||||
# define gz_intmax z_gz_intmax
|
||||
# define gz_strwinerror z_gz_strwinerror
|
||||
# define gzbuffer z_gzbuffer
|
||||
# define gzclearerr z_gzclearerr
|
||||
# define gzclose z_gzclose
|
||||
# define gzclose_r z_gzclose_r
|
||||
# define gzclose_w z_gzclose_w
|
||||
# define gzdirect z_gzdirect
|
||||
# define gzdopen z_gzdopen
|
||||
# define gzeof z_gzeof
|
||||
# define gzerror z_gzerror
|
||||
# define gzflush z_gzflush
|
||||
# define gzfread z_gzfread
|
||||
# define gzfwrite z_gzfwrite
|
||||
# define gzgetc z_gzgetc
|
||||
# define gzgetc_ z_gzgetc_
|
||||
# define gzgets z_gzgets
|
||||
# define gzoffset z_gzoffset
|
||||
# define gzoffset64 z_gzoffset64
|
||||
# define gzopen z_gzopen
|
||||
# define gzopen64 z_gzopen64
|
||||
# ifdef _WIN32
|
||||
# define gzopen_w z_gzopen_w
|
||||
# endif
|
||||
# define gzprintf z_gzprintf
|
||||
# define gzputc z_gzputc
|
||||
# define gzputs z_gzputs
|
||||
# define gzread z_gzread
|
||||
# define gzrewind z_gzrewind
|
||||
# define gzseek z_gzseek
|
||||
# define gzseek64 z_gzseek64
|
||||
# define gzsetparams z_gzsetparams
|
||||
# define gztell z_gztell
|
||||
# define gztell64 z_gztell64
|
||||
# define gzungetc z_gzungetc
|
||||
# define gzvprintf z_gzvprintf
|
||||
# define gzwrite z_gzwrite
|
||||
# endif
|
||||
# define inflate z_inflate
|
||||
# define inflateBack z_inflateBack
|
||||
# define inflateBackEnd z_inflateBackEnd
|
||||
# define inflateBackInit z_inflateBackInit
|
||||
# define inflateBackInit_ z_inflateBackInit_
|
||||
# define inflateCodesUsed z_inflateCodesUsed
|
||||
# define inflateCopy z_inflateCopy
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define inflateGetDictionary z_inflateGetDictionary
|
||||
# define inflateGetHeader z_inflateGetHeader
|
||||
# define inflateInit z_inflateInit
|
||||
# define inflateInit2 z_inflateInit2
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflateMark z_inflateMark
|
||||
# define inflatePrime z_inflatePrime
|
||||
# define inflateReset z_inflateReset
|
||||
# define inflateReset2 z_inflateReset2
|
||||
# define inflateResetKeep z_inflateResetKeep
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateUndermine z_inflateUndermine
|
||||
# define inflateValidate z_inflateValidate
|
||||
# define inflate_copyright z_inflate_copyright
|
||||
# define inflate_fast z_inflate_fast
|
||||
# define inflate_table z_inflate_table
|
||||
# ifndef Z_SOLO
|
||||
# define uncompress z_uncompress
|
||||
# define uncompress2 z_uncompress2
|
||||
# endif
|
||||
# define zError z_zError
|
||||
# ifndef Z_SOLO
|
||||
# define zcalloc z_zcalloc
|
||||
# define zcfree z_zcfree
|
||||
# endif
|
||||
# define zlibCompileFlags z_zlibCompileFlags
|
||||
# define zlibVersion z_zlibVersion
|
||||
|
||||
/* all zlib typedefs in zlib.h and zconf.h */
|
||||
# define Byte z_Byte
|
||||
# define Bytef z_Bytef
|
||||
# define alloc_func z_alloc_func
|
||||
# define charf z_charf
|
||||
# define free_func z_free_func
|
||||
# ifndef Z_SOLO
|
||||
# define gzFile z_gzFile
|
||||
# endif
|
||||
# define gz_header z_gz_header
|
||||
# define gz_headerp z_gz_headerp
|
||||
# define in_func z_in_func
|
||||
# define intf z_intf
|
||||
# define out_func z_out_func
|
||||
# define uInt z_uInt
|
||||
# define uIntf z_uIntf
|
||||
# define uLong z_uLong
|
||||
# define uLongf z_uLongf
|
||||
# define voidp z_voidp
|
||||
# define voidpc z_voidpc
|
||||
# define voidpf z_voidpf
|
||||
|
||||
/* all zlib structs in zlib.h and zconf.h */
|
||||
# define gz_header_s z_gz_header_s
|
||||
# define internal_state z_internal_state
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||
# define MSDOS
|
||||
#endif
|
||||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||
# define OS2
|
||||
#endif
|
||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||
# define WINDOWS
|
||||
#endif
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif
|
||||
#endif
|
||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||
# ifndef SYS16BIT
|
||||
# define SYS16BIT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# define MAXSEG_64K
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_VERSION__
|
||||
# ifndef STDC
|
||||
# define STDC
|
||||
# endif
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# ifndef STDC99
|
||||
# define STDC99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||
# define const /* note: need a more gentle solution here */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(ZLIB_CONST) && !defined(z_const)
|
||||
# define z_const const
|
||||
#else
|
||||
# define z_const
|
||||
#endif
|
||||
|
||||
#ifdef Z_SOLO
|
||||
typedef unsigned long z_size_t;
|
||||
#else
|
||||
# define z_longlong long long
|
||||
# if defined(NO_SIZE_T)
|
||||
typedef unsigned NO_SIZE_T z_size_t;
|
||||
# elif defined(STDC)
|
||||
# include <stddef.h>
|
||||
typedef size_t z_size_t;
|
||||
# else
|
||||
typedef unsigned long z_size_t;
|
||||
# endif
|
||||
# undef z_longlong
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
# define MAX_MEM_LEVEL 8
|
||||
# else
|
||||
# define MAX_MEM_LEVEL 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# ifdef STDC
|
||||
# define OF(args) args
|
||||
# else
|
||||
# define OF(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef Z_ARG /* function prototypes for stdarg */
|
||||
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# define Z_ARG(args) args
|
||||
# else
|
||||
# define Z_ARG(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||
* just define FAR to be empty.
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# if defined(M_I86SM) || defined(M_I86MM)
|
||||
/* MSC small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef _MSC_VER
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||
/* Turbo C small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef __BORLANDC__
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) || defined(WIN32)
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
# ifdef ZLIB_WINAPI
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#if !defined(__MACTYPES__)
|
||||
typedef unsigned char Byte; /* 8 bits */
|
||||
#endif
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
#ifdef SMALL_MEDIUM
|
||||
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||
# define Bytef Byte FAR
|
||||
#else
|
||||
typedef Byte FAR Bytef;
|
||||
#endif
|
||||
typedef char FAR charf;
|
||||
typedef int FAR intf;
|
||||
typedef uInt FAR uIntf;
|
||||
typedef uLong FAR uLongf;
|
||||
|
||||
#ifdef STDC
|
||||
typedef void const *voidpc;
|
||||
typedef void FAR *voidpf;
|
||||
typedef void *voidp;
|
||||
#else
|
||||
typedef Byte const *voidpc;
|
||||
typedef Byte FAR *voidpf;
|
||||
typedef Byte *voidp;
|
||||
#endif
|
||||
|
||||
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
||||
# include <limits.h>
|
||||
# if (UINT_MAX == 0xffffffffUL)
|
||||
# define Z_U4 unsigned
|
||||
# elif (ULONG_MAX == 0xffffffffUL)
|
||||
# define Z_U4 unsigned long
|
||||
# elif (USHRT_MAX == 0xffffffffUL)
|
||||
# define Z_U4 unsigned short
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef Z_U4
|
||||
typedef Z_U4 z_crc_t;
|
||||
#else
|
||||
typedef unsigned long z_crc_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_STDARG_H
|
||||
#endif
|
||||
|
||||
#ifdef STDC
|
||||
# ifndef Z_SOLO
|
||||
# include <sys/types.h> /* for off_t */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# ifndef Z_SOLO
|
||||
# include <stdarg.h> /* for va_list */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifndef Z_SOLO
|
||||
# include <stddef.h> /* for wchar_t */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||
* though the former does not conform to the LFS document), but considering
|
||||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||
* equivalently requesting no 64-bit operations
|
||||
*/
|
||||
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
|
||||
# undef _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
|
||||
#ifndef Z_HAVE_UNISTD_H
|
||||
# ifdef __WATCOMC__
|
||||
# define Z_HAVE_UNISTD_H
|
||||
# endif
|
||||
#endif
|
||||
#ifndef Z_HAVE_UNISTD_H
|
||||
# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
|
||||
# define Z_HAVE_UNISTD_H
|
||||
# endif
|
||||
#endif
|
||||
#ifndef Z_SOLO
|
||||
# if defined(Z_HAVE_UNISTD_H)
|
||||
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
# endif
|
||||
# ifndef z_off_t
|
||||
# define z_off_t off_t
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
|
||||
# define Z_LFS64
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
|
||||
# define Z_LARGE64
|
||||
#endif
|
||||
|
||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
|
||||
# define Z_WANT64
|
||||
#endif
|
||||
|
||||
#if !defined(SEEK_SET) && !defined(Z_SOLO)
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && defined(Z_LARGE64)
|
||||
# define z_off64_t off64_t
|
||||
#else
|
||||
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
|
||||
# define z_off64_t __int64
|
||||
# else
|
||||
# define z_off64_t z_off_t
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
#pragma map(deflateInit_,"DEIN")
|
||||
#pragma map(deflateInit2_,"DEIN2")
|
||||
#pragma map(deflateEnd,"DEEND")
|
||||
#pragma map(deflateBound,"DEBND")
|
||||
#pragma map(inflateInit_,"ININ")
|
||||
#pragma map(inflateInit2_,"ININ2")
|
||||
#pragma map(inflateEnd,"INEND")
|
||||
#pragma map(inflateSync,"INSY")
|
||||
#pragma map(inflateSetDictionary,"INSEDI")
|
||||
#pragma map(compressBound,"CMBND")
|
||||
#pragma map(inflate_table,"INTABL")
|
||||
#pragma map(inflate_fast,"INFA")
|
||||
#pragma map(inflate_copyright,"INCOPY")
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
219
thirdparty/freetype/src/gzip/gzguts.h
vendored
219
thirdparty/freetype/src/gzip/gzguts.h
vendored
@ -1,219 +0,0 @@
|
||||
/* gzguts.h -- zlib internal header definitions for gz* operations
|
||||
* Copyright (C) 2004-2019 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
# ifndef _LARGEFILE_SOURCE
|
||||
# define _LARGEFILE_SOURCE 1
|
||||
# endif
|
||||
# ifdef _FILE_OFFSET_BITS
|
||||
# undef _FILE_OFFSET_BITS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIDDEN
|
||||
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
||||
#else
|
||||
# define ZLIB_INTERNAL
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "zlib.h"
|
||||
#ifdef STDC
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
# define _POSIX_SOURCE
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define WIDECHAR
|
||||
#endif
|
||||
|
||||
#ifdef WINAPI_FAMILY
|
||||
# define open _open
|
||||
# define read _read
|
||||
# define write _write
|
||||
# define close _close
|
||||
#endif
|
||||
|
||||
#ifdef NO_DEFLATE /* for compatibility with old definition */
|
||||
# define NO_GZCOMPRESS
|
||||
#endif
|
||||
|
||||
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define HAVE_VSNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define HAVE_VSNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define HAVE_VSNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
# ifdef MSDOS
|
||||
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
|
||||
but for now we just assume it doesn't. */
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef __TURBOC__
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef WIN32
|
||||
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
|
||||
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
|
||||
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __SASC
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef VMS
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef __OS400__
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef __MVS__
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* unlike snprintf (which is required in C99), _snprintf does not guarantee
|
||||
null termination of the result -- however this is only used in gzlib.c where
|
||||
the result is assured to fit in the space provided */
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#ifndef local
|
||||
# define local static
|
||||
#endif
|
||||
/* since "static" is used to mean two completely different things in C, we
|
||||
define "local" for the non-static meaning of "static", for readability
|
||||
(compile with -Dlocal if your debugger can't find static symbols) */
|
||||
|
||||
/* gz* functions always use library allocation functions */
|
||||
#ifndef STDC
|
||||
extern voidp malloc OF((uInt size));
|
||||
extern void free OF((voidpf ptr));
|
||||
#endif
|
||||
|
||||
/* get errno and strerror definition */
|
||||
#if defined UNDER_CE
|
||||
# include <windows.h>
|
||||
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
|
||||
#else
|
||||
# ifndef NO_STRERROR
|
||||
# include <errno.h>
|
||||
# define zstrerror() strerror(errno)
|
||||
# else
|
||||
# define zstrerror() "stdio error (consult errno)"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* provide prototypes for these when building zlib without LFS */
|
||||
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
||||
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
||||
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
|
||||
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
|
||||
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
||||
#endif
|
||||
|
||||
/* default memLevel */
|
||||
#if MAX_MEM_LEVEL >= 8
|
||||
# define DEF_MEM_LEVEL 8
|
||||
#else
|
||||
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||
#endif
|
||||
|
||||
/* default i/o buffer size -- double this for output when reading (this and
|
||||
twice this must be able to fit in an unsigned type) */
|
||||
#define GZBUFSIZE 8192
|
||||
|
||||
/* gzip modes, also provide a little integrity check on the passed structure */
|
||||
#define GZ_NONE 0
|
||||
#define GZ_READ 7247
|
||||
#define GZ_WRITE 31153
|
||||
#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
|
||||
|
||||
/* values for gz_state how */
|
||||
#define LOOK 0 /* look for a gzip header */
|
||||
#define COPY__ 1 /* copy input directly */
|
||||
#define GZIP 2 /* decompress a gzip stream */
|
||||
|
||||
/* internal gzip file state data structure */
|
||||
typedef struct {
|
||||
/* exposed contents for gzgetc() macro */
|
||||
struct gzFile_s x; /* "x" for exposed */
|
||||
/* x.have: number of bytes available at x.next */
|
||||
/* x.next: next output data to deliver or write */
|
||||
/* x.pos: current position in uncompressed data */
|
||||
/* used for both reading and writing */
|
||||
int mode; /* see gzip modes above */
|
||||
int fd; /* file descriptor */
|
||||
char *path; /* path or fd for error messages */
|
||||
unsigned size; /* buffer size, zero if not allocated yet */
|
||||
unsigned want; /* requested buffer size, default is GZBUFSIZE */
|
||||
unsigned char *in; /* input buffer (double-sized when writing) */
|
||||
unsigned char *out; /* output buffer (double-sized when reading) */
|
||||
int direct; /* 0 if processing gzip, 1 if transparent */
|
||||
/* just for reading */
|
||||
int how; /* 0: get header, 1: copy, 2: decompress */
|
||||
z_off64_t start; /* where the gzip data started, for rewinding */
|
||||
int eof; /* true if end of input file reached */
|
||||
int past; /* true if read requested past end */
|
||||
/* just for writing */
|
||||
int level; /* compression level */
|
||||
int strategy; /* compression strategy */
|
||||
int reset; /* true if a reset is pending after a Z_FINISH */
|
||||
/* seek request */
|
||||
z_off64_t skip; /* amount to skip (already rewound if backwards) */
|
||||
int seek; /* true if seek request pending */
|
||||
/* error information */
|
||||
int err; /* error code */
|
||||
char *msg; /* error message */
|
||||
/* zlib inflate or deflate stream */
|
||||
z_stream strm; /* stream structure in-place (not a pointer) */
|
||||
} gz_state;
|
||||
typedef gz_state FAR *gz_statep;
|
||||
|
||||
/* shared functions */
|
||||
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
|
||||
#if defined UNDER_CE
|
||||
char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
|
||||
#endif
|
||||
|
||||
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
||||
value -- needed when comparing unsigned to z_off64_t, which is signed
|
||||
(possible z_off64_t types off_t, off64_t, and long are all signed) */
|
||||
#ifdef INT_MAX
|
||||
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
|
||||
#else
|
||||
unsigned ZLIB_INTERNAL gz_intmax OF((void));
|
||||
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
|
||||
#endif
|
323
thirdparty/freetype/src/gzip/inffast.c
vendored
323
thirdparty/freetype/src/gzip/inffast.c
vendored
@ -1,323 +0,0 @@
|
||||
/* inffast.c -- fast decoding
|
||||
* Copyright (C) 1995-2017 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "inftrees.h"
|
||||
#include "inflate.h"
|
||||
#include "inffast.h"
|
||||
|
||||
#ifdef ASMINF
|
||||
# pragma message("Assembler code may have bugs -- use at your own risk")
|
||||
#else
|
||||
|
||||
/*
|
||||
Decode literal, length, and distance codes and write out the resulting
|
||||
literal and match bytes until either not enough input or output is
|
||||
available, an end-of-block is encountered, or a data error is encountered.
|
||||
When large enough input and output buffers are supplied to inflate(), for
|
||||
example, a 16K input buffer and a 64K output buffer, more than 95% of the
|
||||
inflate execution time is spent in this routine.
|
||||
|
||||
Entry assumptions:
|
||||
|
||||
state->mode == LEN
|
||||
strm->avail_in >= 6
|
||||
strm->avail_out >= 258
|
||||
start >= strm->avail_out
|
||||
state->bits < 8
|
||||
|
||||
On return, state->mode is one of:
|
||||
|
||||
LEN -- ran out of enough output space or enough available input
|
||||
TYPE -- reached end of block code, inflate() to interpret next block
|
||||
BAD -- error in block data
|
||||
|
||||
Notes:
|
||||
|
||||
- The maximum input bits used by a length/distance pair is 15 bits for the
|
||||
length code, 5 bits for the length extra, 15 bits for the distance code,
|
||||
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
||||
Therefore if strm->avail_in >= 6, then there is enough input to avoid
|
||||
checking for available input while decoding.
|
||||
|
||||
- The maximum bytes that a single length/distance pair can output is 258
|
||||
bytes, which is the maximum length that can be coded. inflate_fast()
|
||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
void ZLIB_INTERNAL inflate_fast(
|
||||
z_streamp strm,
|
||||
unsigned start)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
z_const unsigned char FAR *in; /* local strm->next_in */
|
||||
z_const unsigned char FAR *last; /* have enough input while in < last */
|
||||
unsigned char FAR *out; /* local strm->next_out */
|
||||
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
|
||||
unsigned char FAR *end; /* while out < end, enough space available */
|
||||
#ifdef INFLATE_STRICT
|
||||
unsigned dmax; /* maximum distance from zlib header */
|
||||
#endif
|
||||
unsigned wsize; /* window size or zero if not using window */
|
||||
unsigned whave; /* valid bytes in the window */
|
||||
unsigned wnext; /* window write index */
|
||||
unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
|
||||
unsigned long hold; /* local strm->hold */
|
||||
unsigned bits; /* local strm->bits */
|
||||
code const FAR *lcode; /* local strm->lencode */
|
||||
code const FAR *dcode; /* local strm->distcode */
|
||||
unsigned lmask; /* mask for first level of length codes */
|
||||
unsigned dmask; /* mask for first level of distance codes */
|
||||
code const *here; /* retrieved table entry */
|
||||
unsigned op; /* code bits, operation, extra bits, or */
|
||||
/* window position, window bytes to copy */
|
||||
unsigned len; /* match length, unused bytes */
|
||||
unsigned dist; /* match distance */
|
||||
unsigned char FAR *from; /* where to copy match from */
|
||||
|
||||
/* copy state to local variables */
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
in = strm->next_in;
|
||||
last = in + (strm->avail_in - 5);
|
||||
out = strm->next_out;
|
||||
beg = out - (start - strm->avail_out);
|
||||
end = out + (strm->avail_out - 257);
|
||||
#ifdef INFLATE_STRICT
|
||||
dmax = state->dmax;
|
||||
#endif
|
||||
wsize = state->wsize;
|
||||
whave = state->whave;
|
||||
wnext = state->wnext;
|
||||
window = state->window;
|
||||
hold = state->hold;
|
||||
bits = state->bits;
|
||||
lcode = state->lencode;
|
||||
dcode = state->distcode;
|
||||
lmask = (1U << state->lenbits) - 1;
|
||||
dmask = (1U << state->distbits) - 1;
|
||||
|
||||
/* decode literals and length/distances until end-of-block or not enough
|
||||
input data or output space */
|
||||
do {
|
||||
if (bits < 15) {
|
||||
hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
here = lcode + (hold & lmask);
|
||||
dolen:
|
||||
op = (unsigned)(here->bits);
|
||||
hold >>= op;
|
||||
bits -= op;
|
||||
op = (unsigned)(here->op);
|
||||
if (op == 0) { /* literal */
|
||||
Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
|
||||
"inflate: literal '%c'\n" :
|
||||
"inflate: literal 0x%02x\n", here->val));
|
||||
*out++ = (unsigned char)(here->val);
|
||||
}
|
||||
else if (op & 16) { /* length base */
|
||||
len = (unsigned)(here->val);
|
||||
op &= 15; /* number of extra bits */
|
||||
if (op) {
|
||||
if (bits < op) {
|
||||
hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
len += (unsigned)hold & ((1U << op) - 1);
|
||||
hold >>= op;
|
||||
bits -= op;
|
||||
}
|
||||
Tracevv((stderr, "inflate: length %u\n", len));
|
||||
if (bits < 15) {
|
||||
hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
here = dcode + (hold & dmask);
|
||||
dodist:
|
||||
op = (unsigned)(here->bits);
|
||||
hold >>= op;
|
||||
bits -= op;
|
||||
op = (unsigned)(here->op);
|
||||
if (op & 16) { /* distance base */
|
||||
dist = (unsigned)(here->val);
|
||||
op &= 15; /* number of extra bits */
|
||||
if (bits < op) {
|
||||
hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
if (bits < op) {
|
||||
hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
}
|
||||
dist += (unsigned)hold & ((1U << op) - 1);
|
||||
#ifdef INFLATE_STRICT
|
||||
if (dist > dmax) {
|
||||
strm->msg = (char *)"invalid distance too far back";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
hold >>= op;
|
||||
bits -= op;
|
||||
Tracevv((stderr, "inflate: distance %u\n", dist));
|
||||
op = (unsigned)(out - beg); /* max distance in output */
|
||||
if (dist > op) { /* see if copy from window */
|
||||
op = dist - op; /* distance back in window */
|
||||
if (op > whave) {
|
||||
if (state->sane) {
|
||||
strm->msg =
|
||||
(char *)"invalid distance too far back";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||
if (len <= op - whave) {
|
||||
do {
|
||||
*out++ = 0;
|
||||
} while (--len);
|
||||
continue;
|
||||
}
|
||||
len -= op - whave;
|
||||
do {
|
||||
*out++ = 0;
|
||||
} while (--op > whave);
|
||||
if (op == 0) {
|
||||
from = out - dist;
|
||||
do {
|
||||
*out++ = *from++;
|
||||
} while (--len);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
from = window;
|
||||
if (wnext == 0) { /* very common case */
|
||||
from += wsize - op;
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
*out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
}
|
||||
else if (wnext < op) { /* wrap around window */
|
||||
from += wsize + wnext - op;
|
||||
op -= wnext;
|
||||
if (op < len) { /* some from end of window */
|
||||
len -= op;
|
||||
do {
|
||||
*out++ = *from++;
|
||||
} while (--op);
|
||||
from = window;
|
||||
if (wnext < len) { /* some from start of window */
|
||||
op = wnext;
|
||||
len -= op;
|
||||
do {
|
||||
*out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
}
|
||||
}
|
||||
else { /* contiguous in window */
|
||||
from += wnext - op;
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
*out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
}
|
||||
while (len > 2) {
|
||||
*out++ = *from++;
|
||||
*out++ = *from++;
|
||||
*out++ = *from++;
|
||||
len -= 3;
|
||||
}
|
||||
if (len) {
|
||||
*out++ = *from++;
|
||||
if (len > 1)
|
||||
*out++ = *from++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
from = out - dist; /* copy direct from output */
|
||||
do { /* minimum length is three */
|
||||
*out++ = *from++;
|
||||
*out++ = *from++;
|
||||
*out++ = *from++;
|
||||
len -= 3;
|
||||
} while (len > 2);
|
||||
if (len) {
|
||||
*out++ = *from++;
|
||||
if (len > 1)
|
||||
*out++ = *from++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((op & 64) == 0) { /* 2nd level distance code */
|
||||
here = dcode + here->val + (hold & ((1U << op) - 1));
|
||||
goto dodist;
|
||||
}
|
||||
else {
|
||||
strm->msg = (char *)"invalid distance code";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((op & 64) == 0) { /* 2nd level length code */
|
||||
here = lcode + here->val + (hold & ((1U << op) - 1));
|
||||
goto dolen;
|
||||
}
|
||||
else if (op & 32) { /* end-of-block */
|
||||
Tracevv((stderr, "inflate: end of block\n"));
|
||||
state->mode = TYPE;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
strm->msg = (char *)"invalid literal/length code";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
} while (in < last && out < end);
|
||||
|
||||
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
|
||||
len = bits >> 3;
|
||||
in -= len;
|
||||
bits -= len << 3;
|
||||
hold &= (1U << bits) - 1;
|
||||
|
||||
/* update state and return */
|
||||
strm->next_in = in;
|
||||
strm->next_out = out;
|
||||
strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
|
||||
strm->avail_out = (unsigned)(out < end ?
|
||||
257 + (end - out) : 257 - (out - end));
|
||||
state->hold = hold;
|
||||
state->bits = bits;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
|
||||
- Using bit fields for code structure
|
||||
- Different op definition to avoid & for extra bits (do & for table bits)
|
||||
- Three separate decoding do-loops for direct, window, and wnext == 0
|
||||
- Special case for distance > 1 copies to do overlapped load and store copy
|
||||
- Explicit branch predictions (based on measured branch probabilities)
|
||||
- Deferring match copy and interspersed it with decoding subsequent codes
|
||||
- Swapping literal/length else
|
||||
- Swapping window/direct else
|
||||
- Larger unrolled copy loops (three is about right)
|
||||
- Moving len -= 3 statement into middle of loop
|
||||
*/
|
||||
|
||||
#endif /* !ASMINF */
|
11
thirdparty/freetype/src/gzip/inffast.h
vendored
11
thirdparty/freetype/src/gzip/inffast.h
vendored
@ -1,11 +0,0 @@
|
||||
/* inffast.h -- header to use inffast.c
|
||||
* Copyright (C) 1995-2003, 2010 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
static void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
94
thirdparty/freetype/src/gzip/inffixed.h
vendored
94
thirdparty/freetype/src/gzip/inffixed.h
vendored
@ -1,94 +0,0 @@
|
||||
/* inffixed.h -- table for decoding fixed codes
|
||||
* Generated automatically by makefixed().
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications.
|
||||
It is part of the implementation of this library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
static const code lenfix[512] = {
|
||||
{96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
|
||||
{0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
|
||||
{0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
|
||||
{0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
|
||||
{0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
|
||||
{21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
|
||||
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
|
||||
{0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
|
||||
{18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
|
||||
{0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
|
||||
{0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
|
||||
{0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
|
||||
{20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
|
||||
{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
|
||||
{0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
|
||||
{0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
|
||||
{16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
|
||||
{0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
|
||||
{0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
|
||||
{0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
|
||||
{0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
|
||||
{0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
|
||||
{0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
|
||||
{0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
|
||||
{17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
|
||||
{0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
|
||||
{0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
|
||||
{0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
|
||||
{19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
|
||||
{0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
|
||||
{0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
|
||||
{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
|
||||
{16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
|
||||
{0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
|
||||
{0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
|
||||
{0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
|
||||
{0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
|
||||
{20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
|
||||
{0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
|
||||
{0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
|
||||
{17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
|
||||
{0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
|
||||
{0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
|
||||
{0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
|
||||
{20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
|
||||
{0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
|
||||
{0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
|
||||
{0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
|
||||
{16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
|
||||
{0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
|
||||
{0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
|
||||
{0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
|
||||
{0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
|
||||
{0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
|
||||
{0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
|
||||
{0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
|
||||
{16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
|
||||
{0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
|
||||
{0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
|
||||
{0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
|
||||
{19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
|
||||
{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
|
||||
{0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
|
||||
{0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
|
||||
{16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
|
||||
{0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
|
||||
{0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
|
||||
{0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
|
||||
{0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
|
||||
{64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
|
||||
{0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
|
||||
{0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
|
||||
{18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
|
||||
{0,9,255}
|
||||
};
|
||||
|
||||
static const code distfix[32] = {
|
||||
{16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
|
||||
{21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
|
||||
{18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
|
||||
{19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
|
||||
{16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
|
||||
{22,5,193},{64,5,0}
|
||||
};
|
1605
thirdparty/freetype/src/gzip/inflate.c
vendored
1605
thirdparty/freetype/src/gzip/inflate.c
vendored
File diff suppressed because it is too large
Load Diff
131
thirdparty/freetype/src/gzip/inflate.h
vendored
131
thirdparty/freetype/src/gzip/inflate.h
vendored
@ -1,131 +0,0 @@
|
||||
/* inflate.h -- internal inflate state definition
|
||||
* Copyright (C) 1995-2019 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#ifndef INFLATE_H
|
||||
#define INFLATE_H
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* define NO_GZIP when compiling if you want to disable gzip header and
|
||||
trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
|
||||
the crc code when it is not needed. For shared libraries, gzip decoding
|
||||
should be left enabled. */
|
||||
#ifndef NO_GZIP
|
||||
# define GUNZIP
|
||||
#endif
|
||||
|
||||
/* Possible inflate modes between inflate() calls */
|
||||
typedef enum {
|
||||
HEAD = 16180, /* i: waiting for magic header */
|
||||
FLAGS, /* i: waiting for method and flags (gzip) */
|
||||
TIME, /* i: waiting for modification time (gzip) */
|
||||
OS, /* i: waiting for extra flags and operating system (gzip) */
|
||||
EXLEN, /* i: waiting for extra length (gzip) */
|
||||
EXTRA, /* i: waiting for extra bytes (gzip) */
|
||||
NAME, /* i: waiting for end of file name (gzip) */
|
||||
COMMENT, /* i: waiting for end of comment (gzip) */
|
||||
HCRC, /* i: waiting for header crc (gzip) */
|
||||
DICTID, /* i: waiting for dictionary check value */
|
||||
DICT, /* waiting for inflateSetDictionary() call */
|
||||
TYPE, /* i: waiting for type bits, including last-flag bit */
|
||||
TYPEDO, /* i: same, but skip check to exit inflate on new block */
|
||||
STORED, /* i: waiting for stored size (length and complement) */
|
||||
COPY_, /* i/o: same as COPY below, but only first time in */
|
||||
COPY, /* i/o: waiting for input or output to copy stored block */
|
||||
TABLE, /* i: waiting for dynamic block table lengths */
|
||||
LENLENS, /* i: waiting for code length code lengths */
|
||||
CODELENS, /* i: waiting for length/lit and distance code lengths */
|
||||
LEN_, /* i: same as LEN below, but only first time in */
|
||||
LEN, /* i: waiting for length/lit/eob code */
|
||||
LENEXT, /* i: waiting for length extra bits */
|
||||
DIST, /* i: waiting for distance code */
|
||||
DISTEXT, /* i: waiting for distance extra bits */
|
||||
MATCH, /* o: waiting for output space to copy string */
|
||||
LIT, /* o: waiting for output space to write literal */
|
||||
CHECK, /* i: waiting for 32-bit check value */
|
||||
LENGTH, /* i: waiting for 32-bit length (gzip) */
|
||||
DONE, /* finished check, done -- remain here until reset */
|
||||
BAD, /* got a data error -- remain here until reset */
|
||||
MEM, /* got an inflate() memory error -- remain here until reset */
|
||||
SYNC /* looking for synchronization bytes to restart inflate() */
|
||||
} inflate_mode;
|
||||
|
||||
/*
|
||||
State transitions between above modes -
|
||||
|
||||
(most modes can go to BAD or MEM on error -- not shown for clarity)
|
||||
|
||||
Process header:
|
||||
HEAD -> (gzip) or (zlib) or (raw)
|
||||
(gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
|
||||
HCRC -> TYPE
|
||||
(zlib) -> DICTID or TYPE
|
||||
DICTID -> DICT -> TYPE
|
||||
(raw) -> TYPEDO
|
||||
Read deflate blocks:
|
||||
TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
|
||||
STORED -> COPY_ -> COPY -> TYPE
|
||||
TABLE -> LENLENS -> CODELENS -> LEN_
|
||||
LEN_ -> LEN
|
||||
Read deflate codes in fixed or dynamic block:
|
||||
LEN -> LENEXT or LIT or TYPE
|
||||
LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
|
||||
LIT -> LEN
|
||||
Process trailer:
|
||||
CHECK -> LENGTH -> DONE
|
||||
*/
|
||||
|
||||
/* State maintained between inflate() calls -- approximately 7K bytes, not
|
||||
including the allocated sliding window, which is up to 32K bytes. */
|
||||
struct inflate_state {
|
||||
z_streamp strm; /* pointer back to this zlib stream */
|
||||
inflate_mode mode; /* current inflate mode */
|
||||
int last; /* true if processing last block */
|
||||
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
|
||||
bit 2 true to validate check value */
|
||||
int havedict; /* true if dictionary provided */
|
||||
int flags; /* gzip header method and flags, 0 if zlib, or
|
||||
-1 if raw or no header yet */
|
||||
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
|
||||
unsigned long check; /* protected copy of check value */
|
||||
unsigned long total; /* protected copy of output count */
|
||||
gz_headerp head; /* where to save gzip header information */
|
||||
/* sliding window */
|
||||
unsigned wbits; /* log base 2 of requested window size */
|
||||
unsigned wsize; /* window size or zero if not using window */
|
||||
unsigned whave; /* valid bytes in the window */
|
||||
unsigned wnext; /* window write index */
|
||||
unsigned char FAR *window; /* allocated sliding window, if needed */
|
||||
/* bit accumulator */
|
||||
unsigned long hold; /* input bit accumulator */
|
||||
unsigned bits; /* number of bits in "in" */
|
||||
/* for string and stored block copying */
|
||||
unsigned length; /* literal or length of data to copy */
|
||||
unsigned offset; /* distance back to copy string from */
|
||||
/* for table and code decoding */
|
||||
unsigned extra; /* extra bits needed */
|
||||
/* fixed and dynamic code tables */
|
||||
code const FAR *lencode; /* starting table for length/literal codes */
|
||||
code const FAR *distcode; /* starting table for distance codes */
|
||||
unsigned lenbits; /* index bits for lencode */
|
||||
unsigned distbits; /* index bits for distcode */
|
||||
/* dynamic table building */
|
||||
unsigned ncode; /* number of code length code lengths */
|
||||
unsigned nlen; /* number of length code lengths */
|
||||
unsigned ndist; /* number of distance code lengths */
|
||||
unsigned have; /* number of code lengths in lens[] */
|
||||
code FAR *next; /* next available space in codes[] */
|
||||
unsigned short lens[320]; /* temporary storage for code lengths */
|
||||
unsigned short work[288]; /* work area for code table building */
|
||||
code codes[ENOUGH]; /* space for code tables */
|
||||
int sane; /* if false, allow invalid distance too far */
|
||||
int back; /* bits back of last unprocessed length/lit */
|
||||
unsigned was; /* initial length of match */
|
||||
};
|
||||
|
||||
#endif /* INFLATE_H */
|
304
thirdparty/freetype/src/gzip/inftrees.c
vendored
304
thirdparty/freetype/src/gzip/inftrees.c
vendored
@ -1,304 +0,0 @@
|
||||
/* inftrees.c -- generate Huffman trees for efficient decoding
|
||||
* Copyright (C) 1995-2022 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "inftrees.h"
|
||||
|
||||
#define MAXBITS 15
|
||||
|
||||
static const char inflate_copyright[] =
|
||||
" inflate 1.2.13 Copyright 1995-2022 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
include such an acknowledgment, I would appreciate that you keep this
|
||||
copyright string in the executable of your product.
|
||||
*/
|
||||
|
||||
/*
|
||||
Build a set of tables to decode the provided canonical Huffman code.
|
||||
The code lengths are lens[0..codes-1]. The result starts at *table,
|
||||
whose indices are 0..2^bits-1. work is a writable array of at least
|
||||
lens shorts, which is used as a work area. type is the type of code
|
||||
to be generated, CODES, LENS, or DISTS. On return, zero is success,
|
||||
-1 is an invalid code, and +1 means that ENOUGH isn't enough. table
|
||||
on return points to the next available entry's address. bits is the
|
||||
requested root table index bits, and on return it is the actual root
|
||||
table index bits. It will differ if the request is greater than the
|
||||
longest code or if it is less than the shortest code.
|
||||
*/
|
||||
int ZLIB_INTERNAL inflate_table(
|
||||
codetype type,
|
||||
unsigned short FAR *lens,
|
||||
unsigned codes,
|
||||
code FAR * FAR *table,
|
||||
unsigned FAR *bits,
|
||||
unsigned short FAR *work)
|
||||
{
|
||||
unsigned len; /* a code's length in bits */
|
||||
unsigned sym; /* index of code symbols */
|
||||
unsigned min, max; /* minimum and maximum code lengths */
|
||||
unsigned root; /* number of index bits for root table */
|
||||
unsigned curr; /* number of index bits for current table */
|
||||
unsigned drop; /* code bits to drop for sub-table */
|
||||
int left; /* number of prefix codes available */
|
||||
unsigned used; /* code entries in table used */
|
||||
unsigned huff; /* Huffman code */
|
||||
unsigned incr; /* for incrementing code, index */
|
||||
unsigned fill; /* index for replicating entries */
|
||||
unsigned low; /* low bits for current root entry */
|
||||
unsigned mask; /* mask for low root bits */
|
||||
code here; /* table entry for duplication */
|
||||
code FAR *next; /* next available space in table */
|
||||
const unsigned short FAR *base; /* base value table to use */
|
||||
const unsigned short FAR *extra; /* extra bits table to use */
|
||||
unsigned match; /* use base and extra for symbol >= match */
|
||||
unsigned short count[MAXBITS+1]; /* number of codes of each length */
|
||||
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
|
||||
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65};
|
||||
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
8193, 12289, 16385, 24577, 0, 0};
|
||||
static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
|
||||
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
|
||||
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
|
||||
28, 28, 29, 29, 64, 64};
|
||||
|
||||
/*
|
||||
Process a set of code lengths to create a canonical Huffman code. The
|
||||
code lengths are lens[0..codes-1]. Each length corresponds to the
|
||||
symbols 0..codes-1. The Huffman code is generated by first sorting the
|
||||
symbols by length from short to long, and retaining the symbol order
|
||||
for codes with equal lengths. Then the code starts with all zero bits
|
||||
for the first code of the shortest length, and the codes are integer
|
||||
increments for the same length, and zeros are appended as the length
|
||||
increases. For the deflate format, these bits are stored backwards
|
||||
from their more natural integer increment ordering, and so when the
|
||||
decoding tables are built in the large loop below, the integer codes
|
||||
are incremented backwards.
|
||||
|
||||
This routine assumes, but does not check, that all of the entries in
|
||||
lens[] are in the range 0..MAXBITS. The caller must assure this.
|
||||
1..MAXBITS is interpreted as that code length. zero means that that
|
||||
symbol does not occur in this code.
|
||||
|
||||
The codes are sorted by computing a count of codes for each length,
|
||||
creating from that a table of starting indices for each length in the
|
||||
sorted table, and then entering the symbols in order in the sorted
|
||||
table. The sorted table is work[], with that space being provided by
|
||||
the caller.
|
||||
|
||||
The length counts are used for other purposes as well, i.e. finding
|
||||
the minimum and maximum length codes, determining if there are any
|
||||
codes at all, checking for a valid set of lengths, and looking ahead
|
||||
at length counts to determine sub-table sizes when building the
|
||||
decoding tables.
|
||||
*/
|
||||
|
||||
/* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
|
||||
for (len = 0; len <= MAXBITS; len++)
|
||||
count[len] = 0;
|
||||
for (sym = 0; sym < codes; sym++)
|
||||
count[lens[sym]]++;
|
||||
|
||||
/* bound code lengths, force root to be within code lengths */
|
||||
root = *bits;
|
||||
for (max = MAXBITS; max >= 1; max--)
|
||||
if (count[max] != 0) break;
|
||||
if (root > max) root = max;
|
||||
if (max == 0) { /* no symbols to code at all */
|
||||
here.op = (unsigned char)64; /* invalid code marker */
|
||||
here.bits = (unsigned char)1;
|
||||
here.val = (unsigned short)0;
|
||||
*(*table)++ = here; /* make a table to force an error */
|
||||
*(*table)++ = here;
|
||||
*bits = 1;
|
||||
return 0; /* no symbols, but wait for decoding to report error */
|
||||
}
|
||||
for (min = 1; min < max; min++)
|
||||
if (count[min] != 0) break;
|
||||
if (root < min) root = min;
|
||||
|
||||
/* check for an over-subscribed or incomplete set of lengths */
|
||||
left = 1;
|
||||
for (len = 1; len <= MAXBITS; len++) {
|
||||
left <<= 1;
|
||||
left -= count[len];
|
||||
if (left < 0) return -1; /* over-subscribed */
|
||||
}
|
||||
if (left > 0 && (type == CODES || max != 1))
|
||||
return -1; /* incomplete set */
|
||||
|
||||
/* generate offsets into symbol table for each length for sorting */
|
||||
offs[1] = 0;
|
||||
for (len = 1; len < MAXBITS; len++)
|
||||
offs[len + 1] = offs[len] + count[len];
|
||||
|
||||
/* sort symbols by length, by symbol order within each length */
|
||||
for (sym = 0; sym < codes; sym++)
|
||||
if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
|
||||
|
||||
/*
|
||||
Create and fill in decoding tables. In this loop, the table being
|
||||
filled is at next and has curr index bits. The code being used is huff
|
||||
with length len. That code is converted to an index by dropping drop
|
||||
bits off of the bottom. For codes where len is less than drop + curr,
|
||||
those top drop + curr - len bits are incremented through all values to
|
||||
fill the table with replicated entries.
|
||||
|
||||
root is the number of index bits for the root table. When len exceeds
|
||||
root, sub-tables are created pointed to by the root entry with an index
|
||||
of the low root bits of huff. This is saved in low to check for when a
|
||||
new sub-table should be started. drop is zero when the root table is
|
||||
being filled, and drop is root when sub-tables are being filled.
|
||||
|
||||
When a new sub-table is needed, it is necessary to look ahead in the
|
||||
code lengths to determine what size sub-table is needed. The length
|
||||
counts are used for this, and so count[] is decremented as codes are
|
||||
entered in the tables.
|
||||
|
||||
used keeps track of how many table entries have been allocated from the
|
||||
provided *table space. It is checked for LENS and DIST tables against
|
||||
the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
|
||||
the initial root table size constants. See the comments in inftrees.h
|
||||
for more information.
|
||||
|
||||
sym increments through all symbols, and the loop terminates when
|
||||
all codes of length max, i.e. all codes, have been processed. This
|
||||
routine permits incomplete codes, so another loop after this one fills
|
||||
in the rest of the decoding tables with invalid code markers.
|
||||
*/
|
||||
|
||||
/* set up for code type */
|
||||
switch (type) {
|
||||
case CODES:
|
||||
base = extra = work; /* dummy value--not used */
|
||||
match = 20;
|
||||
break;
|
||||
case LENS:
|
||||
base = lbase;
|
||||
extra = lext;
|
||||
match = 257;
|
||||
break;
|
||||
default: /* DISTS */
|
||||
base = dbase;
|
||||
extra = dext;
|
||||
match = 0;
|
||||
}
|
||||
|
||||
/* initialize state for loop */
|
||||
huff = 0; /* starting code */
|
||||
sym = 0; /* starting code symbol */
|
||||
len = min; /* starting code length */
|
||||
next = *table; /* current table to fill in */
|
||||
curr = root; /* current table index bits */
|
||||
drop = 0; /* current bits to drop from code for index */
|
||||
low = (unsigned)(-1); /* trigger new sub-table when len > root */
|
||||
used = 1U << root; /* use root table entries */
|
||||
mask = used - 1; /* mask for comparing low */
|
||||
|
||||
/* check available table space */
|
||||
if ((type == LENS && used > ENOUGH_LENS) ||
|
||||
(type == DISTS && used > ENOUGH_DISTS))
|
||||
return 1;
|
||||
|
||||
/* process all codes and make table entries */
|
||||
for (;;) {
|
||||
/* create table entry */
|
||||
here.bits = (unsigned char)(len - drop);
|
||||
if (work[sym] + 1U < match) {
|
||||
here.op = (unsigned char)0;
|
||||
here.val = work[sym];
|
||||
}
|
||||
else if (work[sym] >= match) {
|
||||
here.op = (unsigned char)(extra[work[sym] - match]);
|
||||
here.val = base[work[sym] - match];
|
||||
}
|
||||
else {
|
||||
here.op = (unsigned char)(32 + 64); /* end of block */
|
||||
here.val = 0;
|
||||
}
|
||||
|
||||
/* replicate for those indices with low len bits equal to huff */
|
||||
incr = 1U << (len - drop);
|
||||
fill = 1U << curr;
|
||||
min = fill; /* save offset to next table */
|
||||
do {
|
||||
fill -= incr;
|
||||
next[(huff >> drop) + fill] = here;
|
||||
} while (fill != 0);
|
||||
|
||||
/* backwards increment the len-bit code huff */
|
||||
incr = 1U << (len - 1);
|
||||
while (huff & incr)
|
||||
incr >>= 1;
|
||||
if (incr != 0) {
|
||||
huff &= incr - 1;
|
||||
huff += incr;
|
||||
}
|
||||
else
|
||||
huff = 0;
|
||||
|
||||
/* go to next symbol, update count, len */
|
||||
sym++;
|
||||
if (--(count[len]) == 0) {
|
||||
if (len == max) break;
|
||||
len = lens[work[sym]];
|
||||
}
|
||||
|
||||
/* create new sub-table if needed */
|
||||
if (len > root && (huff & mask) != low) {
|
||||
/* if first time, transition to sub-tables */
|
||||
if (drop == 0)
|
||||
drop = root;
|
||||
|
||||
/* increment past last table */
|
||||
next += min; /* here min is 1 << curr */
|
||||
|
||||
/* determine length of next table */
|
||||
curr = len - drop;
|
||||
left = (int)(1 << curr);
|
||||
while (curr + drop < max) {
|
||||
left -= count[curr + drop];
|
||||
if (left <= 0) break;
|
||||
curr++;
|
||||
left <<= 1;
|
||||
}
|
||||
|
||||
/* check for enough space */
|
||||
used += 1U << curr;
|
||||
if ((type == LENS && used > ENOUGH_LENS) ||
|
||||
(type == DISTS && used > ENOUGH_DISTS))
|
||||
return 1;
|
||||
|
||||
/* point entry in root table to sub-table */
|
||||
low = huff & mask;
|
||||
(*table)[low].op = (unsigned char)curr;
|
||||
(*table)[low].bits = (unsigned char)root;
|
||||
(*table)[low].val = (unsigned short)(next - *table);
|
||||
}
|
||||
}
|
||||
|
||||
/* fill in remaining table entry if code is incomplete (guaranteed to have
|
||||
at most one remaining entry, since if the code is incomplete, the
|
||||
maximum code length that was allowed to get this far is one bit) */
|
||||
if (huff != 0) {
|
||||
here.op = (unsigned char)64; /* invalid code marker */
|
||||
here.bits = (unsigned char)(len - drop);
|
||||
here.val = (unsigned short)0;
|
||||
next[huff] = here;
|
||||
}
|
||||
|
||||
/* set return parameters */
|
||||
*table += used;
|
||||
*bits = root;
|
||||
return 0;
|
||||
}
|
67
thirdparty/freetype/src/gzip/inftrees.h
vendored
67
thirdparty/freetype/src/gzip/inftrees.h
vendored
@ -1,67 +0,0 @@
|
||||
/* inftrees.h -- header to use inftrees.c
|
||||
* Copyright (C) 1995-2005, 2010 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#ifndef INFTREES_H
|
||||
#define INFTREES_H
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* Structure for decoding tables. Each entry provides either the
|
||||
information needed to do the operation requested by the code that
|
||||
indexed that table entry, or it provides a pointer to another
|
||||
table that indexes more bits of the code. op indicates whether
|
||||
the entry is a pointer to another table, a literal, a length or
|
||||
distance, an end-of-block, or an invalid code. For a table
|
||||
pointer, the low four bits of op is the number of index bits of
|
||||
that table. For a length or distance, the low four bits of op
|
||||
is the number of extra bits to get after the code. bits is
|
||||
the number of bits in this code or part of the code to drop off
|
||||
of the bit buffer. val is the actual byte to output in the case
|
||||
of a literal, the base length or distance, or the offset from
|
||||
the current table to the next table. Each entry is four bytes. */
|
||||
typedef struct {
|
||||
unsigned char op; /* operation, extra bits, table bits */
|
||||
unsigned char bits; /* bits in this part of the code */
|
||||
unsigned short val; /* offset in table or code value */
|
||||
} code;
|
||||
|
||||
/* op values as set by inflate_table():
|
||||
00000000 - literal
|
||||
0000tttt - table link, tttt != 0 is the number of table index bits
|
||||
0001eeee - length or distance, eeee is the number of extra bits
|
||||
01100000 - end of block
|
||||
01000000 - invalid code
|
||||
*/
|
||||
|
||||
/* Maximum size of the dynamic table. The maximum number of code structures is
|
||||
1444, which is the sum of 852 for literal/length codes and 592 for distance
|
||||
codes. These values were found by exhaustive searches using the program
|
||||
examples/enough.c found in the zlib distribution. The arguments to that
|
||||
program are the number of symbols, the initial root table size, and the
|
||||
maximum bit length of a code. "enough 286 9 15" for literal/length codes
|
||||
returns returns 852, and "enough 30 6 15" for distance codes returns 592.
|
||||
The initial root table size (9 or 6) is found in the fifth argument of the
|
||||
inflate_table() calls in inflate.c and infback.c. If the root table size is
|
||||
changed, then these maximum sizes would be need to be recalculated and
|
||||
updated. */
|
||||
#define ENOUGH_LENS 852
|
||||
#define ENOUGH_DISTS 592
|
||||
#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
|
||||
|
||||
/* Type of code to build for inflate_table() */
|
||||
typedef enum {
|
||||
CODES,
|
||||
LENS,
|
||||
DISTS
|
||||
} codetype;
|
||||
|
||||
static int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||
unsigned codes, code FAR * FAR *table,
|
||||
unsigned FAR *bits, unsigned short FAR *work));
|
||||
|
||||
#endif /* INFTREES_H_ */
|
@ -1,469 +0,0 @@
|
||||
[zlib] Fix zlib sources for compilation with FreeType
|
||||
|
||||
We must ensure that they do not issue compiler errors or warnings when they
|
||||
are compiled as part of `src/gzip/ftgzip.c`.
|
||||
|
||||
* src/gzip/gzguts.h (COPY): Rename to...
|
||||
(COPY__): ... this since `COPY` and `COPY_` conflict with enum values,
|
||||
which have the same name in `zlib.h`.
|
||||
|
||||
* src/gzip/inflate.c, src/gzip/adler32.c, src/gzip/crc32.c,
|
||||
src/gzip/zutil.c: Omit unused function declarations and definitions when
|
||||
`Z_FREETYPE` is defined.
|
||||
|
||||
* src/gzip/inffast.h (inflate_fast): Declare as static.
|
||||
|
||||
* src/gzip/inftrees.c (inflate_copyright): Declare as static.
|
||||
|
||||
* src/gzip/zlib.h: Include `ftzconf.h` instead of `zconf.h` to avoid
|
||||
conflicts with system-installed headers.
|
||||
Omit unused function declarations when `Z_FREETYPE` is defined.
|
||||
(inflateInit2)[Z_FREETYPE]: Provide proper declaration.
|
||||
|
||||
* src/gzip/zutil.h: Use `ft_memxxx` functions instead of `memxxx`.
|
||||
Omit unused function declarations when `Z_FREETYPE` is defined.
|
||||
|
||||
* src/gzip/inflate.h, src/gzip/inftrees.h: Add header guard macros to
|
||||
prevent compiler errors.
|
||||
|
||||
* src/gzip/inftrees.h: Add header guard macros to prevent compiler errors.
|
||||
(inflate_table): Declare as static.
|
||||
|
||||
diff --git b/src/gzip/adler32.c a/src/gzip/adler32.c
|
||||
index be5e8a247..aa032e1dd 100644
|
||||
--- b/src/gzip/adler32.c
|
||||
+++ a/src/gzip/adler32.c
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
#include "zutil.h"
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
||||
+#endif
|
||||
|
||||
#define BASE 65521U /* largest prime smaller than 65536 */
|
||||
#define NMAX 5552
|
||||
@@ -139,6 +141,8 @@ uLong ZEXPORT adler32(
|
||||
return adler32_z(adler, buf, len);
|
||||
}
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
/* ========================================================================= */
|
||||
local uLong adler32_combine_(
|
||||
uLong adler1,
|
||||
@@ -184,3 +188,5 @@ uLong ZEXPORT adler32_combine64(
|
||||
{
|
||||
return adler32_combine_(adler1, adler2, len2);
|
||||
}
|
||||
+
|
||||
+#endif /* !Z_FREETYPE */
|
||||
diff --git b/src/gzip/crc32.c a/src/gzip/crc32.c
|
||||
index 3a52aa89d..6cd1b09d5 100644
|
||||
--- b/src/gzip/crc32.c
|
||||
+++ a/src/gzip/crc32.c
|
||||
@@ -103,9 +103,11 @@
|
||||
# define ARMCRC32
|
||||
#endif
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
/* Local functions. */
|
||||
local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
|
||||
local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
|
||||
+#endif /* Z_FREETYPE */
|
||||
|
||||
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
|
||||
local z_word_t byte_swap OF((z_word_t word));
|
||||
@@ -544,6 +546,8 @@ local void braid(ltl, big, n, w)
|
||||
* generation above.
|
||||
*/
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
/*
|
||||
Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
|
||||
reflected. For speed, this requires that a not be zero.
|
||||
@@ -600,6 +604,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
|
||||
return (const z_crc_t FAR *)crc_table;
|
||||
}
|
||||
|
||||
+#endif /* Z_FREETYPE */
|
||||
+
|
||||
/* =========================================================================
|
||||
* Use ARM machine instructions if available. This will compute the CRC about
|
||||
* ten times faster than the braided calculation. This code does not check for
|
||||
@@ -1077,6 +1083,8 @@ unsigned long ZEXPORT crc32(
|
||||
return crc32_z(crc, buf, len);
|
||||
}
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
/* ========================================================================= */
|
||||
uLong ZEXPORT crc32_combine64(
|
||||
uLong crc1,
|
||||
@@ -1123,3 +1131,5 @@ uLong ZEXPORT crc32_combine_op(
|
||||
{
|
||||
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
|
||||
}
|
||||
+
|
||||
+#endif /* Z_FREETYPE */
|
||||
diff --git b/src/gzip/gzguts.h a/src/gzip/gzguts.h
|
||||
index 57faf3716..4f09a52a7 100644
|
||||
--- b/src/gzip/gzguts.h
|
||||
+++ a/src/gzip/gzguts.h
|
||||
@@ -163,7 +163,7 @@
|
||||
|
||||
/* values for gz_state how */
|
||||
#define LOOK 0 /* look for a gzip header */
|
||||
-#define COPY 1 /* copy input directly */
|
||||
+#define COPY__ 1 /* copy input directly */
|
||||
#define GZIP 2 /* decompress a gzip stream */
|
||||
|
||||
/* internal gzip file state data structure */
|
||||
diff --git b/src/gzip/inffast.h a/src/gzip/inffast.h
|
||||
index e5c1aa4ca..684ae878c 100644
|
||||
--- b/src/gzip/inffast.h
|
||||
+++ a/src/gzip/inffast.h
|
||||
@@ -8,4 +8,4 @@
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
||||
+static void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
||||
diff --git b/src/gzip/inflate.c a/src/gzip/inflate.c
|
||||
index c9e566b03..5117e2e26 100644
|
||||
--- b/src/gzip/inflate.c
|
||||
+++ a/src/gzip/inflate.c
|
||||
@@ -99,8 +99,10 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
||||
#ifdef BUILDFIXED
|
||||
void makefixed OF((void));
|
||||
#endif
|
||||
+#ifndef Z_FREETYPE
|
||||
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
|
||||
unsigned len));
|
||||
+#endif
|
||||
|
||||
local int inflateStateCheck(
|
||||
z_streamp strm)
|
||||
@@ -239,6 +241,8 @@ int ZEXPORT inflateInit2_(
|
||||
return ret;
|
||||
}
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
int ZEXPORT inflateInit_(
|
||||
z_streamp strm,
|
||||
const char *version,
|
||||
@@ -268,6 +272,8 @@ int ZEXPORT inflatePrime(
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
+#endif /* !Z_FREETYPE */
|
||||
+
|
||||
/*
|
||||
Return state with length and distance decoding tables and index sizes set to
|
||||
fixed code decoding. Normally this returns fixed tables from inffixed.h.
|
||||
@@ -1315,6 +1321,8 @@ int ZEXPORT inflateEnd(
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
int ZEXPORT inflateGetDictionary(
|
||||
z_streamp strm,
|
||||
Bytef *dictionary,
|
||||
@@ -1593,3 +1601,5 @@ unsigned long ZEXPORT inflateCodesUsed(
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
return (unsigned long)(state->next - state->codes);
|
||||
}
|
||||
+
|
||||
+#endif /* !Z_FREETYPE */
|
||||
diff --git b/src/gzip/inflate.h a/src/gzip/inflate.h
|
||||
index f127b6b1f..c6f5a52e1 100644
|
||||
--- b/src/gzip/inflate.h
|
||||
+++ a/src/gzip/inflate.h
|
||||
@@ -3,6 +3,9 @@
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
+#ifndef INFLATE_H
|
||||
+#define INFLATE_H
|
||||
+
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
@@ -124,3 +127,5 @@ struct inflate_state {
|
||||
int back; /* bits back of last unprocessed length/lit */
|
||||
unsigned was; /* initial length of match */
|
||||
};
|
||||
+
|
||||
+#endif /* INFLATE_H */
|
||||
diff --git b/src/gzip/inftrees.c a/src/gzip/inftrees.c
|
||||
index d8405a24c..dd4965e9a 100644
|
||||
--- b/src/gzip/inftrees.c
|
||||
+++ a/src/gzip/inftrees.c
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#define MAXBITS 15
|
||||
|
||||
-const char inflate_copyright[] =
|
||||
+static const char inflate_copyright[] =
|
||||
" inflate 1.2.13 Copyright 1995-2022 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
diff --git b/src/gzip/inftrees.h a/src/gzip/inftrees.h
|
||||
index f53665311..a2207efb1 100644
|
||||
--- b/src/gzip/inftrees.h
|
||||
+++ a/src/gzip/inftrees.h
|
||||
@@ -3,6 +3,9 @@
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
+#ifndef INFTREES_H
|
||||
+#define INFTREES_H
|
||||
+
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
@@ -57,6 +60,8 @@ typedef enum {
|
||||
DISTS
|
||||
} codetype;
|
||||
|
||||
-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||
+static int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||
unsigned codes, code FAR * FAR *table,
|
||||
unsigned FAR *bits, unsigned short FAR *work));
|
||||
+
|
||||
+#endif /* INFTREES_H_ */
|
||||
diff --git b/src/gzip/zlib.h a/src/gzip/zlib.h
|
||||
index 953cb5012..3f2f76e3c 100644
|
||||
--- b/src/gzip/zlib.h
|
||||
+++ a/src/gzip/zlib.h
|
||||
@@ -31,7 +31,7 @@
|
||||
#ifndef ZLIB_H
|
||||
#define ZLIB_H
|
||||
|
||||
-#include "zconf.h"
|
||||
+#include "ftzconf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -211,6 +211,8 @@ typedef gz_header FAR *gz_headerp;
|
||||
|
||||
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
#define zlib_version zlibVersion()
|
||||
/* for compatibility with versions < 1.0.2 */
|
||||
|
||||
@@ -373,6 +375,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
|
||||
deallocated).
|
||||
*/
|
||||
|
||||
+#endif /* !Z_FREETYPE */
|
||||
|
||||
/*
|
||||
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
|
||||
@@ -534,6 +537,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
|
||||
The following functions are needed only in some special applications.
|
||||
*/
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
/*
|
||||
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
|
||||
int level,
|
||||
@@ -956,6 +961,8 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
|
||||
destination.
|
||||
*/
|
||||
|
||||
+#endif /* !Z_FREETYPE */
|
||||
+
|
||||
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
|
||||
/*
|
||||
This function is equivalent to inflateEnd followed by inflateInit,
|
||||
@@ -980,6 +987,8 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
|
||||
the windowBits parameter is invalid.
|
||||
*/
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
|
||||
int bits,
|
||||
int value));
|
||||
@@ -1069,6 +1078,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
|
||||
stream state was inconsistent.
|
||||
*/
|
||||
|
||||
+#endif /* !Z_FREETYPE */
|
||||
+
|
||||
/*
|
||||
ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
|
||||
unsigned char FAR *window));
|
||||
@@ -1095,6 +1106,8 @@ typedef unsigned (*in_func) OF((void FAR *,
|
||||
z_const unsigned char FAR * FAR *));
|
||||
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
|
||||
in_func in, void FAR *in_desc,
|
||||
out_func out, void FAR *out_desc));
|
||||
@@ -1214,6 +1227,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
|
||||
27-31: 0 (reserved)
|
||||
*/
|
||||
|
||||
+#endif /* !Z_FREETYPE */
|
||||
+
|
||||
#ifndef Z_SOLO
|
||||
|
||||
/* utility functions */
|
||||
@@ -1765,6 +1780,8 @@ ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2));
|
||||
crc32_combine_op().
|
||||
*/
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
|
||||
/*
|
||||
Give the same result as crc32_combine(), using op in place of len2. op is
|
||||
@@ -1822,6 +1839,19 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
|
||||
ZLIB_VERSION, (int)sizeof(z_stream))
|
||||
#endif
|
||||
|
||||
+#else /* Z_FREETYPE */
|
||||
+
|
||||
+
|
||||
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
|
||||
+ const char *version, int stream_size));
|
||||
+
|
||||
+# define inflateInit2(strm, windowBits) \
|
||||
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
|
||||
+ (int)sizeof(z_stream))
|
||||
+
|
||||
+#endif /* Z_FREETYPE */
|
||||
+
|
||||
+
|
||||
#ifndef Z_SOLO
|
||||
|
||||
/* gzgetc() macro and its supporting function and exposed data structure. Note
|
||||
@@ -1901,20 +1931,25 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
||||
|
||||
#else /* Z_SOLO */
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
|
||||
+#endif
|
||||
|
||||
#endif /* !Z_SOLO */
|
||||
|
||||
/* undocumented functions */
|
||||
+#ifndef Z_FREETYPE
|
||||
ZEXTERN const char * ZEXPORT zError OF((int));
|
||||
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
|
||||
ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
|
||||
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
|
||||
ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
|
||||
ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp));
|
||||
+#endif /* !Z_FREETYPE */
|
||||
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
|
||||
+#ifndef Z_FREETYPE
|
||||
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
|
||||
#if defined(_WIN32) && !defined(Z_SOLO)
|
||||
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
|
||||
@@ -1927,6 +1962,7 @@ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
|
||||
va_list va));
|
||||
# endif
|
||||
#endif
|
||||
+#endif /* !Z_FREETYPE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
diff --git b/src/gzip/zutil.c a/src/gzip/zutil.c
|
||||
index ef174ca64..542706ca0 100644
|
||||
--- b/src/gzip/zutil.c
|
||||
+++ a/src/gzip/zutil.c
|
||||
@@ -10,6 +10,8 @@
|
||||
# include "gzguts.h"
|
||||
#endif
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
z_const char * const z_errmsg[10] = {
|
||||
(z_const char *)"need dictionary", /* Z_NEED_DICT 2 */
|
||||
(z_const char *)"stream end", /* Z_STREAM_END 1 */
|
||||
@@ -138,6 +140,8 @@ const char * ZEXPORT zError(
|
||||
return ERR_MSG(err);
|
||||
}
|
||||
|
||||
+#endif /* !Z_FREETYPE */
|
||||
+
|
||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
||||
/* The older Microsoft C Run-Time Library for Windows CE doesn't have
|
||||
* errno. We define it as a global variable to simplify porting.
|
||||
@@ -159,6 +163,8 @@ void ZLIB_INTERNAL zmemcpy(
|
||||
} while (--len != 0);
|
||||
}
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
int ZLIB_INTERNAL zmemcmp(
|
||||
const Bytef* s1,
|
||||
const Bytef* s2,
|
||||
@@ -181,6 +187,7 @@ void ZLIB_INTERNAL zmemzero(
|
||||
*dest++ = 0; /* ??? to be unrolled */
|
||||
} while (--len != 0);
|
||||
}
|
||||
+#endif /* !Z_FREETYPE */
|
||||
#endif
|
||||
|
||||
#ifndef Z_SOLO
|
||||
diff --git b/src/gzip/zutil.h a/src/gzip/zutil.h
|
||||
index 0bc7f4ecd..055ba8b62 100644
|
||||
--- b/src/gzip/zutil.h
|
||||
+++ a/src/gzip/zutil.h
|
||||
@@ -53,8 +53,10 @@ typedef unsigned long ulg;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
/* (size given to avoid silly warnings with Visual C++) */
|
||||
+#endif /* !Z_FREETYPE */
|
||||
|
||||
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
||||
|
||||
@@ -188,6 +190,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
#pragma warn -8066
|
||||
#endif
|
||||
|
||||
+#ifndef Z_FREETYPE
|
||||
+
|
||||
/* provide prototypes for these when building zlib without LFS */
|
||||
#if !defined(_WIN32) && \
|
||||
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
||||
@@ -196,6 +200,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
|
||||
#endif
|
||||
|
||||
+#endif /* !Z_FREETYPE */
|
||||
+
|
||||
/* common defaults */
|
||||
|
||||
#ifndef OS_CODE
|
||||
@@ -227,9 +233,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
# define zmemcmp _fmemcmp
|
||||
# define zmemzero(dest, len) _fmemset(dest, 0, len)
|
||||
# else
|
||||
-# define zmemcpy memcpy
|
||||
-# define zmemcmp memcmp
|
||||
-# define zmemzero(dest, len) memset(dest, 0, len)
|
||||
+# define zmemcpy ft_memcpy
|
||||
+# define zmemcmp ft_memcmp
|
||||
+# define zmemzero(dest, len) ft_memset(dest, 0, len)
|
||||
# endif
|
||||
#else
|
||||
void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
1971
thirdparty/freetype/src/gzip/zlib.h
vendored
1971
thirdparty/freetype/src/gzip/zlib.h
vendored
File diff suppressed because it is too large
Load Diff
334
thirdparty/freetype/src/gzip/zutil.c
vendored
334
thirdparty/freetype/src/gzip/zutil.c
vendored
@ -1,334 +0,0 @@
|
||||
/* zutil.c -- target dependent utility functions for the compression library
|
||||
* Copyright (C) 1995-2017 Jean-loup Gailly
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#include "zutil.h"
|
||||
#ifndef Z_SOLO
|
||||
# include "gzguts.h"
|
||||
#endif
|
||||
|
||||
#ifndef Z_FREETYPE
|
||||
|
||||
z_const char * const z_errmsg[10] = {
|
||||
(z_const char *)"need dictionary", /* Z_NEED_DICT 2 */
|
||||
(z_const char *)"stream end", /* Z_STREAM_END 1 */
|
||||
(z_const char *)"", /* Z_OK 0 */
|
||||
(z_const char *)"file error", /* Z_ERRNO (-1) */
|
||||
(z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */
|
||||
(z_const char *)"data error", /* Z_DATA_ERROR (-3) */
|
||||
(z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */
|
||||
(z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */
|
||||
(z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */
|
||||
(z_const char *)""
|
||||
};
|
||||
|
||||
|
||||
const char * ZEXPORT zlibVersion()
|
||||
{
|
||||
return ZLIB_VERSION;
|
||||
}
|
||||
|
||||
uLong ZEXPORT zlibCompileFlags()
|
||||
{
|
||||
uLong flags;
|
||||
|
||||
flags = 0;
|
||||
switch ((int)(sizeof(uInt))) {
|
||||
case 2: break;
|
||||
case 4: flags += 1; break;
|
||||
case 8: flags += 2; break;
|
||||
default: flags += 3;
|
||||
}
|
||||
switch ((int)(sizeof(uLong))) {
|
||||
case 2: break;
|
||||
case 4: flags += 1 << 2; break;
|
||||
case 8: flags += 2 << 2; break;
|
||||
default: flags += 3 << 2;
|
||||
}
|
||||
switch ((int)(sizeof(voidpf))) {
|
||||
case 2: break;
|
||||
case 4: flags += 1 << 4; break;
|
||||
case 8: flags += 2 << 4; break;
|
||||
default: flags += 3 << 4;
|
||||
}
|
||||
switch ((int)(sizeof(z_off_t))) {
|
||||
case 2: break;
|
||||
case 4: flags += 1 << 6; break;
|
||||
case 8: flags += 2 << 6; break;
|
||||
default: flags += 3 << 6;
|
||||
}
|
||||
#ifdef ZLIB_DEBUG
|
||||
flags += 1 << 8;
|
||||
#endif
|
||||
/*
|
||||
#if defined(ASMV) || defined(ASMINF)
|
||||
flags += 1 << 9;
|
||||
#endif
|
||||
*/
|
||||
#ifdef ZLIB_WINAPI
|
||||
flags += 1 << 10;
|
||||
#endif
|
||||
#ifdef BUILDFIXED
|
||||
flags += 1 << 12;
|
||||
#endif
|
||||
#ifdef DYNAMIC_CRC_TABLE
|
||||
flags += 1 << 13;
|
||||
#endif
|
||||
#ifdef NO_GZCOMPRESS
|
||||
flags += 1L << 16;
|
||||
#endif
|
||||
#ifdef NO_GZIP
|
||||
flags += 1L << 17;
|
||||
#endif
|
||||
#ifdef PKZIP_BUG_WORKAROUND
|
||||
flags += 1L << 20;
|
||||
#endif
|
||||
#ifdef FASTEST
|
||||
flags += 1L << 21;
|
||||
#endif
|
||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# ifdef NO_vsnprintf
|
||||
flags += 1L << 25;
|
||||
# ifdef HAS_vsprintf_void
|
||||
flags += 1L << 26;
|
||||
# endif
|
||||
# else
|
||||
# ifdef HAS_vsnprintf_void
|
||||
flags += 1L << 26;
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
flags += 1L << 24;
|
||||
# ifdef NO_snprintf
|
||||
flags += 1L << 25;
|
||||
# ifdef HAS_sprintf_void
|
||||
flags += 1L << 26;
|
||||
# endif
|
||||
# else
|
||||
# ifdef HAS_snprintf_void
|
||||
flags += 1L << 26;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
return flags;
|
||||
}
|
||||
|
||||
#ifdef ZLIB_DEBUG
|
||||
#include <stdlib.h>
|
||||
# ifndef verbose
|
||||
# define verbose 0
|
||||
# endif
|
||||
int ZLIB_INTERNAL z_verbose = verbose;
|
||||
|
||||
void ZLIB_INTERNAL z_error(
|
||||
char *m)
|
||||
{
|
||||
fprintf(stderr, "%s\n", m);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* exported to allow conversion of error code to string for compress() and
|
||||
* uncompress()
|
||||
*/
|
||||
const char * ZEXPORT zError(
|
||||
int err)
|
||||
{
|
||||
return ERR_MSG(err);
|
||||
}
|
||||
|
||||
#endif /* !Z_FREETYPE */
|
||||
|
||||
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
|
||||
/* The older Microsoft C Run-Time Library for Windows CE doesn't have
|
||||
* errno. We define it as a global variable to simplify porting.
|
||||
* Its value is always 0 and should not be used.
|
||||
*/
|
||||
int errno = 0;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MEMCPY
|
||||
|
||||
void ZLIB_INTERNAL zmemcpy(
|
||||
Bytef* dest,
|
||||
const Bytef* source,
|
||||
uInt len)
|
||||
{
|
||||
if (len == 0) return;
|
||||
do {
|
||||
*dest++ = *source++; /* ??? to be unrolled */
|
||||
} while (--len != 0);
|
||||
}
|
||||
|
||||
#ifndef Z_FREETYPE
|
||||
|
||||
int ZLIB_INTERNAL zmemcmp(
|
||||
const Bytef* s1,
|
||||
const Bytef* s2,
|
||||
uInt len)
|
||||
{
|
||||
uInt j;
|
||||
|
||||
for (j = 0; j < len; j++) {
|
||||
if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ZLIB_INTERNAL zmemzero(
|
||||
Bytef* dest,
|
||||
uInt len)
|
||||
{
|
||||
if (len == 0) return;
|
||||
do {
|
||||
*dest++ = 0; /* ??? to be unrolled */
|
||||
} while (--len != 0);
|
||||
}
|
||||
#endif /* !Z_FREETYPE */
|
||||
#endif
|
||||
|
||||
#ifndef Z_SOLO
|
||||
|
||||
#ifdef SYS16BIT
|
||||
|
||||
#ifdef __TURBOC__
|
||||
/* Turbo C in 16-bit mode */
|
||||
|
||||
# define MY_ZCALLOC
|
||||
|
||||
/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
|
||||
* and farmalloc(64K) returns a pointer with an offset of 8, so we
|
||||
* must fix the pointer. Warning: the pointer must be put back to its
|
||||
* original form in order to free it, use zcfree().
|
||||
*/
|
||||
|
||||
#define MAX_PTR 10
|
||||
/* 10*64K = 640K */
|
||||
|
||||
local int next_ptr = 0;
|
||||
|
||||
typedef struct ptr_table_s {
|
||||
voidpf org_ptr;
|
||||
voidpf new_ptr;
|
||||
} ptr_table;
|
||||
|
||||
local ptr_table table[MAX_PTR];
|
||||
/* This table is used to remember the original form of pointers
|
||||
* to large buffers (64K). Such pointers are normalized with a zero offset.
|
||||
* Since MSDOS is not a preemptive multitasking OS, this table is not
|
||||
* protected from concurrent access. This hack doesn't work anyway on
|
||||
* a protected system like OS/2. Use Microsoft C instead.
|
||||
*/
|
||||
|
||||
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
|
||||
{
|
||||
voidpf buf;
|
||||
ulg bsize = (ulg)items*size;
|
||||
|
||||
(void)opaque;
|
||||
|
||||
/* If we allocate less than 65520 bytes, we assume that farmalloc
|
||||
* will return a usable pointer which doesn't have to be normalized.
|
||||
*/
|
||||
if (bsize < 65520L) {
|
||||
buf = farmalloc(bsize);
|
||||
if (*(ush*)&buf != 0) return buf;
|
||||
} else {
|
||||
buf = farmalloc(bsize + 16L);
|
||||
}
|
||||
if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
|
||||
table[next_ptr].org_ptr = buf;
|
||||
|
||||
/* Normalize the pointer to seg:0 */
|
||||
*((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
|
||||
*(ush*)&buf = 0;
|
||||
table[next_ptr++].new_ptr = buf;
|
||||
return buf;
|
||||
}
|
||||
|
||||
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
||||
{
|
||||
int n;
|
||||
|
||||
(void)opaque;
|
||||
|
||||
if (*(ush*)&ptr != 0) { /* object < 64K */
|
||||
farfree(ptr);
|
||||
return;
|
||||
}
|
||||
/* Find the original pointer */
|
||||
for (n = 0; n < next_ptr; n++) {
|
||||
if (ptr != table[n].new_ptr) continue;
|
||||
|
||||
farfree(table[n].org_ptr);
|
||||
while (++n < next_ptr) {
|
||||
table[n-1] = table[n];
|
||||
}
|
||||
next_ptr--;
|
||||
return;
|
||||
}
|
||||
Assert(0, "zcfree: ptr not found");
|
||||
}
|
||||
|
||||
#endif /* __TURBOC__ */
|
||||
|
||||
|
||||
#ifdef M_I86
|
||||
/* Microsoft C in 16-bit mode */
|
||||
|
||||
# define MY_ZCALLOC
|
||||
|
||||
#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
|
||||
# define _halloc halloc
|
||||
# define _hfree hfree
|
||||
#endif
|
||||
|
||||
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size)
|
||||
{
|
||||
(void)opaque;
|
||||
return _halloc((long)items, size);
|
||||
}
|
||||
|
||||
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
|
||||
{
|
||||
(void)opaque;
|
||||
_hfree(ptr);
|
||||
}
|
||||
|
||||
#endif /* M_I86 */
|
||||
|
||||
#endif /* SYS16BIT */
|
||||
|
||||
|
||||
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
|
||||
|
||||
#ifndef STDC
|
||||
extern voidp malloc OF((uInt size));
|
||||
extern voidp calloc OF((uInt items, uInt size));
|
||||
extern void free OF((voidpf ptr));
|
||||
#endif
|
||||
|
||||
voidpf ZLIB_INTERNAL zcalloc(
|
||||
voidpf opaque,
|
||||
unsigned items,
|
||||
unsigned size)
|
||||
{
|
||||
(void)opaque;
|
||||
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
|
||||
(voidpf)calloc(items, size);
|
||||
}
|
||||
|
||||
void ZLIB_INTERNAL zcfree(
|
||||
voidpf opaque,
|
||||
voidpf ptr)
|
||||
{
|
||||
(void)opaque;
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
#endif /* MY_ZCALLOC */
|
||||
|
||||
#endif /* !Z_SOLO */
|
281
thirdparty/freetype/src/gzip/zutil.h
vendored
281
thirdparty/freetype/src/gzip/zutil.h
vendored
@ -1,281 +0,0 @@
|
||||
/* zutil.h -- internal interface and configuration of the compression library
|
||||
* Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#ifndef ZUTIL_H
|
||||
#define ZUTIL_H
|
||||
|
||||
#ifdef HAVE_HIDDEN
|
||||
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
||||
#else
|
||||
# define ZLIB_INTERNAL
|
||||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
#if defined(STDC) && !defined(Z_SOLO)
|
||||
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
|
||||
# include <stddef.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef local
|
||||
# define local static
|
||||
#endif
|
||||
/* since "static" is used to mean two completely different things in C, we
|
||||
define "local" for the non-static meaning of "static", for readability
|
||||
(compile with -Dlocal if your debugger can't find static symbols) */
|
||||
|
||||
typedef unsigned char uch;
|
||||
typedef uch FAR uchf;
|
||||
typedef unsigned short ush;
|
||||
typedef ush FAR ushf;
|
||||
typedef unsigned long ulg;
|
||||
|
||||
#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC)
|
||||
# include <limits.h>
|
||||
# if (ULONG_MAX == 0xffffffffffffffff)
|
||||
# define Z_U8 unsigned long
|
||||
# elif (ULLONG_MAX == 0xffffffffffffffff)
|
||||
# define Z_U8 unsigned long long
|
||||
# elif (UINT_MAX == 0xffffffffffffffff)
|
||||
# define Z_U8 unsigned
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef Z_FREETYPE
|
||||
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
/* (size given to avoid silly warnings with Visual C++) */
|
||||
#endif /* !Z_FREETYPE */
|
||||
|
||||
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
||||
|
||||
#define ERR_RETURN(strm,err) \
|
||||
return (strm->msg = ERR_MSG(err), (err))
|
||||
/* To be used only when the state is known to be valid */
|
||||
|
||||
/* common constants */
|
||||
|
||||
#ifndef DEF_WBITS
|
||||
# define DEF_WBITS MAX_WBITS
|
||||
#endif
|
||||
/* default windowBits for decompression. MAX_WBITS is for compression only */
|
||||
|
||||
#if MAX_MEM_LEVEL >= 8
|
||||
# define DEF_MEM_LEVEL 8
|
||||
#else
|
||||
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||
#endif
|
||||
/* default memLevel */
|
||||
|
||||
#define STORED_BLOCK 0
|
||||
#define STATIC_TREES 1
|
||||
#define DYN_TREES 2
|
||||
/* The three kinds of block type */
|
||||
|
||||
#define MIN_MATCH 3
|
||||
#define MAX_MATCH 258
|
||||
/* The minimum and maximum match lengths */
|
||||
|
||||
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
|
||||
|
||||
/* target dependencies */
|
||||
|
||||
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
|
||||
# define OS_CODE 0x00
|
||||
# ifndef Z_SOLO
|
||||
# if defined(__TURBOC__) || defined(__BORLANDC__)
|
||||
# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
|
||||
/* Allow compilation with ANSI keywords only enabled */
|
||||
void _Cdecl farfree( void *block );
|
||||
void *_Cdecl farmalloc( unsigned long nbytes );
|
||||
# else
|
||||
# include <alloc.h>
|
||||
# endif
|
||||
# else /* MSC or DJGPP */
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef AMIGA
|
||||
# define OS_CODE 1
|
||||
#endif
|
||||
|
||||
#if defined(VAXC) || defined(VMS)
|
||||
# define OS_CODE 2
|
||||
# define F_OPEN(name, mode) \
|
||||
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
|
||||
#endif
|
||||
|
||||
#ifdef __370__
|
||||
# if __TARGET_LIB__ < 0x20000000
|
||||
# define OS_CODE 4
|
||||
# elif __TARGET_LIB__ < 0x40000000
|
||||
# define OS_CODE 11
|
||||
# else
|
||||
# define OS_CODE 8
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(ATARI) || defined(atarist)
|
||||
# define OS_CODE 5
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
# define OS_CODE 6
|
||||
# if defined(M_I86) && !defined(Z_SOLO)
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
||||
# define OS_CODE 7
|
||||
# ifndef Z_SOLO
|
||||
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
|
||||
# include <unix.h> /* for fdopen */
|
||||
# else
|
||||
# ifndef fdopen
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __acorn
|
||||
# define OS_CODE 13
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# define OS_CODE 10
|
||||
#endif
|
||||
|
||||
#ifdef _BEOS_
|
||||
# define OS_CODE 16
|
||||
#endif
|
||||
|
||||
#ifdef __TOS_OS400__
|
||||
# define OS_CODE 18
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
# define OS_CODE 19
|
||||
#endif
|
||||
|
||||
#if defined(_BEOS_) || defined(RISCOS)
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
|
||||
# if defined(_WIN32_WCE)
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# else
|
||||
# define fdopen(fd,type) _fdopen(fd,type)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__BORLANDC__) && !defined(MSDOS)
|
||||
#pragma warn -8004
|
||||
#pragma warn -8008
|
||||
#pragma warn -8066
|
||||
#endif
|
||||
|
||||
#ifndef Z_FREETYPE
|
||||
|
||||
/* provide prototypes for these when building zlib without LFS */
|
||||
#if !defined(_WIN32) && \
|
||||
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
||||
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
||||
ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
|
||||
#endif
|
||||
|
||||
#endif /* !Z_FREETYPE */
|
||||
|
||||
/* common defaults */
|
||||
|
||||
#ifndef OS_CODE
|
||||
# define OS_CODE 3 /* assume Unix */
|
||||
#endif
|
||||
|
||||
#ifndef F_OPEN
|
||||
# define F_OPEN(name, mode) fopen((name), (mode))
|
||||
#endif
|
||||
|
||||
/* functions */
|
||||
|
||||
#if defined(pyr) || defined(Z_SOLO)
|
||||
# define NO_MEMCPY
|
||||
#endif
|
||||
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
|
||||
/* Use our own functions for small and medium model with MSC <= 5.0.
|
||||
* You may have to use the same strategy for Borland C (untested).
|
||||
* The __SC__ check is for Symantec.
|
||||
*/
|
||||
# define NO_MEMCPY
|
||||
#endif
|
||||
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
|
||||
# define HAVE_MEMCPY
|
||||
#endif
|
||||
#ifdef HAVE_MEMCPY
|
||||
# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
|
||||
# define zmemcpy _fmemcpy
|
||||
# define zmemcmp _fmemcmp
|
||||
# define zmemzero(dest, len) _fmemset(dest, 0, len)
|
||||
# else
|
||||
# define zmemcpy ft_memcpy
|
||||
# define zmemcmp ft_memcmp
|
||||
# define zmemzero(dest, len) ft_memset(dest, 0, len)
|
||||
# endif
|
||||
#else
|
||||
void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
||||
int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
||||
void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
|
||||
#endif
|
||||
|
||||
/* Diagnostic functions */
|
||||
#ifdef ZLIB_DEBUG
|
||||
# include <stdio.h>
|
||||
extern int ZLIB_INTERNAL z_verbose;
|
||||
extern void ZLIB_INTERNAL z_error OF((char *m));
|
||||
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
||||
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
||||
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
||||
# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
|
||||
# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
|
||||
# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
|
||||
#else
|
||||
# define Assert(cond,msg)
|
||||
# define Trace(x)
|
||||
# define Tracev(x)
|
||||
# define Tracevv(x)
|
||||
# define Tracec(c,x)
|
||||
# define Tracecv(c,x)
|
||||
#endif
|
||||
|
||||
#ifndef Z_SOLO
|
||||
voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
|
||||
unsigned size));
|
||||
void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
|
||||
#endif
|
||||
|
||||
#define ZALLOC(strm, items, size) \
|
||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
|
||||
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
|
||||
|
||||
/* Reverse the bytes in a 32-bit value */
|
||||
#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
|
||||
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
|
||||
|
||||
#endif /* ZUTIL_H */
|
6
thirdparty/freetype/src/psaux/cffdecode.c
vendored
6
thirdparty/freetype/src/psaux/cffdecode.c
vendored
@ -2153,7 +2153,7 @@
|
||||
decoder->locals_bias );
|
||||
|
||||
|
||||
FT_TRACE4(( " callsubr (idx %d, entering level %ld)\n",
|
||||
FT_TRACE4(( " callsubr (idx %d, entering level %td)\n",
|
||||
idx,
|
||||
zone - decoder->zones + 1 ));
|
||||
|
||||
@ -2197,7 +2197,7 @@
|
||||
decoder->globals_bias );
|
||||
|
||||
|
||||
FT_TRACE4(( " callgsubr (idx %d, entering level %ld)\n",
|
||||
FT_TRACE4(( " callgsubr (idx %d, entering level %td)\n",
|
||||
idx,
|
||||
zone - decoder->zones + 1 ));
|
||||
|
||||
@ -2236,7 +2236,7 @@
|
||||
break;
|
||||
|
||||
case cff_op_return:
|
||||
FT_TRACE4(( " return (leaving level %ld)\n",
|
||||
FT_TRACE4(( " return (leaving level %td)\n",
|
||||
decoder->zone - decoder->zones ));
|
||||
|
||||
if ( decoder->zone <= decoder->zones )
|
||||
|
2
thirdparty/freetype/src/psaux/pshints.c
vendored
2
thirdparty/freetype/src/psaux/pshints.c
vendored
@ -310,7 +310,7 @@
|
||||
CF2_Hint hint = &hintmap->edge[i];
|
||||
|
||||
|
||||
FT_TRACE6(( " %3ld %7.2f %7.2f %5d %s%s%s%s\n",
|
||||
FT_TRACE6(( " %3zu %7.2f %7.2f %5d %s%s%s%s\n",
|
||||
hint->index,
|
||||
hint->csCoord / 65536.0,
|
||||
hint->dsCoord / ( hint->scale * 1.0 ),
|
||||
|
4
thirdparty/freetype/src/psaux/t1decode.c
vendored
4
thirdparty/freetype/src/psaux/t1decode.c
vendored
@ -520,7 +520,7 @@
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( bol )
|
||||
{
|
||||
FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
|
||||
FT_TRACE5(( " (%td)", decoder->top - decoder->stack ));
|
||||
bol = FALSE;
|
||||
}
|
||||
#endif
|
||||
@ -1165,7 +1165,7 @@
|
||||
if ( top - decoder->stack != num_args )
|
||||
FT_TRACE0(( "t1_decoder_parse_charstrings:"
|
||||
" too much operands on the stack"
|
||||
" (seen %ld, expected %d)\n",
|
||||
" (seen %td, expected %d)\n",
|
||||
top - decoder->stack, num_args ));
|
||||
break;
|
||||
}
|
||||
|
18
thirdparty/freetype/src/sfnt/sfwoff2.c
vendored
18
thirdparty/freetype/src/sfnt/sfwoff2.c
vendored
@ -36,6 +36,8 @@
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT sfwoff2
|
||||
|
||||
/* An arbitrary, heuristic size limit (67MByte) for expanded WOFF2 data. */
|
||||
#define MAX_SFNT_SIZE ( 1 << 26 )
|
||||
|
||||
#define READ_255USHORT( var ) FT_SET_ERROR( Read255UShort( stream, &var ) )
|
||||
|
||||
@ -2180,9 +2182,8 @@
|
||||
else
|
||||
sfnt_size = woff2.totalSfntSize;
|
||||
|
||||
/* Value 1<<26 = 67108864 is heuristic. */
|
||||
if (sfnt_size >= (1 << 26))
|
||||
sfnt_size = 1 << 26;
|
||||
if ( sfnt_size >= MAX_SFNT_SIZE )
|
||||
sfnt_size = MAX_SFNT_SIZE;
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( sfnt_size != woff2.totalSfntSize )
|
||||
@ -2257,10 +2258,15 @@
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if ( woff2.uncompressed_size > sfnt_size )
|
||||
/* We must not blindly trust `uncompressed_size` since its */
|
||||
/* value might be corrupted. If it is too large, reject the */
|
||||
/* font. In other words, we don't accept a WOFF2 font that */
|
||||
/* expands to something larger than MAX_SFNT_SIZE. If ever */
|
||||
/* necessary, this limit can be easily adjusted. */
|
||||
if ( woff2.uncompressed_size > MAX_SFNT_SIZE )
|
||||
{
|
||||
FT_ERROR(( "woff2_open_font: SFNT table lengths are too large.\n" ));
|
||||
error = FT_THROW( Invalid_Table );
|
||||
FT_ERROR(( "Uncompressed font too large.\n" ));
|
||||
error = FT_THROW( Array_Too_Large );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
4
thirdparty/freetype/src/sfnt/ttcolr.c
vendored
4
thirdparty/freetype/src/sfnt/ttcolr.c
vendored
@ -229,7 +229,7 @@
|
||||
|
||||
base_glyphs_offset_v1 = FT_NEXT_ULONG( p );
|
||||
|
||||
if ( base_glyphs_offset_v1 + 4 >= table_size )
|
||||
if ( base_glyphs_offset_v1 >= table_size - 4 )
|
||||
goto InvalidTable;
|
||||
|
||||
p1 = (FT_Byte*)( table + base_glyphs_offset_v1 );
|
||||
@ -249,7 +249,7 @@
|
||||
|
||||
if ( layer_offset_v1 )
|
||||
{
|
||||
if ( layer_offset_v1 + 4 >= table_size )
|
||||
if ( layer_offset_v1 >= table_size - 4 )
|
||||
goto InvalidTable;
|
||||
|
||||
p1 = (FT_Byte*)( table + layer_offset_v1 );
|
||||
|
11
thirdparty/freetype/src/smooth/ftgrays.c
vendored
11
thirdparty/freetype/src/smooth/ftgrays.c
vendored
@ -1006,10 +1006,11 @@ typedef ptrdiff_t FT_PtrDist;
|
||||
*
|
||||
* For other cases, using binary splits is actually slightly faster.
|
||||
*/
|
||||
#if defined( __SSE2__ ) || \
|
||||
( defined( __x86_64__ ) && !defined( __VMS ) ) || \
|
||||
defined( _M_AMD64 ) || \
|
||||
( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 )
|
||||
#if ( defined( __SSE2__ ) || \
|
||||
defined( __x86_64__ ) || \
|
||||
defined( _M_AMD64 ) || \
|
||||
( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 ) ) && \
|
||||
!defined( __VMS )
|
||||
# define FT_SSE2 1
|
||||
#else
|
||||
# define FT_SSE2 0
|
||||
@ -1933,7 +1934,7 @@ typedef ptrdiff_t FT_PtrDist;
|
||||
if ( continued )
|
||||
FT_Trace_Enable();
|
||||
|
||||
FT_TRACE7(( "band [%d..%d]: %ld cell%s remaining/\n",
|
||||
FT_TRACE7(( "band [%d..%d]: %td cell%s remaining/\n",
|
||||
ras.min_ey,
|
||||
ras.max_ey,
|
||||
ras.cell_null - ras.cell_free,
|
||||
|
1
thirdparty/freetype/src/truetype/truetype.c
vendored
1
thirdparty/freetype/src/truetype/truetype.c
vendored
@ -24,7 +24,6 @@
|
||||
#include "ttinterp.c"
|
||||
#include "ttobjs.c" /* object manager */
|
||||
#include "ttpload.c" /* tables loader */
|
||||
#include "ttsubpix.c"
|
||||
|
||||
|
||||
/* END */
|
||||
|
5
thirdparty/freetype/src/truetype/ttdriver.c
vendored
5
thirdparty/freetype/src/truetype/ttdriver.c
vendored
@ -100,11 +100,6 @@
|
||||
break;
|
||||
|
||||
case TT_INTERPRETER_VERSION_38:
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_38;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TT_INTERPRETER_VERSION_40:
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_40;
|
||||
|
295
thirdparty/freetype/src/truetype/ttgload.c
vendored
295
thirdparty/freetype/src/truetype/ttgload.c
vendored
@ -35,7 +35,6 @@
|
||||
#endif
|
||||
|
||||
#include "tterrors.h"
|
||||
#include "ttsubpix.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
@ -152,9 +151,6 @@
|
||||
FT_UInt glyph_index )
|
||||
{
|
||||
TT_Face face = loader->face;
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
||||
#endif
|
||||
|
||||
FT_Error error;
|
||||
FT_Stream stream = loader->stream;
|
||||
@ -183,20 +179,6 @@
|
||||
loader->top_bearing = top_bearing;
|
||||
loader->vadvance = advance_height;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
|
||||
loader->exec )
|
||||
{
|
||||
loader->exec->sph_tweak_flags = 0;
|
||||
|
||||
/* This may not be the right place for this, but it works... */
|
||||
/* Note that we have to unconditionally load the tweaks since */
|
||||
/* it is possible that glyphs individually switch ClearType's */
|
||||
/* backward compatibility mode on and off. */
|
||||
sph_set_tweaks( loader, glyph_index );
|
||||
}
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||
/* With the incremental interface, these values are set by */
|
||||
/* a call to `tt_get_metrics_incremental'. */
|
||||
@ -798,8 +780,7 @@
|
||||
TT_Hint_Glyph( TT_Loader loader,
|
||||
FT_Bool is_composite )
|
||||
{
|
||||
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
||||
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
TT_Face face = loader->face;
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
||||
#endif
|
||||
@ -820,7 +801,7 @@
|
||||
FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
|
||||
|
||||
/* Reset graphics state. */
|
||||
loader->exec->GS = loader->size->GS;
|
||||
exec->GS = loader->size->GS;
|
||||
|
||||
/* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */
|
||||
/* completely refer to the (already) hinted subglyphs. */
|
||||
@ -860,7 +841,7 @@
|
||||
exec->is_composite = is_composite;
|
||||
exec->pts = *zone;
|
||||
|
||||
error = TT_Run_Context( loader->exec );
|
||||
error = TT_Run_Context( exec );
|
||||
if ( error && exec->pedantic_hinting )
|
||||
return error;
|
||||
|
||||
@ -871,32 +852,20 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
/* Save possibly modified glyph phantom points unless in v40 backward */
|
||||
/* compatibility mode, where no movement on the x axis means no reason */
|
||||
/* to change bearings or advance widths. */
|
||||
if ( !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
||||
exec->backward_compatibility ) )
|
||||
{
|
||||
#endif
|
||||
loader->pp1 = zone->cur[zone->n_points - 4];
|
||||
loader->pp2 = zone->cur[zone->n_points - 3];
|
||||
loader->pp3 = zone->cur[zone->n_points - 2];
|
||||
loader->pp4 = zone->cur[zone->n_points - 1];
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
}
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
||||
exec->backward_compatibility )
|
||||
return FT_Err_Ok;
|
||||
#endif
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
if ( exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN )
|
||||
FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 );
|
||||
|
||||
else if ( exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN )
|
||||
FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 );
|
||||
}
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
loader->pp1 = zone->cur[zone->n_points - 4];
|
||||
loader->pp2 = zone->cur[zone->n_points - 3];
|
||||
loader->pp3 = zone->cur[zone->n_points - 2];
|
||||
loader->pp4 = zone->cur[zone->n_points - 1];
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
@ -960,16 +929,6 @@
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
TT_Face face = loader->face;
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
||||
|
||||
FT_String* family = face->root.family_name;
|
||||
FT_UInt ppem = loader->size->metrics->x_ppem;
|
||||
FT_String* style = face->root.style_name;
|
||||
FT_UInt x_scale_factor = 1000;
|
||||
#endif
|
||||
|
||||
FT_Vector* vec = outline->points;
|
||||
FT_Vector* limit = outline->points + n_points;
|
||||
|
||||
@ -979,52 +938,6 @@
|
||||
FT_Bool do_scale = FALSE;
|
||||
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
/* scale, but only if enabled and only if TT hinting is being used */
|
||||
if ( IS_HINTED( loader->load_flags ) )
|
||||
x_scale_factor = sph_test_tweak_x_scaling( face,
|
||||
family,
|
||||
ppem,
|
||||
style,
|
||||
loader->glyph_index );
|
||||
/* scale the glyph */
|
||||
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ||
|
||||
x_scale_factor != 1000 )
|
||||
{
|
||||
x_scale = FT_MulDiv( loader->size->metrics->x_scale,
|
||||
(FT_Long)x_scale_factor, 1000 );
|
||||
y_scale = loader->size->metrics->y_scale;
|
||||
|
||||
/* compensate for any scaling by de/emboldening; */
|
||||
/* the amount was determined via experimentation */
|
||||
if ( x_scale_factor != 1000 && ppem > 11 )
|
||||
{
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_Vector* orig_points = outline->points;
|
||||
|
||||
|
||||
if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) )
|
||||
outline->points = unrounded;
|
||||
#endif
|
||||
FT_Outline_EmboldenXY( outline,
|
||||
FT_MulFix( 1280 * ppem,
|
||||
1000 - x_scale_factor ),
|
||||
0 );
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) )
|
||||
outline->points = orig_points;
|
||||
#endif
|
||||
}
|
||||
do_scale = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
{
|
||||
/* scale the glyph */
|
||||
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
||||
@ -1451,45 +1364,31 @@
|
||||
static void
|
||||
tt_loader_set_pp( TT_Loader loader )
|
||||
{
|
||||
FT_Bool subpixel_hinting = 0;
|
||||
FT_Bool grayscale = 0;
|
||||
FT_Bool use_aw_2 = 0;
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face );
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting
|
||||
: 0;
|
||||
grayscale = loader->exec ? loader->exec->grayscale
|
||||
: 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
||||
{
|
||||
subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting_lean
|
||||
: 0;
|
||||
grayscale = loader->exec ? loader->exec->grayscale_cleartype
|
||||
: 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
use_aw_2 = FT_BOOL( subpixel_hinting && grayscale );
|
||||
|
||||
loader->pp1.x = loader->bbox.xMin - loader->left_bearing;
|
||||
loader->pp1.y = 0;
|
||||
loader->pp2.x = loader->pp1.x + loader->advance;
|
||||
loader->pp2.y = 0;
|
||||
|
||||
loader->pp3.x = use_aw_2 ? loader->advance / 2 : 0;
|
||||
loader->pp3.x = 0;
|
||||
loader->pp3.y = loader->bbox.yMax + loader->top_bearing;
|
||||
loader->pp4.x = use_aw_2 ? loader->advance / 2 : 0;
|
||||
loader->pp4.x = 0;
|
||||
loader->pp4.y = loader->pp3.y - loader->vadvance;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
{
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face );
|
||||
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
||||
loader->exec &&
|
||||
loader->exec->subpixel_hinting_lean &&
|
||||
loader->exec->grayscale_cleartype )
|
||||
{
|
||||
loader->pp3.x = loader->advance / 2;
|
||||
loader->pp4.x = loader->advance / 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -2277,8 +2176,7 @@
|
||||
#ifdef TT_USE_BYTECODE_INTERPRETER
|
||||
FT_Error error;
|
||||
FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
|
||||
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
||||
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( glyph->face );
|
||||
#endif
|
||||
#endif
|
||||
@ -2298,20 +2196,6 @@
|
||||
FT_Bool grayscale_cleartype;
|
||||
#endif
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
FT_Bool subpixel_hinting = FALSE;
|
||||
|
||||
#if 0
|
||||
/* not used yet */
|
||||
FT_Bool compatible_widths;
|
||||
FT_Bool symmetrical_smoothing;
|
||||
FT_Bool bgr;
|
||||
FT_Bool vertical_lcd;
|
||||
FT_Bool subpixel_positioned;
|
||||
FT_Bool gray_cleartype;
|
||||
#endif
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
FT_Bool reexecute = FALSE;
|
||||
|
||||
|
||||
@ -2331,6 +2215,9 @@
|
||||
if ( !exec )
|
||||
return FT_THROW( Could_Not_Find_Context );
|
||||
|
||||
grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO );
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
||||
{
|
||||
@ -2347,6 +2234,7 @@
|
||||
FT_BOOL( subpixel_hinting_lean &&
|
||||
( load_flags &
|
||||
FT_LOAD_TARGET_LCD_V ) );
|
||||
grayscale = FT_BOOL( grayscale && !subpixel_hinting_lean );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2356,111 +2244,11 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO ) &&
|
||||
SPH_OPTION_SET_SUBPIXEL );
|
||||
|
||||
if ( subpixel_hinting )
|
||||
grayscale = FALSE;
|
||||
else if ( SPH_OPTION_SET_GRAYSCALE )
|
||||
{
|
||||
grayscale = TRUE;
|
||||
subpixel_hinting = FALSE;
|
||||
}
|
||||
else
|
||||
grayscale = FALSE;
|
||||
|
||||
if ( FT_IS_TRICKY( glyph->face ) )
|
||||
subpixel_hinting = FALSE;
|
||||
|
||||
exec->ignore_x_mode = subpixel_hinting || grayscale;
|
||||
exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
|
||||
if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
|
||||
exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
|
||||
|
||||
#if 1
|
||||
exec->compatible_widths = SPH_OPTION_SET_COMPATIBLE_WIDTHS;
|
||||
exec->symmetrical_smoothing = TRUE;
|
||||
exec->bgr = FALSE;
|
||||
exec->vertical_lcd = FALSE;
|
||||
exec->subpixel_positioned = TRUE;
|
||||
exec->gray_cleartype = FALSE;
|
||||
#else /* 0 */
|
||||
exec->compatible_widths =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_COMPATIBLE_WIDTHS );
|
||||
exec->symmetrical_smoothing =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_SYMMETRICAL_SMOOTHING );
|
||||
exec->bgr =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_BGR );
|
||||
exec->vertical_lcd =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_VERTICAL_LCD );
|
||||
exec->subpixel_positioned =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_SUBPIXEL_POSITIONED );
|
||||
exec->gray_cleartype =
|
||||
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
TT_LOAD_GRAY_CLEARTYPE );
|
||||
#endif /* 0 */
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
||||
grayscale = FT_BOOL( !subpixel_hinting_lean &&
|
||||
FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO );
|
||||
else
|
||||
#endif
|
||||
grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO );
|
||||
|
||||
error = TT_Load_Context( exec, face, size );
|
||||
if ( error )
|
||||
return error;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
/* a change from mono to subpixel rendering (and vice versa) */
|
||||
/* requires a re-execution of the CVT program */
|
||||
if ( subpixel_hinting != exec->subpixel_hinting )
|
||||
{
|
||||
FT_TRACE4(( "tt_loader_init: subpixel hinting change,"
|
||||
" re-executing `prep' table\n" ));
|
||||
|
||||
exec->subpixel_hinting = subpixel_hinting;
|
||||
reexecute = TRUE;
|
||||
}
|
||||
|
||||
/* a change from mono to grayscale rendering (and vice versa) */
|
||||
/* requires a re-execution of the CVT program */
|
||||
if ( grayscale != exec->grayscale )
|
||||
{
|
||||
FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
|
||||
" re-executing `prep' table\n" ));
|
||||
|
||||
exec->grayscale = grayscale;
|
||||
reexecute = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
{
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
||||
{
|
||||
@ -2518,14 +2306,6 @@
|
||||
if ( exec->GS.instruct_control & 2 )
|
||||
exec->GS = tt_default_graphics_state;
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
/* check whether we have a font hinted for ClearType -- */
|
||||
/* note that this flag can also be modified in a glyph's bytecode */
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
|
||||
exec->GS.instruct_control & 4 )
|
||||
exec->ignore_x_mode = FALSE;
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
/*
|
||||
* Toggle backward compatibility according to what font wants, except
|
||||
@ -2561,13 +2341,6 @@
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
!( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
||||
exec->backward_compatibility ) &&
|
||||
#endif
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
!( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
|
||||
!SPH_OPTION_BITMAP_WIDTHS &&
|
||||
FT_LOAD_TARGET_MODE( loader->load_flags ) !=
|
||||
FT_RENDER_MODE_MONO &&
|
||||
exec->compatible_widths ) &&
|
||||
#endif
|
||||
!face->postscript.isFixedPitch )
|
||||
{
|
||||
|
8
thirdparty/freetype/src/truetype/ttgxvar.c
vendored
8
thirdparty/freetype/src/truetype/ttgxvar.c
vendored
@ -621,10 +621,10 @@
|
||||
{
|
||||
GX_ItemVarData varData = &itemStore->varData[i];
|
||||
|
||||
FT_UInt item_count;
|
||||
FT_UInt word_delta_count;
|
||||
FT_UInt region_idx_count;
|
||||
FT_UInt per_region_size;
|
||||
FT_UInt item_count;
|
||||
FT_UShort word_delta_count;
|
||||
FT_UInt region_idx_count;
|
||||
FT_UInt per_region_size;
|
||||
|
||||
|
||||
if ( FT_STREAM_SEEK( offset + dataOffsetArray[i] ) )
|
||||
|
838
thirdparty/freetype/src/truetype/ttinterp.c
vendored
838
thirdparty/freetype/src/truetype/ttinterp.c
vendored
File diff suppressed because it is too large
Load Diff
74
thirdparty/freetype/src/truetype/ttinterp.h
vendored
74
thirdparty/freetype/src/truetype/ttinterp.h
vendored
@ -98,48 +98,6 @@ FT_BEGIN_HEADER
|
||||
} TT_CallRec, *TT_CallStack;
|
||||
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* These structures define rules used to tweak subpixel hinting for
|
||||
* various fonts. "", 0, "", NULL value indicates to match any value.
|
||||
*/
|
||||
|
||||
#define SPH_MAX_NAME_SIZE 32
|
||||
#define SPH_MAX_CLASS_MEMBERS 100
|
||||
|
||||
typedef struct SPH_TweakRule_
|
||||
{
|
||||
const char family[SPH_MAX_NAME_SIZE];
|
||||
const FT_UInt ppem;
|
||||
const char style[SPH_MAX_NAME_SIZE];
|
||||
const FT_ULong glyph;
|
||||
|
||||
} SPH_TweakRule;
|
||||
|
||||
|
||||
typedef struct SPH_ScaleRule_
|
||||
{
|
||||
const char family[SPH_MAX_NAME_SIZE];
|
||||
const FT_UInt ppem;
|
||||
const char style[SPH_MAX_NAME_SIZE];
|
||||
const FT_ULong glyph;
|
||||
const FT_ULong scale;
|
||||
|
||||
} SPH_ScaleRule;
|
||||
|
||||
|
||||
typedef struct SPH_Font_Class_
|
||||
{
|
||||
const char name[SPH_MAX_NAME_SIZE];
|
||||
const char member[SPH_MAX_CLASS_MEMBERS][SPH_MAX_NAME_SIZE];
|
||||
|
||||
} SPH_Font_Class;
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* The main structure for the interpreter which collects all necessary
|
||||
@ -399,38 +357,6 @@ FT_BEGIN_HEADER
|
||||
FT_Bool grayscale_cleartype;
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
TT_Round_Func func_round_sphn; /* subpixel rounding function */
|
||||
|
||||
FT_Bool subpixel_hinting; /* Using subpixel hinting? */
|
||||
FT_Bool ignore_x_mode; /* Standard rendering mode for */
|
||||
/* subpixel hinting. On if gray */
|
||||
/* or subpixel hinting is on. */
|
||||
|
||||
/* The following 6 aren't fully implemented but here for MS rasterizer */
|
||||
/* compatibility. */
|
||||
FT_Bool compatible_widths; /* compatible widths? */
|
||||
FT_Bool symmetrical_smoothing; /* symmetrical_smoothing? */
|
||||
FT_Bool bgr; /* bgr instead of rgb? */
|
||||
FT_Bool vertical_lcd; /* long side of LCD subpixel */
|
||||
/* rectangles is horizontal */
|
||||
FT_Bool subpixel_positioned; /* subpixel positioned */
|
||||
/* (DirectWrite ClearType)? */
|
||||
FT_Bool gray_cleartype; /* ClearType hinting but */
|
||||
/* grayscale rendering */
|
||||
|
||||
FT_Int rasterizer_version; /* MS rasterizer version */
|
||||
|
||||
FT_Bool iup_called; /* IUP called for glyph? */
|
||||
|
||||
FT_ULong sph_tweak_flags; /* flags to control */
|
||||
/* hint tweaks */
|
||||
|
||||
FT_ULong sph_in_func_flags; /* flags to indicate if in */
|
||||
/* special functions */
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
/* We maintain two counters (in addition to the instruction counter) */
|
||||
/* that act as loop detectors for LOOPCALL and jump opcodes with */
|
||||
/* negative arguments. */
|
||||
|
3
thirdparty/freetype/src/truetype/ttobjs.c
vendored
3
thirdparty/freetype/src/truetype/ttobjs.c
vendored
@ -1481,9 +1481,6 @@
|
||||
TT_Driver driver = (TT_Driver)ttdriver;
|
||||
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_35;
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_38;
|
||||
#endif
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||
driver->interpreter_version = TT_INTERPRETER_VERSION_40;
|
||||
#endif
|
||||
|
2
thirdparty/freetype/src/truetype/ttobjs.h
vendored
2
thirdparty/freetype/src/truetype/ttobjs.h
vendored
@ -162,8 +162,6 @@ FT_BEGIN_HEADER
|
||||
FT_Long end; /* where does it end? */
|
||||
FT_UInt opc; /* function #, or instruction code */
|
||||
FT_Bool active; /* is it active? */
|
||||
FT_Bool inline_delta; /* is function that defines inline delta? */
|
||||
FT_ULong sph_fdef_flags; /* flags to identify special functions */
|
||||
|
||||
} TT_DefRecord, *TT_DefArray;
|
||||
|
||||
|
1013
thirdparty/freetype/src/truetype/ttsubpix.c
vendored
1013
thirdparty/freetype/src/truetype/ttsubpix.c
vendored
File diff suppressed because it is too large
Load Diff
110
thirdparty/freetype/src/truetype/ttsubpix.h
vendored
110
thirdparty/freetype/src/truetype/ttsubpix.h
vendored
@ -1,110 +0,0 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* ttsubpix.h
|
||||
*
|
||||
* TrueType Subpixel Hinting.
|
||||
*
|
||||
* Copyright (C) 2010-2023 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
*
|
||||
* This file is part of the FreeType project, and may only be used,
|
||||
* modified, and distributed under the terms of the FreeType project
|
||||
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
* this file you indicate that you have read the license and
|
||||
* understand and accept it fully.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TTSUBPIX_H_
|
||||
#define TTSUBPIX_H_
|
||||
|
||||
#include "ttobjs.h"
|
||||
#include "ttinterp.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* ID flags to identify special functions at FDEF and runtime.
|
||||
*
|
||||
*/
|
||||
#define SPH_FDEF_INLINE_DELTA_1 0x0000001
|
||||
#define SPH_FDEF_INLINE_DELTA_2 0x0000002
|
||||
#define SPH_FDEF_DIAGONAL_STROKE 0x0000004
|
||||
#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008
|
||||
#define SPH_FDEF_TTFAUTOHINT_1 0x0000010
|
||||
#define SPH_FDEF_SPACING_1 0x0000020
|
||||
#define SPH_FDEF_SPACING_2 0x0000040
|
||||
#define SPH_FDEF_TYPEMAN_STROKES 0x0000080
|
||||
#define SPH_FDEF_TYPEMAN_DIAGENDCTRL 0x0000100
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Tweak flags that are set for each glyph by the below rules.
|
||||
*
|
||||
*/
|
||||
#define SPH_TWEAK_ALLOW_X_DMOVE 0x0000001UL
|
||||
#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000002UL
|
||||
#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000004UL
|
||||
#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000008UL
|
||||
#define SPH_TWEAK_DEEMBOLDEN 0x0000010UL
|
||||
#define SPH_TWEAK_DO_SHPIX 0x0000020UL
|
||||
#define SPH_TWEAK_EMBOLDEN 0x0000040UL
|
||||
#define SPH_TWEAK_MIAP_HACK 0x0000080UL
|
||||
#define SPH_TWEAK_NORMAL_ROUND 0x0000100UL
|
||||
#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0000200UL
|
||||
#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0000400UL
|
||||
#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0000800UL
|
||||
#define SPH_TWEAK_PIXEL_HINTING 0x0001000UL
|
||||
#define SPH_TWEAK_RASTERIZER_35 0x0002000UL
|
||||
#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0004000UL
|
||||
#define SPH_TWEAK_SKIP_IUP 0x0008000UL
|
||||
#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0010000UL
|
||||
#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0020000UL
|
||||
#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0040000UL
|
||||
#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP 0x0080000UL
|
||||
|
||||
|
||||
FT_LOCAL( FT_Bool )
|
||||
sph_test_tweak( TT_Face face,
|
||||
const FT_String* family,
|
||||
FT_UInt ppem,
|
||||
const FT_String* style,
|
||||
FT_UInt glyph_index,
|
||||
const SPH_TweakRule* rule,
|
||||
FT_UInt num_rules );
|
||||
|
||||
FT_LOCAL( FT_UInt )
|
||||
sph_test_tweak_x_scaling( TT_Face face,
|
||||
const FT_String* family,
|
||||
FT_UInt ppem,
|
||||
const FT_String* style,
|
||||
FT_UInt glyph_index );
|
||||
|
||||
FT_LOCAL( void )
|
||||
sph_set_tweaks( TT_Loader loader,
|
||||
FT_UInt glyph_index );
|
||||
|
||||
|
||||
/* These macros are defined absent a method for setting them */
|
||||
#define SPH_OPTION_BITMAP_WIDTHS FALSE
|
||||
#define SPH_OPTION_SET_SUBPIXEL TRUE
|
||||
#define SPH_OPTION_SET_GRAYSCALE FALSE
|
||||
#define SPH_OPTION_SET_COMPATIBLE_WIDTHS FALSE
|
||||
#define SPH_OPTION_SET_RASTERIZER_VERSION 38
|
||||
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* TTSUBPIX_H_ */
|
||||
|
||||
|
||||
/* END */
|
4
thirdparty/freetype/src/type1/t1load.c
vendored
4
thirdparty/freetype/src/type1/t1load.c
vendored
@ -1773,7 +1773,7 @@
|
||||
*/
|
||||
|
||||
FT_TRACE0(( "parse_subrs: adjusting number of subroutines"
|
||||
" (from %d to %ld)\n",
|
||||
" (from %d to %zu)\n",
|
||||
num_subrs,
|
||||
( parser->root.limit - parser->root.cursor ) >> 3 ));
|
||||
num_subrs = ( parser->root.limit - parser->root.cursor ) >> 3;
|
||||
@ -1948,7 +1948,7 @@
|
||||
if ( num_glyphs > ( limit - cur ) >> 3 )
|
||||
{
|
||||
FT_TRACE0(( "parse_charstrings: adjusting number of glyphs"
|
||||
" (from %d to %ld)\n",
|
||||
" (from %d to %zu)\n",
|
||||
num_glyphs, ( limit - cur ) >> 3 ));
|
||||
num_glyphs = ( limit - cur ) >> 3;
|
||||
}
|
||||
|
2
thirdparty/freetype/src/type42/t42parse.c
vendored
2
thirdparty/freetype/src/type42/t42parse.c
vendored
@ -872,7 +872,7 @@
|
||||
if ( loader->num_glyphs > ( limit - parser->root.cursor ) >> 2 )
|
||||
{
|
||||
FT_TRACE0(( "t42_parse_charstrings: adjusting number of glyphs"
|
||||
" (from %d to %ld)\n",
|
||||
" (from %d to %zu)\n",
|
||||
loader->num_glyphs,
|
||||
( limit - parser->root.cursor ) >> 2 ));
|
||||
loader->num_glyphs = ( limit - parser->root.cursor ) >> 2;
|
||||
|
Loading…
Reference in New Issue
Block a user