[evolution] Fix invalid cast in e_calendar_item_get_date_for_cell()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Fix invalid cast in e_calendar_item_get_date_for_cell()
- Date: Mon, 8 Feb 2021 18:45:53 +0000 (UTC)
commit 752106a632820c3009ff3c756fd491fc93135242
Author: Milan Crha <mcrha redhat com>
Date: Mon Feb 8 19:43:56 2021 +0100
Fix invalid cast in e_calendar_item_get_date_for_cell()
There's no need to use the Atk function implementation, the more it uses
an AtkObject, which is harder to get to, thus rather calculate the index
directly.
src/e-util/ea-calendar-cell.c | 13 ++++++-------
src/e-util/ea-calendar-item.c | 7 ++++++-
2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/e-util/ea-calendar-cell.c b/src/e-util/ea-calendar-cell.c
index d527ff21a1..1813b79642 100644
--- a/src/e-util/ea-calendar-cell.c
+++ b/src/e-util/ea-calendar-cell.c
@@ -235,11 +235,10 @@ ea_calendar_cell_get_name (AtkObject *accessible)
gchar buffer[128];
cell = E_CALENDAR_CELL (g_obj);
- e_calendar_item_get_date_for_cell (cell->calitem, cell->row,
- cell->column,
- &year, &month, &day);
-
- g_snprintf (buffer, 128, "%d-%d-%d", year, month + 1, day);
+ if (e_calendar_item_get_date_for_cell (cell->calitem, cell->row, cell->column, &year, &month,
&day))
+ g_snprintf (buffer, 128, "%d-%d-%d", year, month + 1, day);
+ else
+ buffer[0] = '\0';
ATK_OBJECT_CLASS (parent_class)->set_name (accessible, buffer);
}
return accessible->name;
@@ -342,8 +341,8 @@ component_interface_get_extents (AtkComponent *component,
calitem = cell->calitem;
atk_obj = atk_gobject_accessible_for_object (G_OBJECT (calitem));
ea_calitem = EA_CALENDAR_ITEM (atk_obj);
- e_calendar_item_get_date_for_cell (calitem, cell->row, cell->column,
- &year, &month, &day);
+ if (!e_calendar_item_get_date_for_cell (calitem, cell->row, cell->column, &year, &month, &day))
+ return;
if (!e_calendar_item_get_day_extents (calitem,
year, month, day,
diff --git a/src/e-util/ea-calendar-item.c b/src/e-util/ea-calendar-item.c
index c22adfbef5..1af1ac62e4 100644
--- a/src/e-util/ea-calendar-item.c
+++ b/src/e-util/ea-calendar-item.c
@@ -1269,6 +1269,9 @@ e_calendar_item_get_date_for_offset (ECalendarItem *calitem,
g_return_val_if_fail (E_IS_CALENDAR_ITEM (calitem), FALSE);
+ if (day_offset < 0)
+ return FALSE;
+
if (!e_calendar_item_get_date_range (calitem, &start_year,
&start_month, &start_day,
&end_year, &end_month,
@@ -1294,7 +1297,9 @@ e_calendar_item_get_date_for_cell (ECalendarItem *calitem,
gint *month,
gint *day)
{
- gint index = table_interface_get_index_at (ATK_TABLE (calitem), row, column);
+ gint index;
+
+ index = row * EA_CALENDAR_COLUMN_NUM + column;
return e_calendar_item_get_date_for_offset (calitem, index, year, month, day);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]