diff options
| -rw-r--r-- | lexers/LexCPP.cxx | 22 | 
1 files changed, 10 insertions, 12 deletions
| diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 908949aaf..a839f020a 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -6,12 +6,10 @@  // Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>  // The License.txt file describes the conditions under which this software may be distributed. -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> +#include <cstdlib> +#include <cassert> +#include <cstring> +#include <cctype>  #include <utility>  #include <string> @@ -144,10 +142,10 @@ BracketPair FindBracketPair(std::vector<std::string> &tokens) {  void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,  		int activity, const WordList &markerList, bool caseSensitive){  	if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { -		const int lengthMarker = 50; +		constexpr Sci_PositionU lengthMarker = 50;  		char marker[lengthMarker+1] = ""; -		const Sci_Position currPos = sc.currentPos; -		int i = 0; +		const Sci_PositionU currPos = sc.currentPos; +		Sci_PositionU i = 0;  		while (i < lengthMarker) {  			const char ch = styler.SafeGetCharAt(currPos + i);  			if (IsASpace(ch) || isoperator(ch)) { @@ -245,7 +243,7 @@ struct PPDefinition {  	}  }; -const int inactiveFlag = 0x40; +constexpr int inactiveFlag = 0x40;  class LinePPState {  	// Track the state of preprocessor conditionals to allow showing active and inactive @@ -318,7 +316,7 @@ public:  class PPStates {  	std::vector<LinePPState> vlls;  public: -	LinePPState ForLine(Sci_Position line) const { +	LinePPState ForLine(Sci_Position line) const noexcept {  		if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) {  			return vlls[line];  		} else { @@ -1590,7 +1588,7 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl  	}  	// Evaluate identifiers -	const size_t maxIterations = 100; +	constexpr size_t maxIterations = 100;  	size_t iterations = 0;	// Limit number of iterations in case there is a recursive macro.  	for (size_t i = 0; (i<tokens.size()) && (iterations < maxIterations);) {  		iterations++; | 
