diff options
| author | Greg Ercolano <erco@seriss.com> | 2013-12-28 22:26:22 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2013-12-28 22:26:22 +0000 |
| commit | a4550ade999c43b2a64481323f241842b33c50cc (patch) | |
| tree | daabd3c9ff76751b8fcd4b1a0af4608a026525a2 /src/Fl_Tree.cxx | |
| parent | c90f1904fa6a04cecb4df23c5f28313d4f6306f6 (diff) | |
* Fixes STR#3024 issue with Fl_Tree::find_item()
* Removes redundant const vs. non-const code
using technique from Scott Meyers' book "Effective C++", 3rd Ed.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10038 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Tree.cxx')
| -rw-r--r-- | src/Fl_Tree.cxx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Fl_Tree.cxx b/src/Fl_Tree.cxx index 0cd69904d..53dcbe515 100644 --- a/src/Fl_Tree.cxx +++ b/src/Fl_Tree.cxx @@ -997,11 +997,9 @@ void Fl_Tree::clear_children(Fl_Tree_Item *item) { /// \see item_pathname() /// Fl_Tree_Item *Fl_Tree::find_item(const char *path) { - if ( ! _root ) return(NULL); - char **arr = parse_path(path); - Fl_Tree_Item *item = _root->find_item(arr); - free_path(arr); - return(item); + // I evoke "Effective C++, 3rd Ed", p.23. Sola fide, Amen. + return(const_cast<Fl_Tree_Item*>( + static_cast<const Fl_Tree&>(*this).find_item(path))); } /// A const version of Fl_Tree::find_item(const char *path) |
