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 | 9d748e03134e5c15dd8cb9e8887b80dca0312b09 (patch) | |
tree | 53a2e620fee3952f3afd0d5248e862f19c35393d | |
parent | cc7726eda8aadd6421e4b867b013518aee465ae9 (diff) | |
download | scintilla-mirror-9d748e03134e5c15dd8cb9e8887b80dca0312b09.tar.gz |
Use std::abs in preference to abs as std::abs is generic and abs casts to int
which may drop information.
-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 81d022097..d2e8d7428 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> @@ -877,7 +878,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 36af34685..601bc384b 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); |