[gnumeric] Advanced filter: fix problem with multiple criteria.



commit 50ab41c8d30a4d294c504ec7b3ca084d5a2abe9b
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 30 13:40:38 2010 -0400

    Advanced filter: fix problem with multiple criteria.

 ChangeLog   |    3 +++
 NEWS        |    1 +
 src/value.c |    5 +++--
 3 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bab9739..2766b66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-04-30  Morten Welinder  <terra gnome org>
 
+	* src/value.c (find_rows_that_match): Fix checking of multiple
+	criteria.  Fixes rest of #164169.
+
 	* src/sheet-filter.c (filter_expr_eval): When we're looking for a
 	number, match also strings.  Match strings case insensitively.
 
diff --git a/NEWS b/NEWS
index 57da891..cf1d870 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ Morten:
 	* Fix auto-expr problem.  [#575104]
 	* Fix xls-save problems with custom autofilters.
 	* Fix auto-filter problem.  [#383400]
+	* Fix advanced-filter problem with multiple criteria.  [#164169]
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.2
diff --git a/src/value.c b/src/value.c
index 56dbc59..7f43b64 100644
--- a/src/value.c
+++ b/src/value.c
@@ -1762,8 +1762,9 @@ find_rows_that_match (Sheet *sheet, int first_col, int first_row,
 	for (row = first_row; row <= last_row; row++) {
 		add_flag = TRUE;
 		for (crit_ptr = criterias; crit_ptr; crit_ptr = crit_ptr->next) {
+			GnmDBCriteria const *crit = crit_ptr->data;
 			add_flag = TRUE;
-			for (cond_ptr = ((GnmDBCriteria const *)crit_ptr->data)->conditions;
+			for (cond_ptr = crit->conditions;
 			     cond_ptr != NULL ; cond_ptr = cond_ptr->next) {
 				GnmCriteria *cond = cond_ptr->data;
 				test_cell = sheet_cell_get (sheet, cond->column, row);
@@ -1776,7 +1777,7 @@ find_rows_that_match (Sheet *sheet, int first_col, int first_row,
 				}
 			}
 
-			if (add_flag)
+			if (!add_flag)
 				break;
 		}
 		if (add_flag) {



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