diff options
| author | Neil <nyamatongwe@gmail.com> | 2018-05-03 07:44:07 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2018-05-03 07:44:07 +1000 | 
| commit | 9ffdbac7f017c64ddb7133268b45a8a992389591 (patch) | |
| tree | f21ea44a7be58883d1aaf9bd3827b74b8843dc65 | |
| parent | e680914ac0baa9285554ed574ec6ca6d7686346a (diff) | |
| download | scintilla-mirror-9ffdbac7f017c64ddb7133268b45a8a992389591.tar.gz | |
Avoid casts.
| -rw-r--r-- | lexlib/LexAccessor.h | 5 | ||||
| -rw-r--r-- | src/Editor.cxx | 8 | ||||
| -rw-r--r-- | src/RESearch.cxx | 9 | 
3 files changed, 12 insertions, 10 deletions
| diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h index 87557d8c1..e1043c05f 100644 --- a/lexlib/LexAccessor.h +++ b/lexlib/LexAccessor.h @@ -157,13 +157,14 @@ public:  			if (validLen + (pos - startSeg + 1) >= bufferSize)  				Flush(); +			char attr = static_cast<char>(chAttr);  			if (validLen + (pos - startSeg + 1) >= bufferSize) {  				// Too big for buffer so send directly -				pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr)); +				pAccess->SetStyleFor(pos - startSeg + 1, attr);  			} else {  				for (Sci_PositionU i = startSeg; i <= pos; i++) {  					assert((startPosStyling + validLen) < Length()); -					styleBuf[validLen++] = static_cast<char>(chAttr); +					styleBuf[validLen++] = attr;  				}  			}  		} diff --git a/src/Editor.cxx b/src/Editor.cxx index d0a8f37b3..76e77a016 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4228,10 +4228,10 @@ void Editor::DisplayCursor(Window::Cursor c) {  }  bool Editor::DragThreshold(Point ptStart, Point ptNow) { -	const int xMove = static_cast<int>(ptStart.x - ptNow.x); -	const int yMove = static_cast<int>(ptStart.y - ptNow.y); -	const int distanceSquared = xMove * xMove + yMove * yMove; -	return distanceSquared > 16; +	const XYPOSITION xMove = ptStart.x - ptNow.x; +	const XYPOSITION yMove = ptStart.y - ptNow.y; +	const XYPOSITION distanceSquared = xMove * xMove + yMove * yMove; +	return distanceSquared > 16.0f;  }  void Editor::StartDrag() { diff --git a/src/RESearch.cxx b/src/RESearch.cxx index b368890c3..b590e9d71 100644 --- a/src/RESearch.cxx +++ b/src/RESearch.cxx @@ -255,7 +255,8 @@ RESearch::RESearch(CharClassify *charClassTable) {  	charClass = charClassTable;  	sta = NOP;                  /* status of lastpat */  	bol = 0; -	std::fill(bittab, std::end(bittab), static_cast<unsigned char>(0)); +	const unsigned char nul=0; +	std::fill(bittab, std::end(bittab), nul);  	std::fill(tagstk, std::end(tagstk), 0);  	std::fill(nfa, std::end(nfa), '\0');  	Clear(); @@ -642,7 +643,7 @@ const char *RESearch::Compile(const char *pattern, Sci::Position length, bool ca  				if (tagi > 0 && tagstk[tagi] == n)  					return badpat("Cyclical reference");  				if (tagc > n) { -					*mp++ = static_cast<char>(REF); +					*mp++ = REF;  					*mp++ = static_cast<char>(n);  				} else {  					return badpat("Undetermined reference"); @@ -661,7 +662,7 @@ const char *RESearch::Compile(const char *pattern, Sci::Position length, bool ca  					if (*sp == BOT)  						return badpat("Null pattern inside \\(\\)");  					if (tagi > 0) { -						*mp++ = static_cast<char>(EOT); +						*mp++ = EOT;  						*mp++ = static_cast<char>(tagstk[tagi--]);  					} else {  						return badpat("Unmatched \\)"); @@ -697,7 +698,7 @@ const char *RESearch::Compile(const char *pattern, Sci::Position length, bool ca  				if (*sp == BOT)  					return badpat("Null pattern inside ()");  				if (tagi > 0) { -					*mp++ = static_cast<char>(EOT); +					*mp++ = EOT;  					*mp++ = static_cast<char>(tagstk[tagi--]);  				} else {  					return badpat("Unmatched )"); | 
