Remove clang compiler warnings (#50548). * include/freetype/internal/tttypes.h (TT_FaceRec): Make `var_postscript_prefix_len' unsigned. * src/autofit/afwarp.c (af_warper_compute_line_best): Remove redundant assignment. * src/cff/cffload.c (cff_subfont_load): Add casts. * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment. * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static' keyword. Add casts. (fixed2float): Add cast. (sfnt_get_var_ps_name): Make `p' always initialized. Add casts. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts.
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
diff --git a/ChangeLog b/ChangeLog
index d5addbd..5bbf50a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
2017-03-15 Werner Lemberg <wl@gnu.org>
+ Remove clang compiler warnings (#50548).
+
+ * include/freetype/internal/tttypes.h (TT_FaceRec): Make
+ `var_postscript_prefix_len' unsigned.
+
+ * src/autofit/afwarp.c (af_warper_compute_line_best): Remove
+ redundant assignment.
+
+ * src/cff/cffload.c (cff_subfont_load): Add casts.
+
+ * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment.
+
+ * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static'
+ keyword.
+ Add casts.
+ (fixed2float): Add cast.
+ (sfnt_get_var_ps_name): Make `p' always initialized.
+ Add casts.
+
+ * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts.
+
+2017-03-15 Werner Lemberg <wl@gnu.org>
+
[ftfuzzer] Limit number of tested faces and instances.
This is inspired by the discussion in and analysis of
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index a1f6774..9a2f7c8 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1513,7 +1513,7 @@ FT_BEGIN_HEADER
FT_UInt32 variation_support; /* since 2.7.1 */
const char* var_postscript_prefix; /* since 2.7.2 */
- FT_Int var_postscript_prefix_len; /* since 2.7.2 */
+ FT_UInt var_postscript_prefix_len; /* since 2.7.2 */
#endif
diff --git a/src/autofit/afwarp.c b/src/autofit/afwarp.c
index 44dd49b..f99aa6d 100644
--- a/src/autofit/afwarp.c
+++ b/src/autofit/afwarp.c
@@ -98,7 +98,6 @@
if ( xx1min + w < warper->x2min )
xx1min = warper->x2min - w;
- xx1max = warper->x1max;
if ( xx1max + w > warper->x2max )
xx1max = warper->x2max - w;
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index d356ab3..d3a2af9 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -2084,7 +2084,8 @@
{
do
{
- driver->random_seed = (FT_Int32)cff_random( driver->random_seed );
+ driver->random_seed =
+ (FT_Int32)cff_random( (FT_UInt32)driver->random_seed );
} while ( driver->random_seed < 0 );
}
@@ -2097,7 +2098,7 @@
do
{
face->root.internal->random_seed =
- (FT_Int32)cff_random( face->root.internal->random_seed );
+ (FT_Int32)cff_random( (FT_UInt32)face->root.internal->random_seed );
} while ( face->root.internal->random_seed < 0 );
}
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 59fa290..e1511bd 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -894,8 +894,6 @@
FT_Error error;
- error = FT_ERR( Stack_Underflow );
-
if ( !priv || !priv->subfont )
{
error = FT_THROW( Invalid_File_Format );
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 0f95c76..24181b4 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -271,7 +271,7 @@
#define ROTL32( x, r ) ( x << r ) | ( x >> ( 32 - r ) )
- FT_UInt32
+ static FT_UInt32
fmix32( FT_UInt32 h )
{
h ^= h >> 16;
@@ -284,14 +284,14 @@
}
- void
- murmur_hash_3_128( const void* key,
- const int len,
- FT_UInt32 seed,
- void* out )
+ static void
+ murmur_hash_3_128( const void* key,
+ const unsigned int len,
+ FT_UInt32 seed,
+ void* out )
{
const FT_Byte* data = (const FT_Byte*)key;
- const int nblocks = len / 16;
+ const int nblocks = (int)len / 16;
FT_UInt32 h1 = seed;
FT_UInt32 h2 = seed;
@@ -365,50 +365,50 @@
switch ( len & 15 )
{
case 15:
- k4 ^= tail[14] << 16;
+ k4 ^= (FT_UInt32)tail[14] << 16;
case 14:
- k4 ^= tail[13] << 8;
+ k4 ^= (FT_UInt32)tail[13] << 8;
case 13:
- k4 ^= tail[12] << 0;
+ k4 ^= (FT_UInt32)tail[12];
k4 *= c4;
k4 = ROTL32( k4, 18 );
k4 *= c1;
h4 ^= k4;
case 12:
- k3 ^= tail[11] << 24;
+ k3 ^= (FT_UInt32)tail[11] << 24;
case 11:
- k3 ^= tail[10] << 16;
+ k3 ^= (FT_UInt32)tail[10] << 16;
case 10:
- k3 ^= tail[9] << 8;
+ k3 ^= (FT_UInt32)tail[9] << 8;
case 9:
- k3 ^= tail[8] << 0;
+ k3 ^= (FT_UInt32)tail[8];
k3 *= c3;
k3 = ROTL32( k3, 17 );
k3 *= c4;
h3 ^= k3;
case 8:
- k2 ^= tail[7] << 24;
+ k2 ^= (FT_UInt32)tail[7] << 24;
case 7:
- k2 ^= tail[6] << 16;
+ k2 ^= (FT_UInt32)tail[6] << 16;
case 6:
- k2 ^= tail[5] << 8;
+ k2 ^= (FT_UInt32)tail[5] << 8;
case 5:
- k2 ^= tail[4] << 0;
+ k2 ^= (FT_UInt32)tail[4];
k2 *= c2;
k2 = ROTL32( k2, 16 );
k2 *= c3;
h2 ^= k2;
case 4:
- k1 ^= tail[3] << 24;
+ k1 ^= (FT_UInt32)tail[3] << 24;
case 3:
- k1 ^= tail[2] << 16;
+ k1 ^= (FT_UInt32)tail[2] << 16;
case 2:
- k1 ^= tail[1] << 8;
+ k1 ^= (FT_UInt32)tail[1] << 8;
case 1:
- k1 ^= tail[0] << 0;
+ k1 ^= (FT_UInt32)tail[0];
k1 *= c1;
k1 = ROTL32( k1, 15 );
k1 *= c2;
@@ -699,7 +699,7 @@
/* get digits of fractional part */
for ( i = 0; i < 5; i++ )
{
- *p++ = '0' + frac_part / 0x10000L;
+ *p++ = '0' + (char)( frac_part / 0x10000L );
frac_part %= 0x10000L;
if ( !frac_part )
@@ -875,6 +875,8 @@
if ( ps_name )
{
result = ps_name;
+ p = result + ft_strlen( result ) + 1;
+
goto check_length;
}
else
@@ -940,7 +942,7 @@
for ( i = 0; i < num_coords; i++, coords++, axis++ )
{
- FT_ULong t;
+ char t;
/* omit axis value descriptor if it is identical */
@@ -951,16 +953,16 @@
*p++ = '_';
p = fixed2float( *coords, p );
- t = axis->tag >> 24 & 0xFF;
+ t = (char)( axis->tag >> 24 );
if ( t != ' ' && ft_isalnum( t ) )
*p++ = t;
- t = axis->tag >> 16 & 0xFF;
+ t = (char)( axis->tag >> 16 );
if ( t != ' ' && ft_isalnum( t ) )
*p++ = t;
- t = axis->tag >> 8 & 0xFF;
+ t = (char)( axis->tag >> 8 );
if ( t != ' ' && ft_isalnum( t ) )
*p++ = t;
- t = axis->tag & 0xFF;
+ t = (char)axis->tag;
if ( t != ' ' && ft_isalnum( t ) )
*p++ = t;
}
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 7f0b3f3..4ceee00 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2205,8 +2205,8 @@
ns = &mmvar->namedstyle[fvar_head.instanceCount];
- ns->strid = strid;
- ns->psid = psid;
+ ns->strid = (FT_UInt)strid;
+ ns->psid = (FT_UInt)psid;
a = mmvar->axis;
c = ns->coords;