Revision: 42118
http://brlcad.svn.sourceforge.net/brlcad/?rev=42118&view=rev
Author: brlcad
Date: 2011-01-12 01:46:12 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
differentiate BU_PTBL_LEN() from BU_PTBL_END() such that the prior is not a
valid lvalue. this makes it more appropriate for loop testing and can be an
unsigned type instead of the potentially signed off_t offset type of the
underlying struct member. update references accordingly.
Modified Paths:
--------------
brlcad/trunk/include/bu.h
brlcad/trunk/src/conv/g-obj.c
brlcad/trunk/src/conv/proe-g.c
brlcad/trunk/src/libged/tables.c
brlcad/trunk/src/librt/primitives/nmg/nmg_misc.c
brlcad/trunk/src/librt/primitives/submodel/submodel.c
Modified: brlcad/trunk/include/bu.h
===================================================================
--- brlcad/trunk/include/bu.h 2011-01-12 01:45:10 UTC (rev 42117)
+++ brlcad/trunk/include/bu.h 2011-01-12 01:46:12 UTC (rev 42118)
@@ -1400,7 +1400,7 @@
#define BU_PTBL_BASEADDR(ptbl) ((ptbl)->buffer)
#define BU_PTBL_LASTADDR(ptbl) ((ptbl)->buffer + (ptbl)->end - 1)
#define BU_PTBL_END(ptbl) ((ptbl)->end)
-#define BU_PTBL_LEN(p) ((p)->end)
+#define BU_PTBL_LEN(ptbl) ((size_t)(ptbl)->end)
#define BU_PTBL_GET(ptbl, i) ((ptbl)->buffer[(i)])
#define BU_PTBL_SET(ptbl, i, val) ((ptbl)->buffer[(i)] = (long*)(val))
#define BU_PTBL_TEST(ptbl) ((ptbl)->l.magic == BU_PTBL_MAGIC)
Modified: brlcad/trunk/src/conv/g-obj.c
===================================================================
--- brlcad/trunk/src/conv/g-obj.c 2011-01-12 01:45:10 UTC (rev 42117)
+++ brlcad/trunk/src/conv/g-obj.c 2011-01-12 01:46:12 UTC (rev 42118)
@@ -377,7 +377,7 @@
/* Write vertexuse normals */
if ( do_normals )
{
- for ( i=0; i<BU_PTBL_END( &norms ); i++ )
+ for ( i=0; i<BU_PTBL_LEN( &norms ); i++ )
{
struct vertexuse_a_plane *va;
Modified: brlcad/trunk/src/conv/proe-g.c
===================================================================
--- brlcad/trunk/src/conv/proe-g.c 2011-01-12 01:45:10 UTC (rev 42117)
+++ brlcad/trunk/src/conv/proe-g.c 2011-01-12 01:46:12 UTC (rev 42118)
@@ -907,9 +907,9 @@
dbip = fd_out->dbip;
- if (debug || BU_PTBL_END(&null_parts) ) {
+ if (debug || BU_PTBL_LEN(&null_parts) ) {
bu_log("Deleting references to the following null parts:\n");
- for (i=0; i<BU_PTBL_END(&null_parts); i++) {
+ for (i=0; i<BU_PTBL_LEN(&null_parts); i++) {
char *save_name;
save_name = (char *)BU_PTBL_GET(&null_parts, i);
@@ -962,7 +962,7 @@
size_t k;
int found=0;
- for (k=0; k<BU_PTBL_END(&null_parts); k++) {
+ for (k=0; k<BU_PTBL_LEN(&null_parts); k++) {
char *save_name;
save_name = (char *)BU_PTBL_GET(&null_parts, k);
Modified: brlcad/trunk/src/libged/tables.c
===================================================================
--- brlcad/trunk/src/libged/tables.c 2011-01-12 01:45:10 UTC (rev 42117)
+++ brlcad/trunk/src/libged/tables.c 2011-01-12 01:46:12 UTC (rev 42118)
@@ -166,7 +166,7 @@
(void)fprintf(tabptr, " %-4ld %4ld %4ld %4ld %4ld ",
*numreg, comb->region_id, comb->aircode, comb->GIFTmater,
comb->los);
- for (k=0; k<BU_PTBL_END(cur_path); k++) {
+ for (k=0; k<BU_PTBL_LEN(cur_path); k++) {
struct directory *path_dp;
path_dp = (struct directory *)BU_PTBL_GET(cur_path, k);
Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_misc.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_misc.c 2011-01-12 01:45:10 UTC
(rev 42117)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_misc.c 2011-01-12 01:46:12 UTC
(rev 42118)
@@ -11133,7 +11133,7 @@
bot->num_faces = 0;
/* count the number of triangles */
- for (i=0; i<(size_t)BU_PTBL_LEN(&nmg_faces); i++) {
+ for (i=0; i<BU_PTBL_LEN(&nmg_faces); i++) {
struct face *f;
struct faceuse *fu;
struct loopuse *lu;
@@ -11168,7 +11168,7 @@
bot->face_mode = (struct bu_bitv *)NULL;
/* fill in the vertices */
- for (i=0; i<(size_t)BU_PTBL_LEN(&nmg_vertices); i++) {
+ for (i=0; i<BU_PTBL_LEN(&nmg_vertices); i++) {
struct vertex_g *vg;
v = (struct vertex *)BU_PTBL_GET(&nmg_vertices, i);
@@ -11182,7 +11182,7 @@
/* fill in the faces */
face_no = 0;
- for (i=0; i<(size_t)BU_PTBL_LEN(&nmg_faces); i++) {
+ for (i=0; i<BU_PTBL_LEN(&nmg_faces); i++) {
struct face *f;
struct faceuse *fu;
struct loopuse *lu;
Modified: brlcad/trunk/src/librt/primitives/submodel/submodel.c
===================================================================
--- brlcad/trunk/src/librt/primitives/submodel/submodel.c 2011-01-12
01:45:10 UTC (rev 42117)
+++ brlcad/trunk/src/librt/primitives/submodel/submodel.c 2011-01-12
01:46:12 UTC (rev 42118)
@@ -212,8 +212,8 @@
rt_prep_parallel(sub_rtip, 1);
/* Ensure bu_ptbl rti_resources is full size. Ptrs will be null */
- if ((size_t)BU_PTBL_LEN(&sub_rtip->rti_resources) <
sub_rtip->rti_resources.blen) {
- BU_PTBL_LEN(&sub_rtip->rti_resources) =
(off_t)sub_rtip->rti_resources.blen;
+ if (BU_PTBL_LEN(&sub_rtip->rti_resources) < sub_rtip->rti_resources.blen) {
+ BU_PTBL_END(&sub_rtip->rti_resources) = sub_rtip->rti_resources.blen;
}
if (RT_G_DEBUG) rt_pr_cut_info(sub_rtip, stp->st_name);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits