[evolution-patches] mail, #47208, vFolder with expression #t not working



vfolder search expected a vector expression.  rather than expose that to
the user, it just treats the Expression entry as a bool and vectorises
it implictly (last part of patch).

also some improved warnings/fix to the filter version of the expression
evaluator.

 Z

Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1836.2.6
diff -u -3 -r1.1836.2.6 ChangeLog
--- camel/ChangeLog	29 Jul 2003 13:53:28 -0000	1.1836.2.6
+++ camel/ChangeLog	1 Aug 2003 18:02:42 -0000
@@ -1,3 +1,14 @@
+2003-08-01  Not Zed  <NotZed Ximian com>
+
+	** See bug #47208.
+
+	* camel-filter-search.c (match_all): match-all with no arguments	
+	should always return TRUE.
+
+	* camel-folder-search.c (camel_folder_search_execute_expression):
+	print a warning when we get an invalid result type & fixed a leak
+	for that case.
+	
 2003-07-25  Jeffrey Stedfast  <fejj ximian com>
 
 	* camel-mime-utils.c (header_decode_word): Revert NotZed's fix for
Index: camel/camel-filter-search.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-filter-search.c,v
retrieving revision 1.31
diff -u -3 -r1.31 camel-filter-search.c
--- camel/camel-filter-search.c	25 Feb 2003 19:43:22 -0000	1.31
+++ camel/camel-filter-search.c	1 Aug 2003 18:02:42 -0000
@@ -313,7 +313,7 @@
 		return e_sexp_term_eval (f, argv[0]);
 	
 	r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-	r->value.bool = FALSE;
+	r->value.bool = TRUE;
 	
 	return r;
 }
Index: camel/camel-folder-search.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-folder-search.c,v
retrieving revision 1.54.4.1
diff -u -3 -r1.54.4.1 camel-folder-search.c
--- camel/camel-folder-search.c	1 Jul 2003 18:48:43 -0000	1.54.4.1
+++ camel/camel-folder-search.c	1 Aug 2003 18:02:43 -0000
@@ -362,8 +362,7 @@
 	matches = g_ptr_array_new();
 
 	/* now create a folder summary to return?? */
-	if (r
-	    && r->type == ESEXP_RES_ARRAY_PTR) {
+	if (r->type == ESEXP_RES_ARRAY_PTR) {
 		d(printf("got result ...\n"));
 		/* we use a mempool to store the strings, packed in tight as possible, and freed together */
 		/* because the strings are often short (like <8 bytes long), we would be wasting appx 50%
@@ -391,14 +390,15 @@
 				g_ptr_array_add(matches, e_mempool_strdup(pool, g_ptr_array_index(r->value.ptrarray, i)));
 			}
 		}
-		e_sexp_result_free(search->sexp, r);
 		/* instead of putting the mempool_hash in the structure, we keep the api clean by
 		   putting a reference to it in a hashtable.  Lets us do some debugging and catch
 		   unfree'd results as well. */
 		g_hash_table_insert(p->mempool_hash, matches, pool);
 	} else {
-		d(printf("no result!\n"));
+		g_warning("Search returned an invalid result type");
 	}
+
+	e_sexp_result_free(search->sexp, r);
 
 	search->folder = NULL;
 	search->summary = NULL;
Index: filter/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/filter/ChangeLog,v
retrieving revision 1.371
diff -u -3 -r1.371 ChangeLog
--- filter/ChangeLog	13 Jun 2003 17:26:40 -0000	1.371
+++ filter/ChangeLog	1 Aug 2003 18:02:43 -0000
@@ -1,3 +1,10 @@
+2003-08-01  Not Zed  <NotZed Ximian com>
+
+	** See bug #47208.
+
+	* filter-code.c (build_code): wrap the expression in a match-all
+	so boolean expressions work properly for folder searches.
+
 2003-06-13  Larry Ewing  <lewing ximian com>
 
 	* filter-source.c (filter_source_finalize): free current_url.
Index: filter/filter-code.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/filter-code.c,v
retrieving revision 1.7
diff -u -3 -r1.7 filter-code.c
--- filter/filter-code.c	1 Nov 2002 22:07:46 -0000	1.7
+++ filter/filter-code.c	1 Aug 2003 18:02:43 -0000
@@ -109,12 +109,14 @@
 {
 	GList *l;
 	FilterInput *fi = (FilterInput *)fe;
-	
+
+	g_string_append(out, "(match-all ");
 	l = fi->values;
 	while (l) {
 		g_string_append(out, (char *)l->data);
 		l = g_list_next(l);
 	}
+	g_string_append(out, ")");
 }
 
 /* and we have no value */


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