diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-06-11 12:54:21 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-06-11 12:54:21 +0000 |
commit | 4c1c1e60b7df9c9c49adc7e4fed3b203f16ec28e (patch) | |
tree | 7a6ebf6e308ea177a8c8ce838ad11f6651c19436 | |
parent | 96587a9e70afe9cab04f9d13d1b6cedf3dd6ae4c (diff) | |
parent | ed5d893a29b8cc12642ad3a245f4a6e8716a7371 (diff) | |
download | pango-4c1c1e60b7df9c9c49adc7e4fed3b203f16ec28e.tar.gz |
Merge branch 'fix-gtk2-crash' into 'master'
Revert "PangoLanguage: Fix clang -Wcast-align warnings"
See merge request GNOME/pango!203
-rw-r--r-- | pango/pango-language.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/pango/pango-language.c b/pango/pango-language.c index ed8b0195..575d4652 100644 --- a/pango/pango-language.c +++ b/pango/pango-language.c @@ -66,7 +66,7 @@ pango_language_get_private (PangoLanguage *language) if (!language) return NULL; - priv = (PangoLanguagePrivate *) ((void *)((char *)language - sizeof (PangoLanguagePrivate))); + priv = (PangoLanguagePrivate *) ((char *)language - sizeof (PangoLanguagePrivate)); if (G_UNLIKELY (priv->magic != PANGO_LANGUAGE_PRIVATE_MAGIC)) { @@ -331,7 +331,7 @@ pango_language_from_string (const char *language) G_LOCK_DEFINE_STATIC (lang_from_string); static GHashTable *hash = NULL; /* MT-safe */ PangoLanguagePrivate *priv; - void *result; + char *result; int len; char *p; @@ -354,7 +354,7 @@ pango_language_from_string (const char *language) g_assert (result); priv = (PangoLanguagePrivate *) result; - result = ((char *)result) + sizeof (*priv); + result += sizeof (*priv); pango_language_private_init (priv); @@ -749,7 +749,7 @@ parse_default_languages (void) { char *p, *p_copy; gboolean done = FALSE; - GPtrArray *langs; + GArray *langs; p = getenv ("PANGO_LANGUAGE"); @@ -761,34 +761,34 @@ parse_default_languages (void) p_copy = p = g_strdup (p); - langs = g_ptr_array_new (); + langs = g_array_new (TRUE, FALSE, sizeof (PangoLanguage *)); while (!done) { char *end = strpbrk (p, LANGUAGE_SEPARATORS); if (!end) - { - end = p + strlen (p); - done = TRUE; - } + { + end = p + strlen (p); + done = TRUE; + } else *end = '\0'; /* skip empty languages, and skip the language 'C' */ if (p != end && !(p + 1 == end && *p == 'C')) { - PangoLanguage *l = pango_language_from_string (p); - - g_ptr_array_add (langs, l); - } + PangoLanguage *l = pango_language_from_string (p); + + g_array_append_val (langs, l); + } if (!done) - p = end + 1; + p = end + 1; } g_free (p_copy); - return (PangoLanguage **) g_ptr_array_free (langs, FALSE); + return (PangoLanguage **) g_array_free (langs, FALSE); } static PangoLanguage * |