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

gEDA-cvs: CVS update: o_arc.c



  User: pcjc2   
  Date: 07/02/24 21:15:57

  Modified:    .        o_arc.c o_box.c o_circle.c o_line.c x_multiattrib.c
                        x_pagesel.c x_preview.c x_window.c
  Log:
  Replaced some loosely typed function pointers with more strongly typed pointers.
  
  
  
  Pointers such as void (*draw_func)() don't allow the compiler to check for incompatible pointer assignment. 
  
  Replacing with strictly typed pointers increases robustness.
  
  
  
  
  
  
  Revision  Changes    Path
  1.28      +7 -1      eda/geda/gaf/gschem/src/o_arc.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_arc.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_arc.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -b -r1.27 -r1.28
  --- o_arc.c	24 Feb 2007 18:43:14 -0000	1.27
  +++ o_arc.c	25 Feb 2007 02:15:56 -0000	1.28
  @@ -36,6 +36,12 @@
   /*! \brief */
   #define GET_BOX_HEIGHT(w)			\
   	abs((w)->last_y - (w)->start_y)
  +
  +typedef void (*DRAW_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
  +                           GdkCapStyle cap, gint x, gint y, gint radius,
  +                           gint angle1, gint angle2,
  +                           gint arc_width, gint length, gint space );
  +
   /*! \brief
    *  \note pb20011011 - added this macro to compute distance
    */
  @@ -62,7 +68,7 @@
     int arc_width;
     GdkCapStyle arc_end;
     GdkColor *color;
  -  void (*draw_func)() = NULL;
  +  DRAW_FUNC draw_func = NULL;
     int length, space;
   
     if (o_current->arc == NULL) {
  
  
  
  1.26      +12 -2     eda/geda/gaf/gschem/src/o_box.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_box.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_box.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -b -r1.25 -r1.26
  --- o_box.c	24 Feb 2007 18:43:14 -0000	1.25
  +++ o_box.c	25 Feb 2007 02:15:56 -0000	1.26
  @@ -39,6 +39,16 @@
   #define GET_BOX_TOP(w)				\
   	min((w)->start_y, (w)->last_y);
   
  +typedef void (*DRAW_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
  +                           GdkCapStyle cap, gint filled,
  +                           gint x, gint y, gint width, gint height,
  +                           gint line_width, gint length, gint space );
  +
  +typedef void (*FILL_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
  +                           gint x, gint y, gint width, gint height,
  +                           gint fill_width, gint angle1, gint pitch1,
  +                           gint angle2, gint pitch2 );
  +
   /*! \brief Draw a box on the screen.
    *  \par Function Description
    *  This function is used to draw a box on screen. The box is described in
  @@ -60,8 +70,8 @@
     int fill_width, angle1, pitch1, angle2, pitch2;
     GdkCapStyle box_end;
     GdkColor *color;
  -  void (*draw_func)() = NULL;
  -  void (*fill_func)();
  +  DRAW_FUNC draw_func = NULL;
  +  FILL_FUNC fill_func;
   
     if (o_current->box == NULL) {
       return;
  
  
  
  1.24      +12 -2     eda/geda/gaf/gschem/src/o_circle.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_circle.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_circle.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -b -r1.23 -r1.24
  --- o_circle.c	24 Feb 2007 18:43:14 -0000	1.23
  +++ o_circle.c	25 Feb 2007 02:15:56 -0000	1.24
  @@ -35,6 +35,16 @@
   #define GET_BOX_HEIGHT(w)			\
   	abs((w)->last_y - (w)->start_y)
   
  +typedef void (*DRAW_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
  +                           GdkCapStyle cap, gint x, gint y, gint radius,
  +                           gint angle1, gint angle2,
  +                           gint arc_width, gint length, gint space );
  +
  +typedef void (*FILL_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
  +                           gint x, gint y, gint radius,
  +                           gint fill_width, gint angle1, gint pitch1,
  +                           gint angle2, gint pitch2 );
  +
   /*! \brief Draw a circle on the screen.
    *  \par Function Description
    *  This function is used to draw a circle on screen. The circle is described
  @@ -57,8 +67,8 @@
     int fill_width, angle1, pitch1, angle2, pitch2;
     GdkCapStyle circle_end;
     GdkColor *color;
  -  void (*draw_func)() = NULL;
  -  void (*fill_func)();
  +  DRAW_FUNC draw_func = NULL;
  +  FILL_FUNC fill_func;
   
     if (o_current->circle == NULL) {
       return;
  
  
  
  1.25      +6 -1      eda/geda/gaf/gschem/src/o_line.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_line.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_line.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -b -r1.24 -r1.25
  --- o_line.c	24 Feb 2007 18:43:14 -0000	1.24
  +++ o_line.c	25 Feb 2007 02:15:56 -0000	1.25
  @@ -30,6 +30,11 @@
   #include <dmalloc.h>
   #endif
   
  +typedef void (*DRAW_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
  +                           GdkCapStyle cap,
  +                           gint x1, gint y1, gint x2, gint y2,
  +                           gint line_width, gint length, gint space );
  +
   /*! \brief Draw a line on screen.
    *  \par Function Description
    *  This function is used to draw a line on screen. The line is described
  @@ -49,7 +54,7 @@
     int line_width, length, space;
     GdkColor *color;
     GdkCapStyle line_end;
  -  void (*draw_func)() = NULL;
  +  DRAW_FUNC draw_func = NULL;
   	
     if (o_current->line == NULL) {
       return;
  
  
  
  1.6       +1 -1      eda/geda/gaf/gschem/src/x_multiattrib.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_multiattrib.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_multiattrib.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- x_multiattrib.c	29 Dec 2006 15:22:17 -0000	1.5
  +++ x_multiattrib.c	25 Feb 2007 02:15:56 -0000	1.6
  @@ -1185,7 +1185,7 @@
     GtkWidget *menu;
     struct menuitem_t {
       gchar *label;
  -    void (*callback)(void);
  +    GCallback callback;
     };
     struct menuitem_t menuitems[] = {
       { N_("Duplicate"), G_CALLBACK (multiattrib_callback_popup_duplicate) },
  
  
  
  1.15      +1 -1      eda/geda/gaf/gschem/src/x_pagesel.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_pagesel.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_pagesel.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- x_pagesel.c	15 Jul 2006 18:51:41 -0000	1.14
  +++ x_pagesel.c	25 Feb 2007 02:15:56 -0000	1.15
  @@ -256,7 +256,7 @@
     GtkWidget *menu;
     struct menuitem_t {
       gchar *label;
  -    void (*callback)(void);
  +    GCallback callback;
     };
     struct menuitem_t menuitems[] = {
       { N_("New Page"),     G_CALLBACK (pagesel_callback_popup_new_page)     },
  
  
  
  1.15      +1 -1      eda/geda/gaf/gschem/src/x_preview.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_preview.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_preview.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- x_preview.c	10 Feb 2007 21:25:31 -0000	1.14
  +++ x_preview.c	25 Feb 2007 02:15:57 -0000	1.15
  @@ -313,7 +313,7 @@
   {
     struct event_reg_t {
       gchar *detailed_signal;
  -    void (*c_handler)(void);
  +    GCallback c_handler;
     } drawing_area_events[] = {
       { "realize",              G_CALLBACK (preview_callback_realize)       },
       { "expose_event",         G_CALLBACK (preview_callback_expose)        },
  
  
  
  1.52      +1 -1      eda/geda/gaf/gschem/src/x_window.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_window.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_window.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -b -r1.51 -r1.52
  --- x_window.c	24 Feb 2007 10:45:42 -0000	1.51
  +++ x_window.c	25 Feb 2007 02:15:57 -0000	1.52
  @@ -345,7 +345,7 @@
   {
     struct event_reg_t {
       gchar *detailed_signal;
  -    void (*c_handler)(void);
  +    GCallback c_handler;
     };
   
     struct event_reg_t drawing_area_events[] = {
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs