diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-21 16:18:38 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-21 16:18:38 +1000 |
commit | d05d7fbd132b6a8060b3f0fa3a7a56cfaa0c41e0 (patch) | |
tree | 3722f90a5360ba769d80aaf0a978538655efcb4e /lexlib/CharacterCategory.cxx | |
parent | c477f4d6852219240182352fd35b5429121fee5c (diff) | |
download | scintilla-mirror-d05d7fbd132b6a8060b3f0fa3a7a56cfaa0c41e0.tar.gz |
Safety improvements for character code - drop reinterpret_cast, ensure more
variables are initialized, specify noexcept when safe.
Diffstat (limited to 'lexlib/CharacterCategory.cxx')
-rw-r--r-- | lexlib/CharacterCategory.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lexlib/CharacterCategory.cxx b/lexlib/CharacterCategory.cxx index 92ad49fb0..1595a7192 100644 --- a/lexlib/CharacterCategory.cxx +++ b/lexlib/CharacterCategory.cxx @@ -8,8 +8,8 @@ // The License.txt file describes the conditions under which this software may be distributed. #include <algorithm> +#include <iterator> -#include "StringCopy.h" #include "CharacterCategory.h" namespace Scintilla { @@ -3679,7 +3679,6 @@ const int catRanges[] = { const int maxUnicode = 0x10ffff; const int maskCategory = 0x1F; -const int nRanges = ELEMENTS(catRanges); } @@ -3698,7 +3697,7 @@ CharacterCategory CategoriseCharacter(int character) { if (character < 0 || character > maxUnicode) return ccCn; const int baseValue = character * (maskCategory+1) + maskCategory; - const int *placeAfter = std::lower_bound(catRanges, catRanges+nRanges, baseValue); + const int *placeAfter = std::lower_bound(catRanges, std::end(catRanges), baseValue); return static_cast<CharacterCategory>(*(placeAfter-1) & maskCategory); } |