diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-01-22 01:26:46 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-03-09 11:41:30 +0400 |
commit | b60b0ec72de0f1d8f8fc6ecab93c78f13be96069 (patch) | |
tree | 9d2389fd4dbe0dd61102176c84c9341e321e93bf | |
parent | ab0c00bd7ee71745b9bb401c75482018a664b036 (diff) | |
download | glib-b60b0ec72de0f1d8f8fc6ecab93c78f13be96069.tar.gz |
gio: relax g_content_type_is_a on win32
This is quite gross, but it looks like the whole content-type code on
Windows is similar. Pass test_subtype.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r-- | gio/gcontenttype-win32.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gio/gcontenttype-win32.c b/gio/gcontenttype-win32.c index cac114e56..9b6f69ece 100644 --- a/gio/gcontenttype-win32.c +++ b/gio/gcontenttype-win32.c @@ -128,7 +128,8 @@ g_content_type_is_a (const gchar *type, const gchar *supertype) { gboolean res; - char *value_utf8; + char *perceived_type; + char *perceived_supertype; g_return_val_if_fail (type != NULL, FALSE); g_return_val_if_fail (supertype != NULL, FALSE); @@ -136,12 +137,15 @@ g_content_type_is_a (const gchar *type, if (g_content_type_equals (type, supertype)) return TRUE; - res = FALSE; - value_utf8 = get_registry_classes_key (type, L"PerceivedType"); - if (value_utf8 && strcmp (value_utf8, supertype) == 0) - res = TRUE; - g_free (value_utf8); - + perceived_type = get_registry_classes_key (type, L"PerceivedType"); + perceived_supertype = get_registry_classes_key (supertype, L"PerceivedType"); + + res = perceived_type && perceived_supertype && + strcmp (perceived_type, perceived_supertype) == 0; + + g_free (perceived_type); + g_free (perceived_supertype); + return res; } |