2006-08-27 Jens Claudius <jens.claudius@yahoo.com> 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.
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
diff --git a/ChangeLog b/ChangeLog
index cc74a78..ba9be1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2006-08-27 Jens Claudius <jens.claudius@yahoo.com>
+
+ 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 <wl@gnu.org>
* builds/unix/ftconfig.in: Synchronize with main ftconfig.h.
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index ef3d3f4..fb9e58f 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -211,7 +211,7 @@ FT_BEGIN_HEADER
/* 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. */
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 7ebb141..52a5c20 100644
--- 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];
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 95f297d..a871d50 100644
--- 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 );
}
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 6b75035..fa3dd2f 100644
--- 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;
diff --git a/src/gxvalid/gxvmod.c b/src/gxvalid/gxvmod.c
index d471c2a..b2b16b1 100644
--- 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;