[gnumeric] Sheet Style: kill warnings.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Sheet Style: kill warnings.
- Date: Fri, 19 Oct 2012 18:10:39 +0000 (UTC)
commit f43e4a52b7dc7c7a3a6fb7cfdd599a5e2e41555e
Author: Morten Welinder <terra gnome org>
Date: Fri Oct 19 14:09:27 2012 -0400
Sheet Style: kill warnings.
Filtered area of the sheet might not be the whole sheet.
ChangeLog | 7 +++++++
src/sheet-style.c | 12 ++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d46fcdd..fc7928b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-10-19 Morten Welinder <terra gnome org>
+
+ * src/sheet-style.c (internal_style_list): Check actual area
+ against expected area.
+ (verify_hashes): Check area against initial area.
+ (cb_style_list_add_node): Keep track of (filtered) area.
+
2012-10-18 Morten Welinder <terra gnome org>
* src/sheet-style.c (internal_style_list): New function uniting
diff --git a/src/sheet-style.c b/src/sheet-style.c
index 692a123..d8cd4d7 100644
--- a/src/sheet-style.c
+++ b/src/sheet-style.c
@@ -2351,6 +2351,7 @@ debug_style_list (void)
typedef struct {
GPtrArray *accum;
GHashTable *by_tl, *by_br;
+ size_t area;
gboolean (*style_equal) (GnmStyle const *a, GnmStyle const *b);
gboolean (*style_filter) (GnmStyle const *style);
GnmSheetSize const *sheet_size;
@@ -2425,6 +2426,8 @@ cb_style_list_add_node (GnmStyle *style,
range.end.col = MIN (corner_col + width - 1, ss->max_cols - 1);
range.end.row = MIN (corner_row + height - 1, ss->max_rows - 1);
+ data->area += range_width (&range) * range_height (&range);
+
if (apply_to) {
range.start.col -= apply_to->start.col;
if (range.start.col < 0)
@@ -2467,8 +2470,7 @@ verify_hashes (ISL *data)
(size_t)range_width (&sr->range);
}
- g_return_if_fail (area ==
- (size_t)data->sheet_size->max_cols * data->sheet_size->max_rows);
+ g_return_if_fail (area == data->area);
}
static void
@@ -2667,6 +2669,7 @@ internal_style_list (Sheet const *sheet, GnmRange const *r,
GnmStyleList *res = NULL;
unsigned ui, prelen;
gboolean paranoid = FALSE;
+ size_t sheet_area;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
@@ -2678,6 +2681,7 @@ internal_style_list (Sheet const *sheet, GnmRange const *r,
(GEqualFunc)gnm_cellpos_equal);
data.by_br = g_hash_table_new ((GHashFunc)gnm_cellpos_hash,
(GEqualFunc)gnm_cellpos_equal);
+ data.area = 0;
data.style_equal = style_equal;
data.style_filter = style_filter;
data.sheet_size = gnm_sheet_get_size (sheet);
@@ -2686,6 +2690,10 @@ internal_style_list (Sheet const *sheet, GnmRange const *r,
sheet->tile_top_level, 0, 0, r,
cb_style_list_add_node, &data);
+ sheet_area = (size_t)data.sheet_size->max_cols * data.sheet_size->max_rows;
+ if (data.style_filter ? (data.area > sheet_area) : (data.area != sheet_area))
+ g_warning ("Strange size issue in internal_style_list");
+
/* Populate hashes. */
for (ui = 0; ui < data.accum->len; ui++) {
GnmStyleRegion *sr = g_ptr_array_index (data.accum, ui);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]