ref: a9f6f85e77b5e81734cb3112fa3e091d4b5de3c3
parent: 461cc9365c80559e65993cfb3adfc0f832b62055
author: Werner Lemberg <[email protected]>
date: Mon Dec 17 04:08:09 EST 2012
Various compiler warning fixes. * include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Use `logical not' operator instead of negation. The idea is that `~' returns exactly the data type enforced by the cast to a pointer (be it 32bit or 64bit or whatever), while a negative integer has not this flexibility. * src/cache/ftccmap.c (FTC_CMAP_UNKNOWN): Ditto. * src/truetype/ttgxvar.c (ALL_POINTS, TT_Get_MM_Var): Ditto. * src/type/t1load.c (T1_Get_MM_Var): Ditto. (parse_blend_axis_types): Use cast. * src/bdf/bdflib.c (_bdf_readstream): Use cast.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-12-16 Werner Lemberg <[email protected]>
+
+ Various compiler warning fixes.
+
+ * include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Use
+ `logical not' operator instead of negation. The idea is that `~'
+ returns exactly the data type enforced by the cast to a pointer (be
+ it 32bit or 64bit or whatever), while a negative integer has not
+ this flexibility.
+ * src/cache/ftccmap.c (FTC_CMAP_UNKNOWN): Ditto.
+ * src/truetype/ttgxvar.c (ALL_POINTS, TT_Get_MM_Var): Ditto.
+ * src/type/t1load.c (T1_Get_MM_Var): Ditto.
+ (parse_blend_axis_types): Use cast.
+ * src/bdf/bdflib.c (_bdf_readstream): Use cast.
+
2012-12-16 Infinality <[email protected]>
[truetype] Remove unusued code and variables. Add minor fixes.
@@ -30,7 +45,7 @@
(Ins_MIRP): Don't round x in cut-in calculation. Add logic to handle
ttfautohinted fonts.
- 2012-12-16 Werner Lemberg <[email protected]>
+2012-12-16 Werner Lemberg <[email protected]>
[sfnt] Fix Savannah bug #37936.
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -92,6 +92,7 @@
#endif /* !C++ */
+
/*
* @macro:
* FT_FACE_FIND_GLOBAL_SERVICE
@@ -578,7 +579,7 @@
/*
* A magic number used within the services cache.
*/
-#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)-2) /* magic number */
+#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~1) /* magic number */
/*
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -770,11 +770,11 @@
/* XXX: Use encoding independent value for 0x1a */
if ( buf[start] != '#' && buf[start] != 0x1a && end > start )
{
- error = (*cb)( buf + start, end - start, lineno,
+ error = (*cb)( buf + start, (unsigned long)( end - start ), lineno,
(void*)&cb, client_data );
/* Redo if we have encountered CHARS without properties. */
if ( error == -1 )
- error = (*cb)( buf + start, end - start, lineno,
+ error = (*cb)( buf + start, (unsigned long)( end - start ), lineno,
(void*)&cb, client_data );
if ( error )
break;
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -4,8 +4,7 @@
/* */
/* FreeType CharMap cache (body) */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
-/* 2010, 2011 by */
+/* Copyright 2000-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -121,7 +120,7 @@
/* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */
/* glyph indices haven't been queried through FT_Get_Glyph_Index() yet */
-#define FTC_CMAP_UNKNOWN ( (FT_UInt16)-1 )
+#define FTC_CMAP_UNKNOWN (FT_UInt16)~0
/*************************************************************************/
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -91,7 +91,7 @@
/* indicates that there is a delta for every point without needing to */
/* enumerate all of them. */
/* */
-#define ALL_POINTS (FT_UShort*)( -1 )
+#define ALL_POINTS (FT_UShort*)( ~0 )
#define GX_PT_POINTS_ARE_WORDS 0x80
@@ -703,7 +703,7 @@
mmvar->num_axis =
fvar_head.axisCount;
mmvar->num_designs =
- (FT_UInt)-1; /* meaningless in this context; each glyph */
+ ~0; /* meaningless in this context; each glyph */
/* may have a different number of designs */
/* (or tuples, as called by Apple) */
mmvar->num_namedstyles =
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -320,7 +320,7 @@
mmvar->num_axis = mmaster.num_axis;
mmvar->num_designs = mmaster.num_designs;
- mmvar->num_namedstyles = (FT_UInt)-1; /* Does not apply */
+ mmvar->num_namedstyles = ~0; /* Does not apply */
mmvar->axis = (FT_Var_Axis*)&mmvar[1];
/* Point to axes after MM_Var struct */
mmvar->namedstyle = NULL;
@@ -333,8 +333,8 @@
mmvar->axis[i].def = ( mmvar->axis[i].minimum +
mmvar->axis[i].maximum ) / 2;
/* Does not apply. But this value is in range */
- mmvar->axis[i].strid = (FT_UInt)-1; /* Does not apply */
- mmvar->axis[i].tag = (FT_ULong)-1; /* Does not apply */
+ mmvar->axis[i].strid = ~0; /* Does not apply */
+ mmvar->axis[i].tag = ~0; /* Does not apply */
if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
@@ -615,7 +615,7 @@
goto Exit;
}
- if ( FT_ALLOC( blend->axis_names[n], len + 1 ) )
+ if ( FT_ALLOC( blend->axis_names[n], (FT_Long)( len + 1 ) ) )
goto Exit;
name = (FT_Byte*)blend->axis_names[n];