Revision: 65585
http://sourceforge.net/p/brlcad/code/65585
Author: starseeker
Date: 2015-07-12 00:27:26 +0000 (Sun, 12 Jul 2015)
Log Message:
-----------
Switch binunif/db5_bin off of Tcl objects. Not quite sure how to test this
one...
Modified Paths:
--------------
brlcad/trunk/src/librt/binunif/db5_bin.c
Modified: brlcad/trunk/src/librt/binunif/db5_bin.c
===================================================================
--- brlcad/trunk/src/librt/binunif/db5_bin.c 2015-07-12 00:21:23 UTC (rev
65584)
+++ brlcad/trunk/src/librt/binunif/db5_bin.c 2015-07-12 00:27:26 UTC (rev
65585)
@@ -668,45 +668,47 @@
intern->idb_type = new_type;
}
} else if (BU_STR_EQUAL(argv[0], "D")) {
- Tcl_Obj *obj, *list, **obj_array;
int list_len;
+ const char **obj_array;
unsigned char *buf, *d;
- char *s;
+ const char *s;
int hexlen;
unsigned int h;
- obj = Tcl_NewStringObj(argv[1], -1);
- list = Tcl_NewListObj(0, NULL);
- Tcl_ListObjAppendList(brlcad_interp, list, obj);
- (void)Tcl_ListObjGetElements(brlcad_interp, list, &list_len,
&obj_array);
+ /* split initial list */
+ if (bu_argv_from_tcl_list(argv[1], &list_len, (const char
***)&obj_array) != 0) {
+ return -1;
+ }
hexlen = 0;
for (i = 0; i < (size_t)list_len; i++) {
- hexlen += Tcl_GetCharLength(obj_array[i]);
+ hexlen += strlen(obj_array[i]);
}
if (hexlen % 2) {
bu_vls_printf(logstr, "Hex form of binary data must have an
even number of hex digits");
+ bu_free((char *)obj_array, "obj array");
return BRLCAD_ERROR;
}
buf = (unsigned char *)bu_malloc(hexlen / 2, "tcladjust binary
data");
d = buf;
for (i = 0; i < (size_t)list_len; i++) {
- s = Tcl_GetString(obj_array[i]);
+ s = obj_array[i];
while (*s) {
sscanf(s, "%2x", &h);
*d++ = h;
s += 2;
}
}
- Tcl_DecrRefCount(list);
if (bip->u.uint8) {
bu_free(bip->u.uint8, "binary data");
}
bip->u.uint8 = buf;
bip->count = hexlen / 2 / binu_sizes[bip->type];
+
+ bu_free((char *)obj_array, "obj array");
}
argc -= 2;
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