Commit a126d4c2ef84cbd282bdeaa6c3376eefbcedcdc9

Werner Lemberg 2003-09-20T14:25:10

* src/type1/t1parse.c (pfb_tag_fields): Removed. (read_pfb_tag): Fix code so that it doesn't fail on end-of-file indicated (0x8003).

diff --git a/ChangeLog b/ChangeLog
index 3eccefb..d614995 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-09-19  David Bevan  <dbevan@emtex.com>
+
+	* src/type1/t1parse.c (pfb_tag_fields): Removed.
+	(read_pfb_tag): Fix code so that it doesn't fail on end-of-file
+	indicated (0x8003).
+
 2003-09-16  Werner Lemberg  <wl@gnu.org>
 
 	* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE,
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index c1783f0..cf12c5a 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 parser (body).                                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -79,20 +79,6 @@
   } PFB_Tag;
 
 
-#undef  FT_STRUCTURE
-#define FT_STRUCTURE  PFB_Tag
-
-
-  static
-  const FT_Frame_Field  pfb_tag_fields[] =
-  {
-    FT_FRAME_START( 6 ),
-      FT_FRAME_USHORT ( tag ),
-      FT_FRAME_LONG_LE( size ),
-    FT_FRAME_END
-  };
-
-
   static FT_Error
   read_pfb_tag( FT_Stream   stream,
                 FT_UShort*  tag,
@@ -104,14 +90,18 @@
 
     *tag  = 0;
     *size = 0;
-    if ( !FT_STREAM_READ_FIELDS( pfb_tag_fields, &head ) )
+
+    if ( !FT_READ_USHORT( head.tag ) )
     {
       if ( head.tag == 0x8001U || head.tag == 0x8002U )
       {
-        *tag  = head.tag;
-        *size = head.size;
+        if ( !FT_READ_LONG_LE( head.size ) )
+          *size = head.size;
       }
+
+      *tag = head.tag;
     }
+
     return error;
   }