[gnumeric] xls: fix saving of constants for custom autofilters.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: fix saving of constants for custom autofilters.
- Date: Thu, 29 Apr 2010 15:00:33 +0000 (UTC)
commit a46e63f44d436659afbf830f2213847af0095430
Author: Morten Welinder <terra gnome org>
Date: Thu Apr 29 11:00:04 2010 -0400
xls: fix saving of constants for custom autofilters.
NEWS | 1 +
plugins/excel/ChangeLog | 4 ++++
plugins/excel/ms-excel-write.c | 32 ++++++++++++++++++--------------
3 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/NEWS b/NEWS
index 482bfd1..942e647 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ Morten:
* Fix WEEKNUM problems. [#616330]
* Fix hidden-sheet problem. [#616549]
* Fix auto-expr problem. [#575104]
+ * Fix xls-save problem with custom autofilters.
--------------------------------------------------------------------------
Gnumeric 1.10.2
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index a831bbc..7eff4e7 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-29 Morten Welinder <terra gnome org>
+
+ * ms-excel-write.c (excel_write_DOPER): Fix saving of integers.
+
2010-04-23 Morten Welinder <terra gnome org>
* ms-excel-read.c (supbook_get_sheet): Return "deleted sheet" for
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 58c1117..37d4d27 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -3722,11 +3722,12 @@ excel_write_DOPER (GnmFilterCondition const *cond, int i, guint8 *buf)
if (cond->op[i] == GNM_FILTER_UNUSED)
return NULL;
- switch (cond->value[i]->type) {
- case VALUE_BOOLEAN: buf[0] = 8;
- buf[2] = 0;
- buf[3] = v->v_bool.val ? 1 : 0;
- break;
+ switch (v->type) {
+ case VALUE_BOOLEAN:
+ buf[0] = 8;
+ buf[2] = 0;
+ buf[3] = value_get_as_int (v);
+ break;
case VALUE_FLOAT: {
gnm_float f = value_get_as_float (v);
@@ -3736,20 +3737,22 @@ excel_write_DOPER (GnmFilterCondition const *cond, int i, guint8 *buf)
} else {
int i = (int)f;
buf[0] = 2;
- GSF_LE_SET_GUINT32 (buf + 2, i | 2);
+ GSF_LE_SET_GUINT32 (buf + 2, (i << 2) | 2);
break;
}
break;
}
- case VALUE_ERROR: buf[0] = 8;
- buf[2] = 1;
- buf[3] = excel_write_map_errcode (v);
- break;
+ case VALUE_ERROR:
+ buf[0] = 8;
+ buf[2] = 1;
+ buf[3] = excel_write_map_errcode (v);
+ break;
- case VALUE_STRING: buf[0] = 6;
- str = v->v_str.val->str;
- buf[6] = excel_strlen (str, NULL);
+ case VALUE_STRING:
+ buf[0] = 6;
+ str = value_peek_string (v);
+ buf[6] = excel_strlen (str, NULL);
break;
default :
/* ignore arrays, ranges, empties */
@@ -3775,7 +3778,6 @@ excel_write_AUTOFILTERINFO (BiffPut *bp, ExcelWriteSheet *esheet)
{
GnmFilterCondition const *cond;
GnmFilter const *filter;
- guint8 buf[24];
unsigned count, i;
char const *str0 = NULL, *str1 = NULL;
@@ -3791,6 +3793,8 @@ excel_write_AUTOFILTERINFO (BiffPut *bp, ExcelWriteSheet *esheet)
/* the fields */
for (i = 0; i < filter->fields->len ; i++) {
+ guint8 buf[24];
+
/* filter unused or bucket filters in excel5 */
if (NULL == (cond = gnm_filter_get_condition (filter, i)) ||
cond->op[0] == GNM_FILTER_UNUSED ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]