Commit 77c34b826439a975f7ce804a4913f05246876abb

Werner Lemberg 2003-05-20T22:06:38

* t1load.c (parse_blend_axis_types): Fix compiler warning. * src/gzip/ftgzip.c (ft_gzip_file_io): Avoid zero value of `delta' to prevent infinite loop. * docs/VERSION.DLL: Provide better autoconf snippet to check FreeType version. * src/base/ftobjs.c (open_face): Free `internal' not `face->internal' in case of error to avoid possible segfault. * src/pshinter/pshalgo3.c (ps3_hints_apply): Check whether we actually have an outline.

diff --git a/ChangeLog b/ChangeLog
index ec9f8ef..e4a1026 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2003-05-21  Martin Zinser  <zinser@decus.de>
+
+	* t1load.c (parse_blend_axis_types): Fix compiler warning.
+
+2003-05-21  Weiqi Gao  <weiqigao@networkusa.net>
+
+	* src/gzip/ftgzip.c (ft_gzip_file_io): Avoid zero value of `delta'
+	to prevent infinite loop.
+
+2003-05-21  Lars Clausen  <lrclause@cs.uiuc.edu>
+
+	* docs/VERSION.DLL: Provide better autoconf snippet to check
+	FreeType version.
+
+2003-05-21  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftobjs.c (open_face): Free `internal' not
+	`face->internal' in case of error to avoid possible segfault.
+
+	* src/pshinter/pshalgo3.c (ps3_hints_apply): Check whether we
+	actually have an outline.
+
 2003-05-20  David Chester  <davidchester@qmx.net>
 
 	* src/pshinter/pshalgo3.c (ps3_hints_apply): Try to optimize
@@ -221,7 +243,7 @@
 	Updated.
 
 	* src/gzip/ftgzip.c: C++ doesn't like that the array `inflate_mask'
-	is declared twice.  It is perhaps better to modify the zlip source
+	is declared twice.  It is perhaps better to modify the zlib source
 	files directly instead of this hack.
 	(zcalloc, zfree, ft_gzip_stream_close, ft_gzip_stream_io): Add casts
 	to make build with g++ successful.
diff --git a/docs/VERSION.DLL b/docs/VERSION.DLL
index 10ccbfe..bba36cf 100644
--- a/docs/VERSION.DLL
+++ b/docs/VERSION.DLL
@@ -77,22 +77,27 @@ The libtool numbers are a bit inconsistent due to the library's history:
 
 Lars Clausen contributed the following autoconf fragment to detect which
 version of  FreeType is  installed on  a system.  This  one tests  for a
-version that is at least 2.0.9; you should change the last line to check
-against other release numbers.
-
-  AC_MSG_CHECKING([for version of FreeType])
-  FREETYPE_INCLUDE=`freetype-config --cflags | cut -c3-`
-  FREETYPE_MAJOR=`grep '^#define FREETYPE_MAJOR' \
-                  $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
-  FREETYPE_MINOR=`grep '^#define FREETYPE_MINOR' \
-                  $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
-  FREETYPE_PATCH=`grep '^#define FREETYPE_PATCH' \
-                  $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
-  FREETYPE_VERSION=`echo | awk "BEGIN { printf \"%d\", \
-                     ($FREETYPE_MAJOR * 1000 + $FREETYPE_MINOR) * 1000 \
-                     + $FREETYPE_PATCH;}"`
-  AC_MSG_RESULT([$FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH])
-  if test "$FREETYPE_VERSION" -ge 2000009; then
+version that  is at least 2.0.9;  you should change  it to check against
+other release numbers.
+
+
+  AC_MSG_CHECKING([whether FreeType version is 2.0.9 or higher])
+  old_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS=`freetype-config --cflags`
+  AC_TRY_CPP([
+#include <freetype/freetype.h>
+#if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2000009
+#error Freetype version too low.
+#endif
+  ],[
+    AC_MSG_RESULT(yes)
+    FREETYPE_LIBS=`freetype-config --libs`
+    AC_SUBST(FREETYPE_LIBS)
+    AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
+    CPPFLAGS="$old_CPPFLAGS"
+  ],[
+    AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])
+  ])
 
 
 --- end of VERSION.DLL ---
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
index cbe66d7..5e418f2 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -159,9 +159,6 @@ FT_BEGIN_HEADER
   /*    P      :: This is the _address_ of a _pointer_ which points to the */
   /*              allocated block.  It is always set to NULL on exit.      */
   /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
   /* <Note>                                                                */
   /*    If P or *P are NULL, this function should return successfully.     */
   /*    This is a strong convention within all of FreeType and its         */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 7a8c207..f20fd4e 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -853,7 +853,7 @@
              FT_Face*       aface )
   {
     FT_Memory         memory;
-    FT_Driver_Class  clazz;
+    FT_Driver_Class   clazz;
     FT_Face           face = 0;
     FT_Error          error, error2;
     FT_Face_Internal  internal;
@@ -916,7 +916,7 @@
     if ( error )
     {
       clazz->done_face( face );
-      FT_FREE( face->internal );
+      FT_FREE( internal );
       FT_FREE( face );
       *aface = 0;
     }
@@ -1136,7 +1136,7 @@
     if ( face_index == -1 )
       face_index = 0;
     if ( face_index != 0 )
-      return FT_Err_Cannot_Open_Resource;
+      return error;
 
     if ( FT_ALLOC( offsets, (FT_Long)resource_cnt * sizeof ( FT_Long ) ) )
       return error;
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index d495800..8f37450 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -479,6 +479,8 @@
 
 
       delta = (FT_ULong)( zip->limit - zip->cursor );
+      if ( delta == 0 )
+        break;
       if ( delta >= count )
         delta = count;
 
diff --git a/src/pshinter/pshalgo3.c b/src/pshinter/pshalgo3.c
index cf408a0..28ffd1a 100644
--- a/src/pshinter/pshalgo3.c
+++ b/src/pshinter/pshalgo3.c
@@ -1894,6 +1894,10 @@
     FT_Int         dimension;
 
 
+    /* something to do? */
+    if ( outline->n_points == 0 || outline->n_contours == 0 )
+      return FT_Err_Ok;
+
 #ifdef DEBUG_HINTER
 
     memory = globals->memory;
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 5103d9d..50b47db 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -425,7 +425,7 @@
         token->start++;
 
       len = token->limit - token->start;
-      if ( len <= 0 )
+      if ( len == 0 )
       {
         error = T1_Err_Invalid_File_Format;
         goto Exit;