[evolution-patches] Etable patch
- From: JP Rosevear <jpr ximian com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] Etable patch
- Date: 17 Apr 2003 14:20:01 -0400
Pulls up a patch from the trunk that was never put in head.
-JP
--
JP Rosevear <jpr ximian com>
Ximian, Inc.
? autom4te.cache
? etss.diff
? docs/gal-api.html
? gal/e-table/eto.patch
Index: gal/e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.881
diff -u -r1.881 ChangeLog
--- gal/e-table/ChangeLog 15 Apr 2003 21:34:31 -0000 1.881
+++ gal/e-table/ChangeLog 17 Apr 2003 18:19:20 -0000
@@ -1,3 +1,7 @@
+2003-04-17 JP Rosevear <jpr ximian com>
+
+ * e-table-subset.c : add guarding for row indexing
+
2003-04-15 Hans Petter Jansson <hpj ximian com>
* e-table-header-utils.c (e_table_draw_elided_string): Don't unref
Index: gal/e-table/e-table-subset.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-subset.c,v
retrieving revision 1.36
diff -u -r1.36 e-table-subset.c
--- gal/e-table/e-table-subset.c 5 Nov 2002 22:53:40 -0000 1.36
+++ gal/e-table/e-table-subset.c 17 Apr 2003 18:19:20 -0000
@@ -41,6 +41,9 @@
#define ETSS_CLASS(object) (E_TABLE_SUBSET_GET_CLASS(object))
+#define VALID_ROW(etss, row) (row >= -1 && row < etss->n_map)
+#define MAP_ROW(etss, row) (row == -1 ? -1 : etss->map_table[row])
+
static gint
etss_get_view_row (ETableSubset *etss, int row)
{
@@ -144,9 +147,11 @@
{
ETableSubset *etss = (ETableSubset *)etm;
+ g_return_val_if_fail (VALID_ROW (etss, row), NULL);
+
etss->last_access = row;
d(g_print("g) Setting last_access to %d\n", row));
- return e_table_model_value_at (etss->source, col, etss->map_table [row]);
+ return e_table_model_value_at (etss->source, col, MAP_ROW(etss, row));
}
static void
@@ -154,9 +159,11 @@
{
ETableSubset *etss = (ETableSubset *)etm;
+ g_return_if_fail (VALID_ROW (etss, row));
+
etss->last_access = row;
d(g_print("h) Setting last_access to %d\n", row));
- e_table_model_set_value_at (etss->source, col, etss->map_table [row], val);
+ e_table_model_set_value_at (etss->source, col, MAP_ROW(etss, row), val);
}
static gboolean
@@ -164,7 +171,9 @@
{
ETableSubset *etss = (ETableSubset *)etm;
- return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]);
+ g_return_val_if_fail (VALID_ROW (etss, row), FALSE);
+
+ return e_table_model_is_cell_editable (etss->source, col, MAP_ROW(etss, row));
}
static gboolean
@@ -178,10 +187,12 @@
{
ETableSubset *etss = (ETableSubset *)etm;
+ g_return_val_if_fail (VALID_ROW (etss, row), NULL);
+
if (e_table_model_has_save_id (etss->source))
- return e_table_model_get_save_id (etss->source, etss->map_table [row]);
+ return e_table_model_get_save_id (etss->source, MAP_ROW(etss, row));
else
- return g_strdup_printf ("%d", etss->map_table[row]);
+ return g_strdup_printf ("%d", MAP_ROW(etss, row));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]