Revision: 54132
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54132&view=rev
Author:   caen23
Date:     2013-01-04 10:15:55 +0000 (Fri, 04 Jan 2013)
Log Message:
-----------
Revert to r54130, some files were wrongly committed

Revision Links:
--------------
    http://brlcad.svn.sourceforge.net/brlcad/?rev=54130&view=rev

Modified Paths:
--------------
    brlcad/trunk/include/bu.h
    brlcad/trunk/include/pkg.h
    brlcad/trunk/src/gtools/g_transfer.c
    brlcad/trunk/src/libbu/htonf.c
    brlcad/trunk/src/libbu/tests/CMakeLists.txt
    brlcad/trunk/src/libbu/vlb.c

Modified: brlcad/trunk/include/bu.h
===================================================================
--- brlcad/trunk/include/bu.h   2013-01-04 08:33:45 UTC (rev 54131)
+++ brlcad/trunk/include/bu.h   2013-01-04 10:15:55 UTC (rev 54132)
@@ -2091,12 +2091,10 @@
  *         should be a size_t.
  */
 #ifndef offsetof
-#  define bu_offsetof(_t, _m) (size_t)(&(((_t *)0)->_m))
-#  define bu_offsetofarray(_t, _m) (size_t)((((_t *)0)->_m))
-#else
-#  define bu_offsetof(_t, _m) (size_t)offsetof(_t, _m)
-#  define bu_offsetofarray(_t, _m) (size_t)offsetof(_t, _m[0])
+#  define offsetof(_t, _m) (size_t)(&(((_t *)0)->_m))
 #endif
+#define bu_offsetof(_t, _m) (size_t)offsetof(_t, _m)
+#define bu_offsetofarray(_t, _a, _d, _i) bu_offsetof(_t, _a) + sizeof(_d) * _i
 
 
 /**
@@ -5271,14 +5269,6 @@
 BU_EXPORT extern size_t bu_vlb_buflen(struct bu_vlb *vlb);
 
 /**
- * Return the number of bytes allocated for the buffer of the bu_vlb structure
- *
- * @param vlb Pointer to the bu_vlb structure
- * @return The number of bytes allocated for the buffer of the bu_vlb structure
- */
-BU_EXPORT extern size_t bu_vlb_capacity(struct bu_vlb *vlb);
-
-/**
  * Free the memory allocated for the byte array in the bu_vlb
  * structure.  Also uninitializes the structure.
  *

Modified: brlcad/trunk/include/pkg.h
===================================================================
--- brlcad/trunk/include/pkg.h  2013-01-04 08:33:45 UTC (rev 54131)
+++ brlcad/trunk/include/pkg.h  2013-01-04 10:15:55 UTC (rev 54132)
@@ -107,7 +107,6 @@
     /* neg->read new hdr, 0->all here, >0 ->more to come */
     char *pkc_buf;                             /**< @brief start of dynamic 
buf */
     char *pkc_curpos;                          /**< @brief current position in 
pkg_buf */
-    void *pkc_server_data;                     /**< @brief used to hold server 
data for callbacks */
 };
 #define PKC_NULL       ((struct pkg_conn *)0)
 #define PKC_ERROR      ((struct pkg_conn *)(-1L))

Modified: brlcad/trunk/src/gtools/g_transfer.c
===================================================================
--- brlcad/trunk/src/gtools/g_transfer.c        2013-01-04 08:33:45 UTC (rev 
54131)
+++ brlcad/trunk/src/gtools/g_transfer.c        2013-01-04 10:15:55 UTC (rev 
54132)
@@ -69,27 +69,12 @@
 /* in-memory geometry database filled in by the server as it receives
  * geometry from the client.
  */
-/*
- * Struct DBIP = null;
- * srv_argc = 0;
- * char **srv_argv = NULL;
- */
-typedef struct _server_data_ {
-       struct db_i *DBIP;
-       /* used by server to stash what it should shoot at */
-       int srv_argc;
-       char **srv_argv;
-} server_data;
+struct db_i *DBIP = NULL;
 
+/* used by server to stash what it should shoot at */
+int srv_argc = 0;
+char **srv_argv = NULL;
 
