Diff of /scintilla/lexlib/WordList.cxx [b645ec] .. [635b7c] Maximize Restore

  Switch to side-by-side view

--- a/scintilla/lexlib/WordList.cxx
+++ b/scintilla/lexlib/WordList.cxx
@@ -32,11 +32,11 @@
 	for (int i=0; i<256; i++) {
 		wordSeparator[i] = false;
 	}
-	wordSeparator['\r'] = true;
-	wordSeparator['\n'] = true;
+	wordSeparator[static_cast<unsigned int>('\r')] = true;
+	wordSeparator[static_cast<unsigned int>('\n')] = true;
 	if (!onlyLineEnds) {
-		wordSeparator[' '] = true;
-		wordSeparator['\t'] = true;
+		wordSeparator[static_cast<unsigned int>(' ')] = true;
+		wordSeparator[static_cast<unsigned int>('\t')] = true;
 	}
 	for (int j = 0; wordlist[j]; j++) {
 		int curr = static_cast<unsigned char>(wordlist[j]);
@@ -45,22 +45,24 @@
 		prev = curr;
 	}
 	char **keywords = new char *[words + 1];
-	words = 0;
-	prev = '\0';
-	size_t slen = strlen(wordlist);
-	for (size_t k = 0; k < slen; k++) {
-		if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
-			if (!prev) {
-				keywords[words] = &wordlist[k];
-				words++;
-			}
-		} else {
-			wordlist[k] = '\0';
-		}
-		prev = wordlist[k];
-	}
-	keywords[words] = &wordlist[slen];
-	*len = words;
+	int wordsStore = 0;
+	const size_t slen = strlen(wordlist);
+	if (words) {
+		prev = '\0';
+		for (size_t k = 0; k < slen; k++) {
+			if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
+				if (!prev) {
+					keywords[wordsStore] = &wordlist[k];
+					wordsStore++;
+				}
+			} else {
+				wordlist[k] = '\0';
+			}
+			prev = wordlist[k];
+		}
+	}
+	keywords[wordsStore] = &wordlist[slen];
+	*len = wordsStore;
 	return keywords;
 }
 
@@ -161,7 +163,7 @@
 			j++;
 		}
 	}
-	j = starts['^'];
+	j = starts[static_cast<unsigned int>('^')];
 	if (j >= 0) {
 		while (words[j][0] == '^') {
 			const char *a = words[j] + 1;
@@ -213,7 +215,7 @@
 			j++;
 		}
 	}
-	j = starts['^'];
+	j = starts[static_cast<unsigned int>('^')];
 	if (j >= 0) {
 		while (words[j][0] == '^') {
 			const char *a = words[j] + 1;