Commit f420757c73543e3d57060a5394eb76004d959e4b

suzuki toshiya 2009-08-01T00:30:14

lzw: Count the size of the memory object by ptrdiff_t.

diff --git a/ChangeLog b/ChangeLog
index b670781..a3256a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
 
+	lzw: Count the size of the memory object by ptrdiff_t.
+
+	* src/lzw/ftzopen.h: The types of FT_LzwState->{buf_total,
+	stack_size} are changed from FT_UInt to FT_Offset, to match
+	with size_t, which is appropriate type for the object in
+	the memory buffer.
+
+	* src/lzw/ftzopen.c (ft_lzwstate_stack_grow): The types of
+	`old_size' and `new_size' are changed from FT_UInt to
+	FT_Offset, to match with size_t, which is appropriate type
+	for the object in the memory buffer.
+
+2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
 	otvalid: Count the table size on memory by ptrdiff_t.
 
 	* src/otvalid/otvgpos.c (otv_ValueRecord_validate):
diff --git a/src/lzw/ftzopen.c b/src/lzw/ftzopen.c
index 91ac0a3..8bc65c8 100644
--- a/src/lzw/ftzopen.c
+++ b/src/lzw/ftzopen.c
@@ -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;
 
diff --git a/src/lzw/ftzopen.h b/src/lzw/ftzopen.h
index dd60240..f7d2936 100644
--- a/src/lzw/ftzopen.h
+++ b/src/lzw/ftzopen.h
@@ -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 */