On Sat, 25 Feb 2006, Werner LEMBERG wrote:
> David,
>
>
> please fix compilation with a C++ compiler! For example, `make devel
> CC=g++' fails currently. Otherwise we get zillions of bug reports
> from Nelson Beebe :-)
>
> If there isn't an easy fix there should be a snippet in the configure
> script (or directly in the Makefiles) which activates the proper
> configuration macros.
Patch attached. It also fixes a bunch of warnings/errors not
related to C++. The highlights:
* For C++, it seems like undefining FT_STRICT_ALIASING makes
most of the errors go away, and with FT_STRICT_ALIASING, I
couldn't find any (easy) way to make it go.
* The rest of C++ errors were missing casts (of ints to enums
or the other way..., geez.)
With gcc, I have a lot of warning options enabled, the most
important here was -Wmissing-prototypes, which reveals functions
that should be static but are not, or missing header includes.
So:
* A bunch of missing includes fixed.
* src/sfnt/ttbdf.c seems to have \r\n line endings. The change
I have made there was because of the goto statement, g++ was
erring that the variables may not be initialized... So I made
them assignments instead of initialization, fixed that.
* In src/smooth/ftgrays.c, there was an extern function that I
made it static to go with the rest of the functions in that file,
but I think they all should be changed to FT_Callback.
That was basically it. I'm not quite convinced that
FT_STRICT_ALIASING is needed. David, were you getting new
warnings with gcc 4.1? Cause I fxied all strict-aliasing
warnings on gcc 4.0 previously.
--behdad
http://behdad.org/
"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
-- Dan Bern, "New American Language"
? objs/apinames
? objs/ftexport.sym
? objs/ftmodule.h
Index: builds/unix/ftsystem.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/builds/unix/ftsystem.c,v
retrieving revision 1.29
diff -u -p -d -r1.29 ftsystem.c
--- builds/unix/ftsystem.c 18 Nov 2005 08:23:06 -0000 1.29
+++ builds/unix/ftsystem.c 25 Feb 2006 12:26:19 -0000
@@ -24,6 +24,7 @@
#include FT_ERRORS_H
#include FT_TYPES_H
#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_STREAM_H
/* memory-mapping includes and definitions */
#ifdef HAVE_UNISTD_H
@@ -224,7 +225,7 @@
}
- /* documentation is in ftobjs.h */
+ /* documentation is in ftstream.h */
FT_BASE_DEF( FT_Error )
FT_Stream_Open( FT_Stream stream,
Index: include/freetype/config/ftheader.h
===================================================================
RCS file: /cvsroot/freetype/freetype2/include/freetype/config/ftheader.h,v
retrieving revision 1.39
diff -u -p -d -r1.39 ftheader.h
--- include/freetype/config/ftheader.h 27 Jan 2006 14:16:16 -0000 1.39
+++ include/freetype/config/ftheader.h 25 Feb 2006 12:26:19 -0000
@@ -603,6 +603,19 @@
#define FT_GX_VALIDATE_H <freetype/ftgxval.h>
+ /*************************************************************************
+ *
+ * @macro:
+ * FT_PFR_H
+ *
+ * @description:
+ * A macro used in #include statements to name the file containing the
+ * FreeType 2 API used to access PFR-specific data.
+ *
+ */
+#define FT_PFR_H <freetype/ftpfr.h>
+
+
/* */
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
Index: include/freetype/config/ftoption.h
===================================================================
RCS file: /cvsroot/freetype/freetype2/include/freetype/config/ftoption.h,v
retrieving revision 1.104
diff -u -p -d -r1.104 ftoption.h
--- include/freetype/config/ftoption.h 22 Feb 2006 08:23:35 -0000 1.104
+++ include/freetype/config/ftoption.h 25 Feb 2006 12:26:20 -0000
@@ -587,7 +587,9 @@ FT_BEGIN_HEADER
* releases from emitting zillions of `strict aliasing' warning messages
* each time a memory-management function is called.
*/
+#ifndef __cplusplus
#define FT_STRICT_ALIASING
+#endif
/*
Index: include/freetype/internal/services/svotval.h
===================================================================
RCS file:
/cvsroot/freetype/freetype2/include/freetype/internal/services/svotval.h,v
retrieving revision 1.1
diff -u -p -d -r1.1 svotval.h
--- include/freetype/internal/services/svotval.h 10 Sep 2004 14:39:00
-0000 1.1
+++ include/freetype/internal/services/svotval.h 25 Feb 2006 12:26:20
-0000
@@ -19,6 +19,8 @@
#ifndef __SVOTVAL_H__
#define __SVOTVAL_H__
+#include FT_OPENTYPE_VALIDATE_H
+#include FT_INTERNAL_VALIDATE_H
FT_BEGIN_HEADER
Index: include/freetype/internal/services/svpfr.h
===================================================================
RCS file:
/cvsroot/freetype/freetype2/include/freetype/internal/services/svpfr.h,v
retrieving revision 1.2
diff -u -p -d -r1.2 svpfr.h
--- include/freetype/internal/services/svpfr.h 22 Sep 2003 09:53:52 -0000
1.2
+++ include/freetype/internal/services/svpfr.h 25 Feb 2006 12:26:20 -0000
@@ -19,6 +19,7 @@
#ifndef __SVPFR_H__
#define __SVPFR_H__
+#include FT_PFR_H
#include FT_INTERNAL_SERVICE_H
Index: src/autofit/afcjk.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/autofit/afcjk.c,v
retrieving revision 1.5
diff -u -p -d -r1.5 afcjk.c
--- src/autofit/afcjk.c 15 Feb 2006 06:05:52 -0000 1.5
+++ src/autofit/afcjk.c 25 Feb 2006 12:26:20 -0000
@@ -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,8 @@
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 +1124,7 @@
#endif /* 0 */
- delta = af_hint_normal_stem( hints, edge, edge2, 0, 0 );
+ delta = af_hint_normal_stem( hints, edge, edge2, AF_DIMENSION_HORZ,
AF_DIMENSION_HORZ );
}
else
af_hint_normal_stem( hints, edge, edge2, delta, dim );
Index: src/base/ftobjs.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/base/ftobjs.c,v
retrieving revision 1.243
diff -u -p -d -r1.243 ftobjs.c
--- src/base/ftobjs.c 24 Feb 2006 06:11:30 -0000 1.243
+++ src/base/ftobjs.c 25 Feb 2006 12:26:21 -0000
@@ -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; /* shut gcc up */
switch ( req->type )
@@ -3688,8 +3688,8 @@
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;
}
Index: src/base/ftutil.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/base/ftutil.c,v
retrieving revision 1.16
diff -u -p -d -r1.16 ftutil.c
--- src/base/ftutil.c 17 Feb 2006 08:07:09 -0000 1.16
+++ src/base/ftutil.c 25 Feb 2006 12:26:21 -0000
@@ -624,7 +624,11 @@
{
if ( *P )
{
+#ifdef FT_STRICT_ALIASING
ft_mem_free( memory, *P );
+#else
+ ft_mem_free( memory, P );
+#endif
*P = NULL;
}
}
Index: src/bdf/bdfdrivr.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/bdf/bdfdrivr.c,v
retrieving revision 1.57
diff -u -p -d -r1.57 bdfdrivr.c
--- src/bdf/bdfdrivr.c 16 Feb 2006 22:45:31 -0000 1.57
+++ src/bdf/bdfdrivr.c 25 Feb 2006 12:26:21 -0000
@@ -337,7 +337,7 @@ THE SOFTWARE.
BDF_Face face = (BDF_Face)bdfface;
FT_Memory memory = FT_FACE_MEMORY( face );
- bdf_font_t* font;
+ bdf_font_t* font = NULL; /* shut gcc up */
bdf_options_t options;
FT_UNUSED( num_params );
Index: src/cff/cffcmap.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/cff/cffcmap.c,v
retrieving revision 1.14
diff -u -p -d -r1.14 cffcmap.c
--- src/cff/cffcmap.c 17 Jan 2006 16:55:32 -0000 1.14
+++ src/cff/cffcmap.c 25 Feb 2006 12:26:21 -0000
@@ -119,7 +119,7 @@
/*************************************************************************/
/*************************************************************************/
- const char *
+ FT_CALLBACK_DEF( const char * )
cff_sid_to_glyph_name( CFF_Font cff,
FT_UInt idx )
{
Index: src/cff/cffobjs.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/cff/cffobjs.c,v
retrieving revision 1.79
diff -u -p -d -r1.79 cffobjs.c
--- src/cff/cffobjs.c 14 Feb 2006 06:40:10 -0000 1.79
+++ src/cff/cffobjs.c 25 Feb 2006 12:26:22 -0000
@@ -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;
Index: src/gzip/ftgzip.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/gzip/ftgzip.c,v
retrieving revision 1.21
diff -u -p -d -r1.21 ftgzip.c
--- src/gzip/ftgzip.c 27 Jan 2006 14:16:16 -0000 1.21
+++ src/gzip/ftgzip.c 25 Feb 2006 12:26:22 -0000
@@ -24,6 +24,7 @@
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
+#include FT_GZIP_H
#include <string.h>
Index: src/lzw/ftlzw.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/lzw/ftlzw.c,v
retrieving revision 1.4
diff -u -p -d -r1.4 ftlzw.c
--- src/lzw/ftlzw.c 16 Mar 2005 01:49:54 -0000 1.4
+++ src/lzw/ftlzw.c 25 Feb 2006 12:26:22 -0000
@@ -26,6 +26,7 @@
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
+#include FT_LZW_H
#include <string.h>
#include <stdio.h>
Index: src/lzw/ftlzw2.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/lzw/ftlzw2.c,v
retrieving revision 1.3
diff -u -p -d -r1.3 ftlzw2.c
--- src/lzw/ftlzw2.c 23 Oct 2005 19:25:41 -0000 1.3
+++ src/lzw/ftlzw2.c 25 Feb 2006 12:26:22 -0000
@@ -26,6 +26,7 @@
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_DEBUG_H
+#include FT_LZW_H
#include <string.h>
#include <stdio.h>
Index: src/psaux/afmparse.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/psaux/afmparse.c,v
retrieving revision 1.6
diff -u -p -d -r1.6 afmparse.c
--- src/psaux/afmparse.c 31 Jan 2006 07:01:24 -0000 1.6
+++ src/psaux/afmparse.c 25 Feb 2006 12:26:22 -0000
@@ -513,7 +513,7 @@
return AFM_TOKEN_UNKNOWN;
if ( ft_strncmp( afm_key_table[n], key, len ) == 0 )
- return n;
+ return (AFM_Token)n;
}
}
}
Index: src/psaux/t1cmap.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/psaux/t1cmap.c,v
retrieving revision 1.16
diff -u -p -d -r1.16 t1cmap.c
--- src/psaux/t1cmap.c 12 Jan 2006 08:12:26 -0000 1.16
+++ src/psaux/t1cmap.c 25 Feb 2006 12:26:22 -0000
@@ -257,7 +257,7 @@
/*************************************************************************/
/*************************************************************************/
- const char *
+ FT_CALLBACK_DEF( const char * )
t1_get_glyph_name( T1_Face face,
FT_UInt idx )
{
Index: src/sfnt/ttbdf.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/sfnt/ttbdf.c,v
retrieving revision 1.3
diff -u -p -d -r1.3 ttbdf.c
--- src/sfnt/ttbdf.c 28 Dec 2005 06:47:12 -0000 1.3
+++ src/sfnt/ttbdf.c 25 Feb 2006 12:26:23 -0000
@@ -86,6 +86,9 @@
FT_UInt num_strikes = FT_NEXT_USHORT( p );
FT_UInt32 strings = FT_NEXT_ULONG ( p );
+ FT_UInt count;
+ FT_Byte* strike;
+
if ( version != 0x0001 ||
strings < 8 ||
@@ -102,13 +105,11 @@
bdf->num_strikes = num_strikes;
bdf->strings = bdf->table + strings;
bdf->strings_size = length - strings;
- }
- /* check the strike descriptors */
- {
- FT_UInt count = bdf->num_strikes;
- FT_Byte* p = bdf->table + 8;
- FT_Byte* strike = p + count * 4;
+ /* check the strike descriptors */
+ count = bdf->num_strikes;
+ p = bdf->table + 8;
+ strike = p + count * 4;
for ( ; count > 0; count-- )
Index: src/smooth/ftgrays.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/smooth/ftgrays.c,v
retrieving revision 1.66
diff -u -p -d -r1.66 ftgrays.c
--- src/smooth/ftgrays.c 20 May 2005 06:22:20 -0000 1.66
+++ src/smooth/ftgrays.c 25 Feb 2006 12:26:23 -0000
@@ -1959,7 +1959,7 @@
}
- extern int
+ static int
gray_raster_render( PRaster raster,
const FT_Raster_Params* params )
{
Index: src/tools/apinames.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/tools/apinames.c,v
retrieving revision 1.4
diff -u -p -d -r1.4 apinames.c
--- src/tools/apinames.c 27 Jan 2006 12:11:22 -0000 1.4
+++ src/tools/apinames.c 25 Feb 2006 12:26:24 -0000
@@ -86,14 +86,14 @@ names_add( const char* name,
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" );
}
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" );
@@ -298,7 +298,7 @@ usage( void )
"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",
+ " -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"
Index: src/truetype/ttdriver.c
===================================================================
RCS file: /cvsroot/freetype/freetype2/src/truetype/ttdriver.c,v
retrieving revision 1.90
diff -u -p -d -r1.90 ttdriver.c
--- src/truetype/ttdriver.c 22 Feb 2006 08:23:35 -0000 1.90
+++ src/truetype/ttdriver.c 25 Feb 2006 12:26:24 -0000
@@ -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;
_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel