Commit 5d02b8a1513e4e234bf270ab13df1898403e0607

David Turner 2005-03-15T23:48:15

* src/bdf/bdflib.c: removing compiler warnings

diff --git a/ChangeLog b/ChangeLog
index 0095ce4..42dcd2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2005-03-15  David Turner  <david@freetype.org>
 
+    * src/bdf/bdflib.c: removing compiler warnings
+
+    * docs/CHANGES: updating
+    
+    * src/type1/t1parse.c (T1_New_Parser), src/type42/t42parse.c
+    (t42_parser_init): modifying functions to check the font header before
+    allocating anything on the heap.
+
+    * internal/freetype/ftmemory.h: introducing the new macros FT_ARRAY_MAX
+    and FT_ARRAY_CHECK
+    
+    * src/pcf/pcfread.c, src/pcf/pcfutil.c: minor fixes and simplifications.
+    try to protect the PCF driver from doing stupid things with broken fonts.
+
     * src/lzw/ftlzw.c (FT_Stream_OpenLZW): modified the function to check
     the LZW header before doing anything else. This helps avoid un-necessary
     heap allocations (400 Kb of heap memory for the LZW decoder ! Oh my !)
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 9ac50be..e14fd65 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -415,7 +415,7 @@
   {
     FT_Error  error = 0;
 
-    if ( num_items > list->size )
+    if ( num_items > (int)list->size )
     {
       int  oldsize = list->size;
       int  newsize = oldsize + (oldsize >> 1) + 4;
@@ -637,12 +637,13 @@
     cursor     = 0;
     refill     = 1;
     to_skip    = NO_SKIP;
+    bytes      = 0;  /* make compiler happy */
 
     for (;;)
     {
       if ( refill )
       {
-        bytes = (int) FT_Stream_TryRead( stream, buf + cursor,
+        bytes = (int) FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor,
                                          (FT_ULong)(buf_size - cursor) );
         avail  = cursor + bytes;
         cursor = 0;