Revision: 42162
          http://brlcad.svn.sourceforge.net/brlcad/?rev=42162&view=rev
Author:   brlcad
Date:     2011-01-12 19:06:15 +0000 (Wed, 12 Jan 2011)

Log Message:
-----------
make a slew of other object count struct data members be size_t instead of long 
and int so that can be properly unsigned and higher bound.  match signedness in 
librt accordingly.

Modified Paths:
--------------
    brlcad/trunk/include/raytrace.h
    brlcad/trunk/src/librt/bool.c
    brlcad/trunk/src/librt/cut.c
    brlcad/trunk/src/librt/fortray.c
    brlcad/trunk/src/librt/prep.c
    brlcad/trunk/src/librt/shoot.c
    brlcad/trunk/src/librt/tcl.c
    brlcad/trunk/src/librt/tree.c

Modified: brlcad/trunk/include/raytrace.h
===================================================================
--- brlcad/trunk/include/raytrace.h     2011-01-12 19:01:12 UTC (rev 42161)
+++ brlcad/trunk/include/raytrace.h     2011-01-12 19:06:15 UTC (rev 42162)
@@ -735,11 +735,11 @@
        fastf_t         bn_min[3];
        fastf_t         bn_max[3];
        struct soltab **bn_list;        /**< @brief bn_list[bn_len] */
-       int             bn_len;         /**< @brief # of solids in list */
-       int             bn_maxlen;      /**< @brief # of ptrs allocated to list 
*/
+       size_t          bn_len;         /**< @brief # of solids in list */
+       size_t          bn_maxlen;      /**< @brief # of ptrs allocated to list 
*/
        struct rt_piecelist *bn_piecelist; /**< @brief [] solids with pieces */
