[gnumeric] D-funcs: fix handling of blanks.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] D-funcs: fix handling of blanks.
- Date: Sat, 11 Jun 2016 16:44:41 +0000 (UTC)
commit baa13c0c6ecdb26fb2f9f80ead03f022cc683e93
Author: Morten Welinder <terra gnome org>
Date: Sat Jun 11 12:44:00 2016 -0400
D-funcs: fix handling of blanks.
Also update expected values. We still fail.
ChangeLog | 4 ++++
plugins/fn-database/ChangeLog | 4 ++++
plugins/fn-database/functions.c | 4 ++--
samples/excel12/database.xlsx | Bin 9976 -> 9985 bytes
src/value.c | 4 ++--
5 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c193539..d3a0cd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-06-11 Morten Welinder <terra gnome org>
+
+ * src/value.c (find_rows_that_match): Fix blank handling.
+
2016-05-19 Morten Welinder <terra gnome org>
* src/stf-parse.c (stf_parse_options_guess_formats): Separate
diff --git a/plugins/fn-database/ChangeLog b/plugins/fn-database/ChangeLog
index cce9662..26173a7 100644
--- a/plugins/fn-database/ChangeLog
+++ b/plugins/fn-database/ChangeLog
@@ -1,3 +1,7 @@
+2016-06-11 Morten Welinder <terra gnome org>
+
+ * functions.c (find_cells_that_match): Fix blank handling.
+
2016-06-10 Morten Welinder <terra gnome org>
* functions.c (database_find_values): Make the float case strict.
diff --git a/plugins/fn-database/functions.c b/plugins/fn-database/functions.c
index e5c34e8..7920e71 100644
--- a/plugins/fn-database/functions.c
+++ b/plugins/fn-database/functions.c
@@ -103,6 +103,7 @@ find_cells_that_match (Sheet *sheet, GnmValue const *database,
gboolean add_flag;
GnmCell *cell;
int fake_col;
+ GnmValue const *empty = value_new_empty ();
cells = NULL;
/* TODO : Why ignore the first row ? What if there is no header ? */
@@ -134,8 +135,7 @@ find_cells_that_match (Sheet *sheet, GnmValue const *database,
cond->column, row);
if (tmp != NULL)
gnm_cell_eval (tmp);
- if (gnm_cell_is_empty (tmp) ||
- !cond->fun (tmp->value, cond)) {
+ if (!cond->fun (tmp ? tmp->value : empty, cond)) {
add_flag = FALSE;
break;
}
diff --git a/samples/excel12/database.xlsx b/samples/excel12/database.xlsx
index f6cb1a5..7314eff 100644
Binary files a/samples/excel12/database.xlsx and b/samples/excel12/database.xlsx differ
diff --git a/src/value.c b/src/value.c
index 7cd7c65..0f9efc5 100644
--- a/src/value.c
+++ b/src/value.c
@@ -1958,6 +1958,7 @@ find_rows_that_match (Sheet *sheet, int first_col, int first_row,
gboolean add_flag;
char const *t1, *t2;
GnmCell *test_cell;
+ GnmValue const *empty = value_new_empty ();
for (row = first_row; row <= last_row; row++) {
add_flag = TRUE;
@@ -1970,8 +1971,7 @@ find_rows_that_match (Sheet *sheet, int first_col, int first_row,
test_cell = sheet_cell_get (sheet, cond->column, row);
if (test_cell != NULL)
gnm_cell_eval (test_cell);
- if (gnm_cell_is_empty (test_cell) ||
- !cond->fun (test_cell->value, cond)) {
+ if (!cond->fun (test_cell ? test_cell->value : empty, cond)) {
add_flag = FALSE;
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]