Revision: 76912
http://sourceforge.net/p/brlcad/code/76912
Author: starseeker
Date: 2020-08-24 12:49:07 +0000 (Mon, 24 Aug 2020)
Log Message:
-----------
Start going through Sean's list of dm functions - check their behavior in the
calling code if NULL is returned. Ways to go yet...
Modified Paths:
--------------
brlcad/trunk/src/libdm/dm_plugins.cpp
brlcad/trunk/src/libtclcad/tclcad_mouse.c
brlcad/trunk/src/libtclcad/tclcad_obj.c
Modified: brlcad/trunk/src/libdm/dm_plugins.cpp
===================================================================
--- brlcad/trunk/src/libdm/dm_plugins.cpp 2020-08-24 05:46:41 UTC (rev
76911)
+++ brlcad/trunk/src/libdm/dm_plugins.cpp 2020-08-24 12:49:07 UTC (rev
76912)
@@ -88,7 +88,7 @@
std::string key = d_it->first;
const struct dm *d = d_it->second;
const char *dname = dm_get_dm_name(d);
- if (BU_STR_EQUIV(dmtype, dname)) {
+ if (dname && BU_STR_EQUIV(dmtype, dname)) {
ret = dm_get_graphics_system(d);
break;
}
@@ -127,8 +127,9 @@
std::string key = d_it->first;
const struct dm *d = d_it->second;
if (strlen(bu_vls_cstr(list)) > 0) bu_vls_printf(list, "%s",
bu_vls_cstr(&sep));
- if (dm_get_name(d))
- bu_vls_printf(list, "%s", dm_get_name(d));
+ const char *dname = dm_get_name(d);
+ if (dname)
+ bu_vls_printf(list, "%s", dname);
}
if (strlen(bu_vls_cstr(list)) > 0) bu_vls_printf(list, "%s",
bu_vls_cstr(&sep));
bu_vls_printf(list, "nu");
@@ -149,8 +150,9 @@
}
const struct dm *d = d_it->second;
if (strlen(bu_vls_cstr(list)) > 0) bu_vls_printf(list, "%s",
bu_vls_cstr(&sep));
- if (dm_get_name(d))
- bu_vls_printf(list, "%s", dm_get_name(d));
+ const char *dname = dm_get_name(d);
+ if (dname)
+ bu_vls_printf(list, "%s", dname);
i++;
b = priority_list[i];
}
Modified: brlcad/trunk/src/libtclcad/tclcad_mouse.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad_mouse.c 2020-08-24 05:46:41 UTC (rev
76911)
+++ brlcad/trunk/src/libtclcad/tclcad_mouse.c 2020-08-24 12:49:07 UTC (rev
76912)
@@ -238,16 +238,17 @@
return GED_ERROR;
}
- if (dm_get_pathname((struct dm *)gdvp->dmp)) {
+ struct bu_vls *dname = dm_get_pathname((struct dm *)gdvp->dmp);
+ if (dname && bu_vls_strlen(dname)) {
bu_vls_printf(&bindings, "bind %s <Motion> {%s
mouse_brep_selection_translate %s %s %%x %%y; "
"%s brep %s plot SCV}",
- bu_vls_addr(dm_get_pathname((struct dm *)gdvp->dmp)),
- bu_vls_addr(¤t_top->to_gedp->go_name),
- bu_vls_addr(&gdvp->gv_name),
+ bu_vls_cstr(dname),
+ bu_vls_cstr(¤t_top->to_gedp->go_name),
+ bu_vls_cstr(&gdvp->gv_name),
brep_name,
- bu_vls_addr(¤t_top->to_gedp->go_name),
+ bu_vls_cstr(¤t_top->to_gedp->go_name),
brep_name);
- Tcl_Eval(current_top->to_interp, bu_vls_addr(&bindings));
+ Tcl_Eval(current_top->to_interp, bu_vls_cstr(&bindings));
}
bu_vls_free(&bindings);
@@ -968,13 +969,14 @@
return GED_ERROR;
}
- if (dm_get_pathname((struct dm *)gdvp->dmp)) {
+ struct bu_vls *dname = dm_get_pathname((struct dm *)gdvp->dmp);
+ if (dname) {
bu_vls_printf(&bindings, "bind %s <Motion> {%s
mouse_joint_selection_translate %s %s %%x %%y}",
- bu_vls_addr(dm_get_pathname((struct dm *)gdvp->dmp)),
- bu_vls_addr(¤t_top->to_gedp->go_name),
- bu_vls_addr(&gdvp->gv_name),
+ bu_vls_cstr(dname),
+ bu_vls_cstr(¤t_top->to_gedp->go_name),
+ bu_vls_cstr(&gdvp->gv_name),
joint_name);
- Tcl_Eval(current_top->to_interp, bu_vls_addr(&bindings));
+ Tcl_Eval(current_top->to_interp, bu_vls_cstr(&bindings));
}
bu_vls_free(&bindings);
Modified: brlcad/trunk/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad_obj.c 2020-08-24 05:46:41 UTC (rev
76911)
+++ brlcad/trunk/src/libtclcad/tclcad_obj.c 2020-08-24 12:49:07 UTC (rev
76912)
@@ -1107,9 +1107,9 @@
// There is a top level command created in the Tcl interp that is
the name
// of the dm. Clear that command.
- const char *dm_tcl_cmd = bu_vls_cstr(dm_get_pathname((struct dm
*)gdvp->dmp));
- if (dm_tcl_cmd)
- Tcl_DeleteCommand(top->to_interp, dm_tcl_cmd);
+ struct bu_vls *dm_tcl_cmd = dm_get_pathname((struct dm *)gdvp->dmp);
+ if (dm_tcl_cmd && bu_vls_strlen(dm_tcl_cmd))
+ Tcl_DeleteCommand(top->to_interp, bu_vls_cstr(dm_tcl_cmd));
// Close the dm. This is not done by libged because libged only
manages the
// data bview knows about. From bview's perspective, dmp is just a
pointer
@@ -1623,13 +1623,14 @@
gdvp->gv_prevMouseY = y;
gdvp->gv_mode = TCLCAD_CONSTRAINED_ROTATE_MODE;
- if (dm_get_pathname((struct dm *)gdvp->dmp)) {
+ struct bu_vls *pathname = dm_get_pathname((struct dm *)gdvp->dmp);
+ if (pathname && bu_vls_strlen(pathname)) {
bu_vls_printf(&bindings, "bind %s <Motion> {%s mouse_constrain_rot %s
%s %%x %%y}; break",
- bu_vls_addr(dm_get_pathname((struct dm *)gdvp->dmp)),
- bu_vls_addr(¤t_top->to_gedp->go_name),
- bu_vls_addr(&gdvp->gv_name),
+ bu_vls_cstr(pathname),
+ bu_vls_cstr(¤t_top->to_gedp->go_name),
+ bu_vls_cstr(&gdvp->gv_name),
argv[2]);
- Tcl_Eval(current_top->to_interp, bu_vls_addr(&bindings));
+ Tcl_Eval(current_top->to_interp, bu_vls_cstr(&bindings));
}
bu_vls_free(&bindings);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits