Commit 88c0478dce25738b7ab266f91e1db52969c86461

Werner Lemberg 2003-06-12T13:14:15

* include/freetype/internal/psaux.h (T1_FieldType): Add T1_FIELD_TYPE_KEY. (T1_FIELD_KEY): New macro. * src/psaux/psobjs.c (ps_parser_load_field): Handle T1_FIELD_TYPE_KEY. * src/cid/cidtoken.h: Use T1_FIELD_KEY for /CIDFontName. * src/cache/ftlru.c (FT_LruList_Remove_Selection): Decrease number of nodes. (FT_LruList_Lookup): Fix assertion for out-of-memory case.

diff --git a/ChangeLog b/ChangeLog
index cbab9d4..3ebe8a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-06-12  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/internal/psaux.h (T1_FieldType): Add
+	T1_FIELD_TYPE_KEY.
+	(T1_FIELD_KEY): New macro.
+	* src/psaux/psobjs.c (ps_parser_load_field): Handle
+	T1_FIELD_TYPE_KEY.
+
+	* src/cid/cidtoken.h: Use T1_FIELD_KEY for /CIDFontName.
+
+2003-06-11  Alexander Malmberg  <alexander@malmberg.org>
+
+	* src/cache/ftlru.c (FT_LruList_Remove_Selection): Decrease
+	number of nodes.
+	(FT_LruList_Lookup): Fix assertion for out-of-memory case.
+
 2003-06-11  Werner Lemberg  <wl@gnu.org>
 
 	* src/cid/cidload.c (cid_decrypt): Removed.
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index d7f2c26..1e5b7f2 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -183,6 +183,7 @@ FT_BEGIN_HEADER
     T1_FIELD_TYPE_FIXED_1000,
     T1_FIELD_TYPE_FIXED_1000_P,
     T1_FIELD_TYPE_STRING,
+    T1_FIELD_TYPE_KEY,
     T1_FIELD_TYPE_BBOX,
     T1_FIELD_TYPE_INTEGER_ARRAY,
     T1_FIELD_TYPE_FIXED_ARRAY,
@@ -293,6 +294,9 @@ FT_BEGIN_HEADER
 #define T1_FIELD_STRING( _ident, _fname )                             \
           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname )
 
+#define T1_FIELD_KEY( _ident, _fname )                             \
+          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname )
+
 #define T1_FIELD_BBOX( _ident, _fname )                             \
           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname )
 
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c
index eb2065a..95c1292 100644
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -227,7 +227,7 @@
   
           if ( node == NULL )
           {
-            FT_ASSERT( list->nodes == 0 );
+            FT_ASSERT( list->num_nodes == 0 );
             error = FT_Err_Out_Of_Memory;
             goto Exit;
           }
@@ -245,7 +245,7 @@
            * a classic destroy/create cycle.
            */
           *pnode = NULL;
-          list->num_nodes -= 1;
+          list->num_nodes--;
   
           if ( clazz->node_flush )
           {
@@ -379,6 +379,7 @@
           clazz->node_done( node, list );
 
         FT_FREE( node );
+        list->num_nodes--;
       }
       else
         pnode = &(*pnode)->next;
diff --git a/src/cid/cidtoken.h b/src/cid/cidtoken.h
index eb38c7b..ff2a89d 100644
--- a/src/cid/cidtoken.h
+++ b/src/cid/cidtoken.h
@@ -21,7 +21,7 @@
 #undef  T1CODE
 #define T1CODE        T1_FIELD_LOCATION_CID_INFO
 
-  T1_FIELD_STRING( "CIDFontName", cid_font_name )
+  T1_FIELD_KEY   ( "CIDFontName", cid_font_name )
   T1_FIELD_NUM   ( "CIDFontVersion", cid_version )
   T1_FIELD_NUM   ( "CIDFontType", cid_font_type )
   T1_FIELD_STRING( "Registry", registry )
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index fa1f74a..5ef111a 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -956,7 +956,7 @@
         case 1:
           {
             FT_Memory  memory = parser->memory;
-            FT_Byte    *p;
+            FT_Byte*   p;
 
 
             /* with synthetic fonts, it's possible to find a field twice */
@@ -973,8 +973,8 @@
 
         case 2:
           {
-            FT_Memory  memory = parser->memory;
-            FT_UShort  *p;
+            FT_Memory   memory = parser->memory;
+            FT_UShort*  p;
 
 
             /* with synthetic fonts, it's possible to find a field twice */
@@ -991,8 +991,8 @@
 
         case 4:
           {
-            FT_Memory  memory = parser->memory;
-            FT_UInt32  *p;
+            FT_Memory   memory = parser->memory;
+            FT_UInt32*  p;
 
 
             /* with synthetic fonts, it's possible to find a field twice */
@@ -1010,7 +1010,7 @@
         default:
           {
             FT_Memory  memory = parser->memory;
-            FT_Long  *p;
+            FT_Long*   p;
 
 
             /* with synthetic fonts, it's possible to find a field twice */
@@ -1028,6 +1028,7 @@
         break;
 
       case T1_FIELD_TYPE_STRING:
+      case T1_FIELD_TYPE_KEY:
         {
           FT_Memory  memory = parser->memory;
           FT_UInt    len    = (FT_UInt)( limit - cur );
@@ -1037,6 +1038,12 @@
           if ( *(FT_String**)q )
             break;
 
+          if ( field->type == T1_FIELD_TYPE_KEY )
+          {
+            len--;
+            cur++;
+          }
+
           if ( FT_ALLOC( string, len + 1 ) )
             goto Exit;