Revision: 42067
http://brlcad.svn.sourceforge.net/brlcad/?rev=42067&view=rev
Author: brlcad
Date: 2011-01-11 06:33:08 +0000 (Tue, 11 Jan 2011)
Log Message:
-----------
more size_t cascading. put the type to use throughout much of libbn and most
caller code. other code affected was sketch object code, vertex and curve
counts.
Modified Paths:
--------------
brlcad/trunk/include/bn.h
brlcad/trunk/include/rtgeom.h
brlcad/trunk/src/libbn/plane.c
brlcad/trunk/src/libbn/poly.c
brlcad/trunk/src/libbn/tabdata.c
brlcad/trunk/src/librt/primitives/extrude/extrude.c
brlcad/trunk/src/librt/primitives/revolve/revolve.c
brlcad/trunk/src/librt/primitives/revolve/revolve_brep.cpp
brlcad/trunk/src/librt/primitives/sketch/sketch.c
brlcad/trunk/src/librt/primitives/sketch/sketch_brep.cpp
brlcad/trunk/src/librt/roots.c
brlcad/trunk/src/librt/spectrum.c
brlcad/trunk/src/librt/vlist.c
brlcad/trunk/src/mged/dodraw.c
brlcad/trunk/src/mged/edsol.c
brlcad/trunk/src/proc-db/sketch.c
brlcad/trunk/src/proc-db/tube.c
brlcad/trunk/src/proc-db/vegetation.c
brlcad/trunk/src/proc-db/vegetation.h
brlcad/trunk/src/util/pl-dm.c
Modified: brlcad/trunk/include/bn.h
===================================================================
--- brlcad/trunk/include/bn.h 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/include/bn.h 2011-01-11 06:33:08 UTC (rev 42067)
@@ -1055,7 +1055,7 @@
BN_EXPORT BU_EXTERN(int bn_isect_planes,
(point_t pt,
const plane_t planes[],
- const int pl_count));
+ const size_t pl_count));
/** @} */
/*----------------------------------------------------------------------*/
@@ -1071,7 +1071,7 @@
*/
typedef struct bn_poly {
unsigned long magic;
- int dgr;
+ size_t dgr;
double cf[BN_MAX_POLY_DEGREE+1];
} bn_poly_t;
#define BN_CK_POLY(_p) BU_CKMAG(_p, BN_POLY_MAGIC, "struct bn_poly")
@@ -1634,7 +1634,7 @@
*/
struct bn_table {
unsigned long magic;
- int nx;
+ size_t nx;
fastf_t x[1]; /**< @brief array of nx+1 wavelengths, dynamically
sized */
};
#define BN_CK_TABLE(_p) BU_CKMAG(_p, BN_TABLE_MAGIC, "bn_table")
@@ -1660,7 +1660,7 @@
struct bn_tabdata {
unsigned long magic;
- int ny;
+ size_t ny;
const struct bn_table *table; /**< @brief Up pointer to definition of
X axis */
fastf_t y[1]; /**< @brief array of ny samples,
dynamically sized */
};
@@ -1691,7 +1691,7 @@
BN_EXPORT BU_EXTERN(void bn_ck_table,
(const struct bn_table *tabp));
BN_EXPORT BU_EXTERN(struct bn_table *bn_table_make_uniform,
- (int num,
+ (size_t num,
double first,
double last));
BN_EXPORT BU_EXTERN(void bn_tabdata_add,
@@ -1788,11 +1788,11 @@
(const char *filename));
BN_EXPORT BU_EXTERN(struct bn_tabdata *bn_tabdata_binary_read,
(const char *filename,
- int num,
+ size_t num,
const struct bn_table *tabp));
BN_EXPORT BU_EXTERN(struct bn_tabdata *bn_tabdata_malloc_array,
(const struct bn_table *tabp,
- int num));
+ size_t num));
BN_EXPORT BU_EXTERN(void bn_tabdata_copy,
(struct bn_tabdata *out,
const struct bn_tabdata *in));
@@ -1819,8 +1819,8 @@
double hi));
BN_EXPORT BU_EXTERN(int bn_table_delete_sample_pts,
(struct bn_table *tabp,
- int i,
- int j));
+ unsigned int i,
+ unsigned int j));
BN_EXPORT BU_EXTERN(struct bn_table *bn_table_merge2,
(const struct bn_table *a,
const struct bn_table *b));
@@ -1860,7 +1860,7 @@
*/
struct bn_vlist {
struct bu_list l; /**< @brief magic, forw, back */
- int nused; /**< @brief elements 0..nused active */
+ size_t nused; /**< @brief elements 0..nused active */
int cmd[BN_VLIST_CHUNK]; /**< @brief VL_CMD_* */
point_t pt[BN_VLIST_CHUNK]; /**< @brief associated 3-point/vect */
};
@@ -1923,8 +1923,8 @@
*/
struct bn_vlblock {
unsigned long magic;
- int nused;
- int max;
+ size_t nused;
+ size_t max;
long *rgb; /**< @brief rgb[max] variable size array */
struct bu_list *head; /**< @brief head[max] variable size
array */
struct bu_list *free_vlist_hd; /**< @brief where to get/put free
vlists */
@@ -1959,11 +1959,11 @@
*/
struct vert_root {
unsigned long magic;
- int tree_type; /**< @brief vertices or vertices with
normals */
+ int tree_type; /**< @brief vertices or vertices with normals */
union vert_tree *the_tree; /**< @brief the actual vertex tree */
fastf_t *the_array; /**< @brief the array of vertices */
- unsigned long curr_vert; /**< @brief the number of vertices currently in
the array */
- unsigned long max_vert; /**< @brief the current maximum
capacity of the array */
+ size_t curr_vert; /**< @brief the number of vertices currently in
the array */
+ size_t max_vert; /**< @brief the current maximum capacity of the
array */
};
#define TREE_TYPE_VERTS 1
@@ -2023,7 +2023,7 @@
#define pl_A pl_points[0] /* Synonym for A point */
struct plane_specific {
- int pl_npts; /* number of points on plane */
+ size_t pl_npts; /* number of points on plane */
point_t pl_points[MAXPTS]; /* Actual points on plane */
vect_t pl_Xbasis; /* X (B-A) vector (for 2d coords) */
vect_t pl_Ybasis; /* Y (C-A) vector (for 2d coords) */
Modified: brlcad/trunk/include/rtgeom.h
===================================================================
--- brlcad/trunk/include/rtgeom.h 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/include/rtgeom.h 2011-01-11 06:33:08 UTC (rev 42067)
@@ -460,7 +460,7 @@
point_t V; /**< @brief default embedding of
sketch */
vect_t u_vec; /**< @brief u_vec and v_vec are unit
vectors defining the plane of */
vect_t v_vec; /**< @brief the sketch */
- int vert_count; /**< @brief number of vertices
in this sketch */
+ size_t vert_count; /**< @brief number of vertices
in this sketch */
point2d_t *verts; /**< @brief array of 2D
* vertices that may be used
* as endpoints, centers, or
@@ -468,7 +468,7 @@
*/
/* FIXME: this should have a distinctive name, like rt_curve */
struct curve {
- int seg_count; /**< @brief number of segments in this
curve */
+ size_t seg_count; /**< @brief number of segments in this
curve */
int *reverse; /**< @brief array of ints indicating
if segment should be reversed */
genptr_t *segments; /**< @brief array of pointers to
segments in this curve */
} skt_curve; /**< @brief the curve in this sketch */
Modified: brlcad/trunk/src/libbn/plane.c
===================================================================
--- brlcad/trunk/src/libbn/plane.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/libbn/plane.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -2720,13 +2720,13 @@
* @return 1 - planes form a singular matrix (no solution)
*/
int
-bn_isect_planes(fastf_t *pt, const fastf_t (*planes)[4], const int pl_count)
+bn_isect_planes(fastf_t *pt, const fastf_t (*planes)[4], const size_t pl_count)
{
mat_t matrix;
mat_t inverse;
vect_t hpq;
fastf_t det;
- int i;
+ size_t i;
if (bu_debug & BU_DEBUG_MATH) {
bu_log("bn_isect_planes:\n");
Modified: brlcad/trunk/src/libbn/poly.c
===================================================================
--- brlcad/trunk/src/libbn/poly.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/libbn/poly.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -36,7 +36,6 @@
#include "bn.h"
-#define Abs(a) ((a) >= 0 ? (a) : -(a))
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define PI_DIV_3 (M_PI/3.0)
@@ -95,7 +94,7 @@
/* Not one of the common (or easy) cases. */
{
- register int ct1, ct2;
+ register size_t ct1, ct2;
*product = bn_Zero_poly;
@@ -125,7 +124,7 @@
struct bn_poly *
bn_poly_scale(register struct bn_poly *eqn, double factor)
{
- register int cnt;
+ register size_t cnt;
for (cnt=0; cnt <= eqn->dgr; ++cnt) {
eqn->cf[cnt] *= factor;
@@ -143,9 +142,9 @@
bn_poly_add(register struct bn_poly *sum, register const struct bn_poly
*poly1, register const struct bn_poly *poly2)
{
struct bn_poly tmp;
- register int i, offset;
+ register size_t i, offset;
- offset = Abs(poly1->dgr - poly2->dgr);
+ offset = abs((long)poly1->dgr - (long)poly2->dgr);
tmp = bn_Zero_poly;
@@ -177,9 +176,9 @@
bn_poly_sub(register struct bn_poly *diff, register const struct bn_poly
*poly1, register const struct bn_poly *poly2)
{
struct bn_poly tmp;
- register int i, offset;
+ register size_t i, offset;
- offset = Abs(poly1->dgr - poly2->dgr);
+ offset = abs((long)poly1->dgr - (long)poly2->dgr);
*diff = bn_Zero_poly;
tmp = bn_Zero_poly;
@@ -213,14 +212,17 @@
void
bn_poly_synthetic_division(register struct bn_poly *quo, register struct
bn_poly *rem, register const struct bn_poly *dvdend, register const struct
bn_poly *dvsor)
{
- register int divisor;
- register int n;
+ register size_t divisor;
+ register size_t n;
*quo = *dvdend;
*rem = bn_Zero_poly;
- if ((quo->dgr = dvdend->dgr - dvsor->dgr) < 0)
+ if (dvsor->dgr > dvdend->dgr) {
quo->dgr = -1;
+ } else {
+ quo->dgr = dvdend->dgr - dvsor->dgr;
+ }
if ((rem->dgr = dvsor->dgr - 1) > dvdend->dgr)
rem->dgr = dvdend->dgr;
@@ -360,13 +362,13 @@
}
c1 = eqn->cf[1];
- if (Abs(c1) > SQRT_MAX_FASTF) return 0; /* FAIL */
+ if (abs(c1) > SQRT_MAX_FASTF) return 0; /* FAIL */
c1_3rd = c1 * THIRD;
a = eqn->cf[2] - c1*c1_3rd;
- if (Abs(a) > SQRT_MAX_FASTF) return 0; /* FAIL */
+ if (abs(a) > SQRT_MAX_FASTF) return 0; /* FAIL */
b = (2.0*c1*c1*c1 - 9.0*c1*eqn->cf[2] + 27.0*eqn->cf[3])*INV_TWENTYSEVEN;
- if (Abs(b) > SQRT_MAX_FASTF) return 0; /* FAIL */
+ if (abs(b) > SQRT_MAX_FASTF) return 0; /* FAIL */
if ((delta = a*a) > SQRT_MAX_FASTF) return 0; /* FAIL */
delta = b*b*0.25 + delta*a*INV_TWENTYSEVEN;
@@ -532,15 +534,15 @@
void
bn_pr_poly(const char *title, register const struct bn_poly *eqn)
{
- register int n;
- register int exponent;
+ register size_t n;
+ register size_t exponent;
struct bu_vls str;
char buf[48];
bu_vls_init(&str);
bu_vls_extend(&str, 196);
bu_vls_strcat(&str, title);
- snprintf(buf, 48, " polynomial, degree = %d\n", eqn->dgr);
+ snprintf(buf, 48, " polynomial, degree = %lu\n", eqn->dgr);
bu_vls_strcat(&str, buf);
exponent = eqn->dgr;
Modified: brlcad/trunk/src/libbn/tabdata.c
===================================================================
--- brlcad/trunk/src/libbn/tabdata.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/libbn/tabdata.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -84,7 +84,7 @@
void
bn_ck_table(const struct bn_table *tabp)
{
- register int i;
+ register size_t i;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_ck_table(%p)\n", (void *)tabp);
@@ -106,7 +106,7 @@
* inclusive, using 'num' uniformly spaced samples. Num >= 1.
*/
struct bn_table *
-bn_table_make_uniform(int num, double first, double last)
+bn_table_make_uniform(size_t num, double first, double last)
{
struct bn_table *tabp;
fastf_t *fp;
@@ -613,7 +613,7 @@
* A binary search would be more efficient, as the wavelengths (x values)
* are known to be sorted in ascending order.
*/
-int
+long
bn_table_find_x(const struct bn_table *tabp, double xval)
{
register int i;
@@ -642,10 +642,11 @@
fastf_t
bn_table_lin_interp(const struct bn_tabdata *samp, register double wl)
{
- const struct bn_table *tabp;
- register int i;
- register fastf_t fract;
- register fastf_t ret;
+ const struct bn_table *tabp;
+ size_t i;
+ int idx;
+ fastf_t fract;
+ fastf_t ret;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_table_lin_interp(%p, %g)\n",
(void *)samp, wl);
@@ -653,10 +654,13 @@
tabp = samp->table;
BN_CK_TABLE(tabp);
- if ( (i = bn_table_find_x( tabp, wl )) < 0 ) {
- if (bu_debug&BU_DEBUG_TABDATA)bu_log("bn_table_lin_interp(%g) out of
range %g to %g\n", wl, tabp->x[0], tabp->x[tabp->nx] );
+ idx = bn_table_find_x( tabp, wl );
+ if (idx < 0 ) {
+ if (bu_debug&BU_DEBUG_TABDATA)
+ bu_log("bn_table_lin_interp(%g) out of range %g to %g\n", wl,
tabp->x[0], tabp->x[tabp->nx] );
return 0;
}
+ i = (size_t)idx;
if ( wl < tabp->x[i] || wl >= tabp->x[i+1] ) {
bu_log("bn_table_lin_interp(%g) assertion1 failed at %g\n", wl,
tabp->x[i] );
@@ -694,7 +698,7 @@
{
const struct bn_table *oldtable;
struct bn_tabdata *newsamp;
- int i;
+ size_t i;
int j, k;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_tabdata_resample_max(%p, %p)\n",
(void *)newtable, (void *)olddata);
@@ -775,7 +779,7 @@
{
const struct bn_table *oldtable;
struct bn_tabdata *newsamp;
- int i;
+ size_t i;
int j, k;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_tabdata_resample_avg(%p, %p)\n",
(void *)newtable, (void *)olddata);
@@ -856,8 +860,8 @@
int
bn_table_write(const char *filename, const struct bn_table *tabp)
{
- FILE *fp;
- int j;
+ FILE *fp;
+ size_t j;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_table_write(%s, %p)\n",
filename, (void *)tabp);
@@ -874,7 +878,7 @@
}
bu_semaphore_acquire( BU_SEM_SYSCALL );
- fprintf(fp, " %d sample starts, and one end.\n", tabp->nx );
+ fprintf(fp, " %lu sample starts, and one end.\n", tabp->nx );
for ( j=0; j <= tabp->nx; j++ ) {
fprintf( fp, "%g\n", tabp->x[j] );
}
@@ -894,11 +898,11 @@
bn_table_read(const char *filename)
{
int ret;
- struct bn_table *tabp;
- struct bu_vls line;
- FILE *fp;
- int nw;
- int j;
+ struct bn_table *tabp;
+ struct bu_vls line;
+ FILE *fp;
+ size_t nw;
+ size_t j;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_table_read(%s)\n", filename);
@@ -915,7 +919,7 @@
bu_vls_init(&line);
bu_vls_gets( &line, fp );
nw = 0;
- sscanf( bu_vls_addr(&line), "%d", &nw );
+ sscanf( bu_vls_addr(&line), "%lu", &nw );
bu_vls_free(&line);
if ( nw <= 0 ) bu_bomb("bn_table_read() bad nw value\n");
@@ -945,7 +949,7 @@
void
bn_pr_table(const char *title, const struct bn_table *tabp)
{
- int j;
+ size_t j;
bu_log("%s\n", title);
BN_CK_TABLE(tabp);
@@ -961,7 +965,7 @@
void
bn_pr_tabdata(const char *title, const struct bn_tabdata *data)
{
- int j;
+ size_t j;
bu_log("%s: ", title);
BN_CK_TABDATA(data);
@@ -987,7 +991,7 @@
{
FILE *fp;
const struct bn_table *tabp;
- int j;
+ size_t j;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_print_table_and_tabdata(%s,
%p)\n", filename, (void *)data);
@@ -1033,8 +1037,8 @@
struct bn_tabdata *data;
FILE *fp;
char buf[128];
- int count = 0;
- int i;
+ size_t count = 0;
+ size_t i;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_read_table_and_tabdata(%s)\n",
filename);
@@ -1087,7 +1091,7 @@
* B N _ T A B D A T A _ B I N A R Y _ R E A D
*/
struct bn_tabdata *
-bn_tabdata_binary_read(const char *filename, int num, const struct bn_table
*tabp)
+bn_tabdata_binary_read(const char *filename, size_t num, const struct bn_table
*tabp)
{
struct bn_tabdata *data;
char *cp;
@@ -1095,7 +1099,7 @@
int len;
int got;
int fd;
- int i;
+ long i;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_tabdata_binary_read(%s, num=%d,
%p)\n", filename, num, (void *)tabp);
@@ -1160,13 +1164,13 @@
* are variable length.
*/
struct bn_tabdata *
-bn_tabdata_malloc_array(const struct bn_table *tabp, int num)
+bn_tabdata_malloc_array(const struct bn_table *tabp, size_t num)
{
- struct bn_tabdata *data;
- char *cp;
- int i;
- int nw;
- int nbytes;
+ struct bn_tabdata *data;
+ char *cp;
+ size_t i;
+ size_t nw;
+ size_t nbytes;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_tabdata_malloc_array(%p,
num=%d)\n", (void *)tabp, num);
@@ -1282,7 +1286,7 @@
bn_tabdata_to_tcl(struct bu_vls *vp, const struct bn_tabdata *data)
{
const struct bn_table *tabp;
- register int i;
+ register size_t i;
register fastf_t minval = MAX_FASTF, maxval = -MAX_FASTF;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_tabdata_to_tcl(%p, %p)\n", (void
*)vp, (void *)data);
@@ -1320,11 +1324,11 @@
struct bn_tabdata *
bn_tabdata_from_array(const double *array)
{
- register const double *dp;
- int len = 0;
- struct bn_table *tabp;
- struct bn_tabdata *data;
- register int i;
+ register const double *dp;
+ size_t len = 0;
+ struct bn_table *tabp;
+ struct bn_tabdata *data;
+ register size_t i;
/* First, find len */
for ( dp = array; *dp > 0; dp += 2 )
@@ -1358,7 +1362,7 @@
bn_tabdata_freq_shift(struct bn_tabdata *out, const struct bn_tabdata *in,
double offset)
{
const struct bn_table *tabp;
- register int i;
+ register size_t i;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_tabdata_freq_shift(%p, %p,
offset=%g)\n", (void *)out, (void *)in, offset);
@@ -1384,8 +1388,8 @@
int
bn_table_interval_num_samples(const struct bn_table *tabp, double low, double
hi)
{
- register int i;
- register int count = 0;
+ register size_t i;
+ register size_t count = 0;
BN_CK_TABLE(tabp);
@@ -1405,17 +1409,17 @@
* Returns number of points removed.
*/
int
-bn_table_delete_sample_pts(struct bn_table *tabp, int i, int j)
+bn_table_delete_sample_pts(struct bn_table *tabp, unsigned int i, unsigned int
j)
{
- int tokill;
- int k;
+ size_t tokill;
+ unsigned int k;
if (bu_debug&BU_DEBUG_TABDATA) bu_log("bn_table_delete_samples(%p, %d,
%d)\n", (void *)tabp, i, j);
BN_CK_TABLE(tabp);
- if ( i < 0 || j < 0 ) bu_bomb("bn_table_delete_sample_pts() negative
indices\n");
- if ( i >= tabp->nx || j >= tabp->nx )
bu_bomb("bn_table_delete_sample_pts() index out of range\n");
+ if (i >= tabp->nx || j >= tabp->nx)
+ bu_bomb("bn_table_delete_sample_pts() index out of range\n");
tokill = j - i + 1;
if ( tokill < 1 ) bu_bomb("bn_table_delete_sample_pts(): nothing to
delete\n");
@@ -1439,7 +1443,7 @@
bn_table_merge2(const struct bn_table *a, const struct bn_table *b)
{
struct bn_table *new;
- register int i, j, k;
+ register size_t i, j, k;
BN_CK_TABLE(a);
BN_CK_TABLE(b);
@@ -1499,7 +1503,7 @@
fastf_t filt_range;
fastf_t cell_range;
fastf_t frac;
- int i;
+ size_t i;
BN_CK_TABLE(spectrum);
@@ -1566,7 +1570,7 @@
filt->y[last] = frac;
/* Fill in range between with 1.0 values */
- for ( i = first+1; i < last; i++ )
+ for ( i = first+1; i < (size_t)last; i++ )
filt->y[i] = 1.0;
return filt;
Modified: brlcad/trunk/src/librt/primitives/extrude/extrude.c
===================================================================
--- brlcad/trunk/src/librt/primitives/extrude/extrude.c 2011-01-11 05:59:34 UTC
(rev 42066)
+++ brlcad/trunk/src/librt/primitives/extrude/extrude.c 2011-01-11 06:33:08 UTC
(rev 42067)
@@ -113,8 +113,8 @@
struct rt_sketch_internal *skt;
vect_t tmp, xyz[3];
fastf_t tmp_f, ldir[3];
- int i, j;
- int vert_count;
+ size_t i, j;
+ size_t vert_count;
int curr_vert;
if (rtip) RT_CK_RTI(rtip);
@@ -570,7 +570,8 @@
rt_extrude_shot(struct soltab *stp, struct xray *rp, struct application *ap,
struct seg *seghead)
{
struct extrude_specific *extr=(struct extrude_specific *)stp->st_specific;
- int i, j, k;
+ size_t i;
+ int j, k;
fastf_t dist_top, dist_bottom, to_bottom=0;
fastf_t dist[2];
fastf_t dot_pl1, dir_dot_z;
@@ -903,13 +904,14 @@
}
if (hits_before_bottom & 1) {
+ int counter;
if (hit_count >= MAX_HITS) {
bu_log("Too many hits on extrusion (%s), limit is %d\n",
stp->st_dp->d_namep, MAX_HITS);
bu_bomb("Too many hits on extrusion\n");
}
- for (i=hit_count-1; i>=0; i--)
- hits[i+1] = hits[i];
+ for (counter=hit_count-1; counter>=0; counter--)
+ hits[counter+1] = hits[counter];
hits[0].hit_magic = RT_HIT_MAGIC;
hits[0].hit_dist = dist_bottom;
hits[0].hit_surfno = bot_face;
@@ -945,13 +947,14 @@
/* build segments */
{
+ int cnt;
struct seg *segp;
- for (i=0; i < hit_count; i += 2) {
+ for (cnt=0; cnt < hit_count; cnt += 2) {
RT_GET_SEG(segp, ap->a_resource);
segp->seg_stp = stp;
- segp->seg_in = hits[i]; /* struct copy */
- segp->seg_out = hits[i+1]; /* struct copy */
+ segp->seg_in = hits[cnt]; /* struct copy */
+ segp->seg_out = hits[cnt+1]; /* struct copy */
segp->seg_out.hit_surfno = -segp->seg_out.hit_surfno; /* for
exit hits */
BU_LIST_INSERT(&(seghead->l), &(segp->l));
}
@@ -1115,7 +1118,7 @@
struct curve *crv=(struct curve *)NULL;
struct rt_sketch_internal *sketch_ip;
point_t end_of_h;
- int i1, i2, nused1, nused2;
+ size_t i1, i2, nused1, nused2;
struct bn_vlist *vp1, *vp2, *vp2_start;
BU_CK_LIST_HEAD(vhead);
@@ -1745,15 +1748,15 @@
struct faceuse *fu;
struct vertex ***verts;
struct vertex **vertsa;
- int vert_count=0;
struct rt_extrude_internal *extrude_ip;
struct rt_sketch_internal *sketch_ip;
struct curve *crv=(struct curve *)NULL;
struct bu_ptbl *aloop=NULL, loops, **containing_loops, *outer_loop;
- int i, j, k;
+ plane_t pl;
int *used_seg;
+ size_t i, j, k;
+ size_t vert_count=0;
struct bn_vlist *vlp;
- plane_t pl;
RT_CK_DB_INTERNAL(ip);
extrude_ip = (struct rt_extrude_internal *)ip->idb_ptr;
Modified: brlcad/trunk/src/librt/primitives/revolve/revolve.c
===================================================================
--- brlcad/trunk/src/librt/primitives/revolve/revolve.c 2011-01-11 05:59:34 UTC
(rev 42066)
+++ brlcad/trunk/src/librt/primitives/revolve/revolve.c 2011-01-11 06:33:08 UTC
(rev 42067)
@@ -80,7 +80,7 @@
vect_t xEnd, yEnd;
int *endcount;
- int nseg, i, j, k;
+ size_t nseg, i, j, k;
if (rtip) RT_CK_RTI(rtip);
@@ -120,7 +120,8 @@
* if odd, the point is at the end of a path
*/
endcount = (int *)bu_calloc(rev->sk->vert_count, sizeof(int), "endcount");
- for (i=0; i<rev->sk->vert_count; i++) endcount[i] = 0;
+ for (i=0; i<rev->sk->vert_count; i++)
+ endcount[i] = 0;
nseg = rev->sk->skt_curve.seg_count;
for (i=0; i<nseg; i++) {
@@ -239,7 +240,8 @@
struct hit *hitp;
struct hit *hits[MAX_HITS], hit[MAX_HITS];
- int i, j, nseg, nhits, in, out;
+ size_t i, j, nseg, nhits;
+ int in, out;
fastf_t k, m, h, aa, bb;
point_t dp, pr, xlated;
@@ -709,6 +711,7 @@
bn_poly_t sum_sq; /* {f(y) + g(y)/(2cx)}^2 */
bn_poly_t answer; /* {f(y) + g(y)/(2cx)}^2 - g(y)
*/
bn_complex_t roots[4];
+ int rootcnt;
fastf_t cx, cy, crsq = 0; /* carc's (x, y) coords and
radius^2 */
point2d_t center, radius;
@@ -789,11 +792,12 @@
/* It is known that the equation is 4th order. Therefore,
if the
* root finder returns other than 4 roots, error.
*/
- if ((i = rt_poly_roots(&answer, roots,
stp->st_dp->d_namep)) != 4) {
- if (i > 0) {
- bu_log("tor: rt_poly_roots() 4!=%d\n", i);
- bn_pr_roots(stp->st_name, roots, i);
- } else if (i < 0) {
+ rootcnt = rt_poly_roots(&answer, roots,
stp->st_dp->d_namep);
+ if (rootcnt != 4) {
+ if (rootcnt > 0) {
+ bu_log("tor: rt_poly_roots() 4!=%d\n", rootcnt);
+ bn_pr_roots(stp->st_name, roots, rootcnt);
+ } else if (rootcnt < 0) {
static int reported=0;
bu_log("The root solver failed to converge on a
solution for %s\n", stp->st_dp->d_namep);
if (!reported) {
@@ -1090,7 +1094,7 @@
{
struct rt_revolve_internal *rip;
- int nvert, narc, nadd, nseg, i, j, k;
+ size_t nvert, narc, nadd, nseg, i, j, k;
point2d_t *verts;
struct curve *crv;
Modified: brlcad/trunk/src/librt/primitives/revolve/revolve_brep.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/revolve/revolve_brep.cpp 2011-01-11
05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/librt/primitives/revolve/revolve_brep.cpp 2011-01-11
06:33:08 UTC (rev 42067)
@@ -181,7 +181,7 @@
// For the brep, need the list of 3D vertex points. In sketch, they
// are stored as 2D coordinates, so use the sketch_plane to define 3 space
// points for the vertices.
- for (int i = 0; i < eip->vert_count; i++) {
+ for (size_t i = 0; i < eip->vert_count; i++) {
(*b)->NewVertex(sketch_plane->PointAt(eip->verts[i][0],
eip->verts[i][1]), 0.0);
int vertind = (*b)->m_V.Count() - 1;
(*b)->m_V[vertind].Dump(*dump);
@@ -196,7 +196,7 @@
struct carc_seg *csg;
struct bezier_seg *bsg;
long *lng;
- for (int i = 0; i < (&eip->skt_curve)->seg_count; i++) {
+ for (size_t i = 0; i < (&eip->skt_curve)->seg_count; i++) {
lng = (long *)(&eip->skt_curve)->segments[i];
switch (*lng) {
case CURVE_LSEG_MAGIC: {
Modified: brlcad/trunk/src/librt/primitives/sketch/sketch.c
===================================================================
--- brlcad/trunk/src/librt/primitives/sketch/sketch.c 2011-01-11 05:59:34 UTC
(rev 42066)
+++ brlcad/trunk/src/librt/primitives/sketch/sketch.c 2011-01-11 06:33:08 UTC
(rev 42067)
@@ -51,7 +51,7 @@
int
rt_check_curve(const struct curve *crv, const struct rt_sketch_internal *skt,
int noisy)
{
- int i, j;
+ size_t i, j;
int ret=0;
/* empty sketches are invalid */
@@ -73,20 +73,20 @@
switch (*lng) {
case CURVE_LSEG_MAGIC:
lsg = (struct line_seg *)lng;
- if (lsg->start >= skt->vert_count ||
- lsg->end >= skt->vert_count)
+ if ((size_t)lsg->start >= skt->vert_count ||
+ (size_t)lsg->end >= skt->vert_count)
ret++;
break;
case CURVE_CARC_MAGIC:
csg = (struct carc_seg *)lng;
- if (csg->start >= skt->vert_count ||
- csg->end >= skt->vert_count)
+ if ((size_t)csg->start >= skt->vert_count ||
+ (size_t)csg->end >= skt->vert_count)
ret++;
break;
case CURVE_NURB_MAGIC:
nsg = (struct nurb_seg *)lng;
- for (j=0; j<nsg->c_size; j++) {
- if (nsg->ctl_points[j] >= skt->vert_count) {
+ for (j=0; j<(size_t)nsg->c_size; j++) {
+ if ((size_t)nsg->ctl_points[j] >= skt->vert_count) {
ret++;
break;
}
@@ -94,8 +94,8 @@
break;
case CURVE_BEZIER_MAGIC:
bsg = (struct bezier_seg *)lng;
- for (j=0; j<=bsg->degree; j++) {
- if (bsg->ctl_points[j] >= skt->vert_count) {
+ for (j=0; j<=(size_t)bsg->degree; j++) {
+ if ((size_t)bsg->ctl_points[j] >= skt->vert_count) {
ret++;
break;
}
@@ -514,7 +514,7 @@
switch (*lng) {
case CURVE_LSEG_MAGIC:
lsg = (struct line_seg *)lng;
- if (lsg->start >= sketch_ip->vert_count || lsg->end >=
sketch_ip->vert_count) {
+ if ((size_t)lsg->start >= sketch_ip->vert_count || (size_t)lsg->end
>= sketch_ip->vert_count) {
ret++;
break;
}
@@ -532,7 +532,7 @@
int nsegs;
csg = (struct carc_seg *)lng;
- if (csg->start >= sketch_ip->vert_count || csg->end >=
sketch_ip->vert_count) {
+ if ((size_t)csg->start >= sketch_ip->vert_count ||
(size_t)csg->end >= sketch_ip->vert_count) {
ret++;
break;
}
@@ -674,7 +674,7 @@
nsg = (struct nurb_seg *)lng;
for (i=0; i<nsg->c_size; i++) {
- if (nsg->ctl_points[i] >= sketch_ip->vert_count) {
+ if ((size_t)nsg->ctl_points[i] >= sketch_ip->vert_count) {
ret++;
break;
}
@@ -779,7 +779,7 @@
bsg = (struct bezier_seg *)lng;
for (i=0; i<=bsg->degree; i++) {
- if (bsg->ctl_points[i] >= sketch_ip->vert_count) {
+ if ((size_t)bsg->ctl_points[i] >= sketch_ip->vert_count) {
ret++;
break;
}
@@ -885,7 +885,7 @@
int
curve_to_vlist(struct bu_list *vhead, const struct rt_tess_tol *ttol, fastf_t
*V, fastf_t *u_vec, fastf_t *v_vec, struct rt_sketch_internal *sketch_ip,
struct curve *crv)
{
- int seg_no;
+ size_t seg_no;
int ret=0;
BU_CK_LIST_HEAD(vhead);
@@ -964,10 +964,10 @@
struct rt_sketch_internal *sketch_ip;
union record *rp;
vect_t v;
- int seg_no;
+ size_t seg_no;
unsigned char *ptr;
struct curve *crv;
- int i;
+ size_t i;
if (dbip) RT_CK_DBI(dbip);
@@ -1062,7 +1062,7 @@
nsg->c_size = bu_glong(ptr);
ptr += 4;
nsg->ctl_points = (int *)bu_malloc(nsg->c_size * sizeof(int),
"nsg->ctl_points");
- for (i=0; i<nsg->c_size; i++) {
+ for (i=0; i<(size_t)nsg->c_size; i++) {
nsg->ctl_points[i] = bu_glong(ptr);
ptr += 4;
}
@@ -1080,7 +1080,7 @@
bsg->degree = bu_glong(ptr);
ptr += 4;
bsg->ctl_points = (int *)bu_calloc(bsg->degree + 1,
sizeof(int), "bsg->ctl_points");
- for (i=0; i<=bsg->degree; i++) {
+ for (i=0; i<=(size_t)bsg->degree; i++) {
bsg->ctl_points[i] = bu_glong(ptr);
ptr += 4;
}
@@ -1120,7 +1120,7 @@
{
struct rt_sketch_internal *sketch_ip;
union record *rec;
- int i, seg_no, nbytes=0, ngran;
+ size_t i, seg_no, nbytes=0, ngran;
vect_t tmp_vec;
unsigned char *ptr;
@@ -1253,7 +1253,7 @@
ptr += nseg->k.k_size * 8;
(void)bu_plong(ptr, nseg->c_size);
ptr += 4;
- for (i=0; i<nseg->c_size; i++) {
+ for (i=0; i<(size_t)nseg->c_size; i++) {
(void)bu_plong(ptr, nseg->ctl_points[i]);
ptr += 4;
}
@@ -1268,7 +1268,7 @@
ptr += 4;
(void)bu_plong(ptr, bseg->degree);
ptr += 4;
- for (i=0; i<=bseg->degree; i++) {
+ for (i=0; i<=(size_t)bseg->degree; i++) {
(void)bu_plong(ptr, bseg->ctl_points[i]);
ptr += 4;
}
@@ -1304,10 +1304,10 @@
{
struct rt_sketch_internal *sketch_ip;
vect_t v;
- int seg_no;
+ size_t seg_no;
unsigned char *ptr;
struct curve *crv;
- int i;
+ size_t i;
if (bu_debug&BU_DEBUG_MEM_CHECK) {
bu_log("Barrier check at start of sketch_import5():\n");
@@ -1399,7 +1399,7 @@
nsg->c_size = bu_glong(ptr);
ptr += SIZEOF_NETWORK_LONG;
nsg->ctl_points = (int *)bu_malloc(nsg->c_size * sizeof(int),
"nsg->ctl_points");
- for (i=0; i<nsg->c_size; i++) {
+ for (i=0; i<(size_t)nsg->c_size; i++) {
nsg->ctl_points[i] = bu_glong(ptr);
ptr += SIZEOF_NETWORK_LONG;
}
@@ -1417,7 +1417,7 @@
bsg->degree = bu_glong(ptr);
ptr += SIZEOF_NETWORK_LONG;
bsg->ctl_points = (int *)bu_calloc(bsg->degree+1, sizeof(int),
"bsg->ctl_points");
- for (i=0; i<=bsg->degree; i++) {
+ for (i=0; i<=(size_t)bsg->degree; i++) {
bsg->ctl_points[i] = bu_glong(ptr);
ptr += SIZEOF_NETWORK_LONG;
}
@@ -1459,8 +1459,8 @@
{
struct rt_sketch_internal *sketch_ip;
unsigned char *cp;
- int seg_no;
- int i;
+ size_t seg_no;
+ size_t i;
vect_t tmp_vec;
if (bu_debug&BU_DEBUG_MEM_CHECK) {
@@ -1601,7 +1601,7 @@
cp += nseg->k.k_size * SIZEOF_NETWORK_DOUBLE;
(void)bu_plong(cp, nseg->c_size);
cp += SIZEOF_NETWORK_LONG;
- for (i=0; i<nseg->c_size; i++) {
+ for (i=0; i<(size_t)nseg->c_size; i++) {
(void)bu_plong(cp, nseg->ctl_points[i]);
cp += SIZEOF_NETWORK_LONG;
}
@@ -1616,7 +1616,7 @@
cp += SIZEOF_NETWORK_LONG;
(void)bu_plong(cp, bseg->degree);
cp += SIZEOF_NETWORK_LONG;
- for (i=0; i<=bseg->degree; i++) {
+ for (i=0; i<=(size_t)bseg->degree; i++) {
(void)bu_plong(cp, bseg->ctl_points[i]);
cp += SIZEOF_NETWORK_LONG;
}
@@ -1654,8 +1654,8 @@
{
struct rt_sketch_internal *sketch_ip =
(struct rt_sketch_internal *)ip->idb_ptr;
- int i;
- int seg_no;
+ size_t i;
+ size_t seg_no;
char buf[256];
point_t V;
vect_t u, v;
@@ -1667,7 +1667,7 @@
VSCALE(u, sketch_ip->u_vec, mm2local);
VSCALE(v, sketch_ip->v_vec, mm2local);
- sprintf(buf, "\tV = (%g %g %g), A = (%g %g %g), B = (%g %g %g)\n\t%d
vertices\n",
+ sprintf(buf, "\tV = (%g %g %g), A = (%g %g %g), B = (%g %g %g)\n\t%lu
vertices\n",
V3INTCLAMPARGS(V),
V3INTCLAMPARGS(u),
V3INTCLAMPARGS(v),
@@ -1680,7 +1680,7 @@
if (sketch_ip->vert_count) {
bu_vls_strcat(str, "\tVertices:\n\t");
for (i=0; i<sketch_ip->vert_count; i++) {
- sprintf(buf, " %d-(%g %g)", i, V2INTCLAMPARGS(sketch_ip->verts[i]));
+ sprintf(buf, " %lu-(%g %g)", i,
V2INTCLAMPARGS(sketch_ip->verts[i]));
bu_vls_strcat(str, buf);
if (i && (i+1)%3 == 0)
bu_vls_strcat(str, "\n\t");
@@ -1700,7 +1700,7 @@
switch (lsg->magic) {
case CURVE_LSEG_MAGIC:
lsg = (struct line_seg *)sketch_ip->skt_curve.segments[seg_no];
- if (lsg->start >= sketch_ip->vert_count || lsg->end >=
sketch_ip->vert_count) {
+ if ((size_t)lsg->start >= sketch_ip->vert_count ||
(size_t)lsg->end >= sketch_ip->vert_count) {
if (sketch_ip->skt_curve.reverse[seg_no])
sprintf(buf, "\t\tLine segment from vertex #%d to
#%d\n",
lsg->end, lsg->start);
@@ -1724,7 +1724,7 @@
if (csg->radius < 0.0) {
bu_vls_strcat(str, "\t\tFull Circle:\n");
- if (csg->end >= sketch_ip->vert_count || csg->start >=
sketch_ip->vert_count) {
+ if ((size_t)csg->end >= sketch_ip->vert_count ||
(size_t)csg->start >= sketch_ip->vert_count) {
sprintf(buf, "\t\tcenter at vertex #%d\n",
csg->end);
bu_vls_strcat(str, buf);
@@ -1741,7 +1741,7 @@
} else {
bu_vls_strcat(str, "\t\tCircular Arc:\n");
- if (csg->end >= sketch_ip->vert_count || csg->start >=
sketch_ip->vert_count) {
+ if ((size_t)csg->end >= sketch_ip->vert_count ||
(size_t)csg->start >= sketch_ip->vert_count) {
sprintf(buf, "\t\t\tstart at vertex #%d\n",
csg->start);
bu_vls_strcat(str, buf);
@@ -1780,8 +1780,8 @@
sprintf(buf, "\t\t\torder = %d, number of control points =
%d\n",
nsg->order, nsg->c_size);
bu_vls_strcat(str, buf);
- if (nsg->ctl_points[0] >= sketch_ip->vert_count ||
- nsg->ctl_points[nsg->c_size-1] >= sketch_ip->vert_count) {
+ if ((size_t)nsg->ctl_points[0] >= sketch_ip->vert_count ||
+ (size_t)nsg->ctl_points[nsg->c_size-1] >=
sketch_ip->vert_count) {
if (sketch_ip->skt_curve.reverse[seg_no])
sprintf(buf, "\t\t\tstarts at vertex #%d\n\t\t\tends at
vertex #%d\n",
nsg->ctl_points[nsg->c_size-1],
@@ -1810,8 +1810,8 @@
bu_vls_strcat(str, "\t\tBezier segment:\n");
sprintf(buf, "\t\t\tdegree = %d\n", bsg->degree);
bu_vls_strcat(str, buf);
- if (bsg->ctl_points[0] >= sketch_ip->vert_count ||
- bsg->ctl_points[bsg->degree] >= sketch_ip->vert_count) {
+ if ((size_t)bsg->ctl_points[0] >= sketch_ip->vert_count ||
+ (size_t)bsg->ctl_points[bsg->degree] >=
sketch_ip->vert_count) {
if (sketch_ip->skt_curve.reverse[seg_no]) {
sprintf(buf, "\t\t\tstarts at vertex #%d\n\t\t\tends at
vertex #%d\n",
bsg->ctl_points[bsg->degree],
@@ -1845,7 +1845,7 @@
void
rt_curve_free(struct curve *crv)
{
- int i;
+ size_t i;
if (crv->seg_count)
bu_free((char *)crv->reverse, "crv->reverse");
@@ -1931,7 +1931,7 @@
void
rt_copy_curve(struct curve *crv_out, const struct curve *crv_in)
{
- int i, j;
+ size_t i, j;
crv_out->seg_count = crv_in->seg_count;
if (crv_out->seg_count) {
@@ -1967,16 +1967,16 @@
crv_out->segments[j] = (genptr_t)nsg_out;
*nsg_out = *nsg_in;
nsg_out->ctl_points = (int *)bu_calloc(nsg_in->c_size,
sizeof(int), "nsg_out->ctl_points");
- for (i=0; i<nsg_out->c_size; i++)
+ for (i=0; i<(size_t)nsg_out->c_size; i++)
nsg_out->ctl_points[i] = nsg_in->ctl_points[i];
if (RT_NURB_IS_PT_RATIONAL(nsg_in->pt_type)) {
nsg_out->weights = (fastf_t *)bu_malloc(nsg_out->c_size *
sizeof(fastf_t), "nsg_out->weights");
- for (i=0; i<nsg_out->c_size; i++)
+ for (i=0; i<(size_t)nsg_out->c_size; i++)
nsg_out->weights[i] = nsg_in->weights[i];
} else
nsg_out->weights = (fastf_t *)NULL;
nsg_out->k.knots = bu_malloc(nsg_in->k.k_size *
sizeof(fastf_t), "nsg_out->k.knots");
- for (i=0; i<nsg_in->k.k_size; i++)
+ for (i=0; i<(size_t)nsg_in->k.k_size; i++)
nsg_out->k.knots[i] = nsg_in->k.knots[i];
break;
case CURVE_BEZIER_MAGIC:
@@ -1986,7 +1986,7 @@
*bsg_out = *bsg_in;
bsg_out->ctl_points = (int *)bu_calloc(bsg_out->degree + 1,
sizeof(int),
"bsg_out->ctl_points");
- for (i=0; i<=bsg_out->degree; i++) {
+ for (i=0; i<=(size_t)bsg_out->degree; i++) {
bsg_out->ctl_points[i] = bsg_in->ctl_points[i];
}
break;
@@ -2002,7 +2002,7 @@
rt_copy_sketch(const struct rt_sketch_internal *sketch_ip)
{
struct rt_sketch_internal *out;
- int i;
+ size_t i;
struct curve *crv_out;
RT_SKETCH_CK_MAGIC(sketch_ip);
@@ -2036,7 +2036,7 @@
int
curve_to_tcl_list(struct bu_vls *vls, struct curve *crv)
{
- int i, j;
+ size_t i, j;
bu_vls_printf(vls, " SL {");
for (j=0; j<crv->seg_count; j++) {
@@ -2059,25 +2059,25 @@
{
struct bezier_seg *bsg = (struct bezier_seg
*)crv->segments[j];
bu_vls_printf(vls, " { bezier D %d P {", bsg->degree);
- for (i=0; i<=bsg->degree; i++)
+ for (i=0; i<=(size_t)bsg->degree; i++)
bu_vls_printf(vls, " %d", bsg->ctl_points[i]);
bu_vls_printf(vls, " } }");
}
break;
case CURVE_NURB_MAGIC:
{
- int k;
+ size_t k;
struct nurb_seg *nsg = (struct nurb_seg *)crv->segments[j];
bu_vls_printf(vls, " { nurb O %d T %d K {",
nsg->order, nsg->pt_type);
- for (k=0; k<nsg->k.k_size; k++)
+ for (k=0; k<(size_t)nsg->k.k_size; k++)
bu_vls_printf(vls, " %.25g", nsg->k.knots[k]);
bu_vls_strcat(vls, "} P {");
- for (k=0; k<nsg->c_size; k++)
+ for (k=0; k<(size_t)nsg->c_size; k++)
bu_vls_printf(vls, " %d", nsg->ctl_points[k]);
if (nsg->weights) {
bu_vls_strcat(vls, "} W {");
- for (k=0; k<nsg->c_size; k++)
+ for (k=0; k<(size_t)nsg->c_size; k++)
bu_vls_printf(vls, " %.25g", nsg->weights[k]);
}
bu_vls_strcat(vls, "} }");
@@ -2106,7 +2106,7 @@
rt_sketch_get(struct bu_vls *logstr, const struct rt_db_internal *intern,
const char *attr)
{
struct rt_sketch_internal *skt=(struct rt_sketch_internal
*)intern->idb_ptr;
- int i;
+ size_t i;
struct curve *crv;
BU_CK_VLS(logstr);
@@ -2141,13 +2141,12 @@
return BRLCAD_ERROR;
}
} else if (*attr == 'V') {
- i = atoi((attr+1));
- if (i < 0 || i >= skt->vert_count) {
+ long lval = atol((attr+1));
+ if (lval < 0 || (size_t)lval >= skt->vert_count) {
bu_vls_printf(logstr, "ERROR: Illegal vertex number\n");
return BRLCAD_ERROR;
}
-
- bu_vls_printf(logstr, "%.25g %.25g", V2ARGS(skt->verts[i]));
+ bu_vls_printf(logstr, "%.25g %.25g", V2ARGS(skt->verts[lval]));
} else {
/* unrecognized attribute */
bu_vls_printf(logstr, "ERROR: Unknown attribute, choices are V, A, B,
VL, SL, or V#\n");
@@ -2425,12 +2424,12 @@
return ret;
} else if (*argv[0] == 'V' && isdigit(*(argv[0]+1))) {
/* changing a specific vertex */
- int vert_no;
+ long vert_no;
fastf_t *new_vert;
- vert_no = atoi(argv[0] + 1);
+ vert_no = atol(argv[0] + 1);
new_vert = skt->verts[vert_no];
- if (vert_no < 0 || vert_no > skt->vert_count) {
+ if (vert_no < 0 || (size_t)vert_no > skt->vert_count) {
bu_vls_printf(logstr, "ERROR: Illegal vertex number\n");
return BRLCAD_ERROR;
}
Modified: brlcad/trunk/src/librt/primitives/sketch/sketch_brep.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/sketch/sketch_brep.cpp 2011-01-11
05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/librt/primitives/sketch/sketch_brep.cpp 2011-01-11
06:33:08 UTC (rev 42067)
@@ -159,7 +159,7 @@
// For the brep, need the list of 3D vertex points. In sketch, they
// are stored as 2D coordinates, so use the sketch_plane to define 3 space
// points for the vertices.
- for (int i = 0; i < eip->vert_count; i++) {
+ for (size_t i = 0; i < eip->vert_count; i++) {
(*b)->NewVertex(sketch_plane->PointAt(eip->verts[i][0],
eip->verts[i][1]), 0.0);
}
@@ -172,7 +172,7 @@
struct carc_seg *csg;
struct bezier_seg *bsg;
long *lng;
- for (int i = 0; i < (&eip->skt_curve)->seg_count; i++) {
+ for (size_t i = 0; i < (&eip->skt_curve)->seg_count; i++) {
lng = (long *)(&eip->skt_curve)->segments[i];
switch (*lng) {
case CURVE_LSEG_MAGIC:
Modified: brlcad/trunk/src/librt/roots.c
===================================================================
--- brlcad/trunk/src/librt/roots.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/librt/roots.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -66,7 +66,7 @@
/* input */
/* outputs */
{
- register int n;
+ register size_t n;
register int m;
bn_cx_cons(b, eqn->cf[0], 0.0);
@@ -213,7 +213,7 @@
{
register fastf_t er, ei; /* "epoly" */
register fastf_t zr, zi; /* Z value to evaluate at */
- register int n;
+ register size_t n;
int m;
for (m=0; m < nroots; ++m) {
@@ -297,7 +297,7 @@
register bn_complex_t roots[], /* space to put roots found */
const char *name) /* name of the primitive being checked */
{
- register int n; /* number of roots found */
+ register size_t n; /* number of roots found */
fastf_t factor; /* scaling factor for copy */
/* Remove leading coefficients which are too close to zero,
Modified: brlcad/trunk/src/librt/spectrum.c
===================================================================
--- brlcad/trunk/src/librt/spectrum.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/librt/spectrum.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -116,7 +116,7 @@
struct bn_tabdata *a, *b, *c;
fastf_t xyz_scale;
int i;
- int j;
+ size_t j;
BN_CK_TABLE(tabp);
@@ -195,7 +195,7 @@
void
rt_spect_reflectance_rgb(struct bn_tabdata *curve, const float *rgb)
{
- register int i;
+ register size_t i;
register const struct bn_table *tabp;
BN_CK_TABDATA(curve);
@@ -248,7 +248,7 @@
/* # wavelengths to eval at */
{
const struct bn_table *tabp;
- int j;
+ size_t j;
BN_CK_TABDATA(data);
tabp = data->table;
@@ -307,7 +307,7 @@
/* Degrees Kelvin */
{
const struct bn_table *tabp;
- int j;
+ size_t j;
BN_CK_TABDATA(data);
tabp = data->table;
@@ -338,7 +338,7 @@
/* Degrees Kelvin */
{
const struct bn_table *tabp;
- int j;
+ size_t j;
BN_CK_TABDATA(data);
tabp = data->table;
Modified: brlcad/trunk/src/librt/vlist.c
===================================================================
--- brlcad/trunk/src/librt/vlist.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/librt/vlist.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -55,7 +55,7 @@
int max_ent)
{
struct bn_vlblock *vbp;
- int i;
+ size_t i;
if (BU_LIST_UNINITIALIZED(free_vlist_hd))
BU_LIST_INIT(free_vlist_hd);
@@ -98,7 +98,7 @@
void
rt_vlblock_free(struct bn_vlblock *vbp)
{
- int i;
+ size_t i;
BN_CK_VLBLOCK(vbp);
for (i=0; i < vbp->nused; i++) {
@@ -122,8 +122,8 @@
rt_vlblock_find(struct bn_vlblock *vbp, int r, int g, int b)
{
long new;
- int n;
- int omax; /* old max */
+ size_t n;
+ size_t omax; /* old max */
BN_CK_VLBLOCK(vbp);
@@ -478,7 +478,7 @@
void
rt_plot_vlblock(FILE *fp, const struct bn_vlblock *vbp)
{
- int i;
+ size_t i;
BN_CK_VLBLOCK(vbp);
Modified: brlcad/trunk/src/mged/dodraw.c
===================================================================
--- brlcad/trunk/src/mged/dodraw.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/mged/dodraw.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -1011,7 +1011,7 @@
const char *name,
int copy)
{
- int i;
+ size_t i;
char shortname[32];
char namebuf[64];
char *av[4];
Modified: brlcad/trunk/src/mged/edsol.c
===================================================================
--- brlcad/trunk/src/mged/edsol.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/mged/edsol.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -3933,7 +3933,7 @@
struct rt_arb_internal *arb;
fastf_t *eqp;
static vect_t work;
- int i;
+ size_t i;
static int pnt5; /* ECMD_ARB_SETUP_ROTFACE, special arb7 case */
static float la, lb, lc, ld; /* TGC: length of vectors */
mat_t mat;
Modified: brlcad/trunk/src/proc-db/sketch.c
===================================================================
--- brlcad/trunk/src/proc-db/sketch.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/proc-db/sketch.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -45,6 +45,7 @@
struct bezier_seg *bsg;
struct line_seg *lsg;
struct carc_seg *csg;
+ size_t i;
point_t V;
vect_t u_vec, v_vec;
point2d_t verts[] = {
@@ -59,7 +60,6 @@
{ 125, 0 }, /* 8 */
{ 200, 200 } /* 9 */
};
- int i;
VSET(V, 10, 20, 30);
VSET(u_vec, 1, 0, 0);
Modified: brlcad/trunk/src/proc-db/tube.c
===================================================================
--- brlcad/trunk/src/proc-db/tube.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/proc-db/tube.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -95,7 +95,7 @@
double projectile_pos;
point_t sample[1024];
-int nsamples;
+size_t nsamples;
double iradius, oradius;
double length;
Modified: brlcad/trunk/src/proc-db/vegetation.c
===================================================================
--- brlcad/trunk/src/proc-db/vegetation.c 2011-01-11 05:59:34 UTC (rev
42066)
+++ brlcad/trunk/src/proc-db/vegetation.c 2011-01-11 06:33:08 UTC (rev
42067)
@@ -164,7 +164,7 @@
static segmentList_t *findIntersectors(const growthSegment_t * const segment,
const structure_t * const structure, const segmentList_t * const exemptList) {
- int i, j;
+ size_t i, j;
segmentList_t *bigList = NULL;
segmentList_t *segList = NULL;
double maxFromRadius = 0.0;
@@ -434,8 +434,8 @@
static void growPlant(plant_t *plant) {
- int i;
- int growthSteps;
+ size_t i;
+ size_t growthSteps;
int retryCount;
growthSegment_t *segment;
growthPoint_t *point;
@@ -778,7 +778,7 @@
static void destroyPlant(plant_t *plant) {
- int i;
+ size_t i;
/* get rid of the plant structure properly */
if (plant != NULL) {
Modified: brlcad/trunk/src/proc-db/vegetation.h
===================================================================
--- brlcad/trunk/src/proc-db/vegetation.h 2011-01-11 05:59:34 UTC (rev
42066)
+++ brlcad/trunk/src/proc-db/vegetation.h 2011-01-11 06:33:08 UTC (rev
42067)
@@ -63,8 +63,8 @@
/* not really a list (it is a container), but close enough */
typedef struct segmentList {
- unsigned int capacity;
- unsigned int count;
+ size_t capacity;
+ size_t count;
growthSegment_t **segment;
} segmentList_t;
#define INIT_GROWTHSEGMENTLIST_T(_i) { (_i)->capacity = 0; (_i)->count = 0;
(_i)->segment=NULL; }
@@ -104,8 +104,8 @@
/* XXX not really a list -- it is a container object for a list */
typedef struct growthPointList {
- unsigned int capacity;
- unsigned int count;
+ size_t capacity;
+ size_t count;
growthPoint_t **point;
} growthPointList_t;
#define INIT_GROWTHPOINTLIST_T(_i) { (_i)->capacity = 0; (_i)->count = 0;
(_i)->point=NULL; }
Modified: brlcad/trunk/src/util/pl-dm.c
===================================================================
--- brlcad/trunk/src/util/pl-dm.c 2011-01-11 05:59:34 UTC (rev 42066)
+++ brlcad/trunk/src/util/pl-dm.c 2011-01-11 06:33:08 UTC (rev 42067)
@@ -170,7 +170,7 @@
static void
refresh() {
- int i;
+ size_t i;
struct plot_list *plp;
DM_DRAW_BEGIN(dmp);
@@ -501,7 +501,7 @@
static void
size_reset()
{
- int i;
+ size_t i;
struct bn_vlist *tvp;
vect_t min, max;
vect_t center;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits