From: Matthew Barnes Date: Fri, 6 Jan 2012 17:12:53 +0000 (-0500) Subject: CamelFolderSearch: Add argument guards to set() functions. X-Git-Tag: upstream/3.7.4~1306 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d970f9c43a3cfc20970375fe615547c405ae3b19;p=platform%2Fupstream%2Fevolution-data-server.git CamelFolderSearch: Add argument guards to set() functions. --- diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index 416634c..3be7b3d 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -266,6 +266,9 @@ void camel_folder_search_set_folder (CamelFolderSearch *search, CamelFolder *folder) { + g_return_if_fail (CAMEL_IS_FOLDER_SEARCH (search)); + g_return_if_fail (CAMEL_IS_FOLDER (folder)); + search->folder = folder; } @@ -283,13 +286,15 @@ void camel_folder_search_set_summary (CamelFolderSearch *search, GPtrArray *summary) { + g_return_if_fail (CAMEL_IS_FOLDER_SEARCH (search)); + search->summary = summary; } /** * camel_folder_search_set_body_index: * @search: - * @index: + * @body_index: * * Set the index representing the contents of all messages * in this folder. If this is not set, then the folder implementation @@ -298,13 +303,19 @@ camel_folder_search_set_summary (CamelFolderSearch *search, **/ void camel_folder_search_set_body_index (CamelFolderSearch *search, - CamelIndex *index) + CamelIndex *body_index) { - if (search->body_index) + g_return_if_fail (CAMEL_IS_FOLDER_SEARCH (search)); + + if (body_index != NULL) { + g_return_if_fail (CAMEL_IS_INDEX (body_index)); + g_object_ref (body_index); + } + + if (search->body_index != NULL) g_object_unref (search->body_index); - search->body_index = index; - if (index) - g_object_ref (index); + + search->body_index = body_index; } /** diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h index a1b2448..b3a7a4a 100644 --- a/camel/camel-folder-search.h +++ b/camel/camel-folder-search.h @@ -158,7 +158,7 @@ void camel_folder_search_construct (CamelFolderSearch *search); /* This stuff currently gets cleared when you run a search ... what on earth was i thinking ... */ void camel_folder_search_set_folder (CamelFolderSearch *search, CamelFolder *folder); void camel_folder_search_set_summary (CamelFolderSearch *search, GPtrArray *summary); -void camel_folder_search_set_body_index (CamelFolderSearch *search, CamelIndex *index); +void camel_folder_search_set_body_index (CamelFolderSearch *search, CamelIndex *body_index); /* this interface is deprecated */ GPtrArray *camel_folder_search_execute_expression (CamelFolderSearch *search, const gchar *expr, GError **error);