[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'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
diff --git a/ChangeLog b/ChangeLog
index ab5a816..8c6ce42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
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.
* src/gxvalid/gxvjust.c (gxv_just_check_max_gid):
diff --git a/src/gxvalid/gxvkern.c b/src/gxvalid/gxvkern.c
index 2137db8..8a4f30d 100644
--- a/src/gxvalid/gxvkern.c
+++ b/src/gxvalid/gxvkern.c
@@ -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;