[glib: 6/11] gio: relax g_content_type_is_a on win32
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 6/11] gio: relax g_content_type_is_a on win32
- Date: Thu, 17 Mar 2022 15:14:17 +0000 (UTC)
commit b60b0ec72de0f1d8f8fc6ecab93c78f13be96069
Author: Marc-André Lureau <marcandre lureau redhat com>
Date: Sat Jan 22 01:26:46 2022 +0400
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>
gio/gcontenttype-win32.c | 18 +++++++++++-------
1 file 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]