Revision: 40614
          http://brlcad.svn.sourceforge.net/brlcad/?rev=40614&view=rev
Author:   davidloman
Date:     2010-09-20 17:56:38 +0000 (Mon, 20 Sep 2010)

Log Message:
-----------
Upgrade libpkg to allow for user data being passed to the callback functions 
via the pkg_conn struct.

Modified Paths:
--------------
    brlcad/trunk/include/pkg.h
    brlcad/trunk/src/libpkg/pkg.c

Modified: brlcad/trunk/include/pkg.h
===================================================================
--- brlcad/trunk/include/pkg.h  2010-09-20 17:38:15 UTC (rev 40613)
+++ brlcad/trunk/include/pkg.h  2010-09-20 17:56:38 UTC (rev 40614)
@@ -66,6 +66,7 @@
 struct pkg_switch {
     unsigned short pks_type;   /**< @brief Type code */
     pkg_callback pks_handler;  /**< @brief Message Handler */
+    void *pks_user_data;             /**< @brief User defined pointer to data 
*/
     char *pks_title;           /**< @brief Description of message type */
 };
 
@@ -91,6 +92,7 @@
     struct pkg_header pkc_hdr;                 /**< @brief hdr of cur msg */
     size_t pkc_len;                            /**< @brief pkg_len, in host 
order */
     unsigned short pkc_type;                   /**< @brief pkg_type, in host 
order */
+    void *pkc_user_data;                             /**< @brief User defined 
pointer to data for the current pkg_type */
     /* OUTPUT BUFFER */
     char pkc_stream[PKG_STREAMLEN];            /**< @brief output stream */
     unsigned int pkc_magic;                    /**< @brief for validating 
pointers */

Modified: brlcad/trunk/src/libpkg/pkg.c
===================================================================
--- brlcad/trunk/src/libpkg/pkg.c       2010-09-20 17:38:15 UTC (rev 40613)
+++ brlcad/trunk/src/libpkg/pkg.c       2010-09-20 17:56:38 UTC (rev 40614)
@@ -1525,6 +1525,10 @@
        pc->pkc_buf = (char *)0;
        pc->pkc_curpos = (char *)0;
        pc->pkc_left = -1;              /* safety */
+
+       /* copy the user_data from the current pkg_switch into the pkg_conn */
+       pc->pkc_user_data = pc->pkc_switch[i].pks_user_data;
+
        /* pc->pkc_type, pc->pkc_len are preserved for handler */
        pc->pkc_switch[i].pks_handler(pc, tempbuf);
        return 1;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to