[gnumeric] xls: work on making result independent of things like hash order.



commit 32ecacd2aeb7e2b54e426722852096c56f5c4b9b
Author: Morten Welinder <terra gnome org>
Date:   Fri Feb 22 11:57:53 2013 -0500

    xls: work on making result independent of things like hash order.

 plugins/excel/ChangeLog        |    5 +++++
 plugins/excel/ms-excel-write.c |    9 ++++++---
 src/sheet.h                    |   10 +++++-----
 src/workbook.h                 |    2 +-
 4 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 798301c..3c3f8e6 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-22  Morten Welinder  <terra gnome org>
+
+       * ms-excel-write.c (gather_styles): Use sheet_cells, not
+       sheet_cell_foreach, so the output won't depend on hash order.
+
 2013-02-14  Jean Brefort  <jean brefort normalesup org>
 
        * ms-chart.c (get_style): reversed previous change.
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 9df7e68..0c36a6b 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -2499,7 +2499,7 @@ txomarkup_new (ExcelWriteState *ewb,
 /***************************************************************************/
 
 static void
-cb_cell_pre_pass (gpointer ignored, GnmCell const *cell, ExcelWriteState *ewb)
+cb_cell_pre_pass (GnmCell const *cell, ExcelWriteState *ewb)
 {
        GnmStyle const *style;
        GOFormat const *fmt;
@@ -2600,8 +2600,11 @@ gather_styles (ExcelWriteState *ewb)
                ExcelWriteSheet *esheet = g_ptr_array_index (ewb->esheets, i);
                Sheet *sheet = esheet->gnum_sheet;
                int col, cols = MIN (XLS_MaxCol, gnm_sheet_get_max_cols(sheet));
-               sheet_cell_foreach (sheet,
-                       (GHFunc) cb_cell_pre_pass, &ewb->base);
+               GPtrArray *cells = sheet_cells (sheet, NULL);
+               g_ptr_array_foreach (cells,
+                                    (GFunc)cb_cell_pre_pass,
+                                    &ewb->base);
+               g_ptr_array_free (cells, TRUE);
                sheet_style_foreach (sheet, (GFunc)cb_accum_styles, &ewb->base);
                for (col = 0; col < cols; col++) {
                        ExcelStyleVariant esv;
diff --git a/src/sheet.h b/src/sheet.h
index 1ad3f64..02de535 100644
--- a/src/sheet.h
+++ b/src/sheet.h
@@ -157,11 +157,11 @@ struct _GnmCellIter {
        GnmParsePos  pp;
        ColRowInfo  *ci, *ri;
 };
-GnmValue *sheet_foreach_cell_in_range  (Sheet *sheet, CellIterFlags flags,
-                                 int start_col, int start_row,
-                                 int end_col, int end_row,
-                                 CellIterFunc callback,
-                                 gpointer     closure);
+GnmValue *sheet_foreach_cell_in_range (Sheet *sheet, CellIterFlags flags,
+                                      int start_col, int start_row,
+                                      int end_col, int end_row,
+                                      CellIterFunc callback,
+                                      gpointer     closure);
 void       sheet_cell_foreach   (Sheet const *sheet,
                                  GHFunc callback, gpointer data);
 unsigned    sheet_cells_count   (Sheet const *sheet);
diff --git a/src/workbook.h b/src/workbook.h
index c1ae9df..433bc1f 100644
--- a/src/workbook.h
+++ b/src/workbook.h
@@ -55,7 +55,7 @@ gchar const *workbook_get_last_export_uri (Workbook *wb);
 void         workbook_set_file_exporter          (Workbook *wb, GOFileSaver *fs);
 void         workbook_set_last_export_uri (Workbook *wb, gchar *uri);
 
-/* See also sheet_cell_foreach_range */
+/* See also sheet_foreach_cell_in_range */
 GnmValue   *workbook_foreach_cell_in_range (GnmEvalPos const  *pos,
                                            GnmValue const *cell_range,
                                            CellIterFlags   flags,


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