ref: 6c71c6b968139e91723cb06c91384fc8b5994165
parent: d7e6b767396932f0eb0bd9142deec7e0109ecaa5
author: David Turner <[email protected]>
date: Sat Feb 25 07:49:40 EST 2006
* include/freetype/config/ftoption.h, src/autofit/afcjk.c, src/base/ftobjs.c, src/base/ftutil.c, src/cff/cffobjs.c, src/psaux/afmparse.c, src/sfnt/ttbdf.c, src/tools/apinames.c, src/truetype/ttdriver.c: solved compiler warnings as well as C++ compilation problems
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,18 @@
+2006-02-25 David Turner <[email protected]>
+
+ * include/freetype/config/ftoption.h, src/autofit/afcjk.c,
+ src/base/ftobjs.c, src/base/ftutil.c, src/cff/cffobjs.c,
+ src/psaux/afmparse.c, src/sfnt/ttbdf.c, src/tools/apinames.c,
+ src/truetype/ttdriver.c:
+
+ solved compiler warnings as well as C++ compilation problems
+
+
2006-02-24 Chia-I Wu <[email protected]>
* src/base/ftoutln.c (FT_OUTLINE_GET_CONTOUR, ft_contour_has,
ft_contour_enclosed, ft_outline_get_orientation): Commented out. We
- have to wait until `FT_GlyphSlot_Own_Bitmap' is stabilized.
+ have to wait until `FT_GlyphSlot_Own_Bitmap' is stabilized.
(FT_Outline_Embolden): Use `FT_Outline_Get_Orientation'.
2006-02-24 Chia-I Wu <[email protected]>
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -586,8 +586,13 @@
* certain functions like ft_mem_alloc in a way that prevents recent GCC
* releases from emitting zillions of `strict aliasing' warning messages
* each time a memory-management function is called.
+ *
+ * note that it shouldn't be activated when compiling the library
+ * as C++
*/
+#ifndef __cplusplus
#define FT_STRICT_ALIASING
+#endif
/*
@@ -595,6 +600,11 @@
* structures that was used prior to FreeType 2.2. This also compiles in
* a few obsolete functions to avoid linking problems on typical Unix
* distributions.
+ *
+ * if you're on an embedded system, or if you're building a new
+ * distribution from scratch, it is recommended to disable the macro
+ * since it will reduce the library's code size and activate a few
+ * memory-saving optimizations as well.
*/
#define FT_CONFIG_OPTION_OLD_INTERNALS
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -131,7 +131,7 @@
{
AF_Point pt = seg->first;
AF_Point last = seg->last;
- AF_Flags f0 = pt->flags & AF_FLAG_CONTROL;
+ AF_Flags f0 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL);
AF_Flags f1;
@@ -140,7 +140,7 @@
for ( ; pt != last; f0 = f1 )
{
pt = pt->next;
- f1 = pt->flags & AF_FLAG_CONTROL;
+ f1 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL);
if ( !f0 && !f1 )
break;
@@ -921,7 +921,9 @@
org_len = edge2->opos - edge->opos;
cur_len = af_cjk_compute_stem_width( hints, dim, org_len,
- edge->flags, edge2->flags );
+ (AF_Edge_Flags)edge->flags,
+ (AF_Edge_Flags)edge2->flags );
+
org_center = ( edge->opos + edge2->opos ) / 2 + anchor;
cur_pos1 = org_center - cur_len / 2;
cur_pos2 = cur_pos1 + cur_len;
@@ -1123,7 +1125,8 @@
#endif /* 0 */
- delta = af_hint_normal_stem( hints, edge, edge2, 0, 0 );
+ delta = af_hint_normal_stem( hints, edge, edge2, 0,
+ AF_DIMENSION_HORZ );
}
else
af_hint_normal_stem( hints, edge, edge2, delta, dim );
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2125,7 +2125,7 @@
if ( FT_IS_SCALABLE( face ) )
{
- FT_Long w, h, scaled_w, scaled_h;
+ FT_Long w, h, scaled_w = 0, scaled_h = 0;
switch ( req->type )
@@ -3688,8 +3688,9 @@
FT_Service_TrueTypeEngine service;
- service = ft_module_get_service( module,
- FT_SERVICE_ID_TRUETYPE_ENGINE );
+ service = (FT_Service_TrueTypeEngine)
+ ft_module_get_service( module,
+ FT_SERVICE_ID_TRUETYPE_ENGINE );
if ( service )
result = service->engine_type;
}
--- a/src/base/ftutil.c
+++ b/src/base/ftutil.c
@@ -334,16 +334,15 @@
FT_BASE_DEF( void )
ft_mem_free( FT_Memory memory,
- void** P )
+ void* *P )
{
FT_TRACE7(( "ft_mem_free:" ));
- FT_TRACE7(( " Freeing block 0x%08p, ref 0x%08p\n",
- P, P ? *P : (void*)0 ));
+ FT_TRACE7(( " Freeing block 0x%08p ref 0x%08p\n", P, *P ));
if ( P && *P )
{
memory->free( memory, *P );
- *P = 0;
+ *P = NULL;
}
}
@@ -623,10 +622,7 @@
void* *P )
{
if ( *P )
- {
- ft_mem_free( memory, *P );
- *P = NULL;
- }
+ FT_MEM_FREE( *P );
}
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -206,7 +206,7 @@
if ( FT_HAS_FIXED_SIZES( size->face ) )
{
CFF_Face cffface = (CFF_Face)size->face;
- SFNT_Service sfnt = cffface->sfnt;
+ SFNT_Service sfnt = (SFNT_Service)cffface->sfnt;
FT_ULong index;
--- a/src/psaux/afmparse.c
+++ b/src/psaux/afmparse.c
@@ -513,7 +513,7 @@
return AFM_TOKEN_UNKNOWN;
if ( ft_strncmp( afm_key_table[n], key, len ) == 0 )
- return n;
+ return (AFM_Token) n;
}
}
}
@@ -578,8 +578,8 @@
else
return PSaux_Err_Syntax_Error;
}
-
+
static FT_Error
afm_parse_track_kern( AFM_Parser parser )
{
@@ -606,8 +606,8 @@
while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
{
AFM_ValueRec shared_vals[5];
-
+
switch ( afm_tokenize( key, len ) )
{
case AFM_TOKEN_TRACKKERN:
@@ -796,7 +796,7 @@
break;
case AFM_TOKEN_ENDKERNDATA:
- case AFM_TOKEN_ENDFONTMETRICS:
+ case AFM_TOKEN_ENDFONTMETRICS:
return PSaux_Err_Ok;
case AFM_TOKEN_UNKNOWN:
@@ -940,7 +940,7 @@
goto Fail;
/* fall through since we only support kern data */
- case AFM_TOKEN_ENDFONTMETRICS:
+ case AFM_TOKEN_ENDFONTMETRICS:
return PSaux_Err_Ok;
break;
--- a/src/sfnt/ttbdf.c
+++ b/src/sfnt/ttbdf.c
@@ -92,11 +92,7 @@
( strings - 8 ) / 4 < num_strikes ||
strings + 1 > length )
{
- BadTable:
- FT_FRAME_RELEASE( bdf->table );
- FT_ZERO( bdf );
- error = FT_Err_Invalid_Table;
- goto Exit;
+ goto BadTable;
}
bdf->num_strikes = num_strikes;
@@ -132,6 +128,12 @@
Exit:
return error;
+
+ BadTable:
+ FT_FRAME_RELEASE( bdf->table );
+ FT_ZERO( bdf );
+ error = FT_Err_Invalid_Table;
+ goto Exit;
}
--- a/src/tools/apinames.c
+++ b/src/tools/apinames.c
@@ -86,7 +86,7 @@
if ( num_names >= max_names )
{
max_names += (max_names >> 1) + 4;
- the_names = realloc( the_names, sizeof(the_names[0])*max_names );
+ the_names = (NameRec*)realloc( the_names, sizeof(the_names[0])*max_names );
if ( the_names == NULL )
panic( "not enough memory" );
}
@@ -93,7 +93,7 @@
nm = &the_names[num_names++];
nm->hash = h;
- nm->name = malloc( len+1 );
+ nm->name = (char*)malloc( len+1 );
if ( nm->name == NULL )
panic( "not enough memory" );
@@ -289,23 +289,25 @@
static void
usage( void )
{
- fprintf( stderr,
- "%s %s: extract FreeType API names from header files\n\n"
- "this program is used to extract the list of public FreeType API\n"
- "functions. It receives the list of header files as argument and\n"
- "generates a sorted list of unique identifiers\n\n"
+ static const char* const format =
+ "%s %s: extract FreeType API names from header files\n\n"
+ "this program is used to extract the list of public FreeType API\n"
+ "functions. It receives the list of header files as argument and\n"
+ "generates a sorted list of unique identifiers\n\n"
- "usage: %s header1 [options] [header2 ...]\n\n"
+ "usage: %s header1 [options] [header2 ...]\n\n"
- "options: - : parse the content of stdin, ignore arguments\n"
- " -v : verbose mode, output sent to standard error\n",
- " -oFILE : write output to FILE instead of standard output\n"
- " -dNAME : indicate DLL file name, 'freetype.dll' by default\n"
- " -w : output .DEF file for Visual C++ and Mingw\n"
- " -wB : output .DEF file for Borland C++\n"
- " -wW : output Watcom Linker Response File\n"
- "\n"
- ,
+ "options: - : parse the content of stdin, ignore arguments\n"
+ " -v : verbose mode, output sent to standard error\n"
+ " -oFILE : write output to FILE instead of standard output\n"
+ " -dNAME : indicate DLL file name, 'freetype.dll' by default\n"
+ " -w : output .DEF file for Visual C++ and Mingw\n"
+ " -wB : output .DEF file for Borland C++\n"
+ " -wW : output Watcom Linker Response File\n"
+ "\n";
+
+ fprintf( stderr,
+ format,
PROGRAM_NAME,
PROGRAM_VERSION,
PROGRAM_NAME
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -158,7 +158,7 @@
}
else
{
- SFNT_Service sfnt = ttface->sfnt;
+ SFNT_Service sfnt = (SFNT_Service) ttface->sfnt;
FT_Size_Metrics* metrics = &size->metrics;
@@ -186,7 +186,7 @@
if ( FT_HAS_FIXED_SIZES( size->face ) )
{
TT_Face ttface = (TT_Face)size->face;
- SFNT_Service sfnt = ttface->sfnt;
+ SFNT_Service sfnt = (SFNT_Service) ttface->sfnt;
FT_ULong index;