Next round of compiler fixes. * builds/win32/ftdebug.c, builds/wince/ftdebug.c (ft_debug_init): Add proper cast. * include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Fix cast. * include/freetype/internal/ftstream.h: Decorate stream and frame macros with `FT_Long' and `FT_ULong' as appropriate. * src/base/ftrfork.c (raccess_guess_darwin_hfsplus, raccess_guess_darwin_newvfs): Use cast. * src/bdf/bdflib.c (_bdf_set_default_spacing): Use cast. * src/cache/ftcmanag.c (FTC_Manager_Check): Fix cast. * src/cache/ftcmanag.h (FTC_ManagerRec): Ditto. * src/cff/cf2arrst.c (cf2_arrstack_setNum_Elements): Use cast. * src/cff/cf2ft.c (cf2_freeSeacComponent): Ditto. * src/cff/cffobjs.c (remove_subset_prefix, remove_style): Ditto. * src/cid/cidparse.c (cid_parser_new): Use cast. * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Use cast. * src/psaux/psobjs.c (reallocate_t1_table): Fix argument type. * src/raster/ftraster.c (ft_black_reset): Use cast. * src/truetype/ttgxvar.c (FT_Stream_FTell): Use cast. (ALL_POINTS): Fix cast. * src/type1/t1driver.c (t1_ps_get_font_value): Add casts. * src/type1/t1parse.c (T1_Get_Private_Dict): Add cast.
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 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
diff --git a/ChangeLog b/ChangeLog
index 3fdac98..269d917 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2013-06-06 Werner Lemberg <wl@gnu.org>
+
+ Next round of compiler fixes.
+
+ * builds/win32/ftdebug.c, builds/wince/ftdebug.c (ft_debug_init):
+ Add proper cast.
+
+ * include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Fix
+ cast.
+ * include/freetype/internal/ftstream.h: Decorate stream and frame
+ macros with `FT_Long' and `FT_ULong' as appropriate.
+
+ * src/base/ftrfork.c (raccess_guess_darwin_hfsplus,
+ raccess_guess_darwin_newvfs): Use cast.
+
+ * src/bdf/bdflib.c (_bdf_set_default_spacing): Use cast.
+
+ * src/cache/ftcmanag.c (FTC_Manager_Check): Fix cast.
+ * src/cache/ftcmanag.h (FTC_ManagerRec): Ditto.
+
+ * src/cff/cf2arrst.c (cf2_arrstack_setNum_Elements): Use cast.
+ * src/cff/cf2ft.c (cf2_freeSeacComponent): Ditto.
+ * src/cff/cffobjs.c (remove_subset_prefix, remove_style): Ditto.
+
+ * src/cid/cidparse.c (cid_parser_new): Use cast.
+
+ * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Use cast.
+
+ * src/psaux/psobjs.c (reallocate_t1_table): Fix argument type.
+
+ * src/raster/ftraster.c (ft_black_reset): Use cast.
+
+ * src/truetype/ttgxvar.c (FT_Stream_FTell): Use cast.
+ (ALL_POINTS): Fix cast.
+
+ * src/type1/t1driver.c (t1_ps_get_font_value): Add casts.
+ * src/type1/t1parse.c (T1_Get_Private_Dict): Add cast.
+
2013-06-05 Dave Arnold <darnold@adobe.com>
Fix more MSVC Win32 compiler warnings.
diff --git a/builds/win32/ftdebug.c b/builds/win32/ftdebug.c
index 832eb0f..58b7f89 100644
--- a/builds/win32/ftdebug.c
+++ b/builds/win32/ftdebug.c
@@ -171,7 +171,7 @@
if ( *p == ':' && p > q )
{
- int n, i, len = p - q;
+ int n, i, len = (int)( p - q );
int level = -1, found = -1;
diff --git a/builds/wince/ftdebug.c b/builds/wince/ftdebug.c
index 3c8d328..354f4f0 100644
--- a/builds/wince/ftdebug.c
+++ b/builds/wince/ftdebug.c
@@ -189,7 +189,7 @@
if ( *p == ':' && p > q )
{
- int n, i, len = p - q;
+ int n, i, len = (int)( p - q );
int level = -1, found = -1;
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index 5ee1ce1..724e1f0 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -653,7 +653,9 @@ FT_BEGIN_HEADER
/*
* A magic number used within the services cache.
*/
-#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~1) /* magic number */
+
+ /* ensure that value `1' has the same width as a pointer */
+#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~(FT_PtrDist)1)
/*
diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h
index 6c12d30..2661858 100644
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -486,37 +486,41 @@ FT_BEGIN_HEADER
#define FT_STREAM_POS() \
FT_Stream_Pos( stream )
-#define FT_STREAM_SEEK( position ) \
- FT_SET_ERROR( FT_Stream_Seek( stream, position ) )
+#define FT_STREAM_SEEK( position ) \
+ FT_SET_ERROR( FT_Stream_Seek( stream, \
+ (FT_ULong)(position) ) )
-#define FT_STREAM_SKIP( distance ) \
- FT_SET_ERROR( FT_Stream_Skip( stream, distance ) )
+#define FT_STREAM_SKIP( distance ) \
+ FT_SET_ERROR( FT_Stream_Skip( stream, \
+ (FT_Long)(distance) ) )
-#define FT_STREAM_READ( buffer, count ) \
- FT_SET_ERROR( FT_Stream_Read( stream, \
- (FT_Byte*)buffer, \
- count ) )
+#define FT_STREAM_READ( buffer, count ) \
+ FT_SET_ERROR( FT_Stream_Read( stream, \
+ (FT_Byte*)(buffer), \
+ (FT_ULong)(count) ) )
-#define FT_STREAM_READ_AT( position, buffer, count ) \
- FT_SET_ERROR( FT_Stream_ReadAt( stream, \
- position, \
- (FT_Byte*)buffer, \
- count ) )
+#define FT_STREAM_READ_AT( position, buffer, count ) \
+ FT_SET_ERROR( FT_Stream_ReadAt( stream, \
+ (FT_ULong)(position), \
+ (FT_Byte*)buffer, \
+ (FT_ULong)(count) ) )
#define FT_STREAM_READ_FIELDS( fields, object ) \
FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
-#define FT_FRAME_ENTER( size ) \
- FT_SET_ERROR( \
- FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )
+#define FT_FRAME_ENTER( size ) \
+ FT_SET_ERROR( \
+ FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, \
+ (FT_ULong)(size) ) ) )
-#define FT_FRAME_EXIT() \
+#define FT_FRAME_EXIT() \
FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )
#define FT_FRAME_EXTRACT( size, bytes ) \
FT_SET_ERROR( \
- FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \
+ FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, \
+ (FT_ULong)(size), \
(FT_Byte**)&(bytes) ) ) )
#define FT_FRAME_RELEASE( bytes ) \
diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c
index a74948a..8049117 100644
--- a/src/base/ftrfork.c
+++ b/src/base/ftrfork.c
@@ -507,7 +507,7 @@
FT_Error error;
char* newpath = NULL;
FT_Memory memory;
- FT_Long base_file_len = ft_strlen( base_file_name );
+ FT_Long base_file_len = (FT_Long)ft_strlen( base_file_name );
FT_UNUSED( stream );
@@ -543,7 +543,7 @@
FT_Error error;
char* newpath = NULL;
FT_Memory memory;
- FT_Long base_file_len = ft_strlen( base_file_name );
+ FT_Long base_file_len = (FT_Long)ft_strlen( base_file_name );
FT_UNUSED( stream );
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index c804f63..0b8412d 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1196,7 +1196,7 @@
FT_MEM_COPY( name, font->name, len );
- error = _bdf_list_split( &list, (char *)"-", name, len );
+ error = _bdf_list_split( &list, (char *)"-", name, (unsigned long)len );
if ( error )
goto Fail;
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index 298bb7a..d8c441f 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -473,7 +473,7 @@
/* check node weights */
if ( first )
{
- FT_ULong weight = 0;
+ FT_Offset weight = 0;
node = first;
diff --git a/src/cache/ftcmanag.h b/src/cache/ftcmanag.h
index d6c8516..0aec33c 100644
--- a/src/cache/ftcmanag.h
+++ b/src/cache/ftcmanag.h
@@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (specification). */
/* */
-/* Copyright 2000-2001, 2003, 2004, 2006, 2010 by */
+/* Copyright 2000-2001, 2003, 2004, 2006, 2010, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -94,8 +94,8 @@ FT_BEGIN_HEADER
FT_Memory memory;
FTC_Node nodes_list;
- FT_ULong max_weight;
- FT_ULong cur_weight;
+ FT_Offset max_weight;
+ FT_Offset cur_weight;
FT_UInt num_nodes;
FTC_Cache caches[FTC_MAX_CACHES];
diff --git a/src/cff/cf2arrst.c b/src/cff/cf2arrst.c
index 077986a..c8d6f13 100644
--- a/src/cff/cf2arrst.c
+++ b/src/cff/cf2arrst.c
@@ -101,7 +101,7 @@
FT_Error error = FT_Err_Ok; /* for FT_REALLOC */
FT_Memory memory = arrstack->memory; /* for FT_REALLOC */
- FT_Long newSize = numElements * arrstack->sizeItem;
+ FT_Long newSize = (FT_Long)( numElements * arrstack->sizeItem );
if ( numElements > LONG_MAX / arrstack->sizeItem )
diff --git a/src/cff/cf2ft.c b/src/cff/cf2ft.c
index 717e9ea..965e545 100644
--- a/src/cff/cf2ft.c
+++ b/src/cff/cf2ft.c
@@ -563,7 +563,7 @@
cff_free_glyph_data( decoder->builder.face,
(FT_Byte**)&buf->start,
- buf->end - buf->start );
+ (FT_ULong)( buf->end - buf->start ) );
}
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 90a9a33..dd750d1 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -405,7 +405,7 @@
remove_subset_prefix( FT_String* name )
{
FT_Int32 idx = 0;
- FT_Int32 length = strlen( name ) + 1;
+ FT_Int32 length = (FT_Int32)strlen( name ) + 1;
FT_Bool continue_search = 1;
@@ -442,8 +442,8 @@
FT_Int32 family_name_length, style_name_length;
- family_name_length = strlen( family_name );
- style_name_length = strlen( style_name );
+ family_name_length = (FT_Int32)strlen( family_name );
+ style_name_length = (FT_Int32)strlen( style_name );
if ( family_name_length > style_name_length )
{
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index babe02b..53df315 100644
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -117,12 +117,12 @@
if ( p[0] == 'S' && ft_strncmp( (char*)p, "StartData", 9 ) == 0 )
{
/* save offset of binary data after `StartData' */
- offset += p - buffer + 10;
+ offset += (FT_ULong)( p - buffer + 10 );
goto Found;
}
else if ( p[1] == 's' && ft_strncmp( (char*)p, "/sfnts", 6 ) == 0 )
{
- offset += p - buffer + 7;
+ offset += (FT_ULong)( p - buffer + 7 );
goto Found;
}
}
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index 09d17a6..df25a64 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -532,7 +532,7 @@ THE SOFTWARE.
/* XXX: to do: are there cases that need repadding the bitmap? */
bytes = bitmap->pitch * bitmap->rows;
- error = ft_glyphslot_alloc_bitmap( slot, bytes );
+ error = ft_glyphslot_alloc_bitmap( slot, (FT_ULong)bytes );
if ( error )
goto Exit;
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index 12fc326..dd976d3 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -113,8 +113,8 @@
static FT_Error
- reallocate_t1_table( PS_Table table,
- FT_Long new_size )
+ reallocate_t1_table( PS_Table table,
+ FT_Offset new_size )
{
FT_Memory memory = table->memory;
FT_Byte* old_base = table->block;
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index a161428..4865994 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -3523,7 +3523,8 @@
raster->buffer = pool_base + ( ( sizeof ( *worker ) + 7 ) & ~7 );
- raster->buffer_size = pool_base + pool_size - (char*)raster->buffer;
+ raster->buffer_size = (long)( pool_base + pool_size -
+ (char*)raster->buffer );
raster->worker = worker;
}
else
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 71d880c..7899d36 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -61,9 +61,9 @@
#define FT_Stream_FTell( stream ) \
- ( (stream)->cursor - (stream)->base )
+ (FT_ULong)( (stream)->cursor - (stream)->base )
#define FT_Stream_SeekSet( stream, off ) \
- ( (stream)->cursor = (stream)->base+(off) )
+ ( (stream)->cursor = (stream)->base + (off) )
/*************************************************************************/
@@ -91,7 +91,9 @@
/* indicates that there is a delta for every point without needing to */
/* enumerate all of them. */
/* */
-#define ALL_POINTS (FT_UShort*)( ~0 )
+
+ /* ensure that value `0' has the same width as a pointer */
+#define ALL_POINTS (FT_UShort*)~(FT_PtrDist)0
#define GX_PT_POINTS_ARE_WORDS 0x80
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index f96faa9..697288d 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -258,7 +258,7 @@
break;
case PS_DICT_FONT_NAME:
- retval = ft_strlen( type1->font_name ) + 1;
+ retval = (FT_Long)( ft_strlen( type1->font_name ) + 1 );
if ( value && value_len >= retval )
ft_memcpy( value, (void *)( type1->font_name ), retval );
break;
@@ -278,7 +278,7 @@
case PS_DICT_CHAR_STRING_KEY:
if ( idx < (FT_UInt)type1->num_glyphs )
{
- retval = ft_strlen( type1->glyph_names[idx] ) + 1;
+ retval = (FT_Long)( ft_strlen( type1->glyph_names[idx] ) + 1 );
if ( value && value_len >= retval )
{
ft_memcpy( value, (void *)( type1->glyph_names[idx] ), retval );
@@ -290,7 +290,7 @@
case PS_DICT_CHAR_STRING:
if ( idx < (FT_UInt)type1->num_glyphs )
{
- retval = type1->charstrings_len[idx] + 1;
+ retval = (FT_Long)( type1->charstrings_len[idx] + 1 );
if ( value && value_len >= retval )
{
ft_memcpy( value, (void *)( type1->charstrings[idx] ),
@@ -310,7 +310,7 @@
if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY &&
idx < (FT_UInt)type1->encoding.num_chars )
{
- retval = ft_strlen( type1->encoding.char_name[idx] ) + 1;
+ retval = (FT_Long)( ft_strlen( type1->encoding.char_name[idx] ) + 1 );
if ( value && value_len >= retval )
{
ft_memcpy( value, (void *)( type1->encoding.char_name[idx] ),
@@ -329,7 +329,7 @@
case PS_DICT_SUBR:
if ( idx < (FT_UInt)type1->num_subrs )
{
- retval = type1->subrs_len[idx] + 1;
+ retval = (FT_Long)( type1->subrs_len[idx] + 1 );
if ( value && value_len >= retval )
{
ft_memcpy( value, (void *)( type1->subrs[idx] ), retval - 1 );
@@ -523,31 +523,31 @@
break;
case PS_DICT_VERSION:
- retval = ft_strlen( type1->font_info.version ) + 1;
+ retval = (FT_Long)( ft_strlen( type1->font_info.version ) + 1 );
if ( value && value_len >= retval )
ft_memcpy( value, (void *)( type1->font_info.version ), retval );
break;
case PS_DICT_NOTICE:
- retval = ft_strlen( type1->font_info.notice ) + 1;
+ retval = (FT_Long)( ft_strlen( type1->font_info.notice ) + 1 );
if ( value && value_len >= retval )
ft_memcpy( value, (void *)( type1->font_info.notice ), retval );
break;
case PS_DICT_FULL_NAME:
- retval = ft_strlen( type1->font_info.full_name ) + 1;
+ retval = (FT_Long)( ft_strlen( type1->font_info.full_name ) + 1 );
if ( value && value_len >= retval )
ft_memcpy( value, (void *)( type1->font_info.full_name ), retval );
break;
case PS_DICT_FAMILY_NAME:
- retval = ft_strlen( type1->font_info.family_name ) + 1;
+ retval = (FT_Long)( ft_strlen( type1->font_info.family_name ) + 1 );
if ( value && value_len >= retval )
ft_memcpy( value, (void *)( type1->font_info.family_name ), retval );
break;
case PS_DICT_WEIGHT:
- retval = ft_strlen( type1->font_info.weight ) + 1;
+ retval = (FT_Long)( ft_strlen( type1->font_info.weight ) + 1 );
if ( value && value_len >= retval )
ft_memcpy( value, (void *)( type1->font_info.weight ), retval );
break;
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index f7c402e..106e4e7 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -418,7 +418,7 @@
goto Exit;
}
- size = parser->base_len - ( cur - parser->base_dict );
+ size = (FT_ULong)( parser->base_len - ( cur - parser->base_dict ) );
if ( parser->in_memory )
{