summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-12 21:26:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-13 13:49:35 +0100
commitfc6a8994055db18b9ba2dce1e26d2b1ea9ea41f3 (patch)
tree4b3596307a06d86415e9a4f0fc66709627b734c5 /tools
parente993d98e29faee0947588a326fe9454c8f987ef7 (diff)
ofz#6843 Integer-overflow
Change-Id: I3984253ac3e5eaf0be7b10c8ba95d50e6bd9ce5d Reviewed-on: https://gerrit.libreoffice.org/51175 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/gen.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 5fe6eeeaa3d6..ea855f98e9f0 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -85,6 +85,18 @@ void tools::Rectangle::SaturatingSetSize(const Size& rSize)
nBottom = RECT_EMPTY;
}
+void tools::Rectangle::SaturatingSetX(long x)
+{
+ nRight = o3tl::saturating_add(nRight, x - nLeft);
+ nLeft = x;
+}
+
+void tools::Rectangle::SaturatingSetY(long y)
+{
+ nBottom = o3tl::saturating_add(nBottom, y - nTop);
+ nTop = y;
+}
+
tools::Rectangle& tools::Rectangle::Union( const tools::Rectangle& rRect )
{
if ( rRect.IsEmpty() )