gnumeric r16596 - in branches/gnumeric-1-8: . plugins/fn-info src
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16596 - in branches/gnumeric-1-8: . plugins/fn-info src
- Date: Wed, 21 May 2008 17:14:08 +0000 (UTC)
Author: mortenw
Date: Wed May 21 17:14:08 2008
New Revision: 16596
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16596&view=rev
Log:
2008-05-21 Morten Welinder <terra gnome org>
* src/value-sheet.c (value_area_foreach): Always NULL ->cell_iter.
2008-05-21 Morten Welinder <terra gnome org>
* functions.c (gnumeric_countblank): Use value_area_* functions.
Fixes #534204.
Modified:
branches/gnumeric-1-8/ChangeLog
branches/gnumeric-1-8/NEWS
branches/gnumeric-1-8/plugins/fn-info/ChangeLog
branches/gnumeric-1-8/plugins/fn-info/functions.c
branches/gnumeric-1-8/src/parser.y
branches/gnumeric-1-8/src/value-sheet.c
Modified: branches/gnumeric-1-8/NEWS
==============================================================================
--- branches/gnumeric-1-8/NEWS (original)
+++ branches/gnumeric-1-8/NEWS Wed May 21 17:14:08 2008
@@ -38,6 +38,7 @@
* Fix parser crashes. [#533951] [#534131]
* Fix RANDEXPPOW hang. [#533965]
* Fix array evaluation problem. [#533953]
+ * Fix COUNTBLANK crash. [#534204]
--------------------------------------------------------------------------
Gnumeric 1.8.2
Modified: branches/gnumeric-1-8/plugins/fn-info/functions.c
==============================================================================
--- branches/gnumeric-1-8/plugins/fn-info/functions.c (original)
+++ branches/gnumeric-1-8/plugins/fn-info/functions.c Wed May 21 17:14:08 2008
@@ -1226,33 +1226,45 @@
};
static GnmValue *
-cb_countblank (GnmCellIter const *iter, gpointer user)
+cb_countblank (GnmValueIter const *iter, gpointer user)
{
- gnm_cell_eval (iter->cell);
- if (!gnm_cell_is_empty (iter->cell)) {
- GnmValue const *v = iter->cell->value;
- if (VALUE_IS_STRING (v) && value_peek_string (v)[0] == 0)
- ; /* Nothing -- the empty string is blank. */
- else
- *((int *)user) -= 1;
- }
+ GnmValue const *v = iter->v;
+
+ if (VALUE_IS_STRING (v) && value_peek_string (v)[0] == 0)
+ ; /* Nothing -- the empty string is blank. */
+ else if (VALUE_IS_EMPTY (v))
+ ; /* Nothing */
+ else
+ *((int *)user) -= 1;
+
return NULL;
}
static GnmValue *
gnumeric_countblank (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
{
- Sheet *start_sheet, *end_sheet;
- GnmRange r;
- int count;
-
- gnm_rangeref_normalize (&argv[0]->v_range.cell, ei->pos,
- &start_sheet, &end_sheet, &r);
- count = range_width (&r) * range_height (&r);
- if (start_sheet != end_sheet && end_sheet != NULL)
- count *= 1 + abs (end_sheet->index_in_wb - start_sheet->index_in_wb);
- workbook_foreach_cell_in_range (ei->pos, argv[0],
- CELL_ITER_IGNORE_BLANK, &cb_countblank, &count);
+ GnmValue const *v = argv[0];
+ int count =
+ value_area_get_width (v, ei->pos) *
+ value_area_get_height (v, ei->pos);
+ int nsheets = 1;
+
+ if (v->type == VALUE_CELLRANGE) {
+ GnmRange r;
+ Sheet *start_sheet, *end_sheet;
+
+ gnm_rangeref_normalize (&v->v_range.cell, ei->pos,
+ &start_sheet, &end_sheet, &r);
+
+ if (start_sheet != end_sheet && end_sheet != NULL)
+ nsheets = 1 + abs (end_sheet->index_in_wb -
+ start_sheet->index_in_wb);
+ }
+
+ count *= nsheets;
+
+ value_area_foreach (v, ei->pos, CELL_ITER_IGNORE_BLANK,
+ &cb_countblank, &count);
return value_new_int (count);
}
Modified: branches/gnumeric-1-8/src/parser.y
==============================================================================
--- branches/gnumeric-1-8/src/parser.y (original)
+++ branches/gnumeric-1-8/src/parser.y Wed May 21 17:14:08 2008
@@ -314,7 +314,7 @@
}
/*
- * Build an array expresssion.
+ * Build an array expression.
*
* Returns NULL on failure. Caller must YYERROR in that case.
*/
Modified: branches/gnumeric-1-8/src/value-sheet.c
==============================================================================
--- branches/gnumeric-1-8/src/value-sheet.c (original)
+++ branches/gnumeric-1-8/src/value-sheet.c Wed May 21 17:14:08 2008
@@ -304,13 +304,14 @@
(CellIterFunc) cb_wrapper_foreach_cell_in_area, &wrap);
}
+ v_iter.ep = ep;
+ v_iter.region = v;
+ v_iter.cell_iter = NULL;
+
/* If not an array, apply func to singleton */
- v_iter.ep = ep;
- v_iter.region = v;
if (v->type != VALUE_ARRAY) {
v_iter.x = v_iter.y = 0;
v_iter.v = v;
- v_iter.cell_iter = NULL;
return (*func) (&v_iter, user_data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]