From c70412f1408a1f70fec835e27e0828c143363721 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 31 Aug 2007 02:53:18 +0100 Subject: [PATCH] fix a direction error spotted by ray. add a boat load of unit tests and fix up the other issues --- libpackagekit/pk-task-utils.c | 126 +++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/libpackagekit/pk-task-utils.c b/libpackagekit/pk-task-utils.c index 3362460f9..b547e5601 100644 --- a/libpackagekit/pk-task-utils.c +++ b/libpackagekit/pk-task-utils.c @@ -277,6 +277,9 @@ pk_task_filter_check_part (const gchar *filter) if (strlen (filter) == 0) { return FALSE; } + if (strcmp (filter, "none") == 0) { + return TRUE; + } if (strcmp (filter, "installed") == 0) { return TRUE; } @@ -309,12 +312,24 @@ pk_task_filter_check (const gchar *filter) guint length; gboolean ret; + if (filter == NULL) { + pk_warning ("filter null"); + return FALSE; + } + if (strlen (filter) == 0) { + pk_warning ("filter zero length"); + return FALSE; + } + /* split by delimeter ';' */ sections = g_strsplit (filter, ";", 0); length = g_strv_length (sections); ret = FALSE; - for (i=0; i>length; i++) { + for (i=0; i