• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  *
3  * ftgzip.c
4  *
5  *   FreeType support for .gz compressed files.
6  *
7  * This optional component relies on zlib.  It should mainly be used to
8  * parse compressed PCF fonts, as found with many X11 server
9  * distributions.
10  *
11  * Copyright 2002-2018 by
12  * David Turner, Robert Wilhelm, and Werner Lemberg.
13  *
14  * This file is part of the FreeType project, and may only be used,
15  * modified, and distributed under the terms of the FreeType project
16  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
17  * this file you indicate that you have read the license and
18  * understand and accept it fully.
19  *
20  */
21 
22 
23 #include <ft2build.h>
24 #include FT_INTERNAL_MEMORY_H
25 #include FT_INTERNAL_STREAM_H
26 #include FT_INTERNAL_DEBUG_H
27 #include FT_GZIP_H
28 #include FT_CONFIG_STANDARD_LIBRARY_H
29 
30 
31 #include FT_MODULE_ERRORS_H
32 
33 #undef FTERRORS_H_
34 
35 #undef  FT_ERR_PREFIX
36 #define FT_ERR_PREFIX  Gzip_Err_
37 #define FT_ERR_BASE    FT_Mod_Err_Gzip
38 
39 #include FT_ERRORS_H
40 
41 
42 #ifdef FT_CONFIG_OPTION_USE_ZLIB
43 
44 #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
45 
46 #include <zlib.h>
47 
48 #else /* !FT_CONFIG_OPTION_SYSTEM_ZLIB */
49 
50   /* In this case, we include our own modified sources of the ZLib  */
51   /* within the `gzip' component.  The modifications were necessary */
52   /* to #include all files without conflicts, as well as preventing */
53   /* the definition of `extern' functions that may cause linking    */
54   /* conflicts when a program is linked with both FreeType and the  */
55   /* original ZLib.                                                 */
56 
57 #ifndef USE_ZLIB_ZCALLOC
58 #define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutil.c */
59 #endif
60 
61   /* Note that our `zlib.h' includes `ftzconf.h' instead of `zconf.h'; */
62   /* the main reason is that even a global `zlib.h' includes `zconf.h' */
63   /* with                                                              */
64   /*                                                                   */
65   /*   #include "zconf.h"                                              */
66   /*                                                                   */
67   /* instead of the expected                                           */
68   /*                                                                   */
69   /*   #include <zconf.h>                                              */
70   /*                                                                   */
71   /* so that configuration with `FT_CONFIG_OPTION_SYSTEM_ZLIB' might   */
72   /* include the wrong `zconf.h' file, leading to errors.              */
73 #include "zlib.h"
74 
75 #undef  SLOW
76 #define SLOW  1  /* we can't use asm-optimized sources here! */
77 
78 #if defined( _MSC_VER )      /* Visual C++ (and Intel C++)   */
79   /* We disable the warning `conversion from XXX to YYY,     */
80   /* possible loss of data' in order to compile cleanly with */
81   /* the maximum level of warnings: zlib is non-FreeType     */
82   /* code.                                                   */
83 #pragma warning( push )
84 #pragma warning( disable : 4244 )
85 #endif /* _MSC_VER */
86 
87   /* Urgh.  `inflate_mask' must not be declared twice -- C++ doesn't like
88      this.  We temporarily disable it and load all necessary header files. */
89 #define NO_INFLATE_MASK
90 #include "zutil.h"
91 #include "inftrees.h"
92 #include "infblock.h"
93 #include "infcodes.h"
94 #include "infutil.h"
95 #undef  NO_INFLATE_MASK
96 
97   /* infutil.c must be included before infcodes.c */
98 #include "zutil.c"
99 #include "inftrees.c"
100 #include "infutil.c"
101 #include "infcodes.c"
102 #include "infblock.c"
103 #include "inflate.c"
104 #include "adler32.c"
105 
106 #if defined( _MSC_VER )
107 #pragma warning( pop )
108 #endif
109 
110 #endif /* !FT_CONFIG_OPTION_SYSTEM_ZLIB */
111 
112 
113 /***************************************************************************/
114 /***************************************************************************/
115 /*****                                                                 *****/
116 /*****            Z L I B   M E M O R Y   M A N A G E M E N T          *****/
117 /*****                                                                 *****/
118 /***************************************************************************/
119 /***************************************************************************/
120 
121   /* it is better to use FreeType memory routines instead of raw
122      'malloc/free' */
123 
124   static voidpf
ft_gzip_alloc(FT_Memory memory,uInt items,uInt size)125   ft_gzip_alloc( FT_Memory  memory,
126                  uInt       items,
127                  uInt       size )
128   {
129     FT_ULong    sz = (FT_ULong)size * items;
130     FT_Error    error;
131     FT_Pointer  p  = NULL;
132 
133 
134     (void)FT_ALLOC( p, sz );
135     return p;
136   }
137 
138 
139   static void
ft_gzip_free(FT_Memory memory,voidpf address)140   ft_gzip_free( FT_Memory  memory,
141                 voidpf     address )
142   {
143     FT_MEM_FREE( address );
144   }
145 
146 
147 #if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )
148 
149   local voidpf
zcalloc(voidpf opaque,unsigned items,unsigned size)150   zcalloc ( voidpf    opaque,
151             unsigned  items,
152             unsigned  size )
153   {
154     return ft_gzip_alloc( (FT_Memory)opaque, items, size );
155   }
156 
157   local void
zcfree(voidpf opaque,voidpf ptr)158   zcfree( voidpf  opaque,
159           voidpf  ptr )
160   {
161     ft_gzip_free( (FT_Memory)opaque, ptr );
162   }
163 
164 #endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */
165 
166 
167 /***************************************************************************/
168 /***************************************************************************/
169 /*****                                                                 *****/
170 /*****               Z L I B   F I L E   D E S C R I P T O R           *****/
171 /*****                                                                 *****/
172 /***************************************************************************/
173 /***************************************************************************/
174 
175 #define FT_GZIP_BUFFER_SIZE  4096
176 
177   typedef struct  FT_GZipFileRec_
178   {
179     FT_Stream  source;         /* parent/source stream        */
180     FT_Stream  stream;         /* embedding stream            */
181     FT_Memory  memory;         /* memory allocator            */
182     z_stream   zstream;        /* zlib input stream           */
183 
184     FT_ULong   start;          /* starting position, after .gz header */
185     FT_Byte    input[FT_GZIP_BUFFER_SIZE];   /* input read buffer  */
186 
187     FT_Byte    buffer[FT_GZIP_BUFFER_SIZE];  /* output buffer      */
188     FT_ULong   pos;                          /* position in output */
189     FT_Byte*   cursor;
190     FT_Byte*   limit;
191 
192   } FT_GZipFileRec, *FT_GZipFile;
193 
194 
195   /* gzip flag byte */
196 #define FT_GZIP_ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
197 #define FT_GZIP_HEAD_CRC     0x02 /* bit 1 set: header CRC present */
198 #define FT_GZIP_EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
199 #define FT_GZIP_ORIG_NAME    0x08 /* bit 3 set: original file name present */
200 #define FT_GZIP_COMMENT      0x10 /* bit 4 set: file comment present */
201 #define FT_GZIP_RESERVED     0xE0 /* bits 5..7: reserved */
202 
203 
204   /* check and skip .gz header - we don't support `transparent' compression */
205   static FT_Error
ft_gzip_check_header(FT_Stream stream)206   ft_gzip_check_header( FT_Stream  stream )
207   {
208     FT_Error  error;
209     FT_Byte   head[4];
210 
211 
212     if ( FT_STREAM_SEEK( 0 )       ||
213          FT_STREAM_READ( head, 4 ) )
214       goto Exit;
215 
216     /* head[0] && head[1] are the magic numbers;    */
217     /* head[2] is the method, and head[3] the flags */
218     if ( head[0] != 0x1F              ||
219          head[1] != 0x8B              ||
220          head[2] != Z_DEFLATED        ||
221         (head[3] & FT_GZIP_RESERVED)  )
222     {
223       error = FT_THROW( Invalid_File_Format );
224       goto Exit;
225     }
226 
227     /* skip time, xflags and os code */
228     (void)FT_STREAM_SKIP( 6 );
229 
230     /* skip the extra field */
231     if ( head[3] & FT_GZIP_EXTRA_FIELD )
232     {
233       FT_UInt  len;
234 
235 
236       if ( FT_READ_USHORT_LE( len ) ||
237            FT_STREAM_SKIP( len )    )
238         goto Exit;
239     }
240 
241     /* skip original file name */
242     if ( head[3] & FT_GZIP_ORIG_NAME )
243       for (;;)
244       {
245         FT_UInt  c;
246 
247 
248         if ( FT_READ_BYTE( c ) )
249           goto Exit;
250 
251         if ( c == 0 )
252           break;
253       }
254 
255     /* skip .gz comment */
256     if ( head[3] & FT_GZIP_COMMENT )
257       for (;;)
258       {
259         FT_UInt  c;
260 
261 
262         if ( FT_READ_BYTE( c ) )
263           goto Exit;
264 
265         if ( c == 0 )
266           break;
267       }
268 
269     /* skip CRC */
270     if ( head[3] & FT_GZIP_HEAD_CRC )
271       if ( FT_STREAM_SKIP( 2 ) )
272         goto Exit;
273 
274   Exit:
275     return error;
276   }
277 
278 
279   static FT_Error
ft_gzip_file_init(FT_GZipFile zip,FT_Stream stream,FT_Stream source)280   ft_gzip_file_init( FT_GZipFile  zip,
281                      FT_Stream    stream,
282                      FT_Stream    source )
283   {
284     z_stream*  zstream = &zip->zstream;
285     FT_Error   error   = FT_Err_Ok;
286 
287 
288     zip->stream = stream;
289     zip->source = source;
290     zip->memory = stream->memory;
291 
292     zip->limit  = zip->buffer + FT_GZIP_BUFFER_SIZE;
293     zip->cursor = zip->limit;
294     zip->pos    = 0;
295 
296     /* check and skip .gz header */
297     {
298       stream = source;
299 
300       error = ft_gzip_check_header( stream );
301       if ( error )
302         goto Exit;
303 
304       zip->start = FT_STREAM_POS();
305     }
306 
307     /* initialize zlib -- there is no zlib header in the compressed stream */
308     zstream->zalloc = (alloc_func)ft_gzip_alloc;
309     zstream->zfree  = (free_func) ft_gzip_free;
310     zstream->opaque = stream->memory;
311 
312     zstream->avail_in = 0;
313     zstream->next_in  = zip->buffer;
314 
315     if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK ||
316          !zstream->next_in                           )
317       error = FT_THROW( Invalid_File_Format );
318 
319   Exit:
320     return error;
321   }
322 
323 
324   static void
ft_gzip_file_done(FT_GZipFile zip)325   ft_gzip_file_done( FT_GZipFile  zip )
326   {
327     z_stream*  zstream = &zip->zstream;
328 
329 
330     inflateEnd( zstream );
331 
332     /* clear the rest */
333     zstream->zalloc    = NULL;
334     zstream->zfree     = NULL;
335     zstream->opaque    = NULL;
336     zstream->next_in   = NULL;
337     zstream->next_out  = NULL;
338     zstream->avail_in  = 0;
339     zstream->avail_out = 0;
340 
341     zip->memory = NULL;
342     zip->source = NULL;
343     zip->stream = NULL;
344   }
345 
346 
347   static FT_Error
ft_gzip_file_reset(FT_GZipFile zip)348   ft_gzip_file_reset( FT_GZipFile  zip )
349   {
350     FT_Stream  stream = zip->source;
351     FT_Error   error;
352 
353 
354     if ( !FT_STREAM_SEEK( zip->start ) )
355     {
356       z_stream*  zstream = &zip->zstream;
357 
358 
359       inflateReset( zstream );
360 
361       zstream->avail_in  = 0;
362       zstream->next_in   = zip->input;
363       zstream->avail_out = 0;
364       zstream->next_out  = zip->buffer;
365 
366       zip->limit  = zip->buffer + FT_GZIP_BUFFER_SIZE;
367       zip->cursor = zip->limit;
368       zip->pos    = 0;
369     }
370 
371     return error;
372   }
373 
374 
375   static FT_Error
ft_gzip_file_fill_input(FT_GZipFile zip)376   ft_gzip_file_fill_input( FT_GZipFile  zip )
377   {
378     z_stream*  zstream = &zip->zstream;
379     FT_Stream  stream  = zip->source;
380     FT_ULong   size;
381 
382 
383     if ( stream->read )
384     {
385       size = stream->read( stream, stream->pos, zip->input,
386                            FT_GZIP_BUFFER_SIZE );
387       if ( size == 0 )
388       {
389         zip->limit = zip->cursor;
390         return FT_THROW( Invalid_Stream_Operation );
391       }
392     }
393     else
394     {
395       size = stream->size - stream->pos;
396       if ( size > FT_GZIP_BUFFER_SIZE )
397         size = FT_GZIP_BUFFER_SIZE;
398 
399       if ( size == 0 )
400       {
401         zip->limit = zip->cursor;
402         return FT_THROW( Invalid_Stream_Operation );
403       }
404 
405       FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
406     }
407     stream->pos += size;
408 
409     zstream->next_in  = zip->input;
410     zstream->avail_in = size;
411 
412     return FT_Err_Ok;
413   }
414 
415 
416   static FT_Error
ft_gzip_file_fill_output(FT_GZipFile zip)417   ft_gzip_file_fill_output( FT_GZipFile  zip )
418   {
419     z_stream*  zstream = &zip->zstream;
420     FT_Error   error   = FT_Err_Ok;
421 
422 
423     zip->cursor        = zip->buffer;
424     zstream->next_out  = zip->cursor;
425     zstream->avail_out = FT_GZIP_BUFFER_SIZE;
426 
427     while ( zstream->avail_out > 0 )
428     {
429       int  err;
430 
431 
432       if ( zstream->avail_in == 0 )
433       {
434         error = ft_gzip_file_fill_input( zip );
435         if ( error )
436           break;
437       }
438 
439       err = inflate( zstream, Z_NO_FLUSH );
440 
441       if ( err == Z_STREAM_END )
442       {
443         zip->limit = zstream->next_out;
444         if ( zip->limit == zip->cursor )
445           error = FT_THROW( Invalid_Stream_Operation );
446         break;
447       }
448       else if ( err != Z_OK )
449       {
450         zip->limit = zip->cursor;
451         error      = FT_THROW( Invalid_Stream_Operation );
452         break;
453       }
454     }
455 
456     return error;
457   }
458 
459 
460   /* fill output buffer; `count' must be <= FT_GZIP_BUFFER_SIZE */
461   static FT_Error
ft_gzip_file_skip_output(FT_GZipFile zip,FT_ULong count)462   ft_gzip_file_skip_output( FT_GZipFile  zip,
463                             FT_ULong     count )
464   {
465     FT_Error  error = FT_Err_Ok;
466     FT_ULong  delta;
467 
468 
469     for (;;)
470     {
471       delta = (FT_ULong)( zip->limit - zip->cursor );
472       if ( delta >= count )
473         delta = count;
474 
475       zip->cursor += delta;
476       zip->pos    += delta;
477 
478       count -= delta;
479       if ( count == 0 )
480         break;
481 
482       error = ft_gzip_file_fill_output( zip );
483       if ( error )
484         break;
485     }
486 
487     return error;
488   }
489 
490 
491   static FT_ULong
ft_gzip_file_io(FT_GZipFile zip,FT_ULong pos,FT_Byte * buffer,FT_ULong count)492   ft_gzip_file_io( FT_GZipFile  zip,
493                    FT_ULong     pos,
494                    FT_Byte*     buffer,
495                    FT_ULong     count )
496   {
497     FT_ULong  result = 0;
498     FT_Error  error;
499 
500 
501     /* Reset inflate stream if we're seeking backwards.        */
502     /* Yes, that is not too efficient, but it saves memory :-) */
503     if ( pos < zip->pos )
504     {
505       error = ft_gzip_file_reset( zip );
506       if ( error )
507         goto Exit;
508     }
509 
510     /* skip unwanted bytes */
511     if ( pos > zip->pos )
512     {
513       error = ft_gzip_file_skip_output( zip, (FT_ULong)( pos - zip->pos ) );
514       if ( error )
515         goto Exit;
516     }
517 
518     if ( count == 0 )
519       goto Exit;
520 
521     /* now read the data */
522     for (;;)
523     {
524       FT_ULong  delta;
525 
526 
527       delta = (FT_ULong)( zip->limit - zip->cursor );
528       if ( delta >= count )
529         delta = count;
530 
531       FT_MEM_COPY( buffer, zip->cursor, delta );
532       buffer      += delta;
533       result      += delta;
534       zip->cursor += delta;
535       zip->pos    += delta;
536 
537       count -= delta;
538       if ( count == 0 )
539         break;
540 
541       error = ft_gzip_file_fill_output( zip );
542       if ( error )
543         break;
544     }
545 
546   Exit:
547     return result;
548   }
549 
550 
551 /***************************************************************************/
552 /***************************************************************************/
553 /*****                                                                 *****/
554 /*****               G Z   E M B E D D I N G   S T R E A M             *****/
555 /*****                                                                 *****/
556 /***************************************************************************/
557 /***************************************************************************/
558 
559   static void
ft_gzip_stream_close(FT_Stream stream)560   ft_gzip_stream_close( FT_Stream  stream )
561   {
562     FT_GZipFile  zip    = (FT_GZipFile)stream->descriptor.pointer;
563     FT_Memory    memory = stream->memory;
564 
565 
566     if ( zip )
567     {
568       /* finalize gzip file descriptor */
569       ft_gzip_file_done( zip );
570 
571       FT_FREE( zip );
572 
573       stream->descriptor.pointer = NULL;
574     }
575 
576     if ( !stream->read )
577       FT_FREE( stream->base );
578   }
579 
580 
581   static unsigned long
ft_gzip_stream_io(FT_Stream stream,unsigned long offset,unsigned char * buffer,unsigned long count)582   ft_gzip_stream_io( FT_Stream       stream,
583                      unsigned long   offset,
584                      unsigned char*  buffer,
585                      unsigned long   count )
586   {
587     FT_GZipFile  zip = (FT_GZipFile)stream->descriptor.pointer;
588 
589 
590     return ft_gzip_file_io( zip, offset, buffer, count );
591   }
592 
593 
594   static FT_ULong
ft_gzip_get_uncompressed_size(FT_Stream stream)595   ft_gzip_get_uncompressed_size( FT_Stream  stream )
596   {
597     FT_Error  error;
598     FT_ULong  old_pos;
599     FT_ULong  result = 0;
600 
601 
602     old_pos = stream->pos;
603     if ( !FT_Stream_Seek( stream, stream->size - 4 ) )
604     {
605       result = FT_Stream_ReadULongLE( stream, &error );
606       if ( error )
607         result = 0;
608 
609       (void)FT_Stream_Seek( stream, old_pos );
610     }
611 
612     return result;
613   }
614 
615 
616   /* documentation is in ftgzip.h */
617 
618   FT_EXPORT_DEF( FT_Error )
FT_Stream_OpenGzip(FT_Stream stream,FT_Stream source)619   FT_Stream_OpenGzip( FT_Stream  stream,
620                       FT_Stream  source )
621   {
622     FT_Error     error;
623     FT_Memory    memory;
624     FT_GZipFile  zip = NULL;
625 
626 
627     if ( !stream || !source )
628     {
629       error = FT_THROW( Invalid_Stream_Handle );
630       goto Exit;
631     }
632 
633     memory = source->memory;
634 
635     /*
636      * check the header right now; this prevents allocating un-necessary
637      * objects when we don't need them
638      */
639     error = ft_gzip_check_header( source );
640     if ( error )
641       goto Exit;
642 
643     FT_ZERO( stream );
644     stream->memory = memory;
645 
646     if ( !FT_QNEW( zip ) )
647     {
648       error = ft_gzip_file_init( zip, stream, source );
649       if ( error )
650       {
651         FT_FREE( zip );
652         goto Exit;
653       }
654 
655       stream->descriptor.pointer = zip;
656     }
657 
658     /*
659      * We use the following trick to try to dramatically improve the
660      * performance while dealing with small files.  If the original stream
661      * size is less than a certain threshold, we try to load the whole font
662      * file into memory.  This saves us from using the 32KB buffer needed
663      * to inflate the file, plus the two 4KB intermediate input/output
664      * buffers used in the `FT_GZipFile' structure.
665      */
666     {
667       FT_ULong  zip_size = ft_gzip_get_uncompressed_size( source );
668 
669 
670       if ( zip_size != 0 && zip_size < 40 * 1024 )
671       {
672         FT_Byte*  zip_buff = NULL;
673 
674 
675         if ( !FT_ALLOC( zip_buff, zip_size ) )
676         {
677           FT_ULong  count;
678 
679 
680           count = ft_gzip_file_io( zip, 0, zip_buff, zip_size );
681           if ( count == zip_size )
682           {
683             ft_gzip_file_done( zip );
684             FT_FREE( zip );
685 
686             stream->descriptor.pointer = NULL;
687 
688             stream->size  = zip_size;
689             stream->pos   = 0;
690             stream->base  = zip_buff;
691             stream->read  = NULL;
692             stream->close = ft_gzip_stream_close;
693 
694             goto Exit;
695           }
696 
697           ft_gzip_file_io( zip, 0, NULL, 0 );
698           FT_FREE( zip_buff );
699         }
700         error = FT_Err_Ok;
701       }
702 
703       if ( zip_size )
704         stream->size = zip_size;
705       else
706         stream->size  = 0x7FFFFFFFL;  /* don't know the real size! */
707     }
708 
709     stream->pos   = 0;
710     stream->base  = NULL;
711     stream->read  = ft_gzip_stream_io;
712     stream->close = ft_gzip_stream_close;
713 
714   Exit:
715     return error;
716   }
717 
718 
719   /* documentation is in ftgzip.h */
720 
721   FT_EXPORT_DEF( FT_Error )
FT_Gzip_Uncompress(FT_Memory memory,FT_Byte * output,FT_ULong * output_len,const FT_Byte * input,FT_ULong input_len)722   FT_Gzip_Uncompress( FT_Memory       memory,
723                       FT_Byte*        output,
724                       FT_ULong*       output_len,
725                       const FT_Byte*  input,
726                       FT_ULong        input_len )
727   {
728     z_stream  stream;
729     int       err;
730 
731 
732     /* check for `input' delayed to `inflate' */
733 
734     if ( !memory || ! output_len || !output )
735       return FT_THROW( Invalid_Argument );
736 
737     /* this function is modeled after zlib's `uncompress' function */
738 
739     stream.next_in  = (Bytef*)input;
740     stream.avail_in = (uInt)input_len;
741 
742     stream.next_out  = output;
743     stream.avail_out = (uInt)*output_len;
744 
745     stream.zalloc = (alloc_func)ft_gzip_alloc;
746     stream.zfree  = (free_func) ft_gzip_free;
747     stream.opaque = memory;
748 
749     err = inflateInit2( &stream, MAX_WBITS );
750     if ( err != Z_OK )
751       return FT_THROW( Invalid_Argument );
752 
753     err = inflate( &stream, Z_FINISH );
754     if ( err != Z_STREAM_END )
755     {
756       inflateEnd( &stream );
757       if ( err == Z_OK )
758         err = Z_BUF_ERROR;
759     }
760     else
761     {
762       *output_len = stream.total_out;
763 
764       err = inflateEnd( &stream );
765     }
766 
767     if ( err == Z_MEM_ERROR )
768       return FT_THROW( Out_Of_Memory );
769 
770     if ( err == Z_BUF_ERROR )
771       return FT_THROW( Array_Too_Large );
772 
773     if ( err == Z_DATA_ERROR )
774       return FT_THROW( Invalid_Table );
775 
776     return FT_Err_Ok;
777   }
778 
779 
780 #else /* !FT_CONFIG_OPTION_USE_ZLIB */
781 
782   FT_EXPORT_DEF( FT_Error )
FT_Stream_OpenGzip(FT_Stream stream,FT_Stream source)783   FT_Stream_OpenGzip( FT_Stream  stream,
784                       FT_Stream  source )
785   {
786     FT_UNUSED( stream );
787     FT_UNUSED( source );
788 
789     return FT_THROW( Unimplemented_Feature );
790   }
791 
792 
793   FT_EXPORT_DEF( FT_Error )
FT_Gzip_Uncompress(FT_Memory memory,FT_Byte * output,FT_ULong * output_len,const FT_Byte * input,FT_ULong input_len)794   FT_Gzip_Uncompress( FT_Memory       memory,
795                       FT_Byte*        output,
796                       FT_ULong*       output_len,
797                       const FT_Byte*  input,
798                       FT_ULong        input_len )
799   {
800     FT_UNUSED( memory );
801     FT_UNUSED( output );
802     FT_UNUSED( output_len );
803     FT_UNUSED( input );
804     FT_UNUSED( input_len );
805 
806     return FT_THROW( Unimplemented_Feature );
807   }
808 
809 #endif /* !FT_CONFIG_OPTION_USE_ZLIB */
810 
811 
812 /* END */
813