TextEditor: explicit cast unsigned to int in semantichighlighter

Change-Id: Icb279331f1d8b0da068a46c59d9eeb8ea46c1549
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
David Schulz
2019-06-13 07:16:01 +02:00
parent c76161e802
commit c05ec2833e

View File

@@ -58,14 +58,14 @@ void SemanticHighlighter::incrementalApplyExtraAdditionalFormats(
if (to <= from) if (to <= from)
return; return;
const int firstResultBlockNumber = future.resultAt(from).line - 1; const int firstResultBlockNumber = int(future.resultAt(from).line) - 1;
// blocks between currentBlockNumber and the last block with results will // blocks between currentBlockNumber and the last block with results will
// be cleaned of additional extra formats if they have no results // be cleaned of additional extra formats if they have no results
int currentBlockNumber = 0; int currentBlockNumber = 0;
for (int i = from - 1; i >= 0; --i) { for (int i = from - 1; i >= 0; --i) {
const HighlightingResult &result = future.resultAt(i); const HighlightingResult &result = future.resultAt(i);
const int blockNumber = result.line - 1; const int blockNumber = int(result.line) - 1;
if (blockNumber < firstResultBlockNumber) { if (blockNumber < firstResultBlockNumber) {
// stop! found where last format stopped // stop! found where last format stopped
currentBlockNumber = blockNumber + 1; currentBlockNumber = blockNumber + 1;
@@ -81,7 +81,7 @@ void SemanticHighlighter::incrementalApplyExtraAdditionalFormats(
HighlightingResult result = future.resultAt(from); HighlightingResult result = future.resultAt(from);
for (int i = from; i < to && b.isValid(); ) { for (int i = from; i < to && b.isValid(); ) {
const int blockNumber = result.line - 1; const int blockNumber = int(result.line) - 1;
QTC_ASSERT(blockNumber < doc->blockCount(), return); QTC_ASSERT(blockNumber < doc->blockCount(), return);
// clear formats of blocks until blockNumber // clear formats of blocks until blockNumber
@@ -99,8 +99,8 @@ void SemanticHighlighter::incrementalApplyExtraAdditionalFormats(
formatRange.format = textCharFormatForResult(result, kindToFormat); formatRange.format = textCharFormatForResult(result, kindToFormat);
if (formatRange.format.isValid()) { if (formatRange.format.isValid()) {
formatRange.start = result.column - 1; formatRange.start = int(result.column) - 1;
formatRange.length = result.length; formatRange.length = int(result.length);
formats.append(formatRange); formats.append(formatRange);
} }
@@ -108,7 +108,7 @@ void SemanticHighlighter::incrementalApplyExtraAdditionalFormats(
if (i >= to) if (i >= to)
break; break;
result = future.resultAt(i); result = future.resultAt(i);
const int nextBlockNumber = result.line - 1; const int nextBlockNumber = int(result.line) - 1;
if (nextBlockNumber != blockNumber) if (nextBlockNumber != blockNumber)
break; break;
} }
@@ -127,7 +127,7 @@ void SemanticHighlighter::clearExtraAdditionalFormatsUntilEnd(
for (int i = future.resultCount() - 1; i >= 0; --i) { for (int i = future.resultCount() - 1; i >= 0; --i) {
const HighlightingResult &result = future.resultAt(i); const HighlightingResult &result = future.resultAt(i);
if (result.line) { if (result.line) {
lastBlockNumber = result.line - 1; lastBlockNumber = int(result.line) - 1;
break; break;
} }
} }