Commit b2d025306e3d0b3a4a14f63ac171d496d94eaee6

Werner Lemberg 2005-11-04T06:58:49

* src/base/ftobjs.c (FT_Open_Face): Avoid possible memory leak. Make compiling instructions in docs/CUSTOMIZE work again. * builds/unix/unix-cc.in (CPPFLAGS): New variable. (CFLAGS): Don't include @CPPFLAGS@. * builds/freetype.mk (FT_CFLAGS): Add CPPFLAGS.

diff --git a/ChangeLog b/ChangeLog
index eb10888..93fd55b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,41 +1,51 @@
-2005-10-28  David Turner  <david@freetype.org>
+2005-11-03  Ville Syrjälä  <syrjala@sci.fi>
 
-	* builds/exports.mk, builds/freetype.mk, builds/compiler/visualc.mk,
-	builds/dos/dos-def.mk, builds/os2/os2-def.mk, builds/unix/unix-cc.in,
-	builds/unix/unixddef.mk, builds/win32/w32-bcc.mk,
-	builds/win32/w32-gcc.mk, builds/win32/w32-icc.mk,
-	builds/win32/w32-intl.mk, builds/win32/w32-mingw32.mk,
-	builds/win32/w32-vcc.mk, builds/win32/w32-wat.mk,
-	builds/win32/w32-def.mk, Jamfile:
+	* src/base/ftobjs.c (FT_Open_Face): Avoid possible memory leak.
+
+2005-11-02  Werner Lemberg  <wl@gnu.org>
+
+	Make compiling instructions in docs/CUSTOMIZE work again.
 
-	updating build system to support the generation of a list of exported
-	symbols or Windows .DEF files by parsing the public headers with the
-	"apinames" tool located in src/tools/apinames.c.
+	* builds/unix/unix-cc.in (CPPFLAGS): New variable.
+	(CFLAGS): Don't include @CPPFLAGS@.
+	* builds/freetype.mk (FT_CFLAGS): Add CPPFLAGS.
 
-	only tested on Unix at the moment. On Windows, the .DEF file is
-	generated but isn't used yet to generate a DLL
+2005-10-28  David Turner  <david@freetype.org>
+
+	* builds/exports.mk, builds/freetype.mk, builds/compiler/visualc.mk,
+	builds/dos/dos-def.mk, builds/os2/os2-def.mk,
+	builds/unix/unix-cc.in, builds/unix/unixddef.mk,
+	builds/win32/w32-bcc.mk, builds/win32/w32-gcc.mk,
+	builds/win32/w32-icc.mk, builds/win32/w32-intl.mk,
+	builds/win32/w32-mingw32.mk, builds/win32/w32-vcc.mk,
+	builds/win32/w32-wat.mk, builds/win32/w32-def.mk, Jamfile: Update
+	build system to support the generation of a list of exported symbols
+	or Windows .DEF files by parsing the public headers with the
+	`apinames' tool located in src/tools/apinames.c.
+
+	Only tested on Unix at the moment.  On Windows, the .DEF file is
+	generated but isn't used yet to generate a DLL.
 
         * src/pfr/pfrtypes.h, src/pfr/pfrobjs.h, src/pfr/pfrload.c,
         src/pfr/pfrobjs.c, src/pfr/pfrgload.c:
 
-        * src/base/fttrigon.c (ft_trig_prenorm), src/base/ftcalc.c (FT_MulFix):
-        performance optimizations
+        * src/base/fttrigon.c (ft_trig_prenorm), src/base/ftcalc.c
+        (FT_MulFix): Performance optimizations.
 
 	* include/freetype/internal/ftgloader.h, src/base/ftgloader.h:
-	introductin the FT_GLYPHLOADER_CHECKXXXX macros, and fixed a small
-	bug within FT_GlyphLoader_CheckPoints which caused "AdjustPoints" to
-	be called everytime.
+	Introduce the FT_GLYPHLOADER_CHECKXXXX macros, and fix a small bug
+	within FT_GlyphLoader_CheckPoints which caused `AdjustPoints' to be
+	called everytime.
 
-	* src/autofit/afloader.c, src/truetype/ttgload.c: performance
-	optimization: used FT_GLYPHLOADER_CHECK_POINTS macro on
+	* src/autofit/afloader.c, src/truetype/ttgload.c: Performance
+	optimization: Use FT_GLYPHLOADER_CHECK_POINTS macro on
 	profile-detected hot-spots.
 
