embedserv/source/embed/docholder.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
New commits: commit caea6281967bacd38a9296e6acefe9e5baefc3a4 Author: Stephan Bergmann <[email protected]> Date: Fri Sep 22 08:54:58 2017 +0200 Better not modify const RECTs passed in ...through IOleInPlaceObject::SetObjectRects, via EmbedDocument_Impl::SetObjectRects Change-Id: Ia2533822795776d18132a457dc41f80fadb7c809 Reviewed-on: https://gerrit.libreoffice.org/42615 Tested-by: Jenkins <[email protected]> Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index 2998395279c4..929e8d252350 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -1176,24 +1176,26 @@ HRESULT DocumentHolder::SetContRects(LPCRECT aRect) HRESULT DocumentHolder::SetObjectRects(LPCRECT aRect, LPCRECT aClip) { - const_cast<LPRECT>(aRect)->left -= m_aBorder.left; - const_cast<LPRECT>(aRect)->right += m_aBorder.right; - const_cast<LPRECT>(aRect)->top -= m_aBorder.top; - const_cast<LPRECT>(aRect)->bottom += m_aBorder.bottom; - const_cast<LPRECT>(aClip)->left -= m_aBorder.left; - const_cast<LPRECT>(aClip)->right += m_aBorder.right; - const_cast<LPRECT>(aClip)->top -= m_aBorder.top; - const_cast<LPRECT>(aClip)->bottom += m_aBorder.bottom; + auto rect = *aRect; + rect.left -= m_aBorder.left; + rect.right += m_aBorder.right; + rect.top -= m_aBorder.top; + rect.bottom += m_aBorder.bottom; + auto clip = *aClip; + clip.left -= m_aBorder.left; + clip.right += m_aBorder.right; + clip.top -= m_aBorder.top; + clip.bottom += m_aBorder.bottom; if(m_pCHatchWin) - m_pCHatchWin->RectsSet(const_cast<LPRECT>(aRect), const_cast<LPRECT>(aClip)); + m_pCHatchWin->RectsSet(&rect, &clip); if(m_xEditWindow.is()) { m_xEditWindow->setVisible(false); m_xEditWindow->setPosSize( m_pCHatchWin ? HATCHWIN_BORDERWIDTHDEFAULT : 0, m_pCHatchWin ? HATCHWIN_BORDERWIDTHDEFAULT : 0, - aRect->right - aRect->left, - aRect->bottom - aRect->top, + rect.right - rect.left, + rect.bottom - rect.top, awt::PosSize::POSSIZE); m_xEditWindow->setVisible(true); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
