ref: 4a7f0b1c7a1ec912911187b8090d197a4b887726
parent: a4aa1c5bee675fb4396f2ab3f4843ee97601a1e4
author: Werner Lemberg <[email protected]>
date: Thu Sep 1 03:33:03 EDT 2005
* src/gxvalid/gxvbsln.c (GXV_BSLN_VALUE_EMPTY): Add `U'. * src/gxvalid/gxmort1.c (GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE), src/gxvalid/gxmort2.c (GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE): Fix typo. * src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c, src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx4.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvmort.c: Improve tracing messages. Decorate constants with `U' and `L' where appropriate. Fix compiler warnings. Formatting.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-09-01 Werner Lemberg <[email protected]>
+
+ * src/gxvalid/gxvbsln.c (GXV_BSLN_VALUE_EMPTY): Add `U'.
+
+ * src/gxvalid/gxmort1.c (GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE),
+ src/gxvalid/gxmort2.c (GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE): Fix
+ typo.
+
+ * src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
+ src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx4.c,
+ src/gxvalid/gxvmorx5.c, src/gxvalid/gxvmort.c: Improve tracing
+ messages.
+ Decorate constants with `U' and `L' where appropriate.
+ Fix compiler warnings.
+
2005-08-31 Werner Lemberg <[email protected]>
* src/truetype/ttgload.c (load_truetype_glyph): Fix typo.
--- a/src/gxvalid/gxvbsln.c
+++ b/src/gxvalid/gxvbsln.c
@@ -47,7 +47,7 @@
/*************************************************************************/
#define GXV_BSLN_VALUE_COUNT 32
-#define GXV_BSLN_VALUE_EMPTY 0xFFFF
+#define GXV_BSLN_VALUE_EMPTY 0xFFFFU
typedef struct GXV_bsln_DataRec_
@@ -56,6 +56,7 @@
FT_UShort defaultBaseline;
} GXV_bsln_DataRec, *GXV_bsln_Data;
+
#define GXV_BSLN_DATA( field ) GXV_TABLE_DATA( bsln, field )
--- a/src/gxvalid/gxvlcar.c
+++ b/src/gxvalid/gxvlcar.c
@@ -52,7 +52,8 @@
} GXV_lcar_DataRec, *GXV_lcar_Data;
-#define GXV_LCAR_DATA(FIELD) GXV_TABLE_DATA( lcar, FIELD )
+
+#define GXV_LCAR_DATA( FIELD ) GXV_TABLE_DATA( lcar, FIELD )
/*************************************************************************/
--- a/src/gxvalid/gxvmort1.c
+++ b/src/gxvalid/gxvmort1.c
@@ -46,7 +46,8 @@
} GXV_mort_subtable_type1_StateOptRec,
*GXV_mort_subtable_type1_StateOptRecData;
-#define GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE GXV_STATETABLE_HEADER_SIZE + 2
+#define GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE \
+ ( GXV_STATETABLE_HEADER_SIZE + 2 )
static void
--- a/src/gxvalid/gxvmort2.c
+++ b/src/gxvalid/gxvmort2.c
@@ -51,7 +51,7 @@
*GXV_mort_subtable_type2_StateOptRecData;
#define GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE \
- GXV_STATETABLE_HEADER_SIZE + 2 + 2 + 2
+ ( GXV_STATETABLE_HEADER_SIZE + 2 + 2 + 2 )
static void
--- a/src/gxvalid/gxvmorx.c
+++ b/src/gxvalid/gxvmorx.c
@@ -16,14 +16,17 @@
/***************************************************************************/
/***************************************************************************/
+/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout was support of Information-technology Promotion */
-/* Agency(IPA), Japan. */
+/* Development of gxlayout is supported by the Information-technology */
+/* Promotion Agency(IPA), Japan. */
+/* */
/***************************************************************************/
#include "gxvmorx.h"
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@@ -40,8 +43,9 @@
FT_UShort nSubtables,
GXV_Validator valid )
{
- FT_Bytes p = table;
- GXV_Validate_Func fmt_funcs_table [] =
+ FT_Bytes p = table;
+
+ GXV_Validate_Func fmt_funcs_table[] =
{
gxv_morx_subtable_type0_validate, /* 0 */
gxv_morx_subtable_type1_validate, /* 1 */
@@ -51,11 +55,14 @@
gxv_morx_subtable_type5_validate, /* 5 */
};
- GXV_Validate_Func func;
+
+ GXV_Validate_Func func;
+
FT_UShort i;
- GXV_NAME_ENTER(( "subtables in a chain" ));
+ GXV_NAME_ENTER( "subtables in a chain" );
+
for ( i = 0; i < nSubtables; i++ )
{
FT_ULong length;
@@ -71,7 +78,7 @@
subFeatureFlags = FT_NEXT_ULONG( p );
GXV_TRACE(( "validate chain subtable %d/%d (%d bytes)\n",
- i + 1, nSubtables, length ));
+ i + 1, nSubtables, length ));
type = coverage & 0x0007;
rest = length - ( 4 + 4 + 4 );
@@ -92,7 +99,8 @@
p += rest;
}
- valid->subtable_length = ( p - table );
+ valid->subtable_length = p - table;
+
GXV_EXIT;
}
@@ -102,11 +110,11 @@
FT_Bytes limit,
GXV_Validator valid )
{
- FT_Bytes p = table;
- FT_ULong defaultFlags;
- FT_ULong chainLength;
- FT_ULong nFeatureFlags;
- FT_ULong nSubtables;
+ FT_Bytes p = table;
+ FT_ULong defaultFlags;
+ FT_ULong chainLength;
+ FT_ULong nFeatureFlags;
+ FT_ULong nSubtables;
GXV_NAME_ENTER( "morx chain header" );
@@ -126,6 +134,7 @@
GXV_EXIT;
}
+
FT_LOCAL_DEF( void )
gxv_morx_validate( FT_Bytes table,
FT_Face face,
@@ -150,7 +159,7 @@
version = FT_NEXT_ULONG( p );
nChains = FT_NEXT_ULONG( p );
- if (version != 0x00020000)
+ if ( version != 0x00020000UL )
FT_INVALID_FORMAT;
for ( i = 0; i < nChains; i++ )
--- a/src/gxvalid/gxvmorx.h
+++ b/src/gxvalid/gxvmorx.h
@@ -16,11 +16,14 @@
/***************************************************************************/
/***************************************************************************/
+/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout was support of Information-technology Promotion */
-/* Agency(IPA), Japan. */
+/* Development of gxlayout is supported by the Information-technology */
+/* Promotion Agency(IPA), Japan. */
+/* */
/***************************************************************************/
+
#ifndef __GXVMORX_H_
#define __GXVMORX_H_
@@ -58,7 +61,7 @@
GXV_Validator valid );
-#endif /* Not def: __GXVMORX_H__ */
+#endif /* __GXVMORX_H__ */
/* END */
--- a/src/gxvalid/gxvmorx0.c
+++ b/src/gxvalid/gxvmorx0.c
@@ -17,13 +17,17 @@
/***************************************************************************/
/***************************************************************************/
+/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout was support of Information-technology Promotion */
-/* Agency(IPA), Japan. */
+/* Development of gxlayout is supported by the Information-technology */
+/* Promotion Agency(IPA), Japan. */
+/* */
/***************************************************************************/
+
#include "gxvmorx.h"
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@@ -35,22 +39,27 @@
static void
- gxv_morx_subtable_type0_entry_validate( FT_UShort state,
- FT_UShort flags,
- GXV_XStateTable_GlyphOffsetDesc
- glyphOffset,
- FT_Bytes table,
- FT_Bytes limit,
- GXV_Validator valid )
+ gxv_morx_subtable_type0_entry_validate(
+ FT_UShort state,
+ FT_UShort flags,
+ GXV_XStateTable_GlyphOffsetDesc glyphOffset,
+ FT_Bytes table,
+ FT_Bytes limit,
+ GXV_Validator valid )
{
- FT_UShort markFirst;
- FT_UShort dontAdvance;
- FT_UShort markLast;
- FT_UShort reserved;
- FT_UShort verb;
+ FT_UShort markFirst;
+ FT_UShort dontAdvance;
+ FT_UShort markLast;
+ FT_UShort reserved;
+ FT_UShort verb;
+ FT_UNUSED( state );
+ FT_UNUSED( glyphOffset );
+ FT_UNUSED( table );
+ FT_UNUSED( limit );
- markFirst = flags / 0x8000;
+
+ markFirst = flags / 0x8000U;
dontAdvance = ( flags & 0x4000 ) / 0x4000;
markLast = ( flags & 0x2000 ) / 0x2000;
reserved = flags & 0x1FF0;
@@ -63,6 +72,7 @@
}
}
+
static void
gxv_morx_subtable_type0_validate( FT_Bytes table,
FT_Bytes limit,
@@ -70,8 +80,10 @@
{
FT_Bytes p = table;
- GXV_NAME_ENTER( "morx chain subtable type0 (Indic-Script Rearrangement)" );
+ GXV_NAME_ENTER(
+ "morx chain subtable type0 (Indic-Script Rearrangement)" );
+
GXV_LIMIT_CHECK( GXV_STATETABLE_HEADER_SIZE );
valid->xstatetable.optdata = NULL;
@@ -78,8 +90,11 @@
valid->xstatetable.optdata_load_func = NULL;
valid->xstatetable.subtable_setup_func = NULL;
valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE;
- valid->xstatetable.entry_validate_func = gxv_morx_subtable_type0_entry_validate;
+ valid->xstatetable.entry_validate_func =
+ gxv_morx_subtable_type0_entry_validate;
+
gxv_XStateTable_validate( p, limit, valid );
+
GXV_EXIT;
}
--- a/src/gxvalid/gxvmorx1.c
+++ b/src/gxvalid/gxvmorx1.c
@@ -17,13 +17,17 @@
/***************************************************************************/
/***************************************************************************/
+/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout was support of Information-technology Promotion */
-/* Agency(IPA), Japan. */
+/* Development of gxlayout is supported by the Information-technology */
+/* Promotion Agency(IPA), Japan. */
+/* */
/***************************************************************************/
+
#include "gxvmorx.h"
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@@ -43,16 +47,22 @@
} GXV_morx_subtable_type1_StateOptRec,
*GXV_morx_subtable_type1_StateOptRecData;
-#define GXV_MORX_SUBTABLE_TYPE1_HEADER_SIZE ( GXV_STATETABLE_HEADER_SIZE + 2 )
+#define GXV_MORX_SUBTABLE_TYPE1_HEADER_SIZE \
+ ( GXV_STATETABLE_HEADER_SIZE + 2 )
+
+
static void
gxv_morx_subtable_type1_substitutionTable_load( FT_Bytes table,
FT_Bytes limit,
GXV_Validator valid )
{
- FT_Bytes p = table;
- GXV_morx_subtable_type1_StateOptRecData optdata = valid->xstatetable.optdata;
+ FT_Bytes p = table;
+ GXV_morx_subtable_type1_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
+
GXV_LIMIT_CHECK( 2 );
optdata->substitutionTable = FT_NEXT_USHORT( p );
}
@@ -71,9 +81,11 @@
FT_ULong o[4];
FT_ULong *l[4];
FT_ULong buff[5];
- GXV_morx_subtable_type1_StateOptRecData optdata = valid->xstatetable.optdata;
+ GXV_morx_subtable_type1_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
o[0] = classTable;
o[1] = stateArray;
o[2] = entryTable;
@@ -88,30 +100,37 @@
static void
- gxv_morx_subtable_type1_entry_validate( FT_UShort state,
- FT_UShort flags,
- GXV_StateTable_GlyphOffsetDesc
- glyphOffset,
- FT_Bytes table,
- FT_Bytes limit,
- GXV_Validator valid )
+ gxv_morx_subtable_type1_entry_validate(
+ FT_UShort state,
+ FT_UShort flags,
+ GXV_StateTable_GlyphOffsetDesc glyphOffset,
+ FT_Bytes table,
+ FT_Bytes limit,
+ GXV_Validator valid )
{
- FT_UShort setMark;
- FT_UShort dontAdvance;
- FT_UShort reserved;
- FT_Short markIndex;
- FT_Short currentIndex;
- GXV_morx_subtable_type1_StateOptRecData optdata = valid->xstatetable.optdata;
+ FT_UShort setMark;
+ FT_UShort dontAdvance;
+ FT_UShort reserved;
+ FT_Short markIndex;
+ FT_Short currentIndex;
+ GXV_morx_subtable_type1_StateOptRecData optdata =
+ valid->xstatetable.optdata;
- setMark = flags / 0x8000;
+ FT_UNUSED( state );
+ FT_UNUSED( table );
+ FT_UNUSED( limit );
+
+
+ setMark = flags / 0x8000U;
dontAdvance = ( flags & 0x4000 ) / 0x4000;
reserved = flags & 0x3FFF;
- markIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000 );
- currentIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFF );
+ markIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000UL );
+ currentIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFFUL );
GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",
- setMark, dontAdvance ));
+ setMark, dontAdvance ));
+
if ( 0 < reserved )
{
GXV_TRACE(( " non-zero bits found in reserved range\n" ));
@@ -119,7 +138,8 @@
FT_INVALID_DATA;
}
- GXV_TRACE(( "markIndex = %d, currentIndex = %d\n", markIndex, currentIndex ));
+ GXV_TRACE(( "markIndex = %d, currentIndex = %d\n",
+ markIndex, currentIndex ));
if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 )
optdata->substitutionTable_num_lookupTables = markIndex + 1;
@@ -126,7 +146,6 @@
if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 )
optdata->substitutionTable_num_lookupTables = currentIndex + 1;
-
}
@@ -142,10 +161,11 @@
static GXV_LookupValueDesc
- gxv_morx_subtable_type1_LookupFmt4_transit( FT_UShort relative_gindex,
- GXV_LookupValueDesc base_value,
- FT_Bytes lookuptbl_limit,
- GXV_Validator valid )
+ gxv_morx_subtable_type1_LookupFmt4_transit(
+ FT_UShort relative_gindex,
+ GXV_LookupValueDesc base_value,
+ FT_Bytes lookuptbl_limit,
+ GXV_Validator valid )
{
FT_Bytes p;
FT_Bytes limit;
@@ -153,7 +173,7 @@
GXV_LookupValueDesc value;
- offset = base_value.u + ( relative_gindex * sizeof( FT_UShort ) );
+ offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
@@ -173,11 +193,13 @@
FT_Bytes limit,
GXV_Validator valid )
{
- FT_Bytes p = table;
- GXV_morx_subtable_type1_StateOptRecData optdata = valid->xstatetable.optdata;
+ FT_Bytes p = table;
FT_UShort i;
+ GXV_morx_subtable_type1_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
/* TODO: calculate offset/length for each lookupTables */
valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED;
valid->lookupval_func = gxv_morx_subtable_type1_LookupValue_validate;
@@ -199,9 +221,9 @@
/*
- * subtable for Contextual glyph substition is modified StateTable.
- * In addition classTable, stateArray, entryTable, "substitutionTable"
- * is added.
+ * subtable for Contextual glyph substition is a modified StateTable.
+ * In addition to classTable, stateArray, entryTable, the field
+ * `substitutionTable' is added.
*/
static void
gxv_morx_subtable_type1_validate( FT_Bytes table,
@@ -209,6 +231,7 @@
GXV_Validator valid )
{
FT_Bytes p = table;
+
GXV_morx_subtable_type1_StateOptRec st_rec;
@@ -218,19 +241,24 @@
st_rec.substitutionTable_num_lookupTables = 0;
- valid->xstatetable.optdata = &st_rec;
- valid->xstatetable.optdata_load_func = gxv_morx_subtable_type1_substitutionTable_load;
- valid->xstatetable.subtable_setup_func = gxv_morx_subtable_type1_subtable_setup;
- valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_ULONG;
- valid->xstatetable.entry_validate_func = gxv_morx_subtable_type1_entry_validate;
+ valid->xstatetable.optdata =
+ &st_rec;
+ valid->xstatetable.optdata_load_func =
+ gxv_morx_subtable_type1_substitutionTable_load;
+ valid->xstatetable.subtable_setup_func =
+ gxv_morx_subtable_type1_subtable_setup;
+ valid->xstatetable.entry_glyphoffset_fmt =
+ GXV_GLYPHOFFSET_ULONG;
+ valid->xstatetable.entry_validate_func =
+ gxv_morx_subtable_type1_entry_validate;
+
gxv_XStateTable_validate( p, limit, valid );
- gxv_morx_subtable_type1_substitutionTable_validate( table
- + st_rec.substitutionTable,
- table
- + st_rec.substitutionTable
- + st_rec.substitutionTable_length,
- valid );
+ gxv_morx_subtable_type1_substitutionTable_validate(
+ table + st_rec.substitutionTable,
+ table + st_rec.substitutionTable + st_rec.substitutionTable_length,
+ valid );
+
GXV_EXIT;
}
--- a/src/gxvalid/gxvmorx2.c
+++ b/src/gxvalid/gxvmorx2.c
@@ -17,13 +17,17 @@
/***************************************************************************/
/***************************************************************************/
+/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout was support of Information-technology Promotion */
-/* Agency(IPA), Japan. */
+/* Development of gxlayout is supported by the Information-technology */
+/* Promotion Agency(IPA), Japan. */
+/* */
/***************************************************************************/
+
#include "gxvmorx.h"
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@@ -46,26 +50,36 @@
} GXV_morx_subtable_type2_StateOptRec,
*GXV_morx_subtable_type2_StateOptRecData;
-#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE ( GXV_XSTATETABLE_HEADER_SIZE + 4 + 4 + 4 )
+#define GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE \
+ ( GXV_XSTATETABLE_HEADER_SIZE + 4 + 4 + 4 )
+
+
static void
gxv_morx_subtable_type2_opttable_load( FT_Bytes table,
FT_Bytes limit,
GXV_Validator valid )
{
- FT_Bytes p = table;
- GXV_morx_subtable_type2_StateOptRecData optdata = valid->xstatetable.optdata;
+ FT_Bytes p = table;
+ GXV_morx_subtable_type2_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
+
GXV_LIMIT_CHECK( 4 + 4 + 4 );
optdata->ligActionTable = FT_NEXT_ULONG( p );
optdata->componentTable = FT_NEXT_ULONG( p );
optdata->ligatureTable = FT_NEXT_ULONG( p );
- GXV_TRACE(( "offset to ligActionTable=0x%08x\n", optdata->ligActionTable ));
- GXV_TRACE(( "offset to componentTable=0x%08x\n", optdata->componentTable ));
- GXV_TRACE(( "offset to ligatureTable=0x%08x\n", optdata->ligatureTable ));
+ GXV_TRACE(( "offset to ligActionTable=0x%08x\n",
+ optdata->ligActionTable ));
+ GXV_TRACE(( "offset to componentTable=0x%08x\n",
+ optdata->componentTable ));
+ GXV_TRACE(( "offset to ligatureTable=0x%08x\n",
+ optdata->ligatureTable ));
}
+
static void
gxv_morx_subtable_type2_subtable_setup( FT_ULong table_size,
FT_ULong classTable,
@@ -79,9 +93,11 @@
FT_ULong o[6];
FT_ULong* l[6];
FT_ULong buff[7];
- GXV_morx_subtable_type2_StateOptRecData optdata = valid->xstatetable.optdata;
+ GXV_morx_subtable_type2_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
GXV_NAME_ENTER( "subtable boundaries setup" );
o[0] = classTable;
@@ -100,35 +116,41 @@
gxv_set_length_by_ulong_offset( o, l, buff, 6, table_size, valid );
GXV_TRACE(( "classTable: offset=0x%08x length=0x%08x\n",
- classTable, *classTable_length_p));
+ classTable, *classTable_length_p ));
GXV_TRACE(( "stateArray: offset=0x%08x length=0x%08x\n",
- stateArray, *stateArray_length_p));
+ stateArray, *stateArray_length_p ));
GXV_TRACE(( "entryTable: offset=0x%08x length=0x%08x\n",
- entryTable, *entryTable_length_p));
+ entryTable, *entryTable_length_p ));
GXV_TRACE(( "ligActionTable: offset=0x%08x length=0x%08x\n",
- optdata->ligActionTable,
- optdata->ligActionTable_length));
+ optdata->ligActionTable,
+ optdata->ligActionTable_length ));
GXV_TRACE(( "componentTable: offset=0x%08x length=0x%08x\n",
- optdata->componentTable,
- optdata->componentTable_length));
+ optdata->componentTable,
+ optdata->componentTable_length ));
GXV_TRACE(( "ligatureTable: offset=0x%08x length=0x%08x\n",
- optdata->ligatureTable,
- optdata->ligatureTable_length));
+ optdata->ligatureTable,
+ optdata->ligatureTable_length ));
+
GXV_EXIT;
}
-#define GXV_MORX_LIGACTION_ENTRY_SIZE 4
+#define GXV_MORX_LIGACTION_ENTRY_SIZE 4
+
static void
- gxv_morx_subtable_type2_ligActionIndex_validate( FT_Bytes table,
- FT_UShort ligActionIndex,
- GXV_Validator valid )
+ gxv_morx_subtable_type2_ligActionIndex_validate(
+ FT_Bytes table,
+ FT_UShort ligActionIndex,
+ GXV_Validator valid )
{
/* access ligActionTable */
- GXV_morx_subtable_type2_StateOptRecData optdata = valid->xstatetable.optdata;
+ GXV_morx_subtable_type2_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
FT_Bytes lat_base = table + optdata->ligActionTable;
- FT_Bytes p = lat_base + ligActionIndex * GXV_MORX_LIGACTION_ENTRY_SIZE;
+ FT_Bytes p = lat_base +
+ ligActionIndex * GXV_MORX_LIGACTION_ENTRY_SIZE;
FT_Bytes lat_limit = lat_base + optdata->ligActionTable;
@@ -152,32 +174,35 @@
lig_action = FT_NEXT_ULONG( p );
- last = (lig_action & 0x80000000) / 0x80000000;
- store = (lig_action & 0x40000000) / 0x40000000;
- offset = lig_action & 0x3FFFFFFF;
-
+ last = (lig_action & 0x80000000UL) / 0x80000000UL;
+ store = (lig_action & 0x40000000UL) / 0x40000000UL;
+ offset = lig_action & 0x3FFFFFFFUL;
}
}
static void
- gxv_morx_subtable_type2_entry_validate( FT_UShort state,
- FT_UShort flags,
- GXV_StateTable_GlyphOffsetDesc
- glyphOffset,
- FT_Bytes table,
- FT_Bytes limit,
- GXV_Validator valid )
+ gxv_morx_subtable_type2_entry_validate(
+ FT_UShort state,
+ FT_UShort flags,
+ GXV_StateTable_GlyphOffsetDesc glyphOffset,
+ FT_Bytes table,
+ FT_Bytes limit,
+ GXV_Validator valid )
{
- FT_UShort setComponent;
- FT_UShort dontAdvance;
- FT_UShort performAction;
- FT_UShort reserved;
- FT_UShort ligActionIndex;
+ FT_UShort setComponent;
+ FT_UShort dontAdvance;
+ FT_UShort performAction;
+ FT_UShort reserved;
+ FT_UShort ligActionIndex;
- setComponent = ( flags & 0x8000 ) / 0x8000;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- performAction = ( flags & 0x2000 ) / 0x2000;
+ FT_UNUSED( state );
+ FT_UNUSED( limit );
+
+
+ setComponent = ( flags & 0x8000U ) / 0x8000U;
+ dontAdvance = ( flags & 0x4000 ) / 0x4000;
+ performAction = ( flags & 0x2000 ) / 0x2000;
reserved = flags & 0x1FFF;
ligActionIndex = glyphOffset.u;
@@ -185,7 +210,8 @@
GXV_TRACE(( " reserved 14bit is non-zero\n" ));
if ( 0 < ligActionIndex )
- gxv_morx_subtable_type2_ligActionIndex_validate( table, ligActionIndex, valid );
+ gxv_morx_subtable_type2_ligActionIndex_validate(
+ table, ligActionIndex, valid );
}
@@ -193,23 +219,29 @@
gxv_morx_subtable_type2_ligatureTable_validate( FT_Bytes table,
GXV_Validator valid )
{
- GXV_morx_subtable_type2_StateOptRecData optdata = valid->xstatetable.optdata;
+ GXV_morx_subtable_type2_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
FT_Bytes p = table + optdata->ligatureTable;
FT_Bytes limit = table + optdata->ligatureTable
+ optdata->ligatureTable_length;
+
GXV_NAME_ENTER( "morx chain subtable type2 - substitutionTable" );
+
if ( 0 != optdata->ligatureTable )
{
/* Apple does not give specification of ligatureTable format */
while ( p < limit )
{
- FT_UShort lig_gid;
+ FT_UShort lig_gid;
+
GXV_LIMIT_CHECK( 2 );
lig_gid = FT_NEXT_USHORT( p );
}
}
+
GXV_EXIT;
}
@@ -220,20 +252,30 @@
GXV_Validator valid )
{
FT_Bytes p = table;
+
GXV_morx_subtable_type2_StateOptRec lig_rec;
+
GXV_NAME_ENTER( "morx chain subtable type2 (Ligature Substitution)" );
GXV_LIMIT_CHECK( GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE );
- valid->xstatetable.optdata = &lig_rec;
- valid->xstatetable.optdata_load_func = gxv_morx_subtable_type2_opttable_load;
- valid->xstatetable.subtable_setup_func = gxv_morx_subtable_type2_subtable_setup;
- valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_USHORT;
- valid->xstatetable.entry_validate_func = gxv_morx_subtable_type2_entry_validate;
+ valid->xstatetable.optdata =
+ &lig_rec;
+ valid->xstatetable.optdata_load_func =
+ gxv_morx_subtable_type2_opttable_load;
+ valid->xstatetable.subtable_setup_func =
+ gxv_morx_subtable_type2_subtable_setup;
+ valid->xstatetable.entry_glyphoffset_fmt =
+ GXV_GLYPHOFFSET_USHORT;
+ valid->xstatetable.entry_validate_func =
+ gxv_morx_subtable_type2_entry_validate;
+
gxv_XStateTable_validate( p, limit, valid );
+
p += valid->subtable_length;
gxv_morx_subtable_type2_ligatureTable_validate( table, valid );
+
GXV_EXIT;
}
--- a/src/gxvalid/gxvmorx4.c
+++ b/src/gxvalid/gxvmorx4.c
@@ -17,13 +17,17 @@
/***************************************************************************/
/***************************************************************************/
+/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout was support of Information-technology Promotion */
-/* Agency(IPA), Japan. */
+/* Development of gxlayout is supported by the Information-technology */
+/* Promotion Agency(IPA), Japan. */
+/* */
/***************************************************************************/
+
#include "gxvmorx.h"
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@@ -34,17 +38,18 @@
#define FT_COMPONENT trace_gxvmorx
- static void
- gxv_morx_subtable_type4_validate( FT_Bytes table,
- FT_Bytes limit,
- GXV_Validator valid )
- {
- GXV_NAME_ENTER( "morx chain subtable type4 (Non-Contextual Glyph Substitution)" );
+ static void
+ gxv_morx_subtable_type4_validate( FT_Bytes table,
+ FT_Bytes limit,
+ GXV_Validator valid )
+ {
+ GXV_NAME_ENTER( "morx chain subtable type4 "
+ "(Non-Contextual Glyph Substitution)" );
- gxv_mort_subtable_type4_validate( table, limit, valid );
+ gxv_mort_subtable_type4_validate( table, limit, valid );
- GXV_EXIT;
- }
+ GXV_EXIT;
+ }
/* END */
--- a/src/gxvalid/gxvmorx5.c
+++ b/src/gxvalid/gxvmorx5.c
@@ -17,13 +17,17 @@
/***************************************************************************/
/***************************************************************************/
+/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
-/* Development of gxlayout was support of Information-technology Promotion */
-/* Agency(IPA), Japan. */
+/* Development of gxlayout is supported by the Information-technology */
+/* Promotion Agency(IPA), Japan. */
+/* */
/***************************************************************************/
+
#include "gxvmorx.h"
+
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@@ -34,14 +38,14 @@
#define FT_COMPONENT trace_gxvmorx
-/*
- * morx subtable type5 (Contextual Glyph Insertion)
- * has format of StateTable with insertion-glyph-list
- * without name. however, 32bit offset from the head
- * of subtable to the i-g-l is given after "entryTable",
- * without variable name specification (the exist of
- * offset to the table is different from mort type5).
- */
+ /*
+ * `morx' subtable type5 (Contextual Glyph Insertion)
+ * has format of a StateTable with insertion-glyph-list
+ * without name. However, the 32bit offset from the head
+ * of subtable to the i-g-l is given after `entryTable',
+ * without variable name specification (the existence of
+ * this offset to the table is different from mort type5).
+ */
typedef struct GXV_morx_subtable_type5_StateOptRec_
@@ -52,8 +56,11 @@
} GXV_morx_subtable_type5_StateOptRec,
*GXV_morx_subtable_type5_StateOptRecData;
-#define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE ( GXV_STATETABLE_HEADER_SIZE + 4 )
+#define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE \
+ ( GXV_STATETABLE_HEADER_SIZE + 4 )
+
+
static void
gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes table,
FT_Bytes limit,
@@ -60,9 +67,11 @@
GXV_Validator valid )
{
FT_Bytes p = table;
- GXV_morx_subtable_type5_StateOptRecData optdata = valid->xstatetable.optdata;
+ GXV_morx_subtable_type5_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
GXV_LIMIT_CHECK( 4 );
optdata->insertionGlyphList = FT_NEXT_ULONG( p );
}
@@ -81,9 +90,11 @@
FT_ULong o[4];
FT_ULong* l[4];
FT_ULong buff[5];
- GXV_morx_subtable_type5_StateOptRecData optdata = valid->xstatetable.optdata;
+ GXV_morx_subtable_type5_StateOptRecData optdata =
+ valid->xstatetable.optdata;
+
o[0] = classTable;
o[1] = stateArray;
o[2] = entryTable;
@@ -104,11 +115,12 @@
FT_Bytes limit,
GXV_Validator valid )
{
- FT_Bytes p = table + ( index * 2 );
+ FT_Bytes p = table + index * 2;
- while ( p < table + ( count * 2 ) + ( index * 2 ) )
+
+ while ( p < table + count * 2 + index * 2 )
{
- FT_UShort insert_glyphID;
+ FT_UShort insert_glyphID;
GXV_LIMIT_CHECK( 2 );
@@ -121,13 +133,13 @@
static void
- gxv_morx_subtable_type5_entry_validate( FT_UShort state,
- FT_UShort flags,
- GXV_StateTable_GlyphOffsetDesc
- glyphOffset,
- FT_Bytes table,
- FT_Bytes limit,
- GXV_Validator valid )
+ gxv_morx_subtable_type5_entry_validate(
+ FT_UShort state,
+ FT_UShort flags,
+ GXV_StateTable_GlyphOffsetDesc glyphOffset,
+ FT_Bytes table,
+ FT_Bytes limit,
+ GXV_Validator valid )
{
FT_Bool setMark;
FT_Bool dontAdvance;
@@ -140,7 +152,9 @@
FT_Byte currentInsertList;
FT_UShort markedInsertList;
+ FT_UNUSED( state );
+
setMark = ( flags >> 15 ) & 1;
dontAdvance = ( flags >> 14 ) & 1;
currentIsKashidaLike = ( flags >> 13 ) & 1;
@@ -149,24 +163,20 @@
markedInsertBefore = ( flags >> 10 ) & 1;
currentInsertCount = ( flags & 0x03E0 ) / 0x20;
markedInsertCount = ( flags & 0x001F );
- currentInsertList = glyphOffset.ul / 0x00010000;
- markedInsertList = glyphOffset.ul & 0x0000FFFF;
+ currentInsertList = glyphOffset.ul / 0x00010000UL;
+ markedInsertList = glyphOffset.ul & 0x0000FFFFUL;
if ( currentInsertList && 0 != currentInsertCount )
- {
gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
currentInsertCount,
table, limit,
valid );
- }
if ( markedInsertList && 0 != markedInsertCount )
- {
gxv_morx_subtable_type5_InsertList_validate( markedInsertList,
markedInsertCount,
table, limit,
valid );
- }
}
@@ -176,6 +186,7 @@
GXV_Validator valid )
{
FT_Bytes p = table;
+
GXV_morx_subtable_type5_StateOptRec et_rec;
GXV_morx_subtable_type5_StateOptRecData et = &et_rec;
@@ -184,12 +195,19 @@
GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE );
- valid->xstatetable.optdata = et;
- valid->xstatetable.optdata_load_func = gxv_morx_subtable_type5_insertionGlyphList_load;
- valid->xstatetable.subtable_setup_func = gxv_morx_subtable_type5_subtable_setup;
- valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_ULONG;
- valid->xstatetable.entry_validate_func = gxv_morx_subtable_type5_entry_validate;
+ valid->xstatetable.optdata =
+ et;
+ valid->xstatetable.optdata_load_func =
+ gxv_morx_subtable_type5_insertionGlyphList_load;
+ valid->xstatetable.subtable_setup_func =
+ gxv_morx_subtable_type5_subtable_setup;
+ valid->xstatetable.entry_glyphoffset_fmt =
+ GXV_GLYPHOFFSET_ULONG;
+ valid->xstatetable.entry_validate_func =
+ gxv_morx_subtable_type5_entry_validate;
+
gxv_XStateTable_validate( p, limit, valid );
+
GXV_EXIT;
}