-	* src/autofit/aftypes.h: introducing AF_ANGLE_DIFF macro to inline
-	FT_Angle_Diff
+	* src/autofit/aftypes.h (AF_ANGLE_DIFF): New macro to inline
+	FT_Angle_Diff.
 
-	* src/autofit/afhints.c (af_direction_compute): re-implement
-	"af_direction_compute", and use AF_ANGLE_DIFF to speed up the
-	detection of inflexions.
+	* src/autofit/afhints.c (af_direction_compute): Re-implement.  Use
+	AF_ANGLE_DIFF to speed up the detection of inflexions.
 
 2005-10-28  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
diff --git a/builds/freetype.mk b/builds/freetype.mk
index e152075..d923ad5 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2001, 2002, 2003, 2004 by
+# Copyright 1996-2000, 2001, 2002, 2003, 2004, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -133,7 +133,7 @@ INCLUDE_FLAGS = $(INCLUDES:%=$I%)
 # $(INCLUDE_FLAGS) should come before $(CFLAGS) to avoid problems with
 # old FreeType versions.
 #
-FT_CFLAGS  = $(INCLUDE_FLAGS) $(CFLAGS)
+FT_CFLAGS  = $(CPPFLAGS) $(INCLUDE_FLAGS) $(CFLAGS)
 FT_CC      = $(CC) $(FT_CFLAGS)
 FT_COMPILE = $(CC) $(ANSIFLAGS) $(FT_CFLAGS)
 
diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in
index c488ee0..8950347 100644
--- a/builds/unix/unix-cc.in
+++ b/builds/unix/unix-cc.in
@@ -2,7 +2,7 @@
 # FreeType 2 template for Unix-specific compiler definitions
 #
 
-# Copyright 1996-2000, 2002, 2003 by
+# Copyright 1996-2000, 2002, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -72,8 +72,8 @@ T := -o$(space)
 #
 #   We use our own FreeType configuration file.
 #
-CFLAGS := -c @XX_CFLAGS@ @CPPFLAGS@ @CFLAGS@ \
-          -DFT_CONFIG_CONFIG_H="<ftconfig.h>"
+CPPFLAGS := @CPPFLAGS@
+CFLAGS   := -c @XX_CFLAGS@ @CFLAGS@ -DFT_CONFIG_CONFIG_H="<ftconfig.h>"
 
 # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
 #
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index b93e0af..a45af28 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1939,7 +1939,9 @@ FT_BEGIN_HEADER
   /*                  first face has index 0.                              */
   /*                                                                       */
   /* <Output>                                                              */
-  /*    aface      :: A handle to a new face object.                       */
+  /*    aface      :: A handle to a new face object.  If `face_index' is   */
+  /*                  greater than or equal to zero, it must be non-NULL.  */
+  /*                  See note below.                                      */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
@@ -1949,11 +1951,15 @@ FT_BEGIN_HEADER
   /*    slot for the face object which can be accessed directly through    */
   /*    `face->glyph'.                                                     */
   /*                                                                       */
-  /*    @FT_Open_Face can be used to determine and/or check the font       */
-  /*    format of a given font resource.  If the `face_index' field is     */
-  /*    negative, the function does _not_ return any face handle in        */
-  /*    `*aface'; the function's return value is 0 if the font format is   */
-  /*    recognized, or non-zero otherwise.                                 */
+  /*    @FT_Open_Face can be used to quickly check whether the font format */
+  /*    of a given font resource is supported by FreeType.  If the         */
+  /*    `face_index' field is negative, the function returns a more or     */
+  /*    less empty face handle in `*aface' (if `aface' isn't NULL); the    */
+  /*    function's return value is 0 if the font format is recognized, or  */
+  /*    non-zero otherwise.  The only useful field in this special case is */
+  /*    `face->num_faces' which gives the number of faces within the font  */
+  /*    file.  After examination, the returned @FT_Face structure should   */
+  /*    be deallocated with a call to @FT_Done_Face.                       */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Open_Face( FT_Library           library,
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 471b3ab..3e31da0 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1753,6 +1753,9 @@
 
     if ( aface )
       *aface = face;
+    else
+      FT_Done_Face( face );
+
     goto Exit;
 
   Fail: