[gnome-software: 1/6] appstream: Don’t check for G_IO_ERROR_INVALID_ARGUMENT from libxmlb
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 1/6] appstream: Don’t check for G_IO_ERROR_INVALID_ARGUMENT from libxmlb
- Date: Wed, 25 May 2022 13:28:45 +0000 (UTC)
commit 6b92ef7ca0ab4ee67f2a2d3bef08aeb4d8bec2b0
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed May 25 11:58:48 2022 +0100
appstream: Don’t check for G_IO_ERROR_INVALID_ARGUMENT from libxmlb
It shouldn’t really ever be returned, unless there’s been a programmer
error by passing an invalid query.
This error check has been cargo-culted throughout the gnome-software
code and should be removed pretty much everywhere.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
lib/gs-appstream.c | 40 +-------------------------------------
plugins/core/gs-plugin-appstream.c | 8 --------
plugins/flatpak/gs-flatpak.c | 2 --
3 files changed, 1 insertion(+), 49 deletions(-)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index 38cc31bb5..e2dba583e 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -359,8 +359,6 @@ gs_appstream_refine_add_addons (GsPlugin *plugin,
if (addons == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -394,8 +392,6 @@ gs_appstream_refine_add_images (GsApp *app, AsScreenshot *ss, XbNode *screenshot
if (images == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -424,8 +420,6 @@ gs_appstream_refine_add_screenshots (GsApp *app, XbNode *component, GError **err
if (screenshots == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -456,8 +450,6 @@ gs_appstream_refine_add_provides (GsApp *app, XbNode *component, GError **error)
if (provides == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -561,8 +553,6 @@ gs_appstream_copy_metadata (GsApp *app, XbNode *component, GError **error)
if (values == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -601,8 +591,7 @@ gs_appstream_refine_app_updates (GsApp *app,
gs_app_get_id (app));
releases_inst = xb_silo_query (silo, xpath, 0, &error_local);
if (releases_inst == NULL) {
- if (!g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
- !g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT)) {
+ if (!g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -621,8 +610,6 @@ gs_appstream_refine_app_updates (GsApp *app,
if (releases == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -722,8 +709,6 @@ gs_appstream_refine_add_version_history (GsApp *app, XbNode *component, GError *
if (releases == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -844,9 +829,6 @@ gs_appstream_refine_app_content_rating (GsApp *app,
if (content_attributes == NULL &&
g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
g_clear_error (&error_local);
- } else if (content_attributes == NULL &&
- g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT)) {
- return TRUE;
} else if (content_attributes == NULL) {
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
@@ -876,8 +858,6 @@ gs_appstream_refine_app_content_ratings (GsApp *app,
if (content_ratings == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -954,8 +934,6 @@ gs_appstream_refine_app_relations (GsApp *app,
if (recommends == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -971,8 +949,6 @@ gs_appstream_refine_app_relations (GsApp *app,
if (requires == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1463,8 +1439,6 @@ gs_appstream_search (GsPlugin *plugin,
if (components == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1549,8 +1523,6 @@ gs_appstream_add_category_apps (GsPlugin *plugin,
if (components == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1600,8 +1572,6 @@ gs_appstream_count_component_for_groups (XbSilo *silo,
if (array == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return 0;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return 0;
g_warning ("%s", error_local->message);
return 0;
}
@@ -1690,8 +1660,6 @@ gs_appstream_add_popular (XbSilo *silo,
if (array == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1729,8 +1697,6 @@ gs_appstream_add_recent (GsPlugin *plugin,
if (array == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1791,8 +1757,6 @@ gs_appstream_add_alternates (XbSilo *silo,
if (ids == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1828,8 +1792,6 @@ gs_appstream_add_featured (XbSilo *silo,
if (array == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 488db5384..528101691 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -1057,8 +1057,6 @@ gs_plugin_appstream_refine_state (GsPluginAppstream *self,
if (component == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1101,8 +1099,6 @@ gs_plugin_refine_from_id (GsPluginAppstream *self,
if (components == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1156,8 +1152,6 @@ gs_plugin_refine_from_pkgname (GsPluginAppstream *self,
if (component == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
continue;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- continue;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
@@ -1310,8 +1304,6 @@ refine_wildcard (GsPluginAppstream *self,
if (components == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 715a3f92e..086e843c2 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -3402,8 +3402,6 @@ gs_flatpak_refine_wildcard (GsFlatpak *self, GsApp *app,
if (components == NULL) {
if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
return TRUE;
- if (g_error_matches (error_local, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT))
- return TRUE;
g_propagate_error (error, g_steal_pointer (&error_local));
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]