Fix some warnings
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 10 Dec 2008 08:36:06 +0000 (17:36 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 10 Dec 2008 08:36:06 +0000 (17:36 +0900)
lib/gtksheet/gtksheet.c
lib/gtksheet/psppire-axis-impl.c

index 7569eefe728d3b901d626a857fd713b3be2bbc64..609a81f500231e3a6f1997e035815b8e8f28d014 100644 (file)
@@ -1099,6 +1099,10 @@ static void
 redraw_range (GtkSheet *sheet, GtkSheetRange *range)
 {
   GdkRectangle rect;
+  if ( ! GTK_WIDGET_REALIZED (sheet))
+    return;
+
   if ( NULL != range )
     rectangle_from_range (sheet, range, &rect);
   else
index 619e8238dab5c66a5f6d10c738c1351a4fa0de4d..1fb00d2d8435df76be0b9b1e3d8c4b5fdbfc8147 100644 (file)
@@ -331,12 +331,10 @@ psppire_axis_impl_insert (PsppireAxisImpl *a, gint posn, gint size)
   struct axis_node *before = NULL;
   struct axis_node *new_node;
 
-  g_return_if_fail ( posn < tower_height (&a->unit_tower));
   g_return_if_fail ( posn >= 0);
+  g_return_if_fail ( posn <= tower_height (&a->unit_tower));
 
-  new_node = pool_malloc (a->pool, sizeof (*new_node));
-
-  if ( posn > 0)
+  if ( posn < tower_height (&a->unit_tower))
     {
       unsigned long int start = 0;
       struct tower_node *n;
@@ -349,6 +347,8 @@ psppire_axis_impl_insert (PsppireAxisImpl *a, gint posn, gint size)
       before = tower_data (n, struct axis_node, unit_node);
     }
 
+  new_node = pool_malloc (a->pool, sizeof (*new_node));
+
   tower_insert (&a->unit_tower,
                1,
                &new_node->unit_node,
@@ -437,12 +437,13 @@ psppire_axis_impl_delete (PsppireAxisImpl *a, gint first, gint n_units)
 {
   gint units_to_delete = n_units;
   unsigned long int start;
+  struct tower_node *unit_node ;
   g_return_if_fail (first + n_units < tower_height (&a->unit_tower));
 
   split (a, first);
   split (a, first + n_units);
 
-  struct tower_node *unit_node = tower_lookup (&a->unit_tower, first, &start);
+  unit_node = tower_lookup (&a->unit_tower, first, &start);
   g_assert (start == first);
 
   while (units_to_delete > 0)