diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-06-11 08:39:01 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-06-11 08:39:01 -0400 |
commit | ed5d893a29b8cc12642ad3a245f4a6e8716a7371 (patch) | |
tree | 27fa431c734a78372f4f7eeb618fc2a699175920 /pango | |
parent | b6dc6e05d694bb5a0bd396b5847291ead3a431ea (diff) | |
download | pango-ed5d893a29b8cc12642ad3a245f4a6e8716a7371.tar.gz |
Revert "PangoLanguage: Fix clang -Wcast-align warnings"
This reverts commit 3a9398fb989ff571aa40405987e20d548717687e.
This commit was causing crashes, see #481
Diffstat (limited to 'pango')
-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 * |