One should use dynamic_casts for inheritance-based casting.

(This is a little necessary clean-up of my tree.)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35817 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-10-25 09:49:24 +00:00
parent a2c998d5d0
commit 058035bf2c

View File

@ -2090,7 +2090,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
bool success = false; bool success = false;
for (; it != end; ++it) { for (; it != end; ++it) {
if (it->lyxCode() == BRANCH_CODE) { if (it->lyxCode() == BRANCH_CODE) {
InsetBranch & ins = static_cast<InsetBranch &>(*it); InsetBranch & ins = dynamic_cast<InsetBranch &>(*it);
if (ins.branch() == oldname) { if (ins.branch() == oldname) {
undo().recordUndo(it); undo().recordUndo(it);
ins.rename(newname); ins.rename(newname);
@ -2835,7 +2835,7 @@ void Buffer::getUsedBranches(std::list<docstring> & result, bool const from_mast
InsetIterator const end = inset_iterator_end(inset()); InsetIterator const end = inset_iterator_end(inset());
for (; it != end; ++it) { for (; it != end; ++it) {
if (it->lyxCode() == BRANCH_CODE) { if (it->lyxCode() == BRANCH_CODE) {
InsetBranch & br = static_cast<InsetBranch &>(*it); InsetBranch & br = dynamic_cast<InsetBranch &>(*it);
docstring const name = br.branch(); docstring const name = br.branch();
if (!from_master && !params().branchlist().find(name)) if (!from_master && !params().branchlist().find(name))
result.push_back(name); result.push_back(name);