ANSI C fixes for GTK 1.1.1



The following fixes helped me to get GTK 1.1.1
compile correctly with an ANSI C compiler
(MipsPro C version 7.2.1 on my Silicon Graphics Indy).

It deals with:
- lvalue issues
- inconsistent definitions (e.g. for  gtk_accelerator_valid)
- ...

No guarantees it will work for everyone, but all
tests in testgtk app seem to run fine.

-Winfred


diff -rc orig/gtk+-1.1.1/gtk/gtkaccelgroup.c gtk+-1.1.1/gtk/gtkaccelgroup.c
*** orig/gtk+-1.1.1/gtk/gtkaccelgroup.c	Fri Jul 24 04:23:58 1998
--- gtk+-1.1.1/gtk/gtkaccelgroup.c	Mon Aug 17 09:01:14 1998
***************
*** 696,702 ****
  
  gboolean
  gtk_accelerator_valid (guint		  keyval,
! 		       guint		  modifiers)
  {
    guint invalid_accelerator_vals[] = {
      GDK_BackSpace, GDK_Delete, GDK_KP_Delete,
--- 696,702 ----
  
  gboolean
  gtk_accelerator_valid (guint		  keyval,
! 		       GdkModifierType		  modifiers)
  {
    guint invalid_accelerator_vals[] = {
      GDK_BackSpace, GDK_Delete, GDK_KP_Delete,
***************
*** 1016,1022 ****
  }
  
  void
! gtk_accelerator_set_default_mod_mask (guint           default_mod_mask)
  {
    default_accel_mod_mask = default_mod_mask & GDK_MODIFIER_MASK;
  }
--- 1016,1022 ----
  }
  
  void
! gtk_accelerator_set_default_mod_mask (GdkModifierType           default_mod_mask)
  {
    default_accel_mod_mask = default_mod_mask & GDK_MODIFIER_MASK;
  }
diff -rc orig/gtk+-1.1.1/gtk/gtkclist.c gtk+-1.1.1/gtk/gtkclist.c
*** orig/gtk+-1.1.1/gtk/gtkclist.c	Tue Aug  4 04:35:05 1998
--- gtk+-1.1.1/gtk/gtkclist.c	Mon Aug 17 10:11:09 1998
***************
*** 1914,1923 ****
    while (list)
      {
        if (GPOINTER_TO_INT (list->data) == row1)
! 	GPOINTER_TO_INT (list->data) = row2;
  
         if (GPOINTER_TO_INT (list->data) == row2)
! 	GPOINTER_TO_INT (list->data) = row1;
  
        list = list->next;
      }
--- 1914,1923 ----
    while (list)
      {
        if (GPOINTER_TO_INT (list->data) == row1)
!         list->data = GINT_TO_POINTER (row2);
  
         if (GPOINTER_TO_INT (list->data) == row2)
!          list->data = GINT_TO_POINTER (row1);
  
        list = list->next;
      }
diff -rc orig/gtk+-1.1.1/gtk/gtkcolorsel.c gtk+-1.1.1/gtk/gtkcolorsel.c
*** orig/gtk+-1.1.1/gtk/gtkcolorsel.c	Fri Jul 24 04:23:58 1998
--- gtk+-1.1.1/gtk/gtkcolorsel.c	Mon Aug 17 09:17:41 1998
***************
*** 664,674 ****
    GtkAdjustment *adj;
    gdouble newvalue;
    gint i, which = SCALE;
  
    if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (widget)))
      {
        colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
!       i = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), value_index_key));
  
        if (GTK_IS_SCALE (widget))
  	{
--- 664,677 ----
    GtkAdjustment *adj;
    gdouble newvalue;
    gint i, which = SCALE;
+   gpointer temp;
  
    if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (widget)))
      {
        colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
!       /* i = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), value_index_key)); */
!       temp = gtk_object_get_data (GTK_OBJECT (widget), value_index_key);
!       i = GPOINTER_TO_INT (temp);
  
        if (GTK_IS_SCALE (widget))
  	{
***************
*** 714,724 ****
    GtkAdjustment *adj;
    gdouble newvalue;
    gint i, which = SCALE;
  
    if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (widget)))
      {
        colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
!       i = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), value_index_key));
  
        if (GTK_IS_SCALE (widget))
  	{
--- 717,730 ----
    GtkAdjustment *adj;
    gdouble newvalue;
    gint i, which = SCALE;
+   gpointer temp;
  
    if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (widget)))
      {
        colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
!       /* i = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), value_index_key)); */
!       temp = gtk_object_get_data (GTK_OBJECT (widget), value_index_key);
!       i = GPOINTER_TO_INT (temp);
  
        if (GTK_IS_SCALE (widget))
  	{
diff -rc orig/gtk+-1.1.1/gtk/gtkctree.c gtk+-1.1.1/gtk/gtkctree.c
*** orig/gtk+-1.1.1/gtk/gtkctree.c	Wed Aug  5 04:19:01 1998
--- gtk+-1.1.1/gtk/gtkctree.c	Mon Aug 17 09:39:46 1998
***************
*** 2502,2508 ****
  	}
  
        if (sibling == GTK_CTREE_NODE (clist->row_list))
! 	GTK_CTREE_NODE (clist->row_list) = node;
        if (GTK_CTREE_NODE_PREV (sibling) &&
  	  GTK_CTREE_NODE_NEXT (GTK_CTREE_NODE_PREV (sibling)) == sibling)
  	GTK_CTREE_NODE_NEXT (GTK_CTREE_NODE_PREV (sibling)) = node;
--- 2502,2509 ----
  	}
  
        if (sibling == GTK_CTREE_NODE (clist->row_list))
