diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-04-07 11:45:13 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-04-07 14:13:18 +0200 |
commit | d36f7c5bd2115fcdd26ba8ff7b6a0446dea70bd4 (patch) | |
tree | 5ae4b15f3302a538ac55d714ba0529ca4c1de87a /tools | |
parent | 61d57bcebd1a246603cbcd9ad5e0a7df1a8d66cd (diff) |
Revert "long->sal_Int32 in tools/gen.hxx"
This reverts commit 8bc951daf79decbd8a599a409c6d33c5456710e0.
As discussed at
<https://lists.freedesktop.org/archives/libreoffice/2018-April/079955.html>
"long->sal_Int32 in tools/gen.hxx", that commit caused lots of problems with
signed integer overflow, and the original plan was to redo it to consistently
use sal_Int64 instead of sal_Int32. <https://gerrit.libreoffice.org/#/c/52471/>
"sal_Int32->sal_Int64 in tools/gen.hxx" tried that. However, it failed
miserably on Windows, causing odd failures like not writing out Pictures/*.svm
streams out into .odp during CppunitTest_sd_export_ooxml2. So the next best
approach is to just revert the original commit, at least for now.
Includes revert of follow-up 8c50aff2175e85c54957d98ce32af40a3a87e168 "Fix
Library_vclplug_qt5".
Change-Id: Ia8bf34272d1ed38aac00e5d07a9d13fb03f439ae
Reviewed-on: https://gerrit.libreoffice.org/52532
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qa/cppunit/test_rectangle.cxx | 24 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 4 | ||||
-rw-r--r-- | tools/source/generic/point.cxx | 22 |
3 files changed, 25 insertions, 25 deletions
diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx index 4729d3140df4..c4b321d388eb 100644 --- a/tools/qa/cppunit/test_rectangle.cxx +++ b/tools/qa/cppunit/test_rectangle.cxx @@ -32,28 +32,28 @@ void Test::test_rectangle() { tools::Rectangle aRect(1,1,1,1); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRect.GetWidth()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRect.GetHeight()); + CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth()); + CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRect.getWidth()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRect.getHeight()); + CPPUNIT_ASSERT_EQUAL(long(0), aRect.getWidth()); + CPPUNIT_ASSERT_EQUAL(long(0), aRect.getHeight()); } { tools::Rectangle aRect(Point(), Size(1,1)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRect.Left()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRect.Top()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRect.Right()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRect.Bottom()); + CPPUNIT_ASSERT_EQUAL(long(0), aRect.Left()); + CPPUNIT_ASSERT_EQUAL(long(0), aRect.Top()); + CPPUNIT_ASSERT_EQUAL(long(0), aRect.Right()); + CPPUNIT_ASSERT_EQUAL(long(0), aRect.Bottom()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRect.GetWidth()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRect.GetHeight()); + CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth()); + CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight()); aRect.setX(12); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRect.GetHeight()); + CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight()); aRect.setY(12); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRect.GetWidth()); + CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth()); } } diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index a7c649cecd7d..ea855f98e9f0 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -85,13 +85,13 @@ void tools::Rectangle::SaturatingSetSize(const Size& rSize) nBottom = RECT_EMPTY; } -void tools::Rectangle::SaturatingSetX(sal_Int32 x) +void tools::Rectangle::SaturatingSetX(long x) { nRight = o3tl::saturating_add(nRight, x - nLeft); nLeft = x; } -void tools::Rectangle::SaturatingSetY(sal_Int32 y) +void tools::Rectangle::SaturatingSetY(long y) { nBottom = o3tl::saturating_add(nBottom, y - nTop); nTop = y; diff --git a/tools/source/generic/point.cxx b/tools/source/generic/point.cxx index 7530baf4fdc9..1b470c6065ec 100644 --- a/tools/source/generic/point.cxx +++ b/tools/source/generic/point.cxx @@ -25,18 +25,18 @@ void Point::RotateAround( Point& rPoint, short nOrientation ) const { - sal_Int32 nX = rPoint.X(); - sal_Int32 nY = rPoint.Y(); + long nX = rPoint.X(); + long nY = rPoint.Y(); RotateAround(nX, nY, nOrientation); rPoint.setX(nX); rPoint.setY(nY); } -void Point::RotateAround( sal_Int32& rX, sal_Int32& rY, +void Point::RotateAround( long& rX, long& rY, short nOrientation ) const { - const sal_Int32 nOriginX = X(); - const sal_Int32 nOriginY = Y(); + const long nOriginX = X(); + const long nOriginY = Y(); if ( (nOrientation >= 0) && !(nOrientation % 900) ) { @@ -50,7 +50,7 @@ void Point::RotateAround( sal_Int32& rX, sal_Int32& rY, if ( nOrientation == 900 ) { - sal_Int32 nTemp = rX; + long nTemp = rX; rX = rY; rY = -nTemp; } @@ -61,7 +61,7 @@ void Point::RotateAround( sal_Int32& rX, sal_Int32& rY, } else /* ( nOrientation == 2700 ) */ { - sal_Int32 nTemp = rX; + long nTemp = rX; rX = -rY; rY = nTemp; } @@ -77,12 +77,12 @@ void Point::RotateAround( sal_Int32& rX, sal_Int32& rY, double nSin = sin( nRealOrientation ); // Translation... - sal_Int32 nX = rX-nOriginX; - sal_Int32 nY = rY-nOriginY; + long nX = rX-nOriginX; + long nY = rY-nOriginY; // Rotation... - rX = + static_cast<sal_Int32>(nCos*nX + nSin*nY) + nOriginX; - rY = - static_cast<sal_Int32>(nSin*nX - nCos*nY) + nOriginY; + rX = + static_cast<long>(nCos*nX + nSin*nY) + nOriginX; + rY = - static_cast<long>(nSin*nX - nCos*nY) + nOriginY; } } |