Revision: 45822
http://brlcad.svn.sourceforge.net/brlcad/?rev=45822&view=rev
Author: bhinesley
Date: 2011-08-08 21:01:56 +0000 (Mon, 08 Aug 2011)
Log Message:
-----------
Subcommand functions that are modifying the drawing should have const
parameters, since argument processing is done. Implementing this required
changes to path.c, which accepted a non-const parameter, which led to a failure
to detect that was modifying db_full_path objects when it shouldn't. Resolved
edit_cmd naming inconsistencies (subcmd vs. cmd). Minor reorganization of edit.c
Modified Paths:
--------------
brlcad/trunk/src/libged/path.c
Modified: brlcad/trunk/src/libged/path.c
===================================================================
--- brlcad/trunk/src/libged/path.c 2011-08-08 20:52:38 UTC (rev 45821)
+++ brlcad/trunk/src/libged/path.c 2011-08-08 21:01:56 UTC (rev 45822)
@@ -39,7 +39,7 @@
*/
HIDDEN int
path_validate_recurse(struct ged *gedp, struct db_full_path *path,
- struct directory *roots_child)
+ struct directory *roots_child)
{
struct rt_db_internal intern;
struct rt_comb_internal *comb;
@@ -79,22 +79,27 @@
* true, or GED_ERROR if false.
*/
int
-ged_path_validate(struct ged *gedp, struct db_full_path * const path)
+ged_path_validate(struct ged *gedp, const struct db_full_path *const path)
{
/* Since this is a db_full_path, we already know that each
* directory exists at root, and just need to check the order */
struct directory *root;
+ struct db_full_path path_tmp;
+ int ret;
- RT_CK_FULL_PATH(path);
+ db_dup_full_path(&path_tmp, path);
- if (path->fp_len <= 1)
+ if (path_tmp.fp_len <= 1)
return GED_OK; /* TRUE; no children */
- root = DB_FULL_PATH_ROOT_DIR(path);
+ root = DB_FULL_PATH_ROOT_DIR(&path_tmp);
if (!(root->d_flags & RT_DIR_COMB))
return GED_ERROR; /* has children, but isn't a combination */
- return path_validate_recurse(gedp, path, DB_FULL_PATH_GET(path, 1));
+ ret = path_validate_recurse(gedp, &path_tmp,
+ DB_FULL_PATH_GET(&path_tmp, 1));
+ db_free_full_path(&path_tmp);
+ return ret;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits