diff options
author | Neil <nyamatongwe@gmail.com> | 2014-05-12 10:55:05 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-05-12 10:55:05 +1000 |
commit | 884e9e4291c139dbcea97d50b143e1fd2e6829de (patch) | |
tree | 242153b2fb20faf5908b02099584c79e3a1cd6ab /src | |
parent | d943983d73b9ed4941f24e0af6597c10edd4f73a (diff) | |
download | scintilla-mirror-884e9e4291c139dbcea97d50b143e1fd2e6829de.tar.gz |
Split variable into two as used for different reasons. Use unsigned to avoid
possibility of sign extension problems and to minimize type conversions.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index f1e019b07..24900dc77 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2223,7 +2223,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou ll->edgeColumn = -1; } - char styleByte; const int styleMask = pdoc->stylingBitsMask; ll->styleBitsSet = 0; // Fill base line layout @@ -2233,12 +2232,12 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou int numCharsBeforeEOL = pdoc->LineEnd(line) - posLineStart; const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL; for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) { - styleByte = ll->styles[styleInLine]; + const unsigned char styleByte = ll->styles[styleInLine]; ll->styleBitsSet |= styleByte; - ll->styles[styleInLine] = static_cast<char>(styleByte & styleMask); + ll->styles[styleInLine] = styleByte & styleMask; ll->indicators[styleInLine] = static_cast<char>(styleByte & ~styleMask); } - styleByte = static_cast<char>(((lineLength > 0) ? ll->styles[lineLength-1] : 0) & styleMask); + const unsigned char styleByteLast = ((lineLength > 0) ? ll->styles[lineLength-1] : 0) & styleMask; if (vstyle.someStylesForceCase) { for (int charInLine = 0; charInLine<lineLength; charInLine++) { char chDoc = ll->chars[charInLine]; @@ -2251,7 +2250,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou ll->xHighlightGuide = 0; // Extra element at the end of the line to hold end x position and act as ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character - ll->styles[numCharsInLine] = styleByte; // For eolFilled + ll->styles[numCharsInLine] = styleByteLast; // For eolFilled ll->indicators[numCharsInLine] = 0; // Layout the line, determining the position of each character, |