diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-08-22 22:52:08 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-08-22 22:52:08 +0000 |
commit | c9f014f6478e48efd4427efa0f1d1f37a2c3563b (patch) | |
tree | 0eb952ac056c945715ecd08e446db3db566cb510 /pango | |
parent | b9b68dba2e563f320b7c4b3ea73c68bfa1d9a804 (diff) | |
download | pango-c9f014f6478e48efd4427efa0f1d1f37a2c3563b.tar.gz |
Add some macro definitions for gcc-3.3 that suppress the bogus
Fri Aug 22 18:09:52 2003 Owen Taylor <otaylor@redhat.com>
* pango/opentype/fterrcompat.h: Add some macro definitions
for gcc-3.3 that suppress the bogus strict-aliasing
warnings.
* pango/pango-utils.c (read_config_file): Use
g_hash_table_new_full() to simplify code and fix
gcc-3.3 warnings.
* pango/pangox-fontmap.c (pango_x_real_get_coverage_win)
* pango/querymodules.c (query_module): Suppress gcc-3.3
warnings.
* pango/modules.c (pango_find_map): Fix warning from
missing declaration of pango_module_get_type().
* pango/pango-context.c/pango-engine.c: Fix name confusion
for pango_get_fallback_shaper().
Diffstat (limited to 'pango')
-rw-r--r-- | pango/modules.c | 2 | ||||
-rw-r--r-- | pango/opentype/fterrcompat.h | 36 | ||||
-rw-r--r-- | pango/pango-context.c | 3 | ||||
-rw-r--r-- | pango/pango-engine.c | 2 | ||||
-rw-r--r-- | pango/pango-utils.c | 20 | ||||
-rw-r--r-- | pango/pangofc-fontmap.c | 8 | ||||
-rw-r--r-- | pango/pangox-fontmap.c | 10 | ||||
-rw-r--r-- | pango/querymodules.c | 22 |
8 files changed, 75 insertions, 28 deletions
diff --git a/pango/modules.c b/pango/modules.c index d96f89fe..84cffff5 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -100,6 +100,8 @@ GObjectClass *parent_class; static void build_map (PangoMapInfo *info); static void init_modules (void); +static GType pango_module_get_type (void); + /** * pango_find_map: * @language: the language tag for which to find the map diff --git a/pango/opentype/fterrcompat.h b/pango/opentype/fterrcompat.h index 223a993d..f439293f 100644 --- a/pango/opentype/fterrcompat.h +++ b/pango/opentype/fterrcompat.h @@ -29,6 +29,37 @@ #define GET_ULong() FT_GET_ULONG() #define GET_Tag4() FT_GET_TAG4() +/* Macro definitions to avoid bogus warnings about strict + * aliasing. These make code generation worse, so we only + * use them when necessary + */ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) ({ \ + void *_tmp_; \ + FT_SET_ERROR (FT_MEM_ALLOC_ARRAY( _tmp_, _count_, _type_ )); \ + _pointer_ = _tmp_; \ +}) + +/* FT_MEM_REALLOC macro broken in 2.1.0 */ +#define REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) ({ \ + void *_tmp_; \ + FT_SET_ERROR ( FT_MEM_REALLOC( _tmp_, \ + (_old_) * sizeof ( _type_ ), \ + (_new_) * sizeof ( _type_ ) ) ); \ + _pointer_ = _tmp_; \ +}) + +#define FREE( _pointer_ ) ({ \ + void *_tmp_ = _pointer_; \ + FT_FREE ( _tmp_ ); \ + _pointer_ = _tmp_; \ +}) +#define ALLOC( _pointer_, _size_ ) ({ \ + void *_tmp_; \ + FT_ALLOC( _tmp_, _size_ ); \ + _pointer_ = _tmp_; \ +}) +#else #define ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ FT_SET_ERROR (FT_MEM_ALLOC_ARRAY( _pointer_, _count_, _type_)) @@ -37,11 +68,12 @@ FT_SET_ERROR ( FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( _type_ ), \ (_new_) * sizeof ( _type_ ) ) ) -#define ALLOC( _pointer_, _size_ ) FT_ALLOC( _pointer_, _size_ ) #define FREE( _pointer_ ) FT_FREE( _pointer_ ) +#define ALLOC( _pointer_, _size_ ) FT_ALLOC( _pointer_, _size_ ) +#endif /* gcc >= 3.3 */ #define MEM_Copy( dest, source, count ) FT_MEM_COPY( dest, source, count ) -#endif /* >= 2.1.0 */ +#endif /* freetype >= 2.1.0 */ #endif /* FTERRCOMPAT_H */ diff --git a/pango/pango-context.c b/pango/pango-context.c index 8f9de155..ce11daa4 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -26,6 +26,7 @@ #include "pango/pango-utils.h" #include "pango-engine.h" +#include "pango-engine-private.h" #include "pango-modules.h" struct _PangoContext @@ -624,7 +625,7 @@ add_engines (PangoContext *context, analysis->shape_engine = NULL; if (analysis->shape_engine == NULL) - analysis->shape_engine = pango_get_fallback_shaper (); + analysis->shape_engine = _pango_get_fallback_shaper (); analysis->extra_attrs = extra_attrs; } diff --git a/pango/pango-engine.c b/pango/pango-engine.c index 034f5eb6..844a534d 100644 --- a/pango/pango-engine.c +++ b/pango/pango-engine.c @@ -151,7 +151,7 @@ static PANGO_DEFINE_TYPE (PangoFallbackEngine, pango_fallback_engine, PANGO_TYPE_ENGINE_SHAPE); PangoEngineShape * -pango_get_fallback_shaper (void) +_pango_get_fallback_shaper (void) { static PangoEngineShape *fallback_shaper = NULL; if (!fallback_shaper) diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 285ae089..9478b59b 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -498,7 +498,7 @@ read_config_file (const char *filename, gboolean enoent_error) { gboolean empty = FALSE; gboolean append = FALSE; - char *k, *v; + char *v; if (!section) { @@ -545,16 +545,12 @@ read_config_file (const char *filename, gboolean enoent_error) g_string_prepend_c (tmp_buffer1, '/'); g_string_prepend (tmp_buffer1, section); - /* Remove any existing values */ - if (g_hash_table_lookup_extended (config_hash, tmp_buffer1->str, - (gpointer *)&k, (gpointer *)&v)) + if (append) { - g_free (k); - if (append) - { - g_string_prepend (tmp_buffer2, v); - g_free (v); - } + /* Get any existing value */ + v = g_hash_table_lookup (config_hash, tmp_buffer1->str); + if (v) + g_string_prepend (tmp_buffer2, v); } if (!empty) @@ -594,7 +590,9 @@ read_config () const char *home; const char *envvar; - config_hash = g_hash_table_new (g_str_hash, g_str_equal); + config_hash = g_hash_table_new_full (g_str_hash, g_str_equal, + (GDestroyNotify)g_free, + (GDestroyNotify)g_free); filename = g_build_filename (pango_get_sysconf_subdirectory (), "pangorc", NULL); diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 5916ed46..78199339 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -452,14 +452,14 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap, count = 0; for (i = 0; i < fontset->nfont; i++) { - char *s; + FcChar8 *s; FcResult res; res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **) &s); g_assert (res == FcResultMatch); if (!is_alias_family (s)) - priv->families[count++] = create_family (fcfontmap, s); + priv->families[count++] = create_family (fcfontmap, (gchar *)s); } FcFontSetDestroy (fontset); @@ -1014,14 +1014,14 @@ pango_fc_font_description_from_pattern (FcPattern *pattern, gboolean include_siz PangoWeight weight; double size; - char *s; + FcChar8 *s; int i; desc = pango_font_description_new (); g_assert (FcPatternGetString (pattern, FC_FAMILY, 0, (FcChar8 **) &s) == FcResultMatch); - pango_font_description_set_family (desc, s); + pango_font_description_set_family (desc, (gchar *)s); if (FcPatternGetInteger (pattern, FC_SLANT, 0, &i) == FcResultMatch) { diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c index af669c67..ca6615ec 100644 --- a/pango/pangox-fontmap.c +++ b/pango/pangox-fontmap.c @@ -545,7 +545,7 @@ pango_x_real_get_coverage_win (Display *display) int format; gulong n_items; gulong bytes_after; - Atom *data; + guchar *data; Window retval = None; int (*old_handler) (Display *, XErrorEvent *); @@ -559,12 +559,12 @@ pango_x_real_get_coverage_win (Display *display) 0, 4, False, XA_WINDOW, &type, &format, &n_items, &bytes_after, - (guchar **)&data); + &data); if (type == XA_WINDOW) { if (format == 32 && n_items == 1 && bytes_after == 0) - retval = *data; + retval = *(Atom *)data; XFree (data); } @@ -577,11 +577,11 @@ pango_x_real_get_coverage_win (Display *display) 0, 4, False, XA_WINDOW, &type, &format, &n_items, &bytes_after, - (guchar **)&data) == Success && + &data) == Success && type == XA_WINDOW) { if (format != 32 || n_items != 1 || bytes_after != 0 || - *data != retval) + *(Atom *)data != retval) retval = None; XFree (data); diff --git a/pango/querymodules.c b/pango/querymodules.c index 2c6542dc..88075628 100644 --- a/pango/querymodules.c +++ b/pango/querymodules.c @@ -84,6 +84,20 @@ escape_string (const char *str) return g_string_free (result, FALSE); } +/* Suppresses strict-aliasing warnings for gcc >= 3.3 */ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +#define GET_SYMBOL(module,name,location) ({ \ + gboolean result; \ + void *tmp; \ + result = g_module_symbol (module, name, &tmp); \ + location = (typeof(location))tmp; \ + result; \ +}) +#else +#define GET_SYMBOL(module,name,location) \ + g_module_symbol (module, name, (gpointer *)&location); +#endif + void query_module (const char *dir, const char *name) { @@ -106,10 +120,10 @@ query_module (const char *dir, const char *name) g_printerr ("Cannot load module %s: %s\n", path, g_module_error ()); if (module && - g_module_symbol (module, "script_engine_list", (gpointer *) &list) && - g_module_symbol (module, "script_engine_init", (gpointer *) &init) && - g_module_symbol (module, "script_engine_exit", (gpointer *) &exit) && - g_module_symbol (module, "script_engine_create", (gpointer *) &create)) + GET_SYMBOL (module, "script_engine_list", list) && + GET_SYMBOL (module, "script_engine_init", init) && + GET_SYMBOL (module, "script_engine_exit", exit) && + GET_SYMBOL (module, "script_engine_create", create)) { gint i,j; PangoEngineInfo *engines; |