-       int             bn_piecelen;    /**< @brief # of piecelists used */
-       int             bn_maxpiecelen; /**< @brief # of piecelists allocated */
+       size_t          bn_piecelen;    /**< @brief # of piecelists used */
+       size_t          bn_maxpiecelen; /**< @brief # of piecelists allocated */
     } bn;
     struct nugridnode {
        int nu_type;
@@ -1339,7 +1339,7 @@
  */
 struct rt_piecelist  {
     unsigned long      magic;
-    long               npieces;        /**< @brief  number of pieces in 
pieces[] array */
+    size_t             npieces;        /**< @brief  number of pieces in 
pieces[] array */
     long               *pieces;        /**< @brief  pieces[npieces], piece 
indices */
     struct soltab      *stp;           /**< @brief  ref back to solid */
 };
@@ -1447,19 +1447,19 @@
  * Structure used by the "reprep" routines
  */
 struct rt_reprep_obj_list {
-    int ntopobjs;              /**< @brief  number of objects in the original 
call to gettrees */
+    size_t ntopobjs;           /**< @brief  number of objects in the original 
call to gettrees */
     char **topobjs;            /**< @brief  list of the above object names */
-    int nunprepped;            /**< @brief  number of objects to be unprepped 
and re-prepped */
+    size_t nunprepped;         /**< @brief  number of objects to be unprepped 
and re-prepped */
     char **unprepped;          /**< @brief  list of the above objects */
     /* Above here must be filled in by application */
     /* Below here is used by dynamic geometry routines, should be zeroed by 
application before use */
     struct bu_ptbl paths;      /**< @brief  list of all paths from topobjs to 
unprepped objects */
     struct db_tree_state **tsp;        /**< @brief  tree state used by tree 
walker in "reprep" routines */
     struct bu_ptbl unprep_regions;     /**< @brief  list of region structures 
that will be "unprepped" */
-    long old_nsolids;          /**< @brief  rtip->nsolids before unprep */
-    long old_nregions;         /**< @brief  rtip->nregions before unprep */
-    long nsolids_unprepped;    /**< @brief  number of soltab structures 
eliminated by unprep */
-    long nregions_unprepped;   /**< @brief  number of region structures 
eliminated by unprep */
+    size_t old_nsolids;                /**< @brief  rtip->nsolids before 
unprep */
+    size_t old_nregions;       /**< @brief  rtip->nregions before unprep */
+    size_t nsolids_unprepped;  /**< @brief  number of soltab structures 
eliminated by unprep */
+    size_t nregions_unprepped; /**< @brief  number of region structures 
eliminated by unprep */
 };
 
 
@@ -1738,17 +1738,17 @@
     genptr_t           Orca_hash_tbl;  /**< @brief  Hash table in matrices for 
ORCA */
     struct bu_ptbl     delete_regs;    /**< @brief  list of region pointers to 
delete after light_init() */
     /* Ray-tracing statistics */
-    long               nregions;       /**< @brief  total # of regions 
participating */
-    long               nsolids;        /**< @brief  total # of solids 
participating */
-    long               rti_nrays;      /**< @brief  # calls to rt_shootray() */
-    long               nmiss_model;    /**< @brief  rays missed model RPP */
-    long               nshots;         /**< @brief  # of calls to ft_shot() */
-    long               nmiss;          /**< @brief  solid ft_shot() returned a 
miss */
-    long               nhits;          /**< @brief  solid ft_shot() returned a 
hit */
-    long               nmiss_tree;     /**< @brief  shots missed sub-tree RPP 
*/
-    long               nmiss_solid;    /**< @brief  shots missed solid RPP */
-    long               ndup;           /**< @brief  duplicate shots at a given 
solid */
-    long               nempty_cells;   /**< @brief  number of empty NUgrid 
cells */
+    size_t             nregions;       /**< @brief  total # of regions 
participating */
+    size_t             nsolids;        /**< @brief  total # of solids 
participating */
+    size_t             rti_nrays;      /**< @brief  # calls to rt_shootray() */
+    size_t             nmiss_model;    /**< @brief  rays missed model RPP */
+    size_t             nshots;         /**< @brief  # of calls to ft_shot() */
+    size_t             nmiss;          /**< @brief  solid ft_shot() returned a 
miss */
+    size_t             nhits;          /**< @brief  solid ft_shot() returned a 
hit */
+    size_t             nmiss_tree;     /**< @brief  shots missed sub-tree RPP 
*/
+    size_t             nmiss_solid;    /**< @brief  shots missed solid RPP */
+    size_t             ndup;           /**< @brief  duplicate shots at a given 
solid */
+    size_t             nempty_cells;   /**< @brief  number of empty NUgrid 
cells */
     union cutter       rti_CutHead;    /**< @brief  Head of cut tree */
     union cutter       rti_inf_box;    /**< @brief  List of infinite solids */
     union cutter *     rti_CutFree;    /**< @brief  cut Freelist */
@@ -1769,13 +1769,13 @@
     struct bu_list     rti_solidheads[RT_DBNHASH]; /**< @brief  active solid 
lists */
     struct bu_ptbl     rti_resources;  /**< @brief  list of 'struct 
resource'es encountered */
     double             rti_nu_gfactor; /**< @brief  constant in numcells 
computation */
-    int                        rti_cutlen;     /**< @brief  goal for # solids 
per boxnode */
-    int                        rti_cutdepth;   /**< @brief  goal for depth of 
NUBSPT cut tree */
+    size_t             rti_cutlen;     /**< @brief  goal for # solids per 
boxnode */
+    size_t             rti_cutdepth;   /**< @brief  goal for depth of NUBSPT 
cut tree */
     /* Parameters required for rt_submodel */
     char *             rti_treetop;    /**< @brief  bu_strduped, for 
rt_submodel rti's only */
-    int                        rti_uses;       /**< @brief  for rt_submodel */
+    size_t             rti_uses;       /**< @brief  for rt_submodel */
     /* Parameters for accelerating "pieces" of solids */
-    int                        rti_nsolids_with_pieces; /**< @brief  # solids 
using pieces */
+    size_t             rti_nsolids_with_pieces; /**< @brief  # solids using 
pieces */
     /* Parameters for dynamic geometry */
     int                        rti_add_to_new_solids_list;
     struct bu_ptbl     rti_new_solids;

Modified: brlcad/trunk/src/librt/bool.c
===================================================================
--- brlcad/trunk/src/librt/bool.c       2011-01-12 19:01:12 UTC (rev 42161)
+++ brlcad/trunk/src/librt/bool.c       2011-01-12 19:06:15 UTC (rev 42162)
@@ -221,7 +221,8 @@
            VPRINT(" OPoint", pt);
            bu_log("***********\n");
        }
