[evolution-data-server] CamelFolderSearch: Add argument guards to set() functions.



commit d970f9c43a3cfc20970375fe615547c405ae3b19
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jan 6 12:12:53 2012 -0500

    CamelFolderSearch: Add argument guards to set() functions.

 camel/camel-folder-search.c |   23 +++++++++++++++++------
 camel/camel-folder-search.h |    2 +-
 2 files changed, 18 insertions(+), 7 deletions(-)
---
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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]