[gxvalid] Fix gcc4.6 compiler warnings in gxvkern.c.

* src/gxvalid/gxvkern.c
(gxv_kern_subtable_fmt0_pairs_validate): Conditionalize
unvalidated variable `kernValue'.
(gxv_kern_subtable_fmt1_entry_validate): Conditionalize
unvalidated variables; `push', `dontAdvance', `kernAction',
`kernValue'.
(gxv_kern_coverage_new_apple_validate): Conditionalize
trace-only variables; `kernVertical', `kernCrossStream',
`kernVariation'.
(gxv_kern_coverage_classic_apple_validate): Conditionalize
trace-only variables; `horizontal', `cross_stream'.
(gxv_kern_coverage_classic_microsoft_validate):
Conditionalize trace-only variables; `horizontal',
`minimum', `cross_stream', `override'.
(gxv_kern_subtable_validate): Conditionalize trace-only
variables; `version', `tupleIndex'.
This commit is contained in:
suzuki toshiya 2011-06-14 23:50:39 +09:00
parent ce015ec8da
commit 20c126c1ac
2 changed files with 76 additions and 8 deletions

View File

@ -1,3 +1,24 @@
2011-06-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[gxvalid] Fix gcc4.6 compiler warnings in gxvkern.c.
* src/gxvalid/gxvkern.c
(gxv_kern_subtable_fmt0_pairs_validate): Conditionalize
unvalidated variable `kernValue'.
(gxv_kern_subtable_fmt1_entry_validate): Conditionalize
unvalidated variables; `push', `dontAdvance', `kernAction',
`kernValue'.
(gxv_kern_coverage_new_apple_validate): Conditionalize
trace-only variables; `kernVertical', `kernCrossStream',
`kernVariation'.
(gxv_kern_coverage_classic_apple_validate): Conditionalize
trace-only variables; `horizontal', `cross_stream'.
(gxv_kern_coverage_classic_microsoft_validate):
Conditionalize trace-only variables; `horizontal',
`minimum', `cross_stream', `override'.
(gxv_kern_subtable_validate): Conditionalize trace-only
variables; `version', `tupleIndex'.
2011-06-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[gxvalid] Fix gcc4.6 compiler warnings in gxvjust.c.

View File

