[gnumeric] MStyle: check that empty styles' hash values are zero.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] MStyle: check that empty styles' hash values are zero.
- Date: Tue, 16 Jun 2009 11:50:46 -0400 (EDT)
commit 605a65b2ae53b996e6f10f5168c1468aeea83e82
Author: Morten Welinder <terra gnome org>
Date: Tue Jun 16 11:50:10 2009 -0400
MStyle: check that empty styles' hash values are zero.
ChangeLog | 3 +++
src/mstyle.c | 10 ++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8e51909..8b7495f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2009-06-16 Morten Welinder <terra gnome org>
+ * src/mstyle.c (gnm_style_update): Verify that empty styles have
+ hash values all zero.
+
* src/sstest.c (test_insdel_rowcol_names): Explicitly define
Print_Area to be whole sheet. Fixes test again.
diff --git a/src/mstyle.c b/src/mstyle.c
index 82dfe33..8a8c9e4 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -256,6 +256,16 @@ gnm_style_update (GnmStyle *style)
hash = (hash << 7) ^ (hash >> (sizeof (hash) * 8 - 7));
style->hash_key = hash;
+
+ if (G_UNLIKELY (style->set == 0)) {
+ /*
+ * gnm_style_new and gnm_style_dup both assume that the
+ * correct hash values (both of them) for the empty style
+ * is zero.
+ */
+ g_assert (style->hash_key == 0);
+ g_assert (style->hash_key_xl == 0);
+ }
}
guint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]