diff options
author | Neil <nyamatongwe@gmail.com> | 2018-01-28 08:56:08 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-01-28 08:56:08 +1100 |
commit | 0adf380a4baa2e879279e35b9a5b48fb7d860444 (patch) | |
tree | e601608813408df1292ddf47454a4bd6bad50fea /src | |
parent | 90c59a98bbd0bf42faf2312eb03430c11540071d (diff) | |
download | scintilla-mirror-0adf380a4baa2e879279e35b9a5b48fb7d860444.tar.gz |
Backport: Use std::abs in preference to abs as std::abs is generic and abs casts to int
which may drop information.
Backport of changeset 6434:ed27432729c3.
Diffstat (limited to 'src')
-rw-r--r-- | src/Document.cxx | 3 | ||||
-rw-r--r-- | src/Editor.cxx | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 90dfb52bc..30295ae04 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -10,6 +10,7 @@ #include <cassert> #include <cstring> #include <cstdio> +#include <cmath> #include <stdexcept> #include <string> @@ -881,7 +882,7 @@ Sci::Position Document::GetRelativePositionUTF16(Sci::Position positionStart, Sc const Sci::Position posNext = NextPosition(pos, increment); if (posNext == pos) return INVALID_POSITION; - if (abs(pos-posNext) > 3) // 4 byte character = 2*UTF16. + if (std::abs(pos-posNext) > 3) // 4 byte character = 2*UTF16. characterOffset -= increment; pos = posNext; characterOffset -= increment; diff --git a/src/Editor.cxx b/src/Editor.cxx index 8125d322b..f997181ad 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -11,8 +11,8 @@ #include <cstring> #include <cctype> #include <cstdio> - #include <cmath> + #include <stdexcept> #include <string> #include <vector> @@ -934,7 +934,7 @@ void Editor::ScrollTo(Sci::Line line, bool moveThumb) { // Try to optimise small scrolls #ifndef UNDER_CE const Sci::Line linesToMove = topLine - topLineNew; - const bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting); + const bool performBlit = (std::abs(linesToMove) <= 10) && (paintState == notPainting); willRedrawAll = !performBlit; #endif SetTopLine(topLineNew); |