ref: 18e44430ae30835bc5136208834fbac4920fbea5
parent: 99ded0bed771e7bef6b39abd2683568ac869b574
author: David Turner <[email protected]>
date: Fri Sep 23 09:22:10 EDT 2005
* src/base/Jamfile: adding src/base/ftgxval.c * src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c, src/gxvalid/gxvfeat.c, src/gxvalid/gxvjust.c, src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c, src/gxvalid/gxvmort.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c, src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, src/gxvalid/gxvmort5.c, src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c, src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvopbd.c, src/gxvalid/gxvprop.c, src/sfnt/sfdriver.c, src/truetype/ttgload.c: removing _many_ compiler warnings when compiling with Visual C++ at maximum level (/W4)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,18 @@
* src/autofit/aflatin.c (af_latin_hints_init): fixed a bug that
prevented internal hint mode bitflags from being computed correctly
+ * src/base/Jamfile: adding src/base/ftgxval.c
+
+ * src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c, src/gxvalid/gxvfeat.c,
+ src/gxvalid/gxvjust.c, src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c,
+ src/gxvalid/gxvmort.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c,
+ src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, src/gxvalid/gxvmort5.c,
+ src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
+ src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvopbd.c,
+ src/gxvalid/gxvprop.c, src/sfnt/sfdriver.c, src/truetype/ttgload.c:
+ removing _many_ compiler warnings when compiling with Visual C++
+ at maximum level (/W4)
+
2005-09-22 Werner Lemberg <[email protected]>
* docs/CHANGES: Mention SING Glyphlet support.
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -30,10 +30,15 @@
# Add the optional/replaceable files.
#
-Library $(FT2_LIB) : ftsystem.c ftinit.c ftglyph.c ftmm.c ftbdf.c
- ftbbox.c ftdebug.c ftxf86.c fttype1.c ftpfr.c
- ftstroke.c ftwinfnt.c ftotval.c ftbitmap.c
- ftsynth.c ;
+{
+ local _sources = system init glyph mm bdf
+ bbox debug xf86 type1 pfr
+ stroke winfnt otval bitmap synth
+ gxval
+ ;
+
+ Library $(FT2_LIB) : ft$(_sources).c ;
+}
# Add Macintosh-specific file to the library when necessary.
#
--- a/src/gxvalid/gxvbsln.c
+++ b/src/gxvalid/gxvbsln.c
@@ -131,8 +131,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + ( relative_gindex * sizeof ( FT_UShort ) );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + ( relative_gindex * sizeof ( FT_UShort ) ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
--- a/src/gxvalid/gxvcommn.c
+++ b/src/gxvalid/gxvcommn.c
@@ -94,7 +94,7 @@
if ( j == nmemb )
FT_INVALID_OFFSET;
- *(length[i]) = buff[j + 1] - buff[j];
+ *(length[i]) = (FT_UShort)(buff[j + 1] - buff[j]);
if ( 0 != offset[i] && 0 == *(length[i]) )
FT_INVALID_OFFSET;
@@ -197,8 +197,8 @@
GXV_LIMIT_CHECK( 1 );
val = FT_NEXT_BYTE( p );
- *min = FT_MIN( *min, val );
- *max = FT_MAX( *max, val );
+ *min = (FT_Byte)FT_MIN( *min, val );
+ *max = (FT_Byte)FT_MAX( *max, val );
}
valid->subtable_length = p - table;
@@ -226,8 +226,8 @@
GXV_LIMIT_CHECK( 2 );
val = FT_NEXT_USHORT( p );
- *min = FT_MIN( *min, val );
- *max = FT_MAX( *max, val );
+ *min = (FT_Byte) FT_MIN( *min, val );
+ *max = (FT_Byte) FT_MAX( *max, val );
}
valid->subtable_length = p - table;
@@ -282,9 +282,9 @@
;
entrySelector--;
- searchRange *= binSrchHeader->unitSize;
- rangeShift = binSrchHeader->nUnits * binSrchHeader->unitSize -
- searchRange;
+ searchRange = (FT_UShort)( searchRange * binSrchHeader->unitSize );
+ rangeShift = (FT_UShort)( binSrchHeader->nUnits * binSrchHeader->unitSize
+ - searchRange );
if ( searchRange != binSrchHeader->searchRange ||
entrySelector != binSrchHeader->entrySelector ||
@@ -629,8 +629,11 @@
for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
{
- value = valid->lookupfmt4_trans( gid - firstGlyph, base_value,
- limit, valid );
+ value = valid->lookupfmt4_trans( (FT_UShort)(gid - firstGlyph),
+ base_value,
+ limit,
+ valid );
+
valid->lookupval_func( gid, value, valid );
}
}
@@ -739,7 +742,7 @@
glyphCount = FT_NEXT_USHORT( p );
gxv_glyphid_validate( firstGlyph, valid );
- gxv_glyphid_validate( firstGlyph + glyphCount, valid );
+ gxv_glyphid_validate( (FT_UShort)(firstGlyph + glyphCount), valid );
/* valueArray */
for ( i = 0; i < glyphCount; i++ )
@@ -746,7 +749,7 @@
{
GXV_LIMIT_CHECK( 2 );
value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
- valid->lookupval_func( firstGlyph + i, value, valid );
+ valid->lookupval_func( (FT_UShort)(firstGlyph + i), value, valid );
}
valid->subtable_length = p - table;
@@ -912,7 +915,8 @@
}
GXV_TRACE(( " nameIndex = %d (UNTITLED)\n", name_index ));
- FT_INVALID_DATA;
+ FT_INVALID_DATA;
+ goto Exit; /* make compiler happy */
Out:
FT_TRACE1(( " nameIndex = %d (", name_index ));
@@ -919,6 +923,7 @@
GXV_TRACE_HEXDUMP_SFNTNAME( name );
FT_TRACE1(( ")\n" ));
+ Exit:
GXV_EXIT;
}
@@ -967,7 +972,7 @@
if ( !nGlyphs )
goto Out;
- gxv_glyphid_validate( firstGlyph + nGlyphs, valid );
+ gxv_glyphid_validate( (FT_UShort)(firstGlyph + nGlyphs), valid );
{
FT_Byte nGlyphInClass[256];
@@ -1000,12 +1005,12 @@
break;
}
}
- *length_p = p - table;
+ *length_p = (FT_UShort)(p - table);
/* scan max ClassID in use */
for ( i = 0; i < stateSize; i++ )
if ( ( 3 < i ) && ( nGlyphInClass[i] > 0 ) )
- *maxClassID_p = i;
+ *maxClassID_p = (FT_Byte)i; /* XXX: Check Range ? */
}
Out:
@@ -1037,6 +1042,8 @@
GXV_TRACE(( "parse %d bytes by stateSize=%d maxClassID=%d\n",
(int)(*length_p), stateSize, (int)(maxClassID) ));
+ FT_UNUSED( stateSize );
+
/*
* 2 states are predefined and must be described in StateArray:
* state 0 (start of text), 1 (start of line)
@@ -1053,13 +1060,13 @@
for ( clazz = 0; clazz <= maxClassID; clazz++ )
{
entry = FT_NEXT_BYTE( p );
- *maxEntry_p = FT_MAX( *maxEntry_p, entry );
+ *maxEntry_p = (FT_Byte) FT_MAX( *maxEntry_p, entry );
}
}
GXV_TRACE(( "parsed: maxState=%d, maxEntry=%d\n",
*maxState_p, *maxEntry_p ));
- *length_p = p - table;
+ *length_p = (FT_UShort)(p - table);
GXV_EXIT;
}
@@ -1097,7 +1104,7 @@
FT_INVALID_TOO_SHORT;
/* ftxvalidator and FontValidator both warn and continue */
- maxEntry = *length_p / entrySize - 1;
+ maxEntry = (FT_Byte)(*length_p / entrySize - 1);
GXV_TRACE(( "too large maxEntry, shrinking to %d fit EntryTable length\n",
maxEntry ));
}
@@ -1132,11 +1139,12 @@
continue;
}
- state = ( newState - stateArray ) / ( 1 + maxClassID );
+ state = (FT_Byte)(( newState - stateArray ) / ( 1 + maxClassID ));
switch ( GXV_GLYPHOFFSET_FMT( statetable ) )
{
case GXV_GLYPHOFFSET_NONE:
+ glyphOffset.uc = 0; /* make compiler happy !! */
break;
case GXV_GLYPHOFFSET_UCHAR:
@@ -1166,6 +1174,8 @@
default:
if ( valid->root->level >= FT_VALIDATE_PARANOID )
FT_INVALID_FORMAT;
+
+ goto Exit;
}
if ( NULL != valid->statetable.entry_validate_func )
@@ -1176,7 +1186,8 @@
statetable_limit,
valid );
}
- *length_p = p - table;
+ Exit:
+ *length_p = (FT_UShort)(p - table);
GXV_EXIT;
}
@@ -1258,7 +1269,7 @@
else
setup_func = gxv_StateTable_subtable_setup;
- setup_func( limit - table,
+ setup_func( (FT_UShort)(limit - table),
classTable,
stateArray,
entryTable,
@@ -1276,7 +1287,7 @@
&maxClassID,
valid );
else
- maxClassID = stateSize - 1;
+ maxClassID = (FT_Byte)(stateSize - 1);
if ( stateArray != 0 )
gxv_StateArray_validate( table + stateArray,
@@ -1389,9 +1400,9 @@
FT_UShort offset;
GXV_LookupValueDesc value;
+ /* XXX: check range ? */
+ offset = (FT_UShort)(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;
@@ -1422,6 +1433,8 @@
GXV_TRACE(( "parse % 3d bytes by stateSize=% 3d maxClassID=% 3d\n",
(int)(*length_p), stateSize, (int)(maxClassID) ));
+ FT_UNUSED( stateSize );
+
/*
* 2 states are predefined and must be described:
* state 0 (start of text), 1 (start of line)
@@ -1438,7 +1451,7 @@
for ( clazz = 0; clazz <= maxClassID; clazz++ )
{
entry = FT_NEXT_USHORT( p );
- *maxEntry_p = FT_MAX( *maxEntry_p, entry );
+ *maxEntry_p = (FT_UShort) FT_MAX( *maxEntry_p, entry );
}
}
GXV_TRACE(( "parsed: maxState=%d, maxEntry=%d\n",
@@ -1492,7 +1505,7 @@
FT_INVALID_OFFSET;
}
- state = newState_idx / ( 1 + maxClassID );
+ state = (FT_UShort)(newState_idx / ( 1 + maxClassID ));
if ( 0 != ( newState_idx % ( 1 + maxClassID ) ) )
{
FT_TRACE4(( "-> new state = %d (supposed)\n"
@@ -1505,6 +1518,7 @@
switch ( GXV_GLYPHOFFSET_FMT( xstatetable ) )
{
case GXV_GLYPHOFFSET_NONE:
+ glyphOffset.uc = 0; /* make compiler happy */
break;
case GXV_GLYPHOFFSET_UCHAR:
@@ -1534,6 +1548,7 @@
default:
if ( valid->root->level >= FT_VALIDATE_PARANOID )
FT_INVALID_FORMAT;
+ goto Exit;
}
if ( NULL != valid->xstatetable.entry_validate_func )
@@ -1545,6 +1560,7 @@
valid );
}
+ Exit:
*length_p = p - table;
GXV_EXIT;
@@ -1622,7 +1638,11 @@
classTable_length = valid->subtable_length;
}
else
- valid->xstatetable.maxClassID = valid->xstatetable.nClasses - 1;
+ {
+ /* XXX: check range ? */
+ valid->xstatetable.maxClassID =
+ (FT_UShort)(valid->xstatetable.nClasses - 1);
+ }
if ( stateArray != 0 )
gxv_XStateArray_validate( table + stateArray,
--- a/src/gxvalid/gxvfeat.c
+++ b/src/gxvalid/gxvfeat.c
@@ -225,7 +225,7 @@
( featureFlags & GXV_FEAT_MASK_UNUSED ) == 0 )
FT_INVALID_DATA;
- exclusive = featureFlags & GXV_FEAT_MASK_EXCLUSIVE_SETTINGS;
+ exclusive = FT_BOOL(featureFlags & GXV_FEAT_MASK_EXCLUSIVE_SETTINGS);
if ( exclusive )
{
FT_Byte dynamic_default;
@@ -232,7 +232,8 @@
if ( featureFlags & GXV_FEAT_MASK_DYNAMIC_DEFAULT )
- dynamic_default = featureFlags & GXV_FEAT_MASK_DEFAULT_SETTING;
+ dynamic_default = (FT_Byte)( featureFlags &
+ GXV_FEAT_MASK_DEFAULT_SETTING);
else
dynamic_default = 0;
--- a/src/gxvalid/gxvjust.c
+++ b/src/gxvalid/gxvjust.c
@@ -401,10 +401,10 @@
FT_UNUSED( valid );
- setMark = ( 0x8000U & flags ) / 0x8000U;
- dontAdvance = ( 0x4000 & flags ) / 0x4000;
- markClass = ( 0x3F80 & flags ) / 0x0080;
- currentClass = 0x007F & flags ;
+ setMark = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1);
+ markClass = (FT_UShort)( (flags >> 7) & 0x7F );
+ currentClass = (FT_UShort)( flags & 0x7F );
/* TODO: validate markClass & currentClass */
}
--- a/src/gxvalid/gxvkern.c
+++ b/src/gxvalid/gxvkern.c
@@ -234,9 +234,9 @@
FT_UNUSED( glyphOffset );
- push = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- valueOffset = flags & 0x3FFF;
+ push = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ valueOffset = (FT_UShort)( flags & 0x3FFF );
{
GXV_kern_fmt1_StateOptRecData vt_rec =
@@ -341,7 +341,7 @@
tag, firstGlyph, nGlyphs ));
gxv_glyphid_validate( firstGlyph, valid );
- gxv_glyphid_validate( firstGlyph + nGlyphs - 1, valid );
+ gxv_glyphid_validate( (FT_UShort)(firstGlyph + nGlyphs - 1), valid );
gxv_array_getlimits_ushort( p, p + ( 2 * nGlyphs ),
&( GXV_KERN_FMT2_DATA( offset_min[spec] ) ),
@@ -517,10 +517,10 @@
if ( coverage & 0x1FFC )
return 0;
- kernVertical = ( coverage >> 15 ) & 1;
- kernCrossStream = ( coverage >> 14 ) & 1;
- kernVariation = ( coverage >> 13 ) & 1;
- *format = coverage & 0x0003;
+ kernVertical = FT_BOOL(( coverage >> 15 ) & 1);
+ kernCrossStream = FT_BOOL(( coverage >> 14 ) & 1);
+ kernVariation = FT_BOOL(( coverage >> 13 ) & 1);
+ *format = (FT_UShort)( coverage & 0x0003 );
GXV_TRACE(( "new Apple-dialect: "
"horizontal=%d, cross-stream=%d, variation=%d, format=%d\n",
@@ -528,6 +528,8 @@
GXV_TRACE(( "kerning values in Apple format subtable are ignored\n" ));
+ FT_UNUSED( valid );
+
return 1;
}
@@ -550,9 +552,9 @@
if ( coverage & 0x02FC )
return 0;
- horizontal = ( coverage >> 15 ) & 1;
- cross_stream = ( coverage >> 13 ) & 1;
- *format = coverage & 0x0003;
+ horizontal = FT_BOOL(( coverage >> 15 ) & 1);
+ cross_stream = FT_BOOL(( coverage >> 13 ) & 1);
+ *format = (FT_UShort)( coverage & 0x0003 );
GXV_TRACE(( "classic Apple-dialect: "
"horizontal=%d, cross-stream=%d, format=%d\n",
@@ -579,16 +581,17 @@
FT_Bool cross_stream;
FT_Bool override;
+ FT_UNUSED( valid );
/* reserved bits = 0 */
if ( coverage & 0xFDF0 )
return 0;
- horizontal = coverage & 1;
- minimum = ( coverage >> 1 ) & 1;
- cross_stream = ( coverage >> 2 ) & 1;
- override = ( coverage >> 3 ) & 1;
- *format = ( coverage >> 8 ) & 0x0003;
+ horizontal = FT_BOOL( coverage & 1 );
+ minimum = FT_BOOL(( coverage >> 1 ) & 1);
+ cross_stream = FT_BOOL(( coverage >> 2 ) & 1);
+ override = FT_BOOL(( coverage >> 3 ) & 1);
+ *format = (FT_UShort)(( coverage >> 8 ) & 0x0003);
GXV_TRACE(( "classic Microsoft-dialect: "
"horizontal=%d, minimum=%d, cross-stream=%d, "
--- a/src/gxvalid/gxvlcar.c
+++ b/src/gxvalid/gxvlcar.c
@@ -157,8 +157,8 @@
FT_UNUSED( lookuptbl_limit );
-
- offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof ( FT_UShort ));
p = valid->root->base + offset;
limit = valid->root->limit;
--- a/src/gxvalid/gxvmort.c
+++ b/src/gxvalid/gxvmort.c
@@ -64,10 +64,9 @@
/* nSettings in gxvfeat.c is halved for exclusive on/off settings */
+ nSettings_max = gxv_feat_registry[f->featureType].nSettings;
if ( gxv_feat_registry[f->featureType].exclusive )
- nSettings_max = 2 * gxv_feat_registry[f->featureType].nSettings;
- else
- nSettings_max = gxv_feat_registry[f->featureType].nSettings;
+ nSettings_max = (FT_Byte)(2*nSettings_max);
GXV_TRACE(( "featureType %d is registered", f->featureType ));
GXV_TRACE(( "setting %d", f->featureSetting ));
@@ -125,6 +124,8 @@
gxv_mort_coverage_validate( FT_UShort coverage,
GXV_Validator valid )
{
+ FT_UNUSED( valid );
+
if ( coverage & 0x8000U )
GXV_TRACE(( " this subtable is for vertical text only\n" ));
else
--- a/src/gxvalid/gxvmort0.c
+++ b/src/gxvalid/gxvmort0.c
@@ -80,13 +80,14 @@
FT_UNUSED( limit );
- markFirst = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- markLast = ( flags & 0x2000 ) / 0x2000;
- reserved = flags & 0x1FF0;
- verb = flags & 0x000F;
+ markFirst = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ markLast = (FT_UShort)( (flags >> 13) & 1 );
+ reserved = (FT_UShort)( flags & 0x1FF0 );
+ verb = (FT_UShort)( flags & 0x000F );
FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] );
+ FT_UNUSED( glyphOffset );
GXV_TRACE(( " IndicScript MorphRule for glyphOffset 0x%04x",
glyphOffset.u ));
@@ -95,6 +96,8 @@
GXV_TRACE(( " markLast=%01d", markLast ));
GXV_TRACE(( " %02d", verb ));
GXV_TRACE(( " %s\n", GXV_Mort_IndicScript_Msg[verb] ));
+
+
if ( 0 < reserved )
{
--- a/src/gxvalid/gxvmort1.c
+++ b/src/gxvalid/gxvmort1.c
@@ -115,13 +115,14 @@
substTable = ((GXV_mort_subtable_type1_StateOptRec *)
(valid->statetable.optdata))->substitutionTable;
- substTable_limit = substTable +
+ substTable_limit = (FT_UShort)(substTable +
((GXV_mort_subtable_type1_StateOptRec *)
- (valid->statetable.optdata))->substitutionTable_length;
+ (valid->statetable.optdata))->substitutionTable_length);
- min_gid = ( substTable - wordOffset * 2 ) / 2;
- max_gid = ( substTable_limit - wordOffset * 2 ) / 2;
- max_gid = FT_MAX( max_gid, valid->face->num_glyphs );
+ min_gid = (FT_UShort)(( substTable - wordOffset * 2 ) / 2);
+ max_gid = (FT_UShort)(( substTable_limit - wordOffset * 2 ) / 2);
+ max_gid = (FT_UShort)(FT_MAX( max_gid, valid->face->num_glyphs ));
+ /* XXX: check range ? */
/* TODO: min_gid & max_gid comparison with ClassTable contents */
}
@@ -146,11 +147,11 @@
FT_UNUSED( limit );
- setMark = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- reserved = flags & 0x3FFF;
- markOffset = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000UL );
- currentOffset = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFFUL );
+ setMark = (FT_UShort)( flags >> 15);
+ dontAdvance = (FT_UShort)((flags >> 14) & 1);
+ reserved = (FT_Short)( flags & 0x3FFF );
+ markOffset = (FT_Short)( glyphOffset.ul >> 16 );
+ currentOffset = (FT_Short)( glyphOffset.ul );
if ( 0 < reserved )
{
@@ -177,9 +178,9 @@
GXV_Validator valid )
{
FT_Bytes p = table;
- FT_UShort num_gids =
+ FT_UShort num_gids = (FT_UShort)(
((GXV_mort_subtable_type1_StateOptRec *)
- (valid->statetable.optdata))->substitutionTable_length / 2;
+ (valid->statetable.optdata))->substitutionTable_length / 2);
FT_UShort i;
--- a/src/gxvalid/gxvmort2.c
+++ b/src/gxvalid/gxvmort2.c
@@ -177,9 +177,9 @@
lig_action = FT_NEXT_ULONG( p );
- last = (lig_action & 0x80000000UL) / 0x80000000UL;
- store = (lig_action & 0x40000000UL) / 0x40000000UL;
- offset = lig_action & 0x3FFFFFFFUL;
+ last = (FT_UShort)( (lig_action >> 31) & 1 );
+ store = (FT_UShort)( (lig_action >> 30) & 1 );
+ offset = lig_action & 0x3FFFFFFFUL;
}
}
@@ -202,9 +202,9 @@
FT_UNUSED( limit );
- setComponent = ( flags & 0x8000U ) / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- offset = flags & 0x3FFF;
+ setComponent = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ offset = (FT_UShort)( flags & 0x3FFFU );
if ( 0 < offset )
gxv_mort_subtable_type2_ligActionOffset_validate( table, offset,
--- a/src/gxvalid/gxvmort4.c
+++ b/src/gxvalid/gxvmort4.c
@@ -87,8 +87,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
+ /* XXX: check range */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof ( FT_UShort ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
--- a/src/gxvalid/gxvmort5.c
+++ b/src/gxvalid/gxvmort5.c
@@ -158,16 +158,16 @@
FT_UNUSED( state );
- setMark = ( flags >> 15 ) & 1;
- dontAdvance = ( flags >> 14 ) & 1;
- currentIsKashidaLike = ( flags >> 13 ) & 1;
- markedIsKashidaLike = ( flags >> 12 ) & 1;
- currentInsertBefore = ( flags >> 11 ) & 1;
- markedInsertBefore = ( flags >> 10 ) & 1;
- currentInsertCount = ( flags & 0x03E0 ) / 0x0020;
- markedInsertCount = ( flags & 0x001F );
- currentInsertList = glyphOffset.ul / 0x00010000UL;
- markedInsertList = glyphOffset.ul & 0x0000FFFFUL;
+ setMark = FT_BOOL(( flags >> 15 ) & 1);
+ dontAdvance = FT_BOOL(( flags >> 14 ) & 1);
+ currentIsKashidaLike = FT_BOOL(( flags >> 13 ) & 1);
+ markedIsKashidaLike = FT_BOOL(( flags >> 12 ) & 1);
+ currentInsertBefore = FT_BOOL(( flags >> 11 ) & 1);
+ markedInsertBefore = FT_BOOL(( flags >> 10 ) & 1);
+ currentInsertCount = (FT_Byte)( (flags >> 5) & 0x1F );
+ markedInsertCount = (FT_Byte)( flags & 0x001F );
+ currentInsertList = (FT_UShort)( glyphOffset.ul >> 16 );
+ markedInsertList = (FT_UShort)( glyphOffset.ul );
if ( 0 != currentInsertList && 0 != currentInsertCount )
{
--- a/src/gxvalid/gxvmorx.c
+++ b/src/gxvalid/gxvmorx.c
@@ -85,8 +85,8 @@
GXV_LIMIT_CHECK( rest );
/* morx coverage consists of mort_coverage & 16bit padding */
- gxv_mort_coverage_validate( ( coverage >> 16 ) | coverage, valid );
-
+ gxv_mort_coverage_validate( (FT_UShort)(( coverage >> 16 ) | coverage),
+ valid );
if ( type > 5 )
FT_INVALID_FORMAT;
@@ -128,7 +128,13 @@
/* feature-array of morx is same with that of mort */
gxv_mort_featurearray_validate( p, limit, nFeatureFlags, valid );
p += valid->subtable_length;
- gxv_morx_subtables_validate( p, table + chainLength, nSubtables, valid );
+
+ if ( nSubtables >= 0x10000 )
+ FT_INVALID_DATA;
+
+ gxv_morx_subtables_validate( p, table + chainLength,
+ (FT_UShort)nSubtables, valid );
+
valid->subtable_length = chainLength;
GXV_EXIT;
--- a/src/gxvalid/gxvmorx0.c
+++ b/src/gxvalid/gxvmorx0.c
@@ -59,11 +59,11 @@
FT_UNUSED( limit );
- markFirst = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- markLast = ( flags & 0x2000 ) / 0x2000;
- reserved = flags & 0x1FF0;
- verb = flags & 0x000F;
+ markFirst = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ markLast = (FT_UShort)( (flags >> 13) & 1 );
+ reserved = (FT_UShort)( flags & 0x1FF0 );
+ verb = (FT_UShort)( flags & 0x000F );
if ( 0 < reserved )
{
--- a/src/gxvalid/gxvmorx1.c
+++ b/src/gxvalid/gxvmorx1.c
@@ -122,11 +122,11 @@
FT_UNUSED( limit );
- setMark = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- reserved = flags & 0x3FFF;
- markIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000UL );
- currentIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFFUL );
+ setMark = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ reserved = (FT_UShort)( flags & 0x3FFF );
+ markIndex = (FT_Short)( glyphOffset.ul >> 16 );
+ currentIndex = (FT_Short)( glyphOffset.ul );
GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",
setMark, dontAdvance ));
@@ -142,10 +142,10 @@
markIndex, currentIndex ));
if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 )
- optdata->substitutionTable_num_lookupTables = markIndex + 1;
+ optdata->substitutionTable_num_lookupTables = (FT_Short)(markIndex + 1);
if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 )
- optdata->substitutionTable_num_lookupTables = currentIndex + 1;
+ optdata->substitutionTable_num_lookupTables = (FT_Short)(currentIndex + 1);
}
@@ -155,6 +155,9 @@
GXV_Validator valid )
{
GXV_TRACE(( "morx subtable type1 subst.: %d -> %d\n", glyph, value.u ));
+
+ FT_UNUSED( glyph );
+
if ( value.u > valid->face->num_glyphs )
FT_INVALID_GLYPH_ID;
}
@@ -172,8 +175,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof ( FT_UShort ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
--- a/src/gxvalid/gxvmorx2.c
+++ b/src/gxvalid/gxvmorx2.c
@@ -174,9 +174,9 @@
lig_action = FT_NEXT_ULONG( p );
- last = (lig_action & 0x80000000UL) / 0x80000000UL;
- store = (lig_action & 0x40000000UL) / 0x40000000UL;
- offset = lig_action & 0x3FFFFFFFUL;
+ last = (FT_UShort)( (lig_action >> 31) & 1 );
+ store = (FT_UShort)( (lig_action >> 30) & 1 );
+ offset = lig_action & 0x3FFFFFFFUL;
}
}
@@ -200,10 +200,10 @@
FT_UNUSED( limit );
- setComponent = ( flags & 0x8000U ) / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- performAction = ( flags & 0x2000 ) / 0x2000;
- reserved = flags & 0x1FFF;
+ setComponent = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ performAction = (FT_UShort)( (flags >> 13) & 1 );
+ reserved = (FT_UShort)( flags & 0x1FFF );
ligActionIndex = glyphOffset.u;
if ( reserved > 0 )
--- a/src/gxvalid/gxvmorx5.c
+++ b/src/gxvalid/gxvmorx5.c
@@ -147,7 +147,7 @@
FT_Bool markedIsKashidaLike;
FT_Bool currentInsertBefore;
FT_Bool markedInsertBefore;
- FT_Bool currentInsertCount;
+ FT_Byte currentInsertCount;
FT_Byte markedInsertCount;
FT_Byte currentInsertList;
FT_UShort markedInsertList;
@@ -155,16 +155,16 @@
FT_UNUSED( state );
- setMark = ( flags >> 15 ) & 1;
- dontAdvance = ( flags >> 14 ) & 1;
- currentIsKashidaLike = ( flags >> 13 ) & 1;
- markedIsKashidaLike = ( flags >> 12 ) & 1;
- currentInsertBefore = ( flags >> 11 ) & 1;
- markedInsertBefore = ( flags >> 10 ) & 1;
- currentInsertCount = ( flags & 0x03E0 ) / 0x20;
- markedInsertCount = ( flags & 0x001F );
- currentInsertList = glyphOffset.ul / 0x00010000UL;
- markedInsertList = glyphOffset.ul & 0x0000FFFFUL;
+ setMark = FT_BOOL(( flags >> 15 ) & 1);
+ dontAdvance = FT_BOOL(( flags >> 14 ) & 1);
+ currentIsKashidaLike = FT_BOOL(( flags >> 13 ) & 1);
+ markedIsKashidaLike = FT_BOOL(( flags >> 12 ) & 1);
+ currentInsertBefore = FT_BOOL(( flags >> 11 ) & 1);
+ markedInsertBefore = FT_BOOL(( flags >> 10 ) & 1);
+ currentInsertCount = (FT_Byte)( (flags >> 5) & 0x1F );
+ markedInsertCount = (FT_Byte)( flags & 0x001F );
+ currentInsertList = (FT_Byte) ( glyphOffset.ul >> 16 );
+ markedInsertList = (FT_UShort)( glyphOffset.ul );
if ( currentInsertList && 0 != currentInsertCount )
gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
--- a/src/gxvalid/gxvopbd.c
+++ b/src/gxvalid/gxvopbd.c
@@ -141,8 +141,8 @@
FT_UNUSED( lookuptbl_limit );
FT_UNUSED( valid );
-
- value.u = base_value.u + relative_gindex * 4 * sizeof ( FT_Short );
+ /* XXX: check range ? */
+ value.u = (FT_UShort)(base_value.u + relative_gindex * 4 * sizeof ( FT_Short ));
return value;
}
--- a/src/gxvalid/gxvprop.c
+++ b/src/gxvalid/gxvprop.c
@@ -117,17 +117,17 @@
char complement;
- offset = property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET;
+ offset = (FT_UShort)(property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET);
if ( offset == 0 )
FT_INVALID_DATA;
- complement = offset >> 8;
+ complement = (char)(offset >> 8);
if ( complement & 0x08 )
{
/* Top bit is set: negative */
/* Calculate the absolute offset */
- complement = ( complement & 0x07 ) + 1;
+ complement = (char)(( complement & 0x07 ) + 1);
/* The gid for complement must be greater than 0 */
if ( glyph <= complement )
@@ -136,7 +136,7 @@
else
{
/* The gid for complement must be the face. */
- gxv_glyphid_validate( glyph + complement, valid );
+ gxv_glyphid_validate( (FT_UShort)(glyph + complement), valid );
}
}
else
@@ -213,8 +213,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + relative_gindex * sizeof( FT_UShort );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof( FT_UShort ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -318,12 +318,6 @@
{
FT_UNUSED( module );
- if ( ft_strcmp( module_interface, "get_sfnt" ) == 0 )
- return (FT_Module_Interface)get_sfnt_table;
-
- if ( ft_strcmp( module_interface, "load_sfnt" ) == 0 )
- return (FT_Module_Interface)tt_face_load_any;
-
return ft_service_list_lookup( sfnt_services, module_interface );
}
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -762,6 +762,8 @@
TT_GlyphZone zone = &loader->zone;
FT_Pos origin;
+ FT_UNUSED(is_composite);
+
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
FT_UInt n_ins;
@@ -944,11 +946,11 @@
FT_UInt num_points = gloader->base.outline.n_points;
FT_Bool have_scale;
FT_Pos x, y;
-
- have_scale = subglyph->flags & ( WE_HAVE_A_SCALE |
- WE_HAVE_AN_XY_SCALE |
- WE_HAVE_A_2X2 );
+
+ have_scale = FT_BOOL( subglyph->flags & ( WE_HAVE_A_SCALE |
+ WE_HAVE_AN_XY_SCALE |
+ WE_HAVE_A_2X2 ) );
/* perform the transform required for this subglyph */
if ( have_scale )