Revision: 65578
http://sourceforge.net/p/brlcad/code/65578
Author: starseeker
Date: 2015-07-11 21:58:38 +0000 (Sat, 11 Jul 2015)
Log Message:
-----------
This seems to work, but I could use a second opinion on how to accomplished
what this is trying to do...
Modified Paths:
--------------
brlcad/trunk/src/librt/tree.c
brlcad/trunk/src/rt/rtshot.c
Modified: brlcad/trunk/src/librt/tree.c
===================================================================
--- brlcad/trunk/src/librt/tree.c 2015-07-11 21:38:24 UTC (rev 65577)
+++ brlcad/trunk/src/librt/tree.c 2015-07-11 21:58:38 UTC (rev 65578)
@@ -225,7 +225,8 @@
if (tbl && bu_avs_get(&tsp->ts_attrs, "ORCA_Comp")) {
int newentry;
long int reg_bit = rp->reg_bit;
- const char *key = (char *)reg_bit;
+ struct bu_vls key = BU_VLS_INIT_ZERO;
+ bu_vls_sprintf(&key, "%ld", reg_bit);
inv_mat = (matp_t)bu_calloc(16, sizeof(fastf_t), "inv_mat");
bn_mat_inv(inv_mat, tsp->ts_mat);
@@ -233,11 +234,12 @@
/* enter critical section */
bu_semaphore_acquire(RT_SEM_RESULTS);
- entry = bu_hash_tbl_add(tbl, (unsigned char *)key, strlen(key) + 1,
&newentry);
+ entry = bu_hash_tbl_add(tbl, (unsigned char *)bu_vls_addr(&key),
bu_vls_strlen(&key) + 1, &newentry);
bu_set_hash_value(entry, (unsigned char *)inv_mat);
/* leave critical section */
bu_semaphore_release(RT_SEM_RESULTS);
+ bu_vls_free(&key);
}
if (RT_G_DEBUG & DEBUG_REGIONS) {
Modified: brlcad/trunk/src/rt/rtshot.c
===================================================================
--- brlcad/trunk/src/rt/rtshot.c 2015-07-11 21:38:24 UTC (rev 65577)
+++ brlcad/trunk/src/rt/rtshot.c 2015-07-11 21:58:38 UTC (rev 65578)
@@ -487,8 +487,11 @@
}
for (; pp != PartHeadp; pp = pp->pt_forw) {
matp_t inv_mat;
- const char *key = (const char *)(size_t)pp->pt_regionp->reg_bit;
+ struct bu_vls key = BU_VLS_INIT_ZERO;
struct bu_hash_entry *entry;
+ struct bu_hash_entry *prev = NULL;
+ unsigned long idx;
+ bu_vls_sprintf(&key, "%ld", pp->pt_regionp->reg_bit);
bu_log("\n--- Hit region %s (in %s, out %s) reg_bit = %d\n",
pp->pt_regionp->reg_name,
@@ -497,7 +500,8 @@
pp->pt_regionp->reg_bit);
entry = bu_hash_tbl_find((struct bu_hash_tbl
*)ap->a_rt_i->Orca_hash_tbl,
- (unsigned char *)key, strlen(key) + 1, NULL,
NULL);
+ (unsigned char *)bu_vls_addr(&key),
bu_vls_strlen(&key) + 1, &prev, &idx);
+ bu_vls_free(&key);
if (!entry) {
inv_mat = (matp_t)NULL;
} else {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits