Revision: 70120 http://sourceforge.net/p/brlcad/code/70120 Author: brlcad Date: 2017-08-24 13:25:50 +0000 (Thu, 24 Aug 2017) Log Message: ----------- slew of changes in support of link-time optimization. uninitialized data access, dead code, aliasing due to incorrect types, and a big reworking of the rtuif applications. they should now be back to defining the right modes (RTSRV and RT_MULTISPECTRAL) and linking the right objects in rttherm, remrt/rtsrv, and all the other rt apps.
Modified Paths: -------------- brlcad/trunk/src/conv/comgeom/region.c brlcad/trunk/src/conv/comgeom/solid.c brlcad/trunk/src/conv/iges/add_face.c brlcad/trunk/src/conv/iges/add_inner_shell.c brlcad/trunk/src/conv/iges/brep.c brlcad/trunk/src/conv/iges/check_names.c brlcad/trunk/src/conv/iges/conv_drawings.c brlcad/trunk/src/conv/iges/convassem.c brlcad/trunk/src/conv/iges/convinst.c brlcad/trunk/src/conv/iges/convtree.c brlcad/trunk/src/conv/iges/extrudcirc.c brlcad/trunk/src/conv/iges/extrude.c brlcad/trunk/src/conv/iges/g-iges.c brlcad/trunk/src/conv/iges/get_att.c brlcad/trunk/src/conv/iges/get_cnurb_curve.c brlcad/trunk/src/conv/iges/get_outer_shell.c brlcad/trunk/src/conv/iges/iges.c brlcad/trunk/src/conv/iges/main.c brlcad/trunk/src/conv/iges/make_face.c brlcad/trunk/src/conv/iges/make_nurb_face.c brlcad/trunk/src/conv/iges/read_att.c brlcad/trunk/src/conv/iges/read_edge_list.c brlcad/trunk/src/conv/iges/read_vertex_list.c brlcad/trunk/src/conv/iges/readmatrix.c brlcad/trunk/src/conv/iges/readtree.c brlcad/trunk/src/conv/iges/spline.c brlcad/trunk/src/conv/iges/trimsurf.c brlcad/trunk/src/conv/obj-g.c brlcad/trunk/src/halftone/tone_floyd.c brlcad/trunk/src/libged/ged_private.h brlcad/trunk/src/liboptical/sh_light.c brlcad/trunk/src/librt/binunif/db5_bin.c brlcad/trunk/src/librt/constraint.c brlcad/trunk/src/mged/attach.c brlcad/trunk/src/mged/fbserv.c brlcad/trunk/src/mged/mged.h brlcad/trunk/src/mged/predictor.c brlcad/trunk/src/mged/set.c brlcad/trunk/src/proc-db/naca/nacax.c brlcad/trunk/src/remrt/CMakeLists.txt brlcad/trunk/src/remrt/remrt.c brlcad/trunk/src/rt/CMakeLists.txt brlcad/trunk/src/rt/main.c brlcad/trunk/src/rt/view.c brlcad/trunk/src/rt/viewpp.c brlcad/trunk/src/rt/viewrad.c brlcad/trunk/src/rt/viewsil.c brlcad/trunk/src/rttherm/CMakeLists.txt brlcad/trunk/src/rttherm/viewtherm.c Removed Paths: ------------- brlcad/trunk/src/rt/sh_tcl.c Modified: brlcad/trunk/src/conv/comgeom/region.c =================================================================== --- brlcad/trunk/src/conv/comgeom/region.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/comgeom/region.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -32,7 +32,7 @@ /* defined in read.c */ extern int get_line(char *cp, int buflen, char *title); -extern int getint(char *cp, int start, int len); +extern int getint(char *cp, int start, size_t len); extern void namecvt(int n, char **cp, int c); /* defined in cvt.c */ Modified: brlcad/trunk/src/conv/comgeom/solid.c =================================================================== --- brlcad/trunk/src/conv/comgeom/solid.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/comgeom/solid.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -44,8 +44,9 @@ /* defined in read.c */ extern int get_line(char *cp, int buflen, char *title); -extern int getint(char *cp, int start, int len); extern void namecvt(int n, char **cp, int c); +extern int getint(char *cp, int start, size_t len); +extern double getdouble(char *cp, int start, size_t len); /* defined in cvt.c */ extern void col_pr(char *str); @@ -57,7 +58,6 @@ extern int version; extern int verbose; -extern double getdouble(char *cp, int start, int len); extern int sol_total, sol_work; char scard[132]; /* Solid card buffer area */ Modified: brlcad/trunk/src/conv/iges/add_face.c =================================================================== --- brlcad/trunk/src/conv/iges/add_face.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/add_face.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -25,10 +25,10 @@ Add_face_to_shell(struct shell *s, int entityno, int face_orient) { - int sol_num; /* IGES solid type number */ - int surf_de; /* Directory sequence number for underlying surface */ - int no_of_loops; /* Number of loops in face */ - int outer_loop_flag; /* Indicates if first loop is an the outer loop */ + int sol_num = 0; /* IGES solid type number */ + int surf_de = 0; /* Directory sequence number for underlying surface */ + int no_of_loops = 0; /* Number of loops in face */ + int outer_loop_flag = 0; /* Indicates if first loop is an the outer loop */ int *loop_de; /* Directory sequence numbers for loops */ int loop; int planar = 0; Modified: brlcad/trunk/src/conv/iges/add_inner_shell.c =================================================================== --- brlcad/trunk/src/conv/iges/add_inner_shell.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/add_inner_shell.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -25,8 +25,8 @@ Add_inner_shell(struct nmgregion *r, int entityno) { - int sol_num; /* IGES solid type number */ - int no_of_faces; /* Number of faces in shell */ + int sol_num = 0; /* IGES solid type number */ + int no_of_faces = 0; /* Number of faces in shell */ int face_count = 0; /* Actual number of faces made */ int *face_de; /* Directory sequence numbers for faces */ int *face_orient; /* Orientation of faces */ Modified: brlcad/trunk/src/conv/iges/brep.c =================================================================== --- brlcad/trunk/src/conv/iges/brep.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/brep.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -25,14 +25,14 @@ brep(int entityno) { - int sol_num; /* IGES solid type number */ - int shell_de; /* Directory sequence number for a shell */ - int orient; /* Orientation of shell */ - int *void_shell_de; /* Directory sequence number for an void shell */ - int *void_orient; /* Orientation of void shell */ - int num_of_voids; /* Number of inner void shells */ + int sol_num = 0; /* IGES solid type number */ + int shell_de = 0; /* Directory sequence number for a shell */ + int orient = 0; /* Orientation of shell */ + int *void_shell_de; /* Directory sequence number for an void shell */ + int *void_orient; /* Orientation of void shell */ + int num_of_voids = 0; /* Number of inner void shells */ struct model *m; /* NMG model */ - struct nmgregion *r; /* NMG region */ + struct nmgregion *r; /* NMG region */ struct shell **void_shells; /* List of void shells */ struct shell *s_outer; /* Outer shell */ struct iges_vertex_list *v_list; Modified: brlcad/trunk/src/conv/iges/check_names.c =================================================================== --- brlcad/trunk/src/conv/iges/check_names.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/check_names.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -328,8 +328,8 @@ { int sol_num; int i, j, k; - int num; int skip; + int num = 0; int no_of_assoc = 0; int no_of_props = 0; int name_de = 0; @@ -474,7 +474,7 @@ Get_subfig_name(size_t entityno) { int i; - int entity_type; + int entity_type = 0; char *name; if (entityno >= totentities) Modified: brlcad/trunk/src/conv/iges/conv_drawings.c =================================================================== --- brlcad/trunk/src/conv/iges/conv_drawings.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/conv_drawings.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -108,7 +108,7 @@ void Note_to_vlist(int entno, struct bu_list *vhead) { - int entity_type; + int entity_type = 0; int nstrings = 0; int i; @@ -132,7 +132,8 @@ int internal_rot = 0; double local_scale; char one_char[2]; - point_t loc, tmp; + point_t loc = VINIT_ZERO; + point_t tmp = VINIT_ZERO; char *str = NULL; Readint(&str_len, ""); @@ -198,7 +199,7 @@ void Get_plane(plane_t pl, int entno) { - int entity_type; + int entity_type = 0; int i; Readrec(dir[entno]->param); @@ -242,7 +243,9 @@ int entity_type; int npts, i; point_t tmp, tmp2, tmp3, center; - vect_t v1, v2, v3; + vect_t v1; + vect_t v2; + vect_t v3 = VINIT_ZERO; fastf_t a, b, c; Readrec(dir[entno]->param); @@ -503,9 +506,9 @@ struct views_visible * Get_views_visible(int entno) { - int entity_type; - int no_of_views; - int no_of_entities; + int entity_type = 0; + int no_of_views = 0; + int no_of_entities = 0; size_t i; size_t j; int junk; @@ -548,7 +551,7 @@ fastf_t x, fastf_t y, fastf_t ang) { int view_de; - int entity_type; + int entity_type = 0; struct views_visible *vv; size_t vv_count = 0; int *de_list; /* list of possible view field entries for this view */ @@ -647,7 +650,7 @@ void Get_drawing(int entno, struct bu_ptbl *view_vis_list) { - int entity_type; + int entity_type = 0; int no_of_views; int *view_entno; int i; Modified: brlcad/trunk/src/conv/iges/convassem.c =================================================================== --- brlcad/trunk/src/conv/iges/convassem.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/convassem.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -42,7 +42,11 @@ Convassem() { size_t i; - int j, k, comblen, conv = 0, totass = 0; + int j = 0; + int k = 0; + int comblen = 0; + int conv = 0; + int totass = 0; struct solid_list *root, *ptr, *ptr_tmp; struct wmember head, *wmem; int no_of_assoc = 0; Modified: brlcad/trunk/src/conv/iges/convinst.c =================================================================== --- brlcad/trunk/src/conv/iges/convinst.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/convinst.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -25,10 +25,11 @@ Convinst() { - size_t i; - int j, k; - int type; - int pointer; + size_t i = 0; + int j = 0; + int k = 0; + int type = 0; + int pointer = 0; int conv = 0; int totinst = 0; int no_of_assoc = 0; Modified: brlcad/trunk/src/conv/iges/convtree.c =================================================================== --- brlcad/trunk/src/conv/iges/convtree.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/convtree.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -49,7 +49,8 @@ int att_de = 0; struct brlcad_att brl_att; size_t i; - int j, k; + int j = 0; + int k = 0; if (bu_debug & BU_DEBUG_MEM_CHECK) bu_log("Doing memory checking in Convtree()\n"); Modified: brlcad/trunk/src/conv/iges/extrudcirc.c =================================================================== --- brlcad/trunk/src/conv/iges/extrudcirc.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/extrudcirc.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -28,11 +28,13 @@ /* circular arc entity number */ /* extrusion vector */ { - point_t base; /* center of cylinder base */ - fastf_t radius; /* radius of cylinder */ - fastf_t x_1, y_1; /* Start point */ - fastf_t x_2, y_2; /* Terminate point */ - int sol_num; /* Solid number */ + point_t base = VINIT_ZERO; /* center of cylinder base */ + fastf_t radius = 0.0; /* radius of cylinder */ + fastf_t x_1 = 0.0; /* Start point */ + fastf_t y_1 = 0.0; /* Start point */ + fastf_t x_2 = 0.0; /* Terminate point */ + fastf_t y_2 = 0.0; /* Terminate point */ + int sol_num; /* Solid number */ /* Acquiring Data */ Modified: brlcad/trunk/src/conv/iges/extrude.c =================================================================== --- brlcad/trunk/src/conv/iges/extrude.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/extrude.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -26,11 +26,11 @@ extrude(int entityno) { - fastf_t length; /* extrusion length */ - vect_t edir; /* a unit vector (direction of extrusion */ - vect_t evect; /* Scaled vector for extrusion */ - int sol_num; /* IGES solid type number */ - int curve; /* pointer to directory entry for base curve */ + fastf_t length = 0.0; /* extrusion length */ + vect_t edir = VINIT_ZERO; /* a unit vector (direction of extrusion */ + vect_t evect = VINIT_ZERO; /* Scaled vector for extrusion */ + int sol_num = 0; /* IGES solid type number */ + int curve = 0; /* pointer to directory entry for base curve */ struct ptlist *curv_pts; /* List of points along curve */ size_t i; Modified: brlcad/trunk/src/conv/iges/g-iges.c =================================================================== --- brlcad/trunk/src/conv/iges/g-iges.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/g-iges.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -79,7 +79,7 @@ extern int nmgregion_to_tsurf(char *name, struct nmgregion *r, FILE *fp_dir, FILE *fp_param); extern int write_solid_instance(int orig_de, mat_t mat, FILE *fp_dir, FILE *fp_param); extern void get_props(struct iges_properties *props, struct rt_comb_internal *comb); -extern int comb_to_iges(struct rt_comb_internal *comb, int length, int dependent, struct iges_properties *props, int de_pointers[], FILE *fp_dir, FILE *fp_param); +extern int comb_to_iges(struct rt_comb_internal *comb, size_t length, int dependent, struct iges_properties *props, int de_pointers[], FILE *fp_dir, FILE *fp_param); static void usage(const char *argv0) @@ -778,7 +778,7 @@ props.color[2] = 0; get_props(&props, comb); - dp->d_uses = (-comb_to_iges(comb, (int)comb_len, dependent, &props, de_pointers, fp_dir, fp_param)); + dp->d_uses = (-comb_to_iges(comb, comb_len, dependent, &props, de_pointers, fp_dir, fp_param)); if (!dp->d_uses) { comb_error++; Modified: brlcad/trunk/src/conv/iges/get_att.c =================================================================== --- brlcad/trunk/src/conv/iges/get_att.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/get_att.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -30,7 +30,7 @@ Get_att() { size_t i; - int j; + int j = 0; char *str; for (i = 0; i < totentities; i++) { Modified: brlcad/trunk/src/conv/iges/get_cnurb_curve.c =================================================================== --- brlcad/trunk/src/conv/iges/get_cnurb_curve.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/get_cnurb_curve.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -39,8 +39,8 @@ switch (dir[curve]->type) { case 110: { /* line */ - int pt_type; - int type; + int pt_type = 0; + int type = 0; point_t pt1; point_t start_pt, end_pt; Modified: brlcad/trunk/src/conv/iges/get_outer_shell.c =================================================================== --- brlcad/trunk/src/conv/iges/get_outer_shell.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/get_outer_shell.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -26,7 +26,7 @@ { int sol_num; /* IGES solid type number */ - int no_of_faces; /* Number of faces in shell */ + int no_of_faces = 0; /* Number of faces in shell */ int face_count = 0; /* Number of faces actually made */ int *face_de; /* Directory sequence numbers for faces */ int *face_orient; /* Orientation of faces */ Modified: brlcad/trunk/src/conv/iges/iges.c =================================================================== --- brlcad/trunk/src/conv/iges/iges.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/iges.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -72,7 +72,7 @@ static int unknown_count = 0; static int de_pointer_number; extern char **independent; -extern int no_of_indeps; +extern size_t no_of_indeps; extern int solid_is_brep; extern int comb_form; extern int do_nurbs; @@ -82,7 +82,7 @@ extern int write_vertex_list(struct nmgregion *r, struct bu_ptbl *vtab, FILE *fp_dir, FILE *fp_param); extern int write_edge_list(struct nmgregion *r, int vert_de, struct bu_ptbl *etab, struct bu_ptbl *vtab, FILE *fp_dir, FILE *fp_param); extern int write_shell_face_loop(char *name, struct nmgregion *r, int dependent, int edge_de, struct bu_ptbl *etab, int vert_de, struct bu_ptbl *vtab, FILE *fp_dir, FILE *fp_param); -extern int write_solid_assembly(char *name, int de_list[], int length, int dependent, FILE *fp_dir, FILE *fp_param); +extern int write_solid_assembly(char *name, int de_list[], size_t length, int dependent, FILE *fp_dir, FILE *fp_param); extern int write_planar_nurb(struct faceuse *fu, vect_t u_dir, vect_t v_dir, fastf_t *u_max, fastf_t *v_max, point_t base_pt, FILE *fp_dir, FILE *fp_param); extern int write_name_entity(char *name, FILE *fp_dir, FILE *fp_param); extern int write_att_entity(struct iges_properties *props, FILE *fp_dir, FILE *fp_param); @@ -472,8 +472,8 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; float c[3]; + size_t i; /* initialize directory entry */ for (i = 0; i < 21; i++) @@ -524,7 +524,7 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; /* initialize directory entry */ for (i = 0; i < 21; i++) @@ -586,7 +586,7 @@ void Print_stats(FILE *fp) { - int i; + size_t i; int total_entities = 0; fprintf(fp, "Wrote the following numbers and type of entities:\n"); @@ -606,7 +606,7 @@ int write_dir_entry(FILE *fp, int entry[]) { - int i, j, type_index; + size_t i, j, type_index; const char *label; for (type_index = 0; type_index < NO_OF_TYPES; type_index++) @@ -732,9 +732,9 @@ int *brep_de; /* Directory entry sequence # for BREP Object(s) */ int vert_de; /* Directory entry sequence # for vertex list */ int edge_de; /* Directory entry sequence # for edge list */ - int outer_shell_count; /* number of outer shells in nmgregion */ - int face_count = 0; /* number of faces in nmgregion */ - int i; + size_t outer_shell_count; /* number of outer shells in nmgregion */ + size_t face_count = 0; /* number of faces in nmgregion */ + size_t i; NMG_CK_REGION(r); @@ -833,13 +833,13 @@ int verts_to_copious_data(point_t *pts, - int vert_count, - int pt_size, + size_t vert_count, + size_t pt_size, FILE *fp_dir, FILE *fp_param) { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; if (vert_count < 2) return 0; @@ -899,10 +899,10 @@ struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; struct edgeuse *eu; - int vert_count = 0; point_t *model_pts; point_t *param_pts; - int i; + size_t vert_count = 0; + size_t i; NMG_CK_LOOPUSE(lu); @@ -990,9 +990,9 @@ point_t base_pt = VINIT_ZERO; fastf_t u_max = 0.0; fastf_t v_max = 0.0; - int loop_count = 0; int *curve_de; - int i; + size_t loop_count = 0; + size_t i; NMG_CK_FACEUSE(fu); @@ -1145,7 +1145,7 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; NMG_CK_VERTEX_G(start_vg); NMG_CK_VERTEX_G(end_vg); @@ -1189,7 +1189,7 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; NMG_CK_VERTEX_G(start_vg); NMG_CK_VERTEX_G(end_vg); @@ -1309,7 +1309,7 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; for (i = 0; i < 21; i++) dir_entry[i] = DEFAULT; @@ -1343,7 +1343,7 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; for (i = 0; i < 21; i++) dir_entry[i] = DEFAULT; @@ -1378,7 +1378,7 @@ struct bu_vls str = BU_VLS_INIT_ZERO; point_t pt_on_plane; /* a point on the plane */ int dir_entry[21]; - int i; + size_t i; for (i = 0; i < 21; i++) dir_entry[i] = DEFAULT; @@ -1423,7 +1423,7 @@ fastf_t umin, umax, vmin, vmax; struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; NMG_CK_FACEUSE(fu); @@ -1541,8 +1541,8 @@ struct bu_vls str = BU_VLS_INIT_ZERO; struct iges_properties props; int *shell_list; - int i; - int shell_count = 0; + size_t i; + size_t shell_count = 0; int dir_entry[21]; int name_de; int prop_de; @@ -1560,7 +1560,7 @@ shell_count = 0; for (BU_LIST_FOR(s, shell, &r->s_hd)) { int *face_list; - int face_count = 0; + size_t face_count = 0; /* Count faces */ @@ -1576,8 +1576,8 @@ /* Shell is made of faces. */ for (BU_LIST_FOR(fu, faceuse, &s->fu_hd)) { int *loop_list; - int loop_count = 0; - int exterior_loop = (-1); /* index of outer loop (in loop_list) */ + size_t loop_count = 0; + long exterior_loop = (-1); /* index of outer loop (in loop_list) */ int outer_loop_flag = 1; /* IGES flag to indicate a selected outer loop */ if (fu->orientation != OT_SAME) @@ -1816,7 +1816,7 @@ arb_is_rpp(struct rt_arb_internal *arb) { vect_t v0, v1, v2; - int i; + size_t i; RT_ARB_CK_MAGIC(arb); @@ -1881,7 +1881,7 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; size_t name_len; name_len = strlen(name); @@ -1924,7 +1924,7 @@ struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; int name_de; - int i; + size_t i; if (ip->idb_type != ID_TOR) bu_log("tor_to_iges called for non-torus (type=%d)\n", ip->idb_type); @@ -1976,7 +1976,7 @@ double radius; int dir_entry[21]; int name_de; - int i; + size_t i; if (ip->idb_type != ID_SPH) bu_log("sph_to_iges called for non-sph (type=%d)\n", ip->idb_type); @@ -2033,7 +2033,7 @@ vect_t c_dir; int dir_entry[21]; int name_de; - int i; + size_t i; if (ip->idb_type != ID_ELL) bu_log("ell_to_iges called for non-ell (type=%d)\n", ip->idb_type); @@ -2103,7 +2103,7 @@ vect_t tmp_dir; int dir_entry[21]; int name_de; - int i; + size_t i; if (ip->idb_type != ID_ARB8) bu_log("rpp_to_iges called for non-arb (type=%d)\n", ip->idb_type); @@ -2205,7 +2205,7 @@ struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; int name_de; - int i; + size_t i; if (ip->idb_type != ID_TGC) { bu_log("tgc_to_iges called for non-tgc (type=%d)\n", ip->idb_type); @@ -2306,7 +2306,7 @@ int write_tree_of_unions(char *name, int de_list[], - int length, + size_t length, int dependent, FILE *fp_dir, FILE *fp_param) @@ -2317,7 +2317,7 @@ int name_de; int prop_de; int color_de = DEFAULT; - int i; + size_t i; /* write name entity */ if (name != NULL) @@ -2379,7 +2379,7 @@ int write_solid_assembly(char *name, int de_list[], - int length, + size_t length, int dependent, FILE *fp_dir, FILE *fp_param) @@ -2390,7 +2390,7 @@ int name_de; int prop_de; int color_de = DEFAULT; - int i; + size_t i; /* write name entity */ if (name != NULL) @@ -2458,11 +2458,11 @@ { struct model *model; struct nmgregion *r; - int region_count; int *region_de; int brep_de; int dependent; - int i; + size_t region_count; + size_t i; RT_CK_DB_INTERNAL(ip); @@ -2505,8 +2505,7 @@ fp_dir, fp_param); /* now make the boolean tree */ - brep_de = write_tree_of_unions(name, region_de, region_count , - dependent, fp_dir, fp_param); + brep_de = write_tree_of_unions(name, region_de, region_count, dependent, fp_dir, fp_param); bu_free((char *)region_de, "nmg_to_iges"); return brep_de; @@ -2568,7 +2567,7 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; /* initialize directory entry */ for (i = 0; i < 21; i++) @@ -2602,7 +2601,7 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int i; + size_t i; /* initialize directory entry */ for (i = 0; i < 21; i++) @@ -2635,7 +2634,7 @@ struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; size_t str_len; - int i; + size_t i; /* initialize directory entry */ for (i = 0; i < 21; i++) @@ -2704,7 +2703,7 @@ int props_de; int color_de = DEFAULT; int status = 1; - int i; + size_t i; /* if member has not been converted, don't try to write the tree */ if (de_pointers[0] == 0) @@ -2833,7 +2832,7 @@ int tree_to_iges(struct rt_comb_internal *comb, - int length, int dependent, + size_t length, int dependent, struct iges_properties *props, int de_pointers[], FILE *fp_dir, FILE *fp_param) @@ -2840,13 +2839,13 @@ { struct bu_vls str = BU_VLS_INIT_ZERO; int dir_entry[21]; - int actual_length = 0; + size_t actual_length = 0; int name_de; int props_de; int color_de = DEFAULT; int status = 1; int entity_type; - int i; + size_t i; RT_CK_COMB(comb); @@ -2923,11 +2922,7 @@ int -comb_to_iges(struct rt_comb_internal *comb, - int length, int dependent, - struct iges_properties *props, - int de_pointers[], - FILE *fp_dir, FILE *fp_param) +comb_to_iges(struct rt_comb_internal *comb, size_t length, int dependent, struct iges_properties *props, int de_pointers[], FILE *fp_dir, FILE *fp_param) { RT_CK_COMB(comb); Modified: brlcad/trunk/src/conv/iges/main.c =================================================================== --- brlcad/trunk/src/conv/iges/main.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/main.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -51,7 +51,7 @@ char brlcad_file[256] = {0}; int reclen = 0; int currec = 0; -int ntypes = 0; +size_t ntypes = 0; int brlcad_att_de = 0; struct iges_directory **dir = NULL; struct reglist *regroot = NULL; Modified: brlcad/trunk/src/conv/iges/make_face.c =================================================================== --- brlcad/trunk/src/conv/iges/make_face.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/make_face.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -28,10 +28,10 @@ Make_planar_face(struct shell *s, int entityno, int face_orient) { - int sol_num; /* IGES solid type number */ - int no_of_edges; /* edge count for this loop */ - int no_of_param_curves; - int vert_count = 0; /* Actual number of vertices used to make face */ + int sol_num = 0; /* IGES solid type number */ + int no_of_edges = 0; /* edge count for this loop */ + int no_of_param_curves = 0; + int vert_count = 0; /* Actual number of vertices used to make face */ struct iges_edge_use *edge_list; /* list of edgeuses from iges loop entity */ struct faceuse *fu = NULL; /* NMG face use */ struct loopuse *lu; /* NMG loop use */ Modified: brlcad/trunk/src/conv/iges/make_nurb_face.c =================================================================== --- brlcad/trunk/src/conv/iges/make_nurb_face.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/make_nurb_face.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -25,10 +25,10 @@ Add_nurb_loop_to_face(struct shell *s, struct faceuse *fu, int loop_entityno) { int i, j, k; - int entity_type; - int no_of_edges; - int no_of_param_curves; - int vert_no; + int entity_type = 0; + int no_of_edges = 0; + int no_of_param_curves = 0; + int vert_no = 0; struct face *f; struct face_g_snurb *srf; struct faceuse *fu_ret; Modified: brlcad/trunk/src/conv/iges/read_att.c =================================================================== --- brlcad/trunk/src/conv/iges/read_att.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/read_att.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -29,7 +29,7 @@ Read_att(int att_de, struct brlcad_att *att) { int entityno; - int i; + int i = 0; if (att_de == 0) { /* fill structure with default info */ Modified: brlcad/trunk/src/conv/iges/read_edge_list.c =================================================================== --- brlcad/trunk/src/conv/iges/read_edge_list.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/read_edge_list.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -26,7 +26,7 @@ { struct iges_edge_list *edge_list; int entityno; - int sol_num; + int sol_num = 0; int i; entityno = (edge->edge_de - 1)/2; Modified: brlcad/trunk/src/conv/iges/read_vertex_list.c =================================================================== --- brlcad/trunk/src/conv/iges/read_vertex_list.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/read_vertex_list.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -26,7 +26,7 @@ { struct iges_vertex_list *vertex_list; int entityno; - int sol_num; + int sol_num = 0; int i; entityno = (vert_de - 1)/2; Modified: brlcad/trunk/src/conv/iges/readmatrix.c =================================================================== --- brlcad/trunk/src/conv/iges/readmatrix.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/readmatrix.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -33,7 +33,8 @@ void Readmatrix(int xform, mat_t rot) { - int i, j; + int i = 0; + int j = 0; /* read the actual transformation matrix and store */ Modified: brlcad/trunk/src/conv/iges/readtree.c =================================================================== --- brlcad/trunk/src/conv/iges/readtree.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/readtree.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -24,7 +24,10 @@ union tree * Readtree(mat_t *matp) { - int length, i, k, op; + int length = 0; + int i = 0; + int k = 0; + int op = 0; union tree *ptr, *Pop(); mat_t *new_mat; Modified: brlcad/trunk/src/conv/iges/spline.c =================================================================== --- brlcad/trunk/src/conv/iges/spline.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/spline.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -26,23 +26,23 @@ int spline(int entityno, struct face_g_snurb **b_patch) { - int k1; /* upper index of first sum */ - int k2; /* upper index of second sum */ - int m1; /* degree of 1st set of basis functions */ - int m2; /* degree of 2nd set of basis functions */ - int prop1; /* !0 if closed in first direction */ - int prop2; /* !0 if closed in second direction */ - int prop3; /* !0 if polynomial (else rational) */ - int prop4; /* !0 if periodic in first direction */ - int prop5; /* !0 if periodic in second direction */ - int sol_num; /* IGES solid type number */ + int k1 = 0; /* upper index of first sum */ + int k2 = 0; /* upper index of second sum */ + int m1 = 0; /* degree of 1st set of basis functions */ + int m2 = 0; /* degree of 2nd set of basis functions */ + int prop1 = 0; /* !0 if closed in first direction */ + int prop2 = 0; /* !0 if closed in second direction */ + int prop3 = 0; /* !0 if polynomial (else rational) */ + int prop4 = 0; /* !0 if periodic in first direction */ + int prop5 = 0; /* !0 if periodic in second direction */ + int sol_num = 0; /* IGES solid type number */ int n1, n2; int i, j, k; int count = 0; - int point_size; + int point_size = 0; fastf_t min_knot; double max_wt; - double scan; + double scan = 0.0; /* Acquiring Data */ Modified: brlcad/trunk/src/conv/iges/trimsurf.c =================================================================== --- brlcad/trunk/src/conv/iges/trimsurf.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/trimsurf.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -53,7 +53,7 @@ { struct face_g_snurb *srf; point_t pt; - int entity_type; + int entity_type = 0; int i; int rational; int ncoords; @@ -60,7 +60,7 @@ int n_rows, n_cols, u_order, v_order; int n_u, n_v; int pt_type; - double a; + double a = 0.0; /* Acquiring Data */ @@ -226,17 +226,20 @@ Get_cnurb(int entity_no) { struct edge_g_cnurb *crv; - point_t pt, pt2; - int entity_type; - int num_pts; - int degree; - int i; - int planar; - int rational; - int pt_type; - int ncoords; - double a; - double x, y, z; + double a = 0.0; + double x = 0.0; + double y = 0.0; + double z = 0.0; + int degree = 0; + int entity_type = 0; + int i = 0; + int ncoords = 0; + int num_pts = 0; + int planar = 0; + int pt_type = 0; + int rational = 0; + point_t pt = VINIT_ZERO; + point_t pt2 = VINIT_ZERO; if (dir[entity_no]->param <= pstart) { bu_log("Get_cnurb: Illegal parameter pointer for entity D%07d (%s)\n" , @@ -530,10 +533,13 @@ struct edgeuse *eu; struct edgeuse *new_eu; struct vertex *vp; - int entity_type; - int ncoords; - double x, y, z; - fastf_t u, v; + int entity_type = 0; + int ncoords = 0; + double x = 0.0; + double y = 0.0; + double z = 0.0; + fastf_t u = 0.0; + fastf_t v = 0.0; int i; NMG_CK_SNURB(srf); @@ -712,9 +718,11 @@ Make_loop(int entity_no, int orientation, int on_surf_de, struct face_g_snurb *srf, struct faceuse *fu) { struct loopuse *lu; - int entity_type; - int surf_de, param_curve_de, model_curve_de; - int i; + int entity_type = 0; + int surf_de = 0; + int param_curve_de = 0; + int model_curve_de = 0; + int i = 0; NMG_CK_SNURB(srf); NMG_CK_FACEUSE(fu); @@ -897,8 +905,8 @@ struct loopuse *lu; struct loopuse *kill_lu; struct vertex *verts[3]; - int entity_type; - int surf_de; + int entity_type = 0; + int surf_de = 0; int has_outer_boundary, inner_loop_count, outer_loop; int *inner_loop = NULL; int i; Modified: brlcad/trunk/src/conv/obj-g.c =================================================================== --- brlcad/trunk/src/conv/obj-g.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/obj-g.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -1264,7 +1264,7 @@ tri_arr_3D_t index_arr_tri_3D = NULL; double *facePoints; - int *triFaces; + int *triFaces = NULL; size_t i, numFacePoints; struct faceuse *fu; const int POINTS_PER_FACE = 3; @@ -1431,7 +1431,8 @@ ti->num_tri++; } - bu_free(triFaces, "triFaces"); + if (triFaces) + bu_free(triFaces, "triFaces"); return; } Modified: brlcad/trunk/src/halftone/tone_floyd.c =================================================================== --- brlcad/trunk/src/halftone/tone_floyd.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/halftone/tone_floyd.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -34,7 +34,7 @@ extern int Debug; extern int Levels; -extern int width; +extern long int width; extern struct bn_unif *RandomFlag; /* tone_floyd floyd-steinberg dispersed error method. Modified: brlcad/trunk/src/libged/ged_private.h =================================================================== --- brlcad/trunk/src/libged/ged_private.h 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/libged/ged_private.h 2017-08-24 13:25:50 UTC (rev 70120) @@ -332,7 +332,7 @@ /* defined in red.c */ -extern char _ged_tmpfil[MAXPATHLEN]; +extern char _ged_tmpfil[]; /* defined in rt.c */ Modified: brlcad/trunk/src/liboptical/sh_light.c =================================================================== --- brlcad/trunk/src/liboptical/sh_light.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/liboptical/sh_light.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -1516,7 +1516,7 @@ #ifdef RT_MULTISPECTRAL /* XXX Need a power level for this! */ - bn_tabdata_constval(((struct bn_tabdata *)los->inten), 1.0); + bn_tabdata_constval(*(los->inten), 1.0); #else VSETALL(((vectp_t)los->inten), 1); #endif @@ -1675,8 +1675,12 @@ los.lsp = lsp; #ifdef RT_MULTISPECTRAL - if (swp->msw_intensity[i]) BN_CK_TABDATA(swp->msw_intensity[i]); - los.inten = &swp->msw_intensity[i]; + if (swp->msw_intensity[i]) { + BN_CK_TABDATA(swp->msw_intensity[i]); + los.inten = &swp->msw_intensity[i]; + } else { + bn_tabdata_constval(*los.inten, 1.0); /* punt */ + } #else los.inten = &swp->sw_intensity[3*i]; #endif Modified: brlcad/trunk/src/librt/binunif/db5_bin.c =================================================================== --- brlcad/trunk/src/librt/binunif/db5_bin.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/librt/binunif/db5_bin.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -283,14 +283,11 @@ * tab, and give parameter values. */ int -rt_binunif_describe(struct bu_vls *str, - const struct rt_db_internal *ip, - int UNUSED(verbose), - double UNUSED(mm2local)) +rt_binunif_describe(struct bu_vls *str, const struct rt_db_internal *ip, int UNUSED(verbose), double UNUSED(mm2local)) { - register struct rt_binunif_internal *bip; - char buf[256]; - unsigned short wid; + register struct rt_binunif_internal *bip; + char buf[256]; + unsigned short wid; bip = (struct rt_binunif_internal *) ip->idb_ptr; RT_CK_BINUNIF(bip); Modified: brlcad/trunk/src/librt/constraint.c =================================================================== --- brlcad/trunk/src/librt/constraint.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/librt/constraint.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -69,19 +69,12 @@ int -rt_constraint_export5( - struct bu_external *ep, - const struct rt_db_internal *ip, - double UNUSED(local2mm), - const struct db_i *dbip, - struct resource *resp) +rt_constraint_export5(struct bu_external *ep, const struct rt_db_internal *ip, double UNUSED(local2mm), const struct db_i *UNUSED(dbip)) { struct rt_constraint_internal *cip; struct bu_vls str = BU_VLS_INIT_ZERO; RT_CK_DB_INTERNAL(ip); - if (dbip) RT_CK_DBI(dbip); - if (resp) RT_CK_RESOURCE(resp); if (ip->idb_type != ID_CONSTRAINT) bu_bomb("rt_constraint_export() type not ID_CONSTRAINT"); cip = (struct rt_constraint_internal *) ip->idb_ptr; @@ -100,18 +93,6 @@ } -int -rt_constraint_import5(struct rt_db_internal *ip, const struct bu_external *ep, const mat_t UNUSED(mat), const struct db_i *dbip, struct resource *resp) -{ - RT_CK_DB_INTERNAL(ip); - BU_CK_EXTERNAL(ep); - RT_CK_DBI(dbip); - if (resp) RT_CK_RESOURCE(resp); - - return 0; /* OK */ -} - - /** @} */ /* * Local Variables: Modified: brlcad/trunk/src/mged/attach.c =================================================================== --- brlcad/trunk/src/mged/attach.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/mged/attach.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -116,7 +116,6 @@ # endif #endif /* DM_OSGL */ -extern void fbserv_set_port(void); /* defined in fbserv.c */ extern void share_dlist(struct dm_list *dlp2); /* defined in share.c */ extern struct _color_scheme default_color_scheme; @@ -365,7 +364,7 @@ if (mged_variables->mv_listen) { /* drop all clients */ mged_variables->mv_listen = 0; - fbserv_set_port(); + fbserv_set_port(NULL, NULL, NULL, NULL, NULL); } /* release framebuffer resources */ Modified: brlcad/trunk/src/mged/fbserv.c =================================================================== --- brlcad/trunk/src/mged/fbserv.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/mged/fbserv.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -233,7 +233,7 @@ void -fbserv_set_port(void) +fbserv_set_port(const struct bu_structparse *UNUSED(sp), const char *UNUSED(c1), void *UNUSED(v1), const char *UNUSED(c2), void *UNUSED(v2)) { int i; int save_port; @@ -409,7 +409,7 @@ void -fbserv_set_port(void) +fbserv_set_port(const struct bu_structparse *UNUSED(sp), const char *UNUSED(c1), void *UNUSED(v1), const char *UNUSED(c2), void *UNUSED(v2)) { int i; int save_port; Modified: brlcad/trunk/src/mged/mged.h =================================================================== --- brlcad/trunk/src/mged/mged.h 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/mged/mged.h 2017-08-24 13:25:50 UTC (rev 70120) @@ -623,6 +623,7 @@ int etoin(struct rt_db_internal *ip, fastf_t thick[1]); /* set.c */ +extern void fbserv_set_port(const struct bu_structparse *, const char *, void *, const char *, void *); extern void set_scroll_private(const struct bu_structparse *, const char *, void *, const char *, void *); extern void mged_variable_setup(Tcl_Interp *interpreter); Modified: brlcad/trunk/src/mged/predictor.c =================================================================== --- brlcad/trunk/src/mged/predictor.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/mged/predictor.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -308,7 +308,7 @@ * Called from set.c when the predictor variables are modified. */ void -predictor_hook(void) +predictor_hook(const struct bu_structparse *UNUSED(sp), const char *UNUSED(c1), void *UNUSED(v1), const char *UNUSED(c2), void *UNUSED(v2)) { if (mged_variables->mv_predictor > 0) predictor_init(); Modified: brlcad/trunk/src/mged/set.c =================================================================== --- brlcad/trunk/src/mged/set.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/mged/set.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -33,7 +33,6 @@ #include "tcl.h" /* external sp_hook functions */ -extern void fbserv_set_port(const struct bu_structparse *, const char *, void *, const char *, void *); extern void predictor_hook(const struct bu_structparse *, const char *, void *, const char *, void *); /* exported sp_hook functions */ Modified: brlcad/trunk/src/proc-db/naca/nacax.c =================================================================== --- brlcad/trunk/src/proc-db/naca/nacax.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/proc-db/naca/nacax.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -214,7 +214,7 @@ int k; int n, nn; int nupper, nlower; - fastf_t sbar; + fastf_t sbar = 0.0; const fastf_t TOL = 1e-6; struct fortran_array *xupper, *yupper, *xlower, *ylower; struct fortran_array *xupper_short, *yupper_short, *xlower_short, *ylower_short; @@ -330,7 +330,7 @@ int k; int nn; int nupper, nlower; - fastf_t sbar; + fastf_t sbar = 0.0; const fastf_t TOL = 1e-6; struct fortran_array *xupperCopy, *yupperCopy, *xlowerCopy, *ylowerCopy; struct fortran_array *xupperCopy_short, *yupperCopy_short, *xlowerCopy_short, *ylowerCopy_short; @@ -1043,7 +1043,7 @@ const fastf_t TOL = 1e-6; int errCode; int k, n; - fastf_t sx; + fastf_t sx = 0.0; struct fortran_array *xt, *yt; struct fortran_array *minus_yt; struct fortran_array *xLocal, *yLocal, *sLocal, *xpLocal, *ypLocal; Modified: brlcad/trunk/src/remrt/CMakeLists.txt =================================================================== --- brlcad/trunk/src/remrt/CMakeLists.txt 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/remrt/CMakeLists.txt 2017-08-24 13:25:50 UTC (rev 70120) @@ -12,9 +12,9 @@ ${TCL_INCLUDE_DIRS} ) -BRLCAD_ADDEXEC(remrt "ihost.c;remrt.c" "libremrt;liboptical;libfb") +BRLCAD_ADDEXEC(remrt "../rt/opt.c;ihost.c;remrt.c" "liboptical;libfb") -BRLCAD_ADDEXEC(rtsrv rtsrv.c "libremrt;libfb;liboptical;libpkg;libicv") +BRLCAD_ADDEXEC(rtsrv "../rt/view.c;../rt/do.c;../rt/heatgraph.c;../rt/opt.c;../rt/scanline.c;../rt/worker.c;rtsrv.c" "libfb;liboptical;libpkg;libicv") SET_TARGET_PROPERTIES(rtsrv PROPERTIES COMPILE_DEFINITIONS "RTSRV") CMAKEFILES(ihost.h protocol.h) Modified: brlcad/trunk/src/remrt/remrt.c =================================================================== --- brlcad/trunk/src/remrt/remrt.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/remrt/remrt.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -72,6 +72,8 @@ #include "brlcad_ident.h" + + #ifndef HAVE_VFORK # ifdef HAVE_FORK # define vfork fork @@ -133,14 +135,11 @@ # define MAXSERVERS NFD /* No relay function yet */ #endif +/* NOTE: satisfies linkage with do.c command parsing. possibly wrong + * to stub empty... might hinder remrt's ability to read rt commands. + */ +struct command_tab rt_cmdtab[] = {{NULL, NULL, NULL, 0, 0, 0}}; -/* Needed to satisfy the reference created by including ../rt/opt.o */ -struct command_tab rt_cmdtab[] = { - {(char *)0, (char *)0, (char *)0, - 0, 0, 0} /* END */ -}; - - struct frame { struct frame *fr_forw; struct frame *fr_back; Modified: brlcad/trunk/src/rt/CMakeLists.txt =================================================================== --- brlcad/trunk/src/rt/CMakeLists.txt 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rt/CMakeLists.txt 2017-08-24 13:25:50 UTC (rev 70120) @@ -13,16 +13,26 @@ LIST(REMOVE_DUPLICATES RTBIN_INCLUDE_DIRS) include_directories(${RTBIN_INCLUDE_DIRS}) -set(RT_COMMON_SRCS +set(LIBRTUIF_SOURCES do.c + heatgraph.c main.c opt.c + scanline.c worker.c ) -if(NOT MSVC) - set(RT_COMMON_SRCS ${RT_COMMON_SRCS} heatgraph.c) -endif(NOT MSVC) +add_library(librtuif STATIC ${LIBRTUIF_SOURCES}) +if(M_LIBRARY) + target_link_libraries(librtuif ${M_LIBRARY}) +endif(M_LIBRARY) +set_target_properties(librtuif PROPERTIES FOLDER "BRL-CAD Static Libraries") + +add_library(librtuif_multispectral STATIC ${LIBRTUIF_SOURCES}) +set_property(TARGET librtuif_multispectral APPEND PROPERTY LINKER_LANGUAGE C) +set_property(TARGET librtuif_multispectral APPEND PROPERTY COMPILE_DEFINITIONS "RT_MULTISPECTRAL") +set_property(TARGET librtuif_multispectral APPEND PROPERTY FOLDER "BRL-CAD Static Libraries") + if(BRLCAD_ENABLE_OPENCL) set(OPENCL_LIBS ${OPENCL_LIBRARIES}) endif(BRLCAD_ENABLE_OPENCL) @@ -41,74 +51,50 @@ BRLCAD_ADDEXEC(rtscale "read-rtlog.c;rtscale.c" "${CMAKE_THREAD_LIBS_INIT};librt;libfb;liboptical;libicv;${M_LIBRARY}") -BRLCAD_ADDEXEC(rt "${RT_COMMON_SRCS};scanline.c;view.c" "${OPENCL_LIBS};${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rt "view.c" "${OPENCL_LIBS};${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") -BRLCAD_ADDEXEC(rt_bot_faces "${RT_COMMON_SRCS};view_bot_faces.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rt_bot_faces "view_bot_faces.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rt_bot_faces APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtarea "${RT_COMMON_SRCS};viewarea.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtarea "viewarea.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtarea APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtcell "${RT_COMMON_SRCS};viewcell.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtcell "viewcell.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtcell APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtcheck "${RT_COMMON_SRCS};viewcheck.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtcheck "viewcheck.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtcheck APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtedge "${RT_COMMON_SRCS};viewedge.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtedge "viewedge.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") -BRLCAD_ADDEXEC(rtfrac "${RT_COMMON_SRCS};viewfrac.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtfrac "viewfrac.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtfrac APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtg3 "${RT_COMMON_SRCS};viewg3.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtg3 "viewg3.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtg3 APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rthide "${RT_COMMON_SRCS};viewhide.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rthide "viewhide.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rthide APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtpp "${RT_COMMON_SRCS};viewpp.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtpp "viewpp.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") -BRLCAD_ADDEXEC(rtrad "${RT_COMMON_SRCS};viewrad.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtrad "viewrad.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtrad APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtrange "${RT_COMMON_SRCS};viewrange.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtrange "viewrange.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtrange APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtray "${RT_COMMON_SRCS};viewray.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtray "viewray.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtray APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtsil "${RT_COMMON_SRCS};viewsil.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtsil "viewsil.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") -BRLCAD_ADDEXEC(rtweight "${RT_COMMON_SRCS};viewweight.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtweight "viewweight.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") set_property(TARGET rtweight APPEND PROPERTY COMPILE_DEFINITIONS "RT_TXT_OUTPUT") -BRLCAD_ADDEXEC(rtxray "${RT_COMMON_SRCS};viewxray.c" "${CMAKE_THREAD_LIBS_INIT};librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") +BRLCAD_ADDEXEC(rtxray "viewxray.c" "${CMAKE_THREAD_LIBS_INIT};librtuif;librt;libnmg;libfb;liboptical;libicv;${M_LIBRARY}") -set(LIBREMRT_SOURCES - do.c - opt.c - scanline.c - sh_tcl.c - view.c - worker.c - ) -if(NOT MSVC) - set(LIBREMRT_SOURCES ${LIBREMRT_SOURCES} heatgraph.c) -endif(NOT MSVC) - -add_library(libremrt STATIC ${LIBREMRT_SOURCES}) -if(M_LIBRARY) - target_link_libraries(libremrt ${M_LIBRARY}) -endif(M_LIBRARY) -set_target_properties(libremrt PROPERTIES FOLDER "BRL-CAD Static Libraries") - -add_library(librttherm STATIC ${RT_COMMON_SRCS}) -set_target_properties(librttherm PROPERTIES LINKER_LANGUAGE C) -set_target_properties(librttherm PROPERTIES FOLDER "BRL-CAD Static Libraries") - set(rt_ignore_files - ${LIBREMRT_SOURCES} - heatgraph.c ext.h libfb-dummy.c rad.h Modified: brlcad/trunk/src/rt/main.c =================================================================== --- brlcad/trunk/src/rt/main.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rt/main.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -85,9 +85,9 @@ extern int pix_end; /* pixel to end at */ extern int nobjs; /* Number of cmd-line treetops */ extern char **objtab; /* array of treetop strings */ -long n_malloc; /* Totals at last check */ -long n_free; -long n_realloc; +size_t n_malloc; /* Totals at last check */ +size_t n_free; +size_t n_realloc; extern int matflag; /* read matrix from stdin */ extern int orientflag; /* 1 means orientation has been set */ extern int desiredframe; /* frame to start at */ @@ -120,20 +120,19 @@ void -memory_summary(long num_free_calls) +memory_summary(void) { if (rt_verbosity & VERBOSE_STATS) { - long mdelta = bu_n_malloc - n_malloc; - long fdelta = num_free_calls - n_free; - fprintf(stderr, - "Additional #malloc=%ld, #free=%ld, #realloc=%ld (%ld retained)\n", - mdelta, - fdelta, - bu_n_realloc - n_realloc, - mdelta - fdelta); + size_t mdelta = bu_n_malloc - n_malloc; + size_t fdelta = bu_n_free - n_free; + bu_log("Additional #malloc=%zu, #free=%zu, #realloc=%zu (%zu retained)\n", + mdelta, + fdelta, + bu_n_realloc - n_realloc, + mdelta - fdelta); } n_malloc = bu_n_malloc; - n_free = num_free_calls; + n_free = bu_n_free; n_realloc = bu_n_realloc; } @@ -144,7 +143,6 @@ char idbuf[2048] = {0}; /* First ID record info */ struct bu_vls times = BU_VLS_INIT_ZERO; int i; - long n_free_calls = 0; setmode(fileno(stdin), O_BINARY); setmode(fileno(stdout), O_BINARY); @@ -157,8 +155,17 @@ elevation = 25.0; AmbientIntensity = 0.4; +#ifndef RT_MULTISPECTRAL background[0] = background[1] = 0.0; background[2] = 1.0/255.0; /* slightly non-black */ +#else + { + extern struct bn_table *bn_table_make_visible_and_uniform(int num, double first, double last, int vis_nsamp); + extern fastf_t spectrum_param[]; + spectrum = bn_table_make_visible_and_uniform((int)spectrum_param[0], spectrum_param[1], spectrum_param[2], 20); + BN_GET_TABDATA(background, spectrum); + } +#endif /* Before option processing, get default number of processors */ npsw = bu_avail_cpus(); /* Use all that are present */ @@ -353,7 +360,7 @@ if (rt_verbosity & VERBOSE_STATS) bu_log("DIRBUILD: %s\n", bu_vls_addr(×)); bu_vls_free(×); - memory_summary(n_free_calls); + memory_summary(); /* Copy values from command line options into rtip */ rtip->rti_space_partition = space_partition; @@ -442,7 +449,7 @@ for (i = 0; i < MAX_PSW; i++) { rt_init_resource(&resource[i], i, rtip); } - memory_summary(n_free_calls); + memory_summary(); #ifdef SIGUSR1 (void)signal(SIGUSR1, siginfo_handler); @@ -483,7 +490,6 @@ fprintf(stderr, "cmd: %s\n", buf); ret = rt_do_cmd( rtip, buf, rt_cmdtab); bu_free( buf, "rt_read_cmd command buffer"); - n_free_calls++; if (ret < 0) break; } Deleted: brlcad/trunk/src/rt/sh_tcl.c =================================================================== --- brlcad/trunk/src/rt/sh_tcl.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rt/sh_tcl.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -1,207 +0,0 @@ -/* S H _ T C L . C - * BRL-CAD - * - * Copyright (c) 1997-2016 United States Government as represented by - * the U.S. Army Research Laboratory. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this file; see the file named COPYING for more - * information. - */ -/** @file rt/sh_tcl.c - * - * Tcl interfaces to RT material & shader routines. - * - * These routines are not for casual command-line use; - * as a result, the Tcl name for the function should be exactly - * the same as the C name for the underlying function. - * - */ - -#include "common.h" - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> -#include <string.h> - -#include "tcl.h" - -#include "bu/log.h" -#include "bu/malloc.h" -#include "bu/vls.h" -#include "vmath.h" -#include "bn.h" -#include "raytrace.h" -#include "optical/shadefuncs.h" - - -extern struct mfuncs *mfHead; /* view.c */ -extern int get_args(int argc, const char *argv[]); /* opt.c */ - - -/* - * Go poke the rgb values of a region, on the fly. - * This does not update the in-memory database, - * so any changes will vanish on next re-prep unless other measures - * are taken. - */ -int -sh_directchange_rgb(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, const char *argv[]) -{ - long int rtip_val; - struct rt_i *rtip; - struct region *regp; - struct directory *dp; - float r, g, b; - - if ( argc != 6 ) { - Tcl_AppendResult(interp, "Usage: sh_directchange_rgb $rtip comb r g b\n", NULL); - return TCL_ERROR; - } - - r = atoi(argv[3+0]) / 255.0; - g = atoi(argv[3+1]) / 255.0; - b = atoi(argv[3+2]) / 255.0; - - rtip_val = atol(argv[1]); - rtip = (struct rt_i *)rtip_val; - RT_CK_RTI(rtip); - - if ( rtip->needprep ) { - Tcl_AppendResult(interp, "rt_prep() hasn't been called yet, error.\n", NULL); - return TCL_ERROR; - } - - if ( (dp = db_lookup( rtip->rti_dbip, argv[2], LOOKUP_NOISY)) == RT_DIR_NULL ) { - Tcl_AppendResult(interp, argv[2], ": not found\n", NULL); - return TCL_ERROR; - } - - /* Find all region names which match /comb/ pattern */ - for ( BU_LIST_FOR( regp, region, &rtip->HeadRegion ) ) { - /* XXX quick hack */ - if ( strstr( regp->reg_name, argv[2] ) == NULL ) continue; - - /* Modify the region's color */ - bu_log("sh_directchange_rgb() changing %s\n", regp->reg_name); - VSET( regp->reg_mater.ma_color, r, g, b ); - - /* Update the shader */ - mlib_free(regp); - if ( mlib_setup( &mfHead, regp, rtip ) != 1 ) { - Tcl_AppendResult(interp, regp->reg_name, ": mlib_setup() failure\n", NULL); - } - } - - return TCL_OK; -} - - -/* - * Go poke the rgb values of a region, on the fly. - * This does not update the in-memory database, - * so any changes will vanish on next re-prep unless other measures - * are taken. - */ -int -sh_directchange_shader(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, const char *argv[]) -{ - long int rtip_val; - struct rt_i *rtip; - struct region *regp; - struct directory *dp; - struct bu_vls shader = BU_VLS_INIT_ZERO; - - if ( argc < 4 ) { - Tcl_AppendResult(interp, "Usage: sh_directchange_shader $rtip comb shader_arg(s)\n", NULL); - return TCL_ERROR; - } - - rtip_val = atol(argv[1]); - rtip = (struct rt_i *)rtip_val; - RT_CK_RTI(rtip); - - if ( rtip->needprep ) { - Tcl_AppendResult(interp, "rt_prep() hasn't been called yet, error.\n", NULL); - return TCL_ERROR; - } - - if ( (dp = db_lookup( rtip->rti_dbip, argv[2], LOOKUP_NOISY)) == RT_DIR_NULL ) { - Tcl_AppendResult(interp, argv[2], ": not found\n", NULL); - return TCL_ERROR; - } - - bu_vls_from_argv(&shader, argc-3, argv+3); - bu_vls_trimspace(&shader); - - /* Find all region names which match /comb/ pattern */ - for ( BU_LIST_FOR( regp, region, &rtip->HeadRegion ) ) { - /* XXX quick hack */ - if ( strstr( regp->reg_name, argv[2] ) == NULL ) continue; - - /* Modify the region's shader string */ - bu_log("sh_directchange_shader() changing %s\n", regp->reg_name); - if ( regp->reg_mater.ma_shader ) - bu_free( (void *)regp->reg_mater.ma_shader, "reg_mater.ma_shader"); - regp->reg_mater.ma_shader = bu_vls_strdup(&shader); - - /* Update the shader */ - mlib_free(regp); - if ( mlib_setup( &mfHead, regp, rtip ) != 1 ) { - Tcl_AppendResult(interp, regp->reg_name, ": mlib_setup() failure\n", NULL); - } - } - - bu_vls_free(&shader); - return TCL_OK; -} - -/* - * Process RT-style command-line options. - */ -int -sh_opt(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, const char *argv[]) -{ - if ( argc < 2 ) { - Tcl_AppendResult(interp, "Usage: sh_opt command_line_option(s)\n", NULL); - return TCL_ERROR; - } - if ( get_args( argc, argv ) <= 0 ) - return TCL_ERROR; - return TCL_OK; -} - -/* - * Add all the supported Tcl interfaces to RT material/shader routines to - * the list of commands known by the given interpreter. - */ -void -sh_tcl_setup(Tcl_Interp *interp) -{ - (void)Tcl_CreateCommand(interp, "sh_directchange_rgb", sh_directchange_rgb, - (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - (void)Tcl_CreateCommand(interp, "sh_directchange_shader", sh_directchange_shader, - (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - (void)Tcl_CreateCommand(interp, "sh_opt", sh_opt, - (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); -} - -/* - * Local Variables: - * mode: C - * tab-width: 8 - * indent-tabs-mode: t - * c-file-style: "stroustrup" - * End: - * ex: shiftwidth=4 tabstop=8 - */ Modified: brlcad/trunk/src/rt/view.c =================================================================== --- brlcad/trunk/src/rt/view.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rt/view.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -154,7 +154,7 @@ int inonbackground[3] = {0}; /* integer non-background */ #ifdef RTSRV -extern int srv_startpix; /* offset for view_pixel */ +extern int srv_startpix; /* offset for view_pixel */ extern int srv_scanlen; /* BUFMODE_RTSRV buffer length */ #endif @@ -1759,8 +1759,7 @@ break; #ifdef RTSRV case BUFMODE_RTSRV: - scanbuf = bu_malloc(srv_scanlen*pwidth + sizeof(long), - "scanbuf [multi-line]"); + scanbuf = (unsigned char *)bu_malloc(srv_scanlen*pwidth + sizeof(long), "scanbuf [multi-line]"); break; #endif case BUFMODE_INCR: Modified: brlcad/trunk/src/rt/viewpp.c =================================================================== --- brlcad/trunk/src/rt/viewpp.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rt/viewpp.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -67,7 +67,7 @@ static int ntomiss; /* number of pixels to miss */ static int col; /* column; for PP 75 char/line crap */ -void view_pixel(void) {} +void view_pixel(struct application *UNUSED(ap)) {} #define pchar(c) {putc(c, stdout);if (col++==74) {putc('\n', stdout);col=0;}} @@ -149,7 +149,7 @@ } void -view_eol(void) +view_eol(struct application *UNUSED(ap)) { pchar('.'); /* End of scanline */ last_solidp = SOLTAB_NULL; @@ -160,7 +160,7 @@ * Called when the picture is finally done. */ void -view_end(void) +view_end(struct application *UNUSED(ap)) { fprintf(stdout, "/\n"); /* end of view */ fflush(stdout); @@ -167,7 +167,7 @@ } int -view_init(register struct application *ap, char *file, char *obj, int minus_o) +view_init(struct application *ap, char *file, char *obj, int minus_o, int UNUSED(minus_F)) { ap->a_hit = pphit; ap->a_miss = ppmiss; @@ -185,10 +185,10 @@ return 0; /* no framebuffer needed */ } -void view_2init(void) {;} +void view_2init(struct application *UNUSED(ap), char *UNUSED(framename)) {;} -void view_setup(void) {} -void view_cleanup(void) {} +void view_setup(struct rt_i *UNUSED(rtip)) {} +void view_cleanup(struct rt_i *UNUSED(rtip)) {} void application_init (void) {} Modified: brlcad/trunk/src/rt/viewrad.c =================================================================== --- brlcad/trunk/src/rt/viewrad.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rt/viewrad.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -59,8 +59,8 @@ extern mat_t view2model; extern fastf_t viewsize; -extern int width; -extern int height; +extern size_t width; +extern size_t height; int numreflect = DEFAULTREFLECT; /* max number of reflections */ Modified: brlcad/trunk/src/rt/viewsil.c =================================================================== --- brlcad/trunk/src/rt/viewsil.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rt/viewsil.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -40,9 +40,9 @@ #include "./rtuif.h" -extern FILE *outfp; -extern int width, height; -static unsigned char *scanbuf; +extern FILE *outfp; +extern size_t width, height; +static unsigned char *scanbuf; /* * Viewing module specific "set" variables. Modified: brlcad/trunk/src/rttherm/CMakeLists.txt =================================================================== --- brlcad/trunk/src/rttherm/CMakeLists.txt 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rttherm/CMakeLists.txt 2017-08-24 13:25:50 UTC (rev 70120) @@ -14,7 +14,7 @@ CMAKEFILES(ssampview.c) endif(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_TK) -BRLCAD_ADDEXEC(rttherm "spectrum.c;viewtherm.c" "libfb;libged;librttherm;libmultispectral") +BRLCAD_ADDEXEC(rttherm "spectrum.c;viewtherm.c" "libfb;libged;librtuif_multispectral;libmultispectral") SET_TARGET_PROPERTIES(rttherm PROPERTIES COMPILE_DEFINITIONS "RT_MULTISPECTRAL") install(PROGRAMS ssampview.tcl DESTINATION ${BIN_DIR}) Modified: brlcad/trunk/src/rttherm/viewtherm.c =================================================================== --- brlcad/trunk/src/rttherm/viewtherm.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/rttherm/viewtherm.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -59,6 +59,7 @@ /* private */ #include "../rt/rtuif.h" #include "../rt/ext.h" +#include "../rt/scanline.h" #include "brlcad_ident.h" @@ -112,7 +113,6 @@ extern int curframe; /* from main.c */ extern fastf_t frame_delta_t; /* from main.c */ -void free_scanlines(void); /***** variables shared with rt.c *****/ extern char *outputfile; /* name of base of output file */ @@ -119,11 +119,9 @@ /***** end variables shared with rt.c *****/ -static struct scanline { - int sl_left; /* # pixels left on this scanline */ - char *sl_buf; /* ptr to scanline array of spectra */ -} *scanline; +static struct scanline *scanline = NULL; + fastf_t spectrum_param[3] = { 100, 380, 12000 /* # samp, min nm, max nm */ }; @@ -159,8 +157,8 @@ /* If scanline buffer has not yet been allocated, do so now */ slp = &scanline[app->a_y]; bu_semaphore_acquire(RT_SEM_RESULTS); - if (slp->sl_buf == (char *)0) { - slp->sl_buf = (char *)bn_tabdata_malloc_array(spectrum, width); + if (!slp->sl_buf) { + slp->sl_buf = (unsigned char *)bn_tabdata_malloc_array(spectrum, width); } bu_semaphore_release(RT_SEM_RESULTS); BN_CK_TABDATA(slp->sl_buf); /* pun for first struct in array (sanity) */ @@ -291,7 +289,7 @@ } #endif /* MSWISS */ bu_free(scanline[app->a_y].sl_buf, "sl_buf scanline buffer"); - scanline[app->a_y].sl_buf = (char *)0; + scanline[app->a_y].sl_buf = NULL; } @@ -311,7 +309,7 @@ view_end(struct application *app) { RT_AP_CHECK(app); - free_scanlines(); + free_scanlines(height, scanline); } @@ -637,22 +635,6 @@ } -void -free_scanlines(void) -{ - size_t y; - - for (y=0; y<height; y++) { - if (scanline[y].sl_buf) { - bu_free(scanline[y].sl_buf, "sl_buf scanline buffer"); - scanline[y].sl_buf = (char *)0; - } - } - bu_free((char *)scanline, "struct scanline[height]"); - scanline = (struct scanline *)0; -} - - /* * Called once, early on in RT setup, before view size is set. */ @@ -706,10 +688,9 @@ * one in incremental mode) */ if (!incr_mode || !scanline) { - if (scanline) free_scanlines(); - scanline = (struct scanline *)bu_calloc( - height, sizeof(struct scanline), - "struct scanline[height]"); + if (scanline) + free_scanlines(height, scanline); + scanline = (struct scanline *)bu_calloc(height, sizeof(struct scanline), "struct scanline[height]"); } /* Extra 2nd file! Write out spectrum info */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits