Commit 004f3da80a5d9c8a0feebb2bcce80d9b7566c94f

Werner Lemberg 2004-07-28T00:09:02

* src/pcf/pcfread.c (pcf_interpret_style): Always allocate memory for face->style_name. * src/pcf/pcfdrivr.c (PCF_Face_Done): Free `style_name'. * include/freetype/config/ftconfig.h (FT_SIZEOF_LONG): Recognize five-byte `long' (which is avoided then).

diff --git a/ChangeLog b/ChangeLog
index 59155c0..5eab0e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-07-26  Søren Sandmann  <sandmann@daimi.au.dk>
+
+	* src/pcf/pcfread.c (pcf_interpret_style): Always allocate memory for
+	face->style_name.
+	* src/pcf/pcfdrivr.c (PCF_Face_Done): Free `style_name'.
+
+2004-07-26  Darren J Longhorn  <darren.longhorn@redcom.co.uk>
+
+	* include/freetype/config/ftconfig.h (FT_SIZEOF_LONG): Recognize
+	five-byte `long' (which is avoided then).
+
 2004-07-25  Detlef Würkner  <TetiSoft@apg.lahn.de>
 
 	* src/pcf/pcfdrivr.c (PCF_Set_Pixel_Size): Compare heights, not
@@ -17,7 +28,7 @@
 2004-07-24  Derek B. Noonburg  <derekn@foolabs.com>
 
 	* src/cff/cffload.c (cff_font_load): Always create inverse mapping.
-	Even if the charstring count id different from the CID count, it is
+	Even if the charstring count is the same as the CID count, it is
 	still possible that the font uses a different CID -> GID mapping.
 
 2004-07-23  Werner Lemberg  <wl@gnu.org>
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index 4bd8cf6..e878efb 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -72,20 +72,23 @@ FT_BEGIN_HEADER
 
 
   /* The size of an `int' type.  */
-#if   FT_UINT_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_INT  (32 / FT_CHAR_BIT)
-#elif FT_UINT_MAX == 0xFFFFU
+#if                                 FT_UINT_MAX == 0xFFFFUL
 #define FT_SIZEOF_INT  (16 / FT_CHAR_BIT)
-#elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU
+#elif                               FT_UINT_MAX == 0xFFFFFFFFUL
+#define FT_SIZEOF_INT  (32 / FT_CHAR_BIT)
+#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
 #define FT_SIZEOF_INT  (64 / FT_CHAR_BIT)
 #else
 #error "Unsupported size of `int' type!"
 #endif
 
-  /* The size of a `long' type.  */
-#if   FT_ULONG_MAX == 0xFFFFFFFFUL
+  /* The size of a `long' type.  A five-byte `long' (as used e.g. on the */
+  /* DM642) is recognized but avoided.                                   */
+#if                                  FT_ULONG_MAX == 0xFFFFFFFFUL
+#define FT_SIZEOF_LONG  (32 / FT_CHAR_BIT)
+#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
 #define FT_SIZEOF_LONG  (32 / FT_CHAR_BIT)
-#elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
+#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
 #define FT_SIZEOF_LONG  (64 / FT_CHAR_BIT)
 #else
 #error "Unsupported size of `long' type!"
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index ddb9b09..e47a684 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -221,6 +221,7 @@ THE SOFTWARE.
 
     FT_FREE( face->toc.tables );
     FT_FREE( pcfface->family_name );
+    FT_FREE( pcfface->style_name );
     FT_FREE( pcfface->available_sizes );
     FT_FREE( face->charset_encoding );
     FT_FREE( face->charset_registry );
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index 383daaa..61af96f 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -945,7 +945,12 @@ THE SOFTWARE.
     }
 
     if ( !parts || !len )
-      face->style_name = (char *)"Regular";
+    {
+      if ( FT_ALLOC( face->style_name, 8 ) )
+        return error;
+      ft_strcpy( face->style_name, "Regular" );
+      face->style_name[7] = '\0';
+    }
     else
     {
       char          *style, *s;