aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2023-03-27 09:29:48 +1100
committerNeil <nyamatongwe@gmail.com>2023-03-27 09:29:48 +1100
commit765390e6db2b69976448e92d9a86516ead9b0c09 (patch)
treeeb01e21aae213bc8422ffdee8c99e4521c28dde8 /src
parent481b5651df9bd160d4ff1f1ba471eead61a53252 (diff)
downloadscintilla-mirror-765390e6db2b69976448e92d9a86516ead9b0c09.tar.gz
Declare const where possible.
Diffstat (limited to 'src')
-rw-r--r--src/CallTip.cxx4
-rw-r--r--src/Editor.cxx2
-rw-r--r--src/LineMarker.cxx16
-rw-r--r--src/MarginView.cxx2
-rw-r--r--src/ScintillaBase.cxx2
5 files changed, 13 insertions, 13 deletions
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index 4742f66e4..eea592489 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -108,14 +108,14 @@ void DrawArrow(Surface *surface, const PRectangle &rc, bool upArrow, ColourRGBA
constexpr XYPOSITION pixelMove = 0.0f;
if (upArrow) { // Up arrow
- Point pts[] = {
+ const Point pts[] = {
Point(centreX - halfWidth + pixelMove, centreY + quarterWidth + 0.5f),
Point(centreX + halfWidth + pixelMove, centreY + quarterWidth + 0.5f),
Point(centreX + pixelMove, centreY - halfWidth + quarterWidth + 0.5f),
};
surface->Polygon(pts, std::size(pts), FillStroke(colourBG));
} else { // Down arrow
- Point pts[] = {
+ const Point pts[] = {
Point(centreX - halfWidth + pixelMove, centreY - quarterWidth + 0.5f),
Point(centreX + halfWidth + pixelMove, centreY - quarterWidth + 0.5f),
Point(centreX + pixelMove, centreY + halfWidth - quarterWidth + 0.5f),
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 3b0455b5e..a78bcc8eb 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1914,7 +1914,7 @@ Sci::Position Editor::FormatRange(Scintilla::Message iMessage, Scintilla::uptr_t
void *ptr = PtrFromSPtr(lParam);
if (iMessage == Message::FormatRange) {
RangeToFormat *pfr = static_cast<RangeToFormat *>(ptr);
- CharacterRangeFull chrg{ pfr->chrg.cpMin,pfr->chrg.cpMax };
+ const CharacterRangeFull chrg{ pfr->chrg.cpMin,pfr->chrg.cpMax };
AutoSurface surface(pfr->hdc, this, Technology::Default);
AutoSurface surfaceMeasure(pfr->hdcTarget, this, Technology::Default);
if (!surface || !surfaceMeasure) {
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index 9794f523c..c13b2495d 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -144,7 +144,7 @@ void DrawTail(Surface *surface, XYPOSITION leftLine, XYPOSITION rightTail, XYPOS
const XYPOSITION strokeTop = centreY + slopeLength;
const XYPOSITION halfWidth = widthSymbolStroke / 2.0f;
const XYPOSITION strokeMiddle = strokeTop + halfWidth;
- Point lines[] = {
+ const Point lines[] = {
// Stick
Point(rightTail, strokeMiddle),
Point(leftLine + halfWidth + slopeLength, strokeMiddle),
@@ -396,7 +396,7 @@ void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *f
break;
case MarkerSymbol::Arrow: {
- Point pts[] = {
+ const Point pts[] = {
Point(centreX - dimOn4, centreY - dimOn2),
Point(centreX - dimOn4, centreY + dimOn2),
Point(centreX + dimOn2 - dimOn4, centreY),
@@ -406,7 +406,7 @@ void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *f
break;
case MarkerSymbol::ArrowDown: {
- Point pts[] = {
+ const Point pts[] = {
Point(centreX - dimOn2, centreY - dimOn4),
Point(centreX + dimOn2, centreY - dimOn4),
Point(centreX, centreY + dimOn2 - dimOn4),
@@ -416,7 +416,7 @@ void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *f
break;
case MarkerSymbol::Plus: {
- Point pts[] = {
+ const Point pts[] = {
Point(centreX - armSize, centreY - 1),
Point(centreX - 1, centreY - 1),
Point(centreX - 1, centreY - armSize),
@@ -435,7 +435,7 @@ void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *f
break;
case MarkerSymbol::Minus: {
- Point pts[] = {
+ const Point pts[] = {
Point(centreX - armSize, centreY - 1),
Point(centreX + armSize, centreY - 1),
Point(centreX + armSize, centreY + 1),
@@ -489,7 +489,7 @@ void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *f
break;
case MarkerSymbol::ShortArrow: {
- Point pts[] = {
+ const Point pts[] = {
Point(centreX, centreY + dimOn2),
Point(centreX + dimOn2, centreY),
Point(centreX, centreY - dimOn2),
@@ -547,7 +547,7 @@ void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *f
case MarkerSymbol::Bookmark: {
const XYPOSITION halfHeight = std::floor(minDim / 3);
- Point pts[] = {
+ const Point pts[] = {
Point(rcWhole.left, centreY - halfHeight),
Point(rcWhole.right - strokeWidth - 2, centreY - halfHeight),
Point(rcWhole.right - strokeWidth - 2 - halfHeight, centreY),
@@ -560,7 +560,7 @@ void LineMarker::Draw(Surface *surface, const PRectangle &rcWhole, const Font *f
case MarkerSymbol::VerticalBookmark: {
const XYPOSITION halfWidth = std::floor(minDim / 3);
- Point pts[] = {
+ const Point pts[] = {
Point(centreX - halfWidth, centreY - dimOn2),
Point(centreX + halfWidth, centreY - dimOn2),
Point(centreX + halfWidth, centreY + dimOn2),
diff --git a/src/MarginView.cxx b/src/MarginView.cxx
index 7f63f3047..6cc961db2 100644
--- a/src/MarginView.cxx
+++ b/src/MarginView.cxx
@@ -92,7 +92,7 @@ void DrawWrapMarker(Surface *surface, PRectangle rcPlace,
}
};
- Relative rel = { x0, isEndMarker ? 1 : -1, y0, 1, widthStroke / 2.0f };
+ const Relative rel = { x0, isEndMarker ? 1 : -1, y0, 1, widthStroke / 2.0f };
// arrow head
const Point head[] = {
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 02b8040a4..489079a86 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -265,7 +265,7 @@ void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list
}
}
- ListOptions options{
+ const ListOptions options{
vs.ElementColour(Element::List),
vs.ElementColour(Element::ListBack),
vs.ElementColour(Element::ListSelected),