-server_data*
-init_srv_data () {
-               server_data *stash = bu_malloc(sizeof *stash, "server data 
memory");
-               stash->DBIP = NULL;
-               stash->srv_argc = 0;
-               stash->srv_argv = NULL;
-               return stash;
-}
 
 /** print a usage statement when invoked with bad, help, or no arguments
  */
@@ -126,18 +111,18 @@
 }
 
 void
-do_something(server_data *stash) {
+do_something() {
     /* shoot a ray at some geometry just to show that we can */
     struct application ap;
     struct rt_i *rtip;
     int i;
 
-    if (!stash->DBIP) {
+    if (!DBIP) {
        return;
     }
 
     RT_APPLICATION_INIT(&ap);
-    rtip = rt_new_rti(stash->DBIP); /* clone dbip */
+    rtip = rt_new_rti(DBIP); /* clone dbip */
     if (!rtip) {
        bu_log("Unable to create a database instance off of the raytrace 
instance\n");
        return;
@@ -150,13 +135,13 @@
     VSET(ap.a_ray.r_dir, 0, 0, -1);
 
     /* shoot at any geometry specified */
-    for (i = 0; i < stash->srv_argc; i++) {
-       if (rt_gettree(rtip, stash->srv_argv[i]) != 0) {
-           bu_log("Unable to validate %s for raytracing\n", 
stash->srv_argv[i]);
+    for (i = 0; i < srv_argc; i++) {
+       if (rt_gettree(rtip, srv_argv[i]) != 0) {
+           bu_log("Unable to validate %s for raytracing\n", srv_argv[i]);
            continue;
        }
        rt_prep(rtip);
-       bu_log("Shooting at %s from (0, 0, 10000) in the (0, 0, -1) 
direction\n", stash->srv_argv[i]);
+       bu_log("Shooting at %s from (0, 0, 10000) in the (0, 0, -1) 
direction\n", srv_argv[i]);
        (void)rt_shootray(&ap);
        rt_clean(rtip);
     }
@@ -176,41 +161,36 @@
 
 
 void
-server_args(struct pkg_conn *connection, char *buf)
+server_args(struct pkg_conn *UNUSED(connection), char *buf)
 {
     /* updates the srv_argc and srv_argv application globals used to
      * show that we can shoot at geometry in-memory.
      */
-       server_data *stash;
-       stash = init_srv_data();
-       stash->srv_argc++;
-    if (!stash->srv_argv) {
-       stash->srv_argv = bu_calloc(1, stash->srv_argc * sizeof(char *), 
"server_args() srv_argv calloc");
+    srv_argc++;
+    if (!srv_argv) {
+       srv_argv = bu_calloc(1, srv_argc * sizeof(char *), "server_args() 
srv_argv calloc");
     } else {
-       stash->srv_argv = bu_realloc(stash->srv_argv, stash->srv_argc * 
sizeof(char *), "server_args() srv_argv realloc");
+       srv_argv = bu_realloc(srv_argv, srv_argc * sizeof(char *), 
"server_args() srv_argv realloc");
     }
-    stash->srv_argv[stash->srv_argc - 1] = bu_calloc(1, strlen(buf)+1, 
"server_args() srv_argv[] calloc");
-    bu_strlcpy(stash->srv_argv[stash->srv_argc - 1], buf, strlen(buf)+1);
+    srv_argv[srv_argc - 1] = bu_calloc(1, strlen(buf)+1, "server_args() 
srv_argv[] calloc");
+    bu_strlcpy(srv_argv[srv_argc - 1], buf, strlen(buf)+1);
 
     bu_log("Planning to shoot at %s\n", buf);
-    connection->pkc_server_data = stash;;
+
     free(buf);
 }
 
 
 void
-server_geom(struct pkg_conn *connection, char *buf)
+server_geom(struct pkg_conn *UNUSED(connection), char *buf)
 {
     struct bu_external ext;
     struct db5_raw_internal raw;
     int flags;
 
-    server_data *stash;
-    stash =(server_data*) connection->pkc_server_data;
-
-    if (stash->DBIP == NULL) {
+    if (DBIP == NULL) {
        /* first geometry received, initialize */
-       stash->DBIP = db_open_inmem();
+       DBIP = db_open_inmem();
     }
 
     if (db5_get_raw_internal_ptr(&raw, (const unsigned char *)buf) == NULL) {
@@ -226,29 +206,27 @@
     ext.ext_buf = (uint8_t *)buf;
     ext.ext_nbytes = raw.object_length;
     flags = db_flags_raw_internal(&raw) | RT_DIR_INMEM;
-    wdb_export_external(stash->DBIP->dbi_wdbp, &ext, (const char 
*)raw.name.ext_buf, flags, raw.minor_type);
+    wdb_export_external(DBIP->dbi_wdbp, &ext, (const char *)raw.name.ext_buf, 
flags, raw.minor_type);
 
     bu_log("Received %s (MAJOR=%d, MINOR=%d)\n", raw.name.ext_buf, 
raw.major_type, raw.minor_type);
 }
 
 
 void
-server_ciao(struct pkg_conn* connection, char *buf)
+server_ciao(struct pkg_conn *UNUSED(connection), char *buf)
 {
-    server_data *stash;
-
     bu_log("CIAO encountered\n");
-    stash = (server_data*) connection->pkc_server_data;
+
     /* shoot some rays just to show that we can if server was
      * invoked with specific geometry.
      */
-    do_something(stash);
+    do_something();
 
-    if (stash->DBIP != NULL) {
+    if (DBIP != NULL) {
        /* uncomment to avoid an in-mem dbip close bug */
        /* DBIP->dbi_fp = fopen("/dev/null", "rb");*/
-       db_close(stash->DBIP);
-       stash->DBIP = NULL;
+       db_close(DBIP);
+       DBIP = NULL;
     }
 
     free(buf);

Modified: brlcad/trunk/src/libbu/htonf.c
===================================================================
--- brlcad/trunk/src/libbu/htonf.c      2013-01-04 08:33:45 UTC (rev 54131)
+++ brlcad/trunk/src/libbu/htonf.c      2013-01-04 10:15:55 UTC (rev 54132)
@@ -28,54 +28,78 @@
 
 #include "bu.h"
 
-/* 
- * a definition of convert_float: a function that takes a float and 
- * converts it to the format of the host/network 
- */
-HIDDEN void convert_float(register unsigned char *out, register const unsigned 
char *in, size_t count)
-{
-        register size_t i;
-        assert(sizeof(float) == SIZEOF_NETWORK_FLOAT);
-        switch (bu_byteorder()) {
-               case BU_BIG_ENDIAN:
-                /*
-                 * First, the case where the system already operates in
-                 * IEEE format internally, using big-endian order. These
-                 * are the lucky ones.
-                 */
-                memcpy(out, in, count*SIZEOF_NETWORK_FLOAT);
-                return;
-                case BU_LITTLE_ENDIAN:
-                    /*
-                     * This machine uses IEEE, but in little-endian byte order
-                     */
-                    for (i=count; i > 0; i--) {
-                        *out++ = in[3];
-                        *out++ = in[2];
-                        *out++ = in[1];
-                        *out++ = in[0];
-                        in += SIZEOF_NETWORK_FLOAT;
-                    }
-                    return;
-                default:
-                    /* nada */
-                    break;
-        }
-        bu_bomb("ntohf.c: ERROR, no NtoHD conversion for this machine type\n");
-}
 
-
 void
 htonf(register unsigned char *out, register const unsigned char *in, size_t 
count)
 {
-convert_float(out,in,count);
+    register size_t i;
+
+    assert(sizeof(float) == SIZEOF_NETWORK_FLOAT);
+
+    switch (bu_byteorder()) {
+       case BU_BIG_ENDIAN:
+           /*
+            * First, the case where the system already operates in
+            * IEEE format internally, using big-endian order.  These
+            * are the lucky ones.
+            */
+           memcpy(out, in, count*SIZEOF_NETWORK_FLOAT);
+           return;
+       case BU_LITTLE_ENDIAN:
+           /*
+            * This machine uses IEEE, but in little-endian byte order
+            */
+           for (i=count; i > 0; i--) {
+               *out++ = in[3];
+               *out++ = in[2];
+               *out++ = in[1];
+               *out++ = in[0];
+               in += SIZEOF_NETWORK_FLOAT;
+           }
+           return;
+       default:
+           /* nada */
+           break;
+    }
+
+    bu_bomb("ntohf.c:  ERROR, no NtoHD conversion for this machine type\n");
 }
 
 
 void
 ntohf(register unsigned char *out, register const unsigned char *in, size_t 
count)
 {
-convert_float(out,in,count);
+    register size_t i;
+
+    assert(sizeof(float) == SIZEOF_NETWORK_FLOAT);
+
+    switch (bu_byteorder()) {
+       case BU_BIG_ENDIAN:
+           /*
+            * First, the case where the system already operates in
+            * IEEE format internally, using big-endian order.  These
+            * are the lucky ones.
+            */
+           memcpy(out, in, count*SIZEOF_NETWORK_FLOAT);
+           return;
+       case BU_LITTLE_ENDIAN:
+           /*
+            * This machine uses IEEE, but in little-endian byte order
+            */
+           for (i=count; i > 0; i--) {
+               *out++ = in[3];
+               *out++ = in[2];
+               *out++ = in[1];
+               *out++ = in[0];
+               in += SIZEOF_NETWORK_FLOAT;
+           }
+           return;
+       default:
+           /* nada */
+           break;
+    }
+
+    bu_bomb("ntohf.c:  ERROR, no NtoHD conversion for this machine type\n");
 }
 
 /*

Modified: brlcad/trunk/src/libbu/tests/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libbu/tests/CMakeLists.txt 2013-01-04 08:33:45 UTC (rev 
54131)
+++ brlcad/trunk/src/libbu/tests/CMakeLists.txt 2013-01-04 10:15:55 UTC (rev 
54132)
@@ -355,32 +355,6 @@
 add_test(bu_vls_vprintf_test_56 tester_bu_vls_vprintf 56)
 add_test(bu_vls_vprintf_test_57 tester_bu_vls_vprintf 57)
 
-#
-#  ************ vlb.c tests *************
-#
-# For tester_bu_vlb the format is:
-#
-# tester_bu_vlb [-i initSize] size ...
-#
-# Where size is the size of a memory block to be added to the array
-# The blocks will be allocated sequentially and filled with random data.
-#
-# Adding the -i option will specify an initial size to be allocated when the 
buffer is initialized.
-
-BRLCAD_ADDEXEC(tester_bu_vlb bu_vlb.c libbu NO_INSTALL LOCAL)
-
-add_test(bu_vlb_test_single        tester_bu_vlb 1)
-add_test(bu_vlb_test_twice_single   tester_bu_vlb 1 1)
-add_test(bu_vlb_test_3             tester_bu_vlb 1 2 3)
-add_test(bu_vlb_test_larger        tester_bu_vlb 10 30)
-add_test(bu_vlb_test_very_large            tester_bu_vlb 1000 2000 3000 4000 
5000)
-add_test(bu_vlb_test_very_large_2   tester_bu_vlb 5000 4000 3000 2000 1000)
-add_test(bu_vlb_test_boundary_alloc tester_bu_vlb 511 1 1 256 255 512 1024)
-add_test(bu_vlb_test_many_writes    tester_bu_vlb 128 128 128 128 128 128 128 
128 128 128 128 128 128 128 128 128)
-
-add_test(bu_vlb_test_large_init            tester_bu_vlb -i 2048 1000 2000 
3000 4000)
-add_test(bu_vlb_test_large_init_2   tester_bu_vlb -i 6500 4000 3000 2000 1000)
-
 # Local Variables:
 # tab-width: 8
 # mode: cmake

Modified: brlcad/trunk/src/libbu/vlb.c
===================================================================
--- brlcad/trunk/src/libbu/vlb.c        2013-01-04 08:33:45 UTC (rev 54131)
+++ brlcad/trunk/src/libbu/vlb.c        2013-01-04 10:15:55 UTC (rev 54132)
@@ -99,14 +99,7 @@
     return vlb->nextByte;
 }
 
-size_t
-bu_vlb_capacity(struct bu_vlb *vlb)
-{
-    BU_CKMAG(vlb, BU_VLB_MAGIC, "magic for bu_vlb");
-    return vlb->bufCapacity;
-}
 
-
 void
 bu_vlb_free(struct bu_vlb *vlb)
 {

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


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to