-       if (segp->seg_stp->st_bit >= rtip->nsolids) bu_bomb("rt_boolweave: 
st_bit");
+       if ((size_t)segp->seg_stp->st_bit >= rtip->nsolids)
+           bu_bomb("rt_boolweave: st_bit");
 
        BU_LIST_DEQUEUE(&(segp->l));
        BU_LIST_INSERT(&(out_hd->l), &(segp->l));

Modified: brlcad/trunk/src/librt/cut.c
===================================================================
--- brlcad/trunk/src/librt/cut.c        2011-01-12 19:01:12 UTC (rev 42161)
+++ brlcad/trunk/src/librt/cut.c        2011-01-12 19:06:15 UTC (rev 42162)
@@ -50,7 +50,7 @@
 
 HIDDEN int rt_ck_overlap BU_ARGS((const vect_t min, const vect_t max, const 
struct soltab *stp, const struct rt_i *rtip));
 HIDDEN int rt_ct_box BU_ARGS((struct rt_i *rtip, union cutter *cutp, int axis, 
double where, int force));
-HIDDEN void rt_ct_optim BU_ARGS((struct rt_i *rtip, union cutter *cutp, int 
depth));
+HIDDEN void rt_ct_optim BU_ARGS((struct rt_i *rtip, union cutter *cutp, size_t 
depth));
 HIDDEN void rt_ct_free BU_ARGS((struct rt_i *rtip, union cutter *cutp));
 HIDDEN void rt_ct_release_storage BU_ARGS((union cutter *cutp));
 
@@ -239,8 +239,8 @@
     int nu_ncells;             /* # cells along one axis */
     int nu_sol_per_cell;       /* avg # solids per cell */
     int nu_max_ncells;         /* hard limit on nu_ncells */
-    int pseudo_depth;          /* "fake" depth to tell rt_ct_optim */
-    register int i;
+    size_t pseudo_depth;               /* "fake" depth to tell rt_ct_optim */
+    register size_t i;
     int xp, yp, zp;
     vect_t xmin, xmax, ymin, ymax, zmin, zmax;
     struct boxnode nu_xbox, nu_ybox, nu_zbox;
@@ -690,7 +690,7 @@
     int upper_or_lower[3];
     fastf_t max_empty;
     int max_empty_dir;
-    int i;
+    size_t i;
     int num_splits=0;
 
     switch (cutp->cut_type) {
@@ -713,7 +713,7 @@
            }
 
            for (i=0; i<cutp->bn.bn_piecelen; i++) {
-               int j;
+               size_t j;
 
                pl = cutp->bn.bn_piecelist[i];
                for (j=0; j<pl.npieces; j++) {
@@ -1465,11 +1465,11 @@
  *
  * Returns the total number of solids and solid "pieces" in a boxnode.
  */
-HIDDEN int
+HIDDEN size_t
 rt_ct_piececount(const union cutter *cutp)
 {
-    int i;
-    int count;
+    long i;
+    size_t count;
 
     BU_ASSERT(cutp->cut_type == CUT_BOXNODE);
 
@@ -1494,9 +1494,9 @@
  * overlap in space.
  */
 HIDDEN void
-rt_ct_optim(struct rt_i *rtip, register union cutter *cutp, int depth)
+rt_ct_optim(struct rt_i *rtip, register union cutter *cutp, size_t depth)
 {
-    int oldlen;
+    size_t oldlen;
 
     if (cutp->cut_type == CUT_CUTNODE) {
        rt_ct_optim(rtip, cutp->cn.cn_l, depth+1);
@@ -1618,7 +1618,8 @@
     double middle;             /* midpoint */
     double d;
     fastf_t max, min;
-    register int i;
+    register size_t i;
+    long il;
     register double left, right;
 
     if (RT_G_DEBUG&DEBUG_CUTDETAIL)
@@ -1661,8 +1662,8 @@
     }
 
     /* Loop over all the solid pieces */
-    for (i = cutp->bn.bn_piecelen-1; i >= 0; i--) {
-       struct rt_piecelist *plp = &cutp->bn.bn_piecelist[i];
+    for (il = cutp->bn.bn_piecelen-1; il >= 0; il--) {
+       struct rt_piecelist *plp = &cutp->bn.bn_piecelist[il];
        struct soltab *stp = plp->stp;
        int j;
 
@@ -1766,7 +1767,7 @@
 HIDDEN void
 rt_ct_release_storage(register union cutter *cutp)
 {
-    int i;
+    size_t i;
 
     switch (cutp->cut_type) {
 
@@ -1843,7 +1844,7 @@
 void
 rt_pr_cut(const union cutter *cutp, int lvl)
 {
-    int i, j;
+    size_t i, j;
 
     bu_log("%p ", (void *)cutp);
     for (i=lvl; i>0; i--)
@@ -2278,8 +2279,8 @@
 void
 remove_from_bsp(struct soltab *stp, union cutter *cutp, struct bn_tol *tol)
 {
-    int idx;
-    int i;
+    size_t idx;
+    size_t i;
 
     switch (cutp->cut_type) {
        case CUT_BOXNODE:

Modified: brlcad/trunk/src/librt/fortray.c
===================================================================
--- brlcad/trunk/src/librt/fortray.c    2011-01-12 19:01:12 UTC (rev 42161)
+++ brlcad/trunk/src/librt/fortray.c    2011-01-12 19:06:15 UTC (rev 42162)
@@ -340,18 +340,18 @@
     int        i;
     int        len;
     int        offset;
-    int        rnum;
-    char       buf[512];
+    size_t rnum;
+    char buf[512];
 
     rnum = *region_num-1;
-    if ( rnum < 0 || rnum > (*rtip)->nregions )  {
+    if ( rnum > (*rtip)->nregions )  {
        sprintf( buf, "Region id %d out of range, max=%ld",
                 *region_num, (long)((*rtip)->nregions) );
        fr_string_c2f( fbuf, buf, fbuflen );
        return;
     }
     for ( BU_LIST_FOR( rp, region, &((*rtip)->HeadRegion) ) )  {
-       if ( rp->reg_bit != rnum )  continue;
+       if ( (size_t)rp->reg_bit != rnum )  continue;
        len = (int)strlen( rp->reg_name );
        offset = 0;
        if ( len >= fbuflen )  {

Modified: brlcad/trunk/src/librt/prep.c
===================================================================
--- brlcad/trunk/src/librt/prep.c       2011-01-12 19:01:12 UTC (rev 42161)
+++ brlcad/trunk/src/librt/prep.c       2011-01-12 19:06:15 UTC (rev 42162)
@@ -1540,7 +1540,7 @@
            if (stp->st_rtip == rtip) {
                long bit=stp->st_bit;
                struct region *rp;
-               int i, j;
+               size_t i, j;
 
                /* found soltab for this instance */
 
@@ -1589,7 +1589,7 @@
 {
     struct bu_ptbl unprep_regions;
     struct db_full_path *path;
-    int i, j, k;
+    size_t i, j, k;
 
     rt_res_pieces_clean(resp, rtip);
 
@@ -1784,12 +1784,12 @@
 int
 rt_reprep(struct rt_i *rtip, struct rt_reprep_obj_list *objs, struct resource 
*resp)
 {
-    int i;
+    size_t i;
     char **argv;
     struct region *rp;
     struct soltab *stp;
     fastf_t old_min[3], old_max[3];
-    long bitno;
+    size_t bitno;
 
     VMOVE(old_min, rtip->mdl_min);
     VMOVE(old_max, rtip->mdl_max);

Modified: brlcad/trunk/src/librt/shoot.c
===================================================================
--- brlcad/trunk/src/librt/shoot.c      2011-01-12 19:01:12 UTC (rev 42161)
+++ brlcad/trunk/src/librt/shoot.c      2011-01-12 19:06:15 UTC (rev 42162)
@@ -680,7 +680,7 @@
     struct xray ray;
     struct resource *resp;
     struct rt_i *rtip;
-    int i;
+    size_t i;
 
     resp = ss->ap->a_resource;
     rtip = ss->ap->a_rt_i;

Modified: brlcad/trunk/src/librt/tcl.c
===================================================================
--- brlcad/trunk/src/librt/tcl.c        2011-01-12 19:01:12 UTC (rev 42161)
+++ brlcad/trunk/src/librt/tcl.c        2011-01-12 19:06:15 UTC (rev 42162)
@@ -141,7 +141,7 @@
 {
     static const char xyz[4] = "XYZ";
     struct bu_vls str;
-    int i;
+    size_t i;
 
     bu_vls_init(&str);
 
@@ -166,7 +166,7 @@
            bu_vls_printf(&str, "} pieces {");
            for (i = 0; i < cutp->bn.bn_piecelen; i++) {
                struct rt_piecelist *plp = &cutp->bn.bn_piecelist[i];
-               int j;
+               size_t j;
                RT_CK_PIECELIST(plp);
                /* These can be taken by user positionally */
                bu_vls_printf(&str, "{%s {", plp->stp->st_name);

Modified: brlcad/trunk/src/librt/tree.c
===================================================================
--- brlcad/trunk/src/librt/tree.c       2011-01-12 19:01:12 UTC (rev 42161)
+++ brlcad/trunk/src/librt/tree.c       2011-01-12 19:06:15 UTC (rev 42162)
@@ -774,7 +774,7 @@
     struct soltab *stp;
     struct region *regp;
     Tcl_HashTable *tbl;
-    int prev_sol_count;
+    size_t prev_sol_count;
     int i;
     int num_attrs=0;
     point_t region_min, region_max;


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

Reply via email to