aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 273875e4e..5ebb0bcf4 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -143,14 +143,14 @@ void LineLayout::SetLineStart(int line, int start) {
void LineLayout::SetBracesHighlight(Range rangeLine, const Sci::Position braces[],
char bracesMatchStyle, int xHighlight, bool ignoreStyle) {
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
- int braceOffset = braces[0] - rangeLine.start;
+ const int braceOffset = braces[0] - rangeLine.start;
if (braceOffset < numCharsInLine) {
bracePreviousStyles[0] = styles[braceOffset];
styles[braceOffset] = bracesMatchStyle;
}
}
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[1])) {
- int braceOffset = braces[1] - rangeLine.start;
+ const int braceOffset = braces[1] - rangeLine.start;
if (braceOffset < numCharsInLine) {
bracePreviousStyles[1] = styles[braceOffset];
styles[braceOffset] = bracesMatchStyle;
@@ -164,13 +164,13 @@ void LineLayout::SetBracesHighlight(Range rangeLine, const Sci::Position braces[
void LineLayout::RestoreBracesHighlight(Range rangeLine, const Sci::Position braces[], bool ignoreStyle) {
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
- int braceOffset = braces[0] - rangeLine.start;
+ const int braceOffset = braces[0] - rangeLine.start;
if (braceOffset < numCharsInLine) {
styles[braceOffset] = bracePreviousStyles[0];
}
}
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[1])) {
- int braceOffset = braces[1] - rangeLine.start;
+ const int braceOffset = braces[1] - rangeLine.start;
if (braceOffset < numCharsInLine) {
styles[braceOffset] = bracePreviousStyles[1];
}
@@ -180,7 +180,7 @@ void LineLayout::RestoreBracesHighlight(Range rangeLine, const Sci::Position bra
int LineLayout::FindBefore(XYPOSITION x, int lower, int upper) const {
do {
- int middle = (upper + lower + 1) / 2; // Round high
+ const int middle = (upper + lower + 1) / 2; // Round high
const XYPOSITION posMiddle = positions[middle];
if (x < posMiddle) {
upper = middle - 1;
@@ -491,7 +491,7 @@ BreakFinder::~BreakFinder() {
TextSegment BreakFinder::Next() {
if (subBreak == -1) {
- int prev = nextBreak;
+ const int prev = nextBreak;
while (nextBreak < lineRange.end) {
int charWidth = 1;
if (encodingFamily == efUnicode)
@@ -529,7 +529,7 @@ TextSegment BreakFinder::Next() {
}
// Splitting up a long run from prev to nextBreak in lots of approximately lengthEachSubdivision.
// For very long runs add extra breaks after spaces or if no spaces before low punctuation.
- int startSegment = subBreak;
+ const int startSegment = subBreak;
if ((nextBreak - subBreak) <= lengthEachSubdivision) {
subBreak = -1;
return TextSegment(startSegment, nextBreak - startSegment);
@@ -659,12 +659,12 @@ void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, uns
// long comments with only a single comment.
// Two way associative: try two probe positions.
- unsigned int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
+ const unsigned int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
probe = hashValue % pces.size();
if (pces[probe].Retrieve(styleNumber, s, len, positions)) {
return;
}
- unsigned int probe2 = (hashValue * 37) % pces.size();
+ const unsigned int probe2 = (hashValue * 37) % pces.size();
if (pces[probe2].Retrieve(styleNumber, s, len, positions)) {
return;
}
@@ -678,7 +678,7 @@ void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, uns
unsigned int startSegment = 0;
XYPOSITION xStartSegment = 0;
while (startSegment < len) {
- unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision);
+ const unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision);
FontAlias fontStyle = vstyle.styles[styleNumber].font;
surface->MeasureWidths(fontStyle, s + startSegment, lenSegment, positions + startSegment);
for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) {