summaryrefslogtreecommitdiff
path: root/src/freetype2/lzw
diff options
context:
space:
mode:
Diffstat (limited to 'src/freetype2/lzw')
-rw-r--r--src/freetype2/lzw/ftlzw.c9
-rw-r--r--src/freetype2/lzw/ftzopen.c9
-rw-r--r--src/freetype2/lzw/ftzopen.h10
3 files changed, 17 insertions, 11 deletions
diff --git a/src/freetype2/lzw/ftlzw.c b/src/freetype2/lzw/ftlzw.c
index 45fbf7b..4f601a1 100644
--- a/src/freetype2/lzw/ftlzw.c
+++ b/src/freetype2/lzw/ftlzw.c
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2004, 2005, 2006 by */
+/* Copyright 2004, 2005, 2006, 2009 by */
/* Albert Chin-A-Young. */
/* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */
@@ -27,8 +27,7 @@
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
#include FT_LZW_H
-#include <string.h>
-#include <stdio.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H
#include FT_MODULE_ERRORS_H
@@ -43,6 +42,10 @@
#ifdef FT_CONFIG_OPTION_USE_LZW
+#ifdef FT_CONFIG_OPTION_PIC
+#error "lzw code does not support PIC yet"
+#endif
+
#include "ftzopen.h"
diff --git a/src/freetype2/lzw/ftzopen.c b/src/freetype2/lzw/ftzopen.c
index fc78315..8bc65c8 100644
--- a/src/freetype2/lzw/ftzopen.c
+++ b/src/freetype2/lzw/ftzopen.c
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2005, 2006, 2007 by David Turner. */
+/* Copyright 2005, 2006, 2007, 2009 by David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -113,8 +113,8 @@
{
FT_Memory memory = state->memory;
FT_Error error;
- FT_UInt old_size = state->stack_size;
- FT_UInt new_size = old_size;
+ FT_Offset old_size = state->stack_size;
+ FT_Offset new_size = old_size;
new_size = new_size + ( new_size >> 1 ) + 4;
@@ -332,6 +332,9 @@
while ( code >= 256U )
{
+ if ( !state->prefix )
+ goto Eof;
+
FTLZW_STACK_PUSH( state->suffix[code - 256] );
code = state->prefix[code - 256];
}
diff --git a/src/freetype2/lzw/ftzopen.h b/src/freetype2/lzw/ftzopen.h
index 9788114..f7d2936 100644
--- a/src/freetype2/lzw/ftzopen.h
+++ b/src/freetype2/lzw/ftzopen.h
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2005, 2006, 2007 by David Turner. */
+/* Copyright 2005, 2006, 2007, 2008 by David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -46,7 +46,7 @@
#define LZW_MASK( n ) ( ( 1U << (n) ) - 1U )
- typedef enum
+ typedef enum FT_LzwPhase_
{
FT_LZW_PHASE_START = 0,
FT_LZW_PHASE_CODE,
@@ -109,7 +109,7 @@
* `free_ent', `num_bits' cannot grow larger than `max_bits'.
*/
- typedef struct _FT_LzwStateRec
+ typedef struct FT_LzwStateRec_
{
FT_LzwPhase phase;
FT_Int in_eof;
@@ -118,7 +118,7 @@
FT_Int buf_offset;
FT_Int buf_size;
FT_Bool buf_clear;
- FT_Int buf_total;
+ FT_Offset buf_total;
FT_UInt max_bits; /* max code bits, from file header */
FT_Int block_mode; /* block mode flag, from file header */
@@ -137,7 +137,7 @@
FT_Byte* stack; /* character stack */
FT_UInt stack_top;
- FT_UInt stack_size;
+ FT_Offset stack_size;
FT_Byte stack_0[FT_LZW_DEFAULT_STACK_SIZE]; /* minimize heap alloc */
FT_Stream source; /* source stream */