summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/gzip/ftgzip.c
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-11-02 07:10:28 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-11-03 16:21:10 +0000
commitdba44cd4e5754b579f2184a864ffe7b79b0a7e56 (patch)
treec8829051b16c8a78f049fb05bae9322293143c91 /src/3rdparty/freetype/src/gzip/ftgzip.c
parente056be144a0207699b42a01b6d4cb6f19be474d7 (diff)
Update bundled FreeType to 2.6.1
Change-Id: Ic489f8aa8ad42da3922f542e6c9064afe44f3799 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/3rdparty/freetype/src/gzip/ftgzip.c')
-rw-r--r--src/3rdparty/freetype/src/gzip/ftgzip.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/3rdparty/freetype/src/gzip/ftgzip.c b/src/3rdparty/freetype/src/gzip/ftgzip.c
index 2d4200d9fa..422035c00b 100644
--- a/src/3rdparty/freetype/src/gzip/ftgzip.c
+++ b/src/3rdparty/freetype/src/gzip/ftgzip.c
@@ -8,7 +8,7 @@
/* parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2002-2006, 2009-2014 by */
+/* Copyright 2002-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -58,7 +58,6 @@
/* conflicts when a program is linked with both FreeType and the */
/* original ZLib. */
-#define NO_DUMMY_DECL
#ifndef USE_ZLIB_ZCALLOC
#define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutils.c */
#endif
@@ -378,7 +377,10 @@
size = stream->read( stream, stream->pos, zip->input,
FT_GZIP_BUFFER_SIZE );
if ( size == 0 )
+ {
+ zip->limit = zip->cursor;
return FT_THROW( Invalid_Stream_Operation );
+ }
}
else
{
@@ -387,7 +389,10 @@
size = FT_GZIP_BUFFER_SIZE;
if ( size == 0 )
+ {
+ zip->limit = zip->cursor;
return FT_THROW( Invalid_Stream_Operation );
+ }
FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
}
@@ -434,7 +439,8 @@
}
else if ( err != Z_OK )
{
- error = FT_THROW( Invalid_Stream_Operation );
+ zip->limit = zip->cursor;
+ error = FT_THROW( Invalid_Stream_Operation );
break;
}
}
@@ -558,19 +564,22 @@
stream->descriptor.pointer = NULL;
}
+
+ if ( !stream->read )
+ FT_FREE( stream->base );
}
- static FT_ULong
- ft_gzip_stream_io( FT_Stream stream,
- FT_ULong pos,
- FT_Byte* buffer,
- FT_ULong count )
+ static unsigned long
+ ft_gzip_stream_io( FT_Stream stream,
+ unsigned long offset,
+ unsigned char* buffer,
+ unsigned long count )
{
FT_GZipFile zip = (FT_GZipFile)stream->descriptor.pointer;
- return ft_gzip_file_io( zip, pos, buffer, count );
+ return ft_gzip_file_io( zip, offset, buffer, count );
}
@@ -585,7 +594,7 @@
old_pos = stream->pos;
if ( !FT_Stream_Seek( stream, stream->size - 4 ) )
{
- result = FT_Stream_ReadULong( stream, &error );
+ result = FT_Stream_ReadULongLE( stream, &error );
if ( error )
result = 0;
@@ -686,7 +695,7 @@
stream->size = 0x7FFFFFFFL; /* don't know the real size! */
stream->pos = 0;
- stream->base = 0;
+ stream->base = NULL;
stream->read = ft_gzip_stream_io;
stream->close = ft_gzip_stream_close;