ref: a787f45580b8d0dee569b7cafceb7c8737df6487
parent: c4c35b773dbeb444bf2848619defce03660b0e4b
author: Jens Claudius <[email protected]>
date: Sun Aug 27 07:26:18 EDT 2006
2006-08-27 Jens Claudius <[email protected]> Fix miscellaneous compiler warnings. * freetype2/include/freetype/internal/ftobjs.h: close comment with `*/' to avoid `/* in comment' compiler warning. * freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn cast `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)' since on 64-bit platforms void* is larger than FT_UInt32. * freetype2/src/base/ftobjs.c (t_validator_error): cast away volatileness of argument to ft_longjmp. Spotted by Werner `Putzfrau' Lemberg. * freetype2/src/bdf/bdflib.c (bdf_load_font): initialize local variable `lineno'. * freetype2/src/gxvalid/gxvmod.c (classic_kern_validate): mark local variable `error' volatile.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2006-08-27 Jens Claudius <[email protected]>
+
+ Fix miscellaneous compiler warnings.
+
+ * freetype2/include/freetype/internal/ftobjs.h: close
+ comment with `*/' to avoid `/* in comment' compiler warning.
+
+ * freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn
+ cast `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)'
+ since on 64-bit platforms void* is larger than FT_UInt32.
+
+ * freetype2/src/base/ftobjs.c (t_validator_error): cast
+ away volatileness of argument to ft_longjmp. Spotted by
+ Werner `Putzfrau' Lemberg.
+
+ * freetype2/src/bdf/bdflib.c (bdf_load_font): initialize
+ local variable `lineno'.
+
+ * freetype2/src/gxvalid/gxvmod.c (classic_kern_validate):
+ mark local variable `error' volatile.
+
2006-08-27 Werner Lemberg <[email protected]>
* builds/unix/ftconfig.in: Synchronize with main ftconfig.h.
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -211,7 +211,7 @@
/* this data when first opened. This field exists only if */
/* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
- /* force_autohing ::
+ /* force_autohing :: */
/* this boolean flag is used to instruct the glyph loader to */
/* ignore the format-specific hinter, and use the auto-hinter */
/* instead to load all glyphs. */
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -460,7 +460,9 @@
FT_MemSource node, *pnode;
- hash = (FT_UInt32)(void*)_ft_debug_file +
+ /* cast to FT_PtrDist first since void* can be larger */
+ /* than FT_UInt32 and GCC 4.1.1 emits a warning */
+ hash = (FT_UInt32)(FT_PtrDist)(void*)_ft_debug_file +
(FT_UInt32)( 5 * _ft_debug_lineno );
pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -89,8 +89,17 @@
ft_validator_error( FT_Validator valid,
FT_Error error )
{
+ /* since the cast below also disables the compiler's */
+ /* type check, we introduce a dummy variable, which */
+ /* will be optimized away */
+ volatile jmp_buf* jump_buffer = &valid->jump_buffer;
+
+
valid->error = error;
- ft_longjmp( valid->jump_buffer, 1 );
+
+ /* throw away volatileness; use `jump_buffer' or the */
+ /* compiler may warn about an unused local variable */
+ ft_longjmp( *(jmp_buf*) jump_buffer, 1 );
}
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -2204,7 +2204,7 @@
bdf_options_t* opts,
bdf_font_t* *font )
{
- unsigned long lineno;
+ unsigned long lineno = 0; /* make compiler happy */
_bdf_parse_t *p;
FT_Memory memory = extmemory;
--- a/src/gxvalid/gxvmod.c
+++ b/src/gxvalid/gxvmod.c
@@ -197,7 +197,10 @@
FT_Byte* volatile ckern = NULL;
FT_ULong len_ckern = 0;
- FT_Error error = GXV_Err_Ok;
+ /* without volatile on `error' GCC 4.1.1. emits: */
+ /* warning: variable 'error' might be clobbered by 'longjmp' or 'vfork' */
+ /* this warning seems spurious but --- */
+ FT_Error volatile error = GXV_Err_Ok;
FT_ValidatorRec volatile valid;