!     /* *(GtkCTreeNode **)(&(clist->row_list)) = node; */
! 	LGTK_CTREE_NODE (clist->row_list) = node ;
        if (GTK_CTREE_NODE_PREV (sibling) &&
  	  GTK_CTREE_NODE_NEXT (GTK_CTREE_NODE_PREV (sibling)) == sibling)
  	GTK_CTREE_NODE_NEXT (GTK_CTREE_NODE_PREV (sibling)) = node;
***************
*** 2557,2563 ****
  	    }
  	  else
  	    {
! 	      GTK_CTREE_NODE (clist->row_list) = node;
  	      GTK_CTREE_NODE_PREV (node) = NULL;
  	      GTK_CTREE_NODE_NEXT (list_end) = NULL;
  	    }
--- 2558,2564 ----
  	    }
  	  else
  	    {
! 	      LGTK_CTREE_NODE (clist->row_list) = node;
  	      GTK_CTREE_NODE_PREV (node) = NULL;
  	      GTK_CTREE_NODE_NEXT (list_end) = NULL;
  	    }
***************
*** 2568,2574 ****
  
    if (clist->row_list_end == NULL ||
        GTK_CTREE_NODE (clist->row_list_end->next) == node)
!     GTK_CTREE_NODE (clist->row_list_end) = list_end;
  
    if (visible && update_focus_row)
      {
--- 2569,2575 ----
  
    if (clist->row_list_end == NULL ||
        GTK_CTREE_NODE (clist->row_list_end->next) == node)
!     LGTK_CTREE_NODE (clist->row_list_end) = list_end;
  
    if (visible && update_focus_row)
      {
***************
*** 2621,2627 ****
         (GTK_CTREE_ROW (node)->children &&
  	gtk_ctree_is_ancestor (ctree, node,
  			       GTK_CTREE_NODE (clist->row_list_end)))))
!     GTK_CTREE_NODE (clist->row_list_end) = GTK_CTREE_NODE_PREV (node);
  
    /* update list */
    rows = 0;
--- 2622,2628 ----
         (GTK_CTREE_ROW (node)->children &&
  	gtk_ctree_is_ancestor (ctree, node,
  			       GTK_CTREE_NODE (clist->row_list_end)))))
!     LGTK_CTREE_NODE (clist->row_list_end) = GTK_CTREE_NODE_PREV (node);
  
    /* update list */
    rows = 0;
