aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lexlib/CharacterCategory.cxx5
-rw-r--r--src/CaseConvert.cxx21
-rw-r--r--src/CaseFolder.cxx2
-rw-r--r--src/CharClassify.cxx2
4 files changed, 14 insertions, 16 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);
}
diff --git a/src/CaseConvert.cxx b/src/CaseConvert.cxx
index ce191f574..2d6db4eb7 100644
--- a/src/CaseConvert.cxx
+++ b/src/CaseConvert.cxx
@@ -563,8 +563,7 @@ class CaseConverter : public ICaseConverter {
enum { maxConversionLength=6 };
struct ConversionString {
char conversion[maxConversionLength+1];
- ConversionString() {
- conversion[0] = '\0';
+ ConversionString() : conversion{} {
}
};
// Conversions are initially store in a vector of structs but then decomposed into
@@ -572,10 +571,10 @@ class CaseConverter : public ICaseConverter {
struct CharacterConversion {
int character;
ConversionString conversion;
- CharacterConversion(int character_=0, const char *conversion_="") : character(character_) {
+ CharacterConversion(int character_=0, const char *conversion_="") noexcept : character(character_) {
StringCopy(conversion.conversion, conversion_);
}
- bool operator<(const CharacterConversion &other) const {
+ bool operator<(const CharacterConversion &other) const noexcept {
return character < other.character;
}
};
@@ -607,9 +606,9 @@ public:
size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) override {
size_t lenConverted = 0;
size_t mixedPos = 0;
- unsigned char bytes[UTF8MaxBytes + 1];
+ unsigned char bytes[UTF8MaxBytes + 1]{};
while (mixedPos < lenMixed) {
- const unsigned char leadByte = static_cast<unsigned char>(mixed[mixedPos]);
+ const unsigned char leadByte = mixed[mixedPos];
const char *caseConverted = 0;
size_t lenMixedChar = 1;
if (UTF8IsAscii(leadByte)) {
@@ -705,10 +704,10 @@ void SetupConversions(enum CaseConversion conversion) {
while (*sComplex) {
// Longest ligature is 3 character so 5 for safety
const size_t lenUTF8 = 5*UTF8MaxBytes+1;
- char originUTF8[lenUTF8];
- char foldedUTF8[lenUTF8];
- char lowerUTF8[lenUTF8];
- char upperUTF8[lenUTF8];
+ unsigned char originUTF8[lenUTF8]{};
+ char foldedUTF8[lenUTF8]{};
+ char lowerUTF8[lenUTF8]{};
+ char upperUTF8[lenUTF8]{};
size_t i = 0;
while (*sComplex && *sComplex != '|') {
originUTF8[i++] = *sComplex;
@@ -738,7 +737,7 @@ void SetupConversions(enum CaseConversion conversion) {
sComplex++;
lowerUTF8[i] = 0;
- const int character = UnicodeFromUTF8(reinterpret_cast<unsigned char *>(originUTF8));
+ const int character = UnicodeFromUTF8(originUTF8);
if (conversion == CaseConversionFold && foldedUTF8[0]) {
caseConvFold.Add(character, foldedUTF8);
diff --git a/src/CaseFolder.cxx b/src/CaseFolder.cxx
index e45c1eb5c..0fd29c7bb 100644
--- a/src/CaseFolder.cxx
+++ b/src/CaseFolder.cxx
@@ -17,7 +17,7 @@ using namespace Scintilla;
CaseFolder::~CaseFolder() {
}
-CaseFolderTable::CaseFolderTable() {
+CaseFolderTable::CaseFolderTable() : mapping{} {
for (size_t iChar=0; iChar<sizeof(mapping); iChar++) {
mapping[iChar] = static_cast<char>(iChar);
}
diff --git a/src/CharClassify.cxx b/src/CharClassify.cxx
index b4f021d59..ba8433e62 100644
--- a/src/CharClassify.cxx
+++ b/src/CharClassify.cxx
@@ -14,7 +14,7 @@
using namespace Scintilla;
-CharClassify::CharClassify() {
+CharClassify::CharClassify() : charClass{} {
SetDefaultCharClasses(true);
}