[gnumeric] .gnumeric: don't write empty cells.



commit aac7f33006bfc7dc6c6f5cd00010e3ae5095f6ee
Author: Morten Welinder <terra gnome org>
Date:   Mon Apr 29 11:02:35 2013 -0400

    .gnumeric: don't write empty cells.
    
    They're not supposed to make a difference, so don't write them at all.

 ChangeLog            |    5 +++++
 NEWS                 |    1 +
 src/xml-sax-write.c  |    9 +++++++--
 test/t5902-applix.pl |    2 +-
 test/t5904-mps.pl    |    4 ++--
 5 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7c8b951..0bb9df3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-29  Morten Welinder  <terra gnome org>
+
+       * src/xml-sax-write.c (cb_write_cell): Ignore completely empty
+       cells.
+
 2013-04-26  Morten Welinder <terra gnome org>
 
        * configure.ac: Post-release bump.
diff --git a/NEWS b/NEWS
index ecf8e25..193c5b5 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Andreas:
 
 Morten:
        * Improve xlsx import of style-only cells.
+       * Don't write empty cells to .gnumeric.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.2
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index 96f49e0..48ce084 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -895,8 +895,13 @@ xml_write_cell_and_position (GnmOutputXML *state,
 static GnmValue *
 cb_write_cell (GnmCellIter const *iter, GnmOutputXML *state)
 {
-       xml_write_cell_and_position (state,
-               iter->cell->base.texpr, iter->cell->value, &iter->pp);
+       GnmExprTop const *texpr = iter->cell->base.texpr;
+       GnmValue const *value = iter->cell->value;
+
+       if (texpr == NULL && VALUE_IS_EMPTY (value))
+               return NULL;
+
+       xml_write_cell_and_position (state, texpr, value, &iter->pp);
        return NULL;
 }
 
diff --git a/test/t5902-applix.pl b/test/t5902-applix.pl
index 4946d0c..3914648 100755
--- a/test/t5902-applix.pl
+++ b/test/t5902-applix.pl
@@ -9,4 +9,4 @@ use GnumericTest;
 my $mode = ((shift @ARGV) || "check");
 
 &message ("Check the applix importer.");
-&test_importer ("$samples/applix/sample.as", "5e70eaaf0c01e51a4ba8afba2dd2ad5b468fabcc", $mode);
+&test_importer ("$samples/applix/sample.as", "8d4950f5c10eeb0ebf750973927ad191233f85f7", $mode);
diff --git a/test/t5904-mps.pl b/test/t5904-mps.pl
index fb45040..54868f4 100755
--- a/test/t5904-mps.pl
+++ b/test/t5904-mps.pl
@@ -9,5 +9,5 @@ use GnumericTest;
 my $mode = ((shift @ARGV) || "check");
 
 &message ("Check the mps importer.");
-&test_importer ("$samples/solver/blend.mps", "551a877554b663a983b88f39e2df1becef94283f", $mode);
-&test_importer ("$samples/solver/afiro.mps", "3d71a8ce3f9ff12e5e3306f59113aebcdb614816", $mode);
+&test_importer ("$samples/solver/blend.mps", "d60f1d1eade4ae7e534cc4f5088de9cdf4b0c3ca", $mode);
+&test_importer ("$samples/solver/afiro.mps", "16b8c1f9ab75d23b3760a128ad72320e893f7a6c", $mode);


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