***************
*** 2692,2698 ****
    else
      {
        if (GTK_CTREE_NODE (clist->row_list) == node)
! 	GTK_CTREE_NODE (clist->row_list) = GTK_CTREE_ROW (node)->sibling;
        else
  	{
  	  GtkCTreeNode *sibling;
--- 2693,2699 ----
    else
      {
        if (GTK_CTREE_NODE (clist->row_list) == node)
! 	LGTK_CTREE_NODE (clist->row_list) = GTK_CTREE_ROW (node)->sibling;
        else
  	{
  	  GtkCTreeNode *sibling;
***************
*** 2880,2886 ****
        if (GTK_CTREE_NODE_NEXT (node))
  	GTK_CTREE_NODE_PREV (GTK_CTREE_NODE_NEXT (node)) = work;
        else
! 	GTK_CTREE_NODE (clist->row_list_end) = work;
  
        GTK_CTREE_NODE_NEXT (node) = GTK_CTREE_ROW (node)->children;
        
--- 2881,2887 ----
        if (GTK_CTREE_NODE_NEXT (node))
  	GTK_CTREE_NODE_PREV (GTK_CTREE_NODE_NEXT (node)) = work;
        else
! 	LGTK_CTREE_NODE (clist->row_list_end) = work;
  
        GTK_CTREE_NODE_NEXT (node) = GTK_CTREE_ROW (node)->children;
        
***************
*** 2952,2958 ****
        else
  	{
  	  GTK_CTREE_NODE_NEXT (node) = NULL;
! 	  GTK_CTREE_NODE (clist->row_list_end) = node;
  	}
  
        if (gtk_ctree_is_visible (ctree, node))
--- 2953,2959 ----
        else
  	{
  	  GTK_CTREE_NODE_NEXT (node) = NULL;
! 	  LGTK_CTREE_NODE (clist->row_list_end) = node;
  	}
  
        if (gtk_ctree_is_visible (ctree, node))
***************
*** 3733,3739 ****
    /* create the row */
    new_row = row_new (ctree);
    node = GTK_CTREE_NODE (g_list_alloc ());
!   GTK_CTREE_ROW (node) = new_row;
  
    if (text)
      for (i = 0; i < clist->columns; i++)
--- 3734,3740 ----
    /* create the row */
    new_row = row_new (ctree);
    node = GTK_CTREE_NODE (g_list_alloc ());
!   LGTK_CTREE_ROW (node) = new_row;
  
    if (text)
      for (i = 0; i < clist->columns; i++)
***************
*** 3792,3798 ****
      return NULL;
    if (!(cnode = GTK_CTREE_NODE (g_list_alloc ())))
      return NULL;
!   GTK_CTREE_ROW (cnode) = new_row;
  
    set_node_info (ctree, cnode, "", 0, NULL, NULL, NULL, NULL, TRUE, FALSE);
  
--- 3793,3799 ----
      return NULL;
    if (!(cnode = GTK_CTREE_NODE (g_list_alloc ())))
      return NULL;
!   LGTK_CTREE_ROW (cnode) = new_row;
  
    set_node_info (ctree, cnode, "", 0, NULL, NULL, NULL, NULL, TRUE, FALSE);
  
diff -rc orig/gtk+-1.1.1/gtk/gtkctree.h gtk+-1.1.1/gtk/gtkctree.h
*** orig/gtk+-1.1.1/gtk/gtkctree.h	Wed Aug  5 04:19:01 1998
--- gtk+-1.1.1/gtk/gtkctree.h	Mon Aug 17 09:39:06 1998
***************
*** 38,47 ****
  #define GTK_IS_CTREE(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_CTREE))
  #define GTK_IS_CTREE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CTREE))
  
  #define GTK_CTREE_ROW(_node_) ((GtkCTreeRow *)(((GList *)(_node_))->data))
  #define GTK_CTREE_NODE(_node_) ((GtkCTreeNode *)((_node_)))
! #define GTK_CTREE_NODE_NEXT(_nnode_) ((GtkCTreeNode *)(((GList *)(_nnode_))->next))
! #define GTK_CTREE_NODE_PREV(_pnode_) ((GtkCTreeNode *)(((GList *)(_pnode_))->prev))
  #define GTK_CTREE_TREE(_ctree_, _glist_) \
    ((GtkCellTree *) &(((GtkCTreeRow *)((_glist_)->data))->cell[(_ctree_)->tree_col]))
  
--- 38,49 ----
  #define GTK_IS_CTREE(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_CTREE))
  #define GTK_IS_CTREE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CTREE))
  
+ #define LGTK_CTREE_ROW(_node_) (*(GtkCTreeRow **)(&((GList *)(_node_))->data))
  #define GTK_CTREE_ROW(_node_) ((GtkCTreeRow *)(((GList *)(_node_))->data))
+ #define LGTK_CTREE_NODE(_node_) (*(GtkCTreeNode **)(&(_node_)))
  #define GTK_CTREE_NODE(_node_) ((GtkCTreeNode *)((_node_)))
! #define GTK_CTREE_NODE_NEXT(_nnode_) (*(GtkCTreeNode **)(&((GList *)(_nnode_))->next))
! #define GTK_CTREE_NODE_PREV(_pnode_) (*(GtkCTreeNode **)(&((GList *)(_pnode_))->prev))
  #define GTK_CTREE_TREE(_ctree_, _glist_) \
    ((GtkCellTree *) &(((GtkCTreeRow *)((_glist_)->data))->cell[(_ctree_)->tree_col]))
  
diff -rc orig/gtk+-1.1.1/gtk/gtkeditable.c gtk+-1.1.1/gtk/gtkeditable.c
*** orig/gtk+-1.1.1/gtk/gtkeditable.c	Fri Jul 24 04:23:59 1998
--- gtk+-1.1.1/gtk/gtkeditable.c	Mon Aug 17 09:43:23 1998
***************
*** 533,539 ****
  
    klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
  
!   return klass->set_position (editable, position);
  }
  
  gint
--- 533,539 ----
  
    klass = GTK_EDITABLE_CLASS (GTK_OBJECT (editable)->klass);
  
!   /* return klass->set_position (editable, position); */
  }
  
  gint



____________________________________________________________________
Get free e-mail and a permanent address at http://www.netaddress.com/?N=1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]