[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 8d0897b37: [type1, cid, type42] Post-cleanup.
From: |
Werner Lemberg |
Subject: |
[freetype2] master 8d0897b37: [type1, cid, type42] Post-cleanup. |
Date: |
Sat, 9 Sep 2023 22:25:22 -0400 (EDT) |
branch: master
commit 8d0897b37d11b93d5518e3e28846c8ad679b77c9
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[type1, cid, type42] Post-cleanup.
* include/freetype/internal/psaux.h (T1_FIELD_ZERO): Terminating macro.
* src/cid/cidload.c (cid_parse_dict): Use while-loop.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
---
include/freetype/internal/psaux.h | 8 +++++---
src/cid/cidload.c | 11 ++++-------
src/type1/t1load.c | 10 +++-------
src/type42/t42parse.c | 15 ++++++---------
4 files changed, 18 insertions(+), 26 deletions(-)
diff --git a/include/freetype/internal/psaux.h
b/include/freetype/internal/psaux.h
index d2dabc7fe..76cbebdba 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -276,7 +276,7 @@ FT_BEGIN_HEADER
{ \
sizeof ( _ident ) - 1, \
_ident, T1CODE, _type, \
- 0, \
+ NULL, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE( _fname ), \
0, 0, \
@@ -297,7 +297,7 @@ FT_BEGIN_HEADER
{ \
sizeof ( _ident ) - 1, \
_ident, T1CODE, _type, \
- 0, \
+ NULL, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_max, \
@@ -309,7 +309,7 @@ FT_BEGIN_HEADER
{ \
sizeof ( _ident ) - 1, \
_ident, T1CODE, _type, \
- 0, \
+ NULL, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_max, 0, \
@@ -359,6 +359,8 @@ FT_BEGIN_HEADER
#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \
T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
+#define T1_FIELD_ZERO { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 }
+
/*************************************************************************/
/*************************************************************************/
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 356673a61..7984a45f9 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -388,7 +388,7 @@
T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
T1_FIELD_CALLBACK( "FontName", parse_font_name, 0 )
- { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 }
+ T1_FIELD_ZERO
};
@@ -469,15 +469,11 @@
T1_Field keyword = (T1_Field)cid_field_records;
- for (;;)
+ while ( keyword->len )
{
- FT_Byte* name;
+ FT_Byte* name = (FT_Byte*)keyword->ident;
- name = (FT_Byte*)keyword->ident;
- if ( !name )
- break;
-
if ( keyword->len == len &&
ft_memcmp( cur, name, len ) == 0 )
{
@@ -489,6 +485,7 @@
return parser->root.error;
break;
}
+
keyword++;
}
}
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 6a2d2801d..5acd52a47 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -2284,7 +2284,7 @@
T1_FIELD_DICT_PRIVATE )
#endif
- { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 }
+ T1_FIELD_ZERO
};
@@ -2392,15 +2392,11 @@
T1_Field keyword = (T1_Field)t1_keywords;
- for (;;)
+ while ( keyword->len )
{
- FT_Byte* name;
+ FT_Byte* name = (FT_Byte*)keyword->ident;
- name = (FT_Byte*)keyword->ident;
- if ( !name )
- break;
-
if ( keyword->len == len &&
ft_memcmp( cur, name, len ) == 0 )
{
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index 71654c7b3..889bd1803 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -99,7 +99,7 @@
T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings, 0 )
T1_FIELD_CALLBACK( "sfnts", t42_parse_sfnts, 0 )
- { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 }
+ T1_FIELD_ZERO
};
@@ -1195,8 +1195,6 @@
{
T42_Parser parser = &loader->parser;
FT_Byte* limit;
- FT_Int n_keywords = (FT_Int)( sizeof ( t42_keywords ) /
- sizeof ( t42_keywords[0] ) );
parser->root.cursor = base;
@@ -1273,16 +1271,13 @@
if ( len > 0 && len < 22 && parser->root.cursor < limit )
{
- int i;
+ T1_Field keyword = (T1_Field)t42_keywords;
/* now compare the immediate name to the keyword table */
-
- /* loop through all known keywords */
- for ( i = 0; i < n_keywords; i++ )
+ while ( keyword->len )
{
- T1_Field keyword = (T1_Field)&t42_keywords[i];
- FT_Byte *name = (FT_Byte*)keyword->ident;
+ FT_Byte* name = (FT_Byte*)keyword->ident;
if ( !name )
@@ -1299,6 +1294,8 @@
return parser->root.error;
break;
}
+
+ keyword++;
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 8d0897b37: [type1, cid, type42] Post-cleanup.,
Werner Lemberg <=