@ -127,7 +127,9 @@
{
FT_UShort gid_left;
FT_UShort gid_right;
#ifdef GXV_LOAD_UNUSED_VARS
FT_Short kernValue;
#endif
/* left */
@ -156,7 +158,11 @@
FT_INVALID_DATA;
/* skip the kern value */
#ifdef GXV_LOAD_UNUSED_VARS
kernValue = FT_NEXT_SHORT( p );
#else
p += 2;
#endif
}
GXV_EXIT;
@ -261,18 +267,24 @@
FT_Bytes limit,
GXV_Validator valid )
{
#ifdef GXV_LOAD_UNUSED_VARS
FT_UShort push;
FT_UShort dontAdvance;
#endif
FT_UShort valueOffset;
#ifdef GXV_LOAD_UNUSED_VARS
FT_UShort kernAction;
FT_UShort kernValue;
#endif
FT_UNUSED( state );
FT_UNUSED( glyphOffset_p );
#ifdef GXV_LOAD_UNUSED_VARS
push = (FT_UShort)( ( flags >> 15 ) & 1 );
dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
#endif
valueOffset = (FT_UShort)( flags & 0x3FFF );
{
@ -288,8 +300,12 @@
limit = table + vt_rec->valueTable + vt_rec->valueTable_length;
GXV_LIMIT_CHECK( 2 + 2 );
#ifdef GXV_LOAD_UNUSED_VARS
kernAction = FT_NEXT_USHORT( p );
kernValue = FT_NEXT_USHORT( p );
#else
p += 4;
#endif
}
}
@ -479,6 +495,9 @@
FT_INVALID_GLYPH_ID;
}
if ( flags != 0 )
GXV_TRACE(( "kern subtable fmt3 has nonzero value"
" (%d) in unused flag\n", flags ));
/*
* just skip kernValue[kernValueCount]
*/
@ -545,20 +564,24 @@
GXV_Validator valid )
{
/* new Apple-dialect */
#ifdef GXV_LOAD_TRACE_VARS
FT_Bool kernVertical;
FT_Bool kernCrossStream;
FT_Bool kernVariation;
#endif
FT_UNUSED( valid );
/* reserved bits = 0 */
if ( coverage & 0x1FFC )
return 0;
return FALSE;
#ifdef GXV_LOAD_TRACE_VARS
kernVertical = FT_BOOL( ( coverage >> 15 ) & 1 );
kernCrossStream = FT_BOOL( ( coverage >> 14 ) & 1 );
kernVariation = FT_BOOL( ( coverage >> 13 ) & 1 );
#endif
*format = (FT_UShort)( coverage & 0x0003 );
@ -568,7 +591,7 @@
GXV_TRACE(( "kerning values in Apple format subtable are ignored\n" ));
return 1;
return TRUE;
}
@ -578,20 +601,24 @@
GXV_Validator valid )
{
/* classic Apple-dialect */
#ifdef GXV_LOAD_TRACE_VARS
FT_Bool horizontal;
FT_Bool cross_stream;
#endif
/* check expected flags, but don't check if MS-dialect is impossible */
if ( !( coverage & 0xFD00 ) && KERN_ALLOWS_MS( valid ) )
return 0;
return FALSE;
/* reserved bits = 0 */
if ( coverage & 0x02FC )
return 0;
return FALSE;
#ifdef GXV_LOAD_TRACE_VARS
horizontal = FT_BOOL( ( coverage >> 15 ) & 1 );
cross_stream = FT_BOOL( ( coverage >> 13 ) & 1 );
#endif
*format = (FT_UShort)( coverage & 0x0003 );
@ -601,11 +628,11 @@
/* format 1 requires GX State Machine, too new for classic */
if ( *format == 1 )
return 0;
return FALSE;
GXV_TRACE(( "kerning values in Apple format subtable are ignored\n" ));
return 1;
return TRUE;
}
@ -615,22 +642,26 @@
GXV_Validator valid )
{
/* classic Microsoft-dialect */
#ifdef GXV_LOAD_TRACE_VARS
FT_Bool horizontal;
FT_Bool minimum;
FT_Bool cross_stream;
FT_Bool override;
#endif
FT_UNUSED( valid );
/* reserved bits = 0 */
if ( coverage & 0xFDF0 )
return 0;
return FALSE;
#ifdef GXV_LOAD_TRACE_VARS
horizontal = FT_BOOL( coverage & 1 );
minimum = FT_BOOL( ( coverage >> 1 ) & 1 );
cross_stream = FT_BOOL( ( coverage >> 2 ) & 1 );
override = FT_BOOL( ( coverage >> 3 ) & 1 );
#endif
*format = (FT_UShort)( ( coverage >> 8 ) & 0x0003 );
@ -643,7 +674,7 @@
GXV_TRACE((
"kerning values in Microsoft format 2 subtable are ignored\n" ));
return 1;
return TRUE;
}
@ -714,10 +745,14 @@
GXV_Validator valid )
{
FT_Bytes p = table;
#ifdef GXV_LOAD_TRACE_VARS
FT_UShort version = 0; /* MS only: subtable version, unused */
#endif
FT_ULong length; /* MS: 16bit, Apple: 32bit*/
FT_UShort coverage;
#ifdef GXV_LOAD_TRACE_VARS
FT_UShort tupleIndex = 0; /* Apple only */
#endif
FT_UShort u16[2];
FT_UShort format = 255; /* subtable format */
@ -732,23 +767,35 @@
switch ( gxv_kern_coverage_validate( coverage, &format, valid ) )
{
case KERN_DIALECT_MS:
#ifdef GXV_LOAD_TRACE_VARS
version = u16[0];
#endif
length = u16[1];
#ifdef GXV_LOAD_TRACE_VARS
tupleIndex = 0;
#endif
GXV_TRACE(( "Subtable version = %d\n", version ));
GXV_TRACE(( "Subtable length = %d\n", length ));
break;
case KERN_DIALECT_APPLE:
#ifdef GXV_LOAD_TRACE_VARS
version = 0;
#endif
length = ( u16[0] << 16 ) + u16[1];
#ifdef GXV_LOAD_TRACE_VARS
tupleIndex = 0;
#endif
GXV_TRACE(( "Subtable length = %d\n", length ));
if ( KERN_IS_NEW( valid ) )
{
GXV_LIMIT_CHECK( 2 );
#ifdef GXV_LOAD_TRACE_VARS
tupleIndex = FT_NEXT_USHORT( p );
#else
p += 2;
#endif
GXV_TRACE(( "Subtable tupleIndex = %d\n", tupleIndex ));
}
break;