sw/source/core/frmedt/tblsel.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit 65f98610ddb9b3847aad0566e15b6087d0149464 Author: Michael Stahl <mst...@redhat.com> Date: Wed Oct 28 23:43:02 2015 +0100 sw: fix "long" overflow in lcl_CalcWish 0 + (1 * 32768 * 65536 / 65537) evaluates to -32767 with 32-bit MSVC whereas with 64-bit GCC the result is +32767. The multiplication overflows to 0x80000000 - so do that in 64 bits. This fixes the JunitTest_sw_unoapi_4 failure in SwXTextTable on the TableBorder property, where the wrong result caused MakeSelUnions() to believe that the last cell is not visible and hence setting the TableBorder property failed. Change-Id: Idb10535ce5342cd83d7ab6aea07782a2034469eb diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 99b4e9e..269cdd5 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1503,7 +1503,8 @@ static SwTwips lcl_CalcWish( const SwLayoutFrm *pCell, long nWish, while ( pTmp->GetPrev() ) { pTmp = static_cast<const SwLayoutFrm*>(pTmp->GetPrev()); - long nTmp = pTmp->GetFormat()->GetFrmSize().GetWidth(); + sal_Int64 nTmp = pTmp->GetFormat()->GetFrmSize().GetWidth(); + // multiply in 64-bit to avoid overflow here! nRet += ( bRTL ? ( -1 ) : 1 ) * nTmp * nAct / nWish; } pTmp = pTmp->GetUpper()->GetUpper(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits