diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2016-06-26 18:25:36 +0900 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-06-26 20:15:31 +0000 |
commit | b075882016d8388d20cc7490eb0733a9d0d97a5f (patch) | |
tree | 8d4df6e3a361f23b56b8a449b37c773f3ed40268 | |
parent | 2184b08dd185f3f20d8b2098d3f652aed629b51f (diff) |
starmath: Fix invalid static_cast
It was an undefined behavior that static_cast'ing a pointer to
SmVisibleNode to SmStructureNode's.
Change-Id: Ic391175a5535cec84bd7f9ec58fa13a411398331
Reviewed-on: https://gerrit.libreoffice.org/26676
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | starmath/inc/node.hxx | 6 | ||||
-rw-r--r-- | starmath/source/node.cxx | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index fa79f550f019..72da13b2d50c 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -114,13 +114,12 @@ class SmNode : public SmRect FontAttribute mnAttributes; bool mbIsPhantom; bool mbIsSelected; + // index in accessible text; -1 if not (yet) applicable + sal_Int32 mnAccIndex; protected: SmNode(SmNodeType eNodeType, const SmToken &rNodeToken); - // index in accessible text -1 if not (yet) applicable - sal_Int32 mnAccIndex; - public: SmNode(const SmNode&) = delete; SmNode& operator=(const SmNode&) = delete; @@ -174,6 +173,7 @@ public: virtual void GetAccessibleText( OUStringBuffer &rText ) const = 0; sal_Int32 GetAccessibleIndex() const { return mnAccIndex; } + void SetAccessibleIndex(sal_Int32 nAccIndex) { mnAccIndex = nAccIndex; } const SmNode * FindNodeWithAccessibleIndex(sal_Int32 nAccIndex) const; sal_uInt16 GetRow() const { return sal::static_int_cast<sal_uInt16>(maNodeToken.nRow); } diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index f378e4dc5921..8300752a171a 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -429,7 +429,7 @@ void SmStructureNode::GetAccessibleText( OUStringBuffer &rText ) const [&rText](SmNode *pNode) { if (pNode->IsVisible()) - static_cast<SmStructureNode *>(pNode)->mnAccIndex = rText.getLength(); + pNode->SetAccessibleIndex(rText.getLength()); pNode->GetAccessibleText( rText ); }); } |