aboutsummaryrefslogtreecommitdiffhomepage
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
parent481b5651df9bd160d4ff1f1ba471eead61a53252 (diff)
downloadscintilla-mirror-765390e6db2b69976448e92d9a86516ead9b0c09.tar.gz
Declare const where possible.
-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
-rw-r--r--win32/PlatWin.cxx20
-rw-r--r--win32/PlatWin.h2
7 files changed, 24 insertions, 24 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),
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index c3157416a..dbb929620 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -1713,19 +1713,19 @@ void SurfaceD2D::RoundedRectangle(PRectangle rc, FillStroke fillStroke) {
const FLOAT minDimension = static_cast<FLOAT>(std::min(rc.Width(), rc.Height())) / 2.0f;
const FLOAT radius = std::min(4.0f, minDimension);
if (fillStroke.fill.colour == fillStroke.stroke.colour) {
- D2D1_ROUNDED_RECT roundedRectFill = {
+ const D2D1_ROUNDED_RECT roundedRectFill = {
RectangleFromPRectangle(rc),
radius, radius };
D2DPenColourAlpha(fillStroke.fill.colour);
pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
} else {
- D2D1_ROUNDED_RECT roundedRectFill = {
+ const D2D1_ROUNDED_RECT roundedRectFill = {
RectangleFromPRectangle(rc.Inset(1.0)),
radius-1, radius-1 };
D2DPenColourAlpha(fillStroke.fill.colour);
pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
- D2D1_ROUNDED_RECT roundedRect = {
+ const D2D1_ROUNDED_RECT roundedRect = {
RectangleFromPRectangle(rc.Inset(0.5)),
radius, radius };
D2DPenColourAlpha(fillStroke.stroke.colour);
@@ -1749,12 +1749,12 @@ void SurfaceD2D::AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStroke
pRenderTarget->DrawRectangle(rectOutline, pBrush, fillStroke.stroke.WidthF());
} else {
const float cornerSizeF = static_cast<float>(cornerSize);
- D2D1_ROUNDED_RECT roundedRectFill = {
+ const D2D1_ROUNDED_RECT roundedRectFill = {
rectFill, cornerSizeF - 1.0f, cornerSizeF - 1.0f };
D2DPenColourAlpha(fillStroke.fill.colour);
pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
- D2D1_ROUNDED_RECT roundedRect = {
+ const D2D1_ROUNDED_RECT roundedRect = {
rectOutline, cornerSizeF, cornerSizeF};
D2DPenColourAlpha(fillStroke.stroke.colour);
pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush, fillStroke.stroke.WidthF());
@@ -1814,7 +1814,7 @@ void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsig
ID2D1Bitmap *bitmap = nullptr;
const D2D1_SIZE_U size = D2D1::SizeU(width, height);
- D2D1_BITMAP_PROPERTIES props = {{DXGI_FORMAT_B8G8R8A8_UNORM,
+ const D2D1_BITMAP_PROPERTIES props = {{DXGI_FORMAT_B8G8R8A8_UNORM,
D2D1_ALPHA_MODE_PREMULTIPLIED}, 72.0, 72.0};
const HRESULT hr = pRenderTarget->CreateBitmap(size, image.data(),
width * 4, &props, &bitmap);
@@ -1857,12 +1857,12 @@ void SurfaceD2D::Stadium(PRectangle rc, FillStroke fillStroke, Ends ends) {
const FLOAT halfStroke = fillStroke.stroke.WidthF() / 2.0f;
if (ends == Surface::Ends::semiCircles) {
const D2D1_RECT_F rect = RectangleFromPRectangle(rc);
- D2D1_ROUNDED_RECT roundedRectFill = { RectangleInset(rect, fillStroke.stroke.WidthF()),
+ const D2D1_ROUNDED_RECT roundedRectFill = { RectangleInset(rect, fillStroke.stroke.WidthF()),
radiusFill, radiusFill };
D2DPenColourAlpha(fillStroke.fill.colour);
pRenderTarget->FillRoundedRectangle(roundedRectFill, pBrush);
- D2D1_ROUNDED_RECT roundedRect = { RectangleInset(rect, halfStroke),
+ const D2D1_ROUNDED_RECT roundedRect = { RectangleInset(rect, halfStroke),
radius, radius };
D2DPenColourAlpha(fillStroke.stroke.colour);
pRenderTarget->DrawRoundedRectangle(roundedRect, pBrush, fillStroke.stroke.WidthF());
@@ -2869,7 +2869,7 @@ void Window::SetCursor(Cursor curs) {
coordinates */
PRectangle Window::GetMonitorRect(Point pt) {
const PRectangle rcPosition = GetPosition();
- POINT ptDesktop = {static_cast<LONG>(pt.x + rcPosition.left),
+ const POINT ptDesktop = {static_cast<LONG>(pt.x + rcPosition.left),
static_cast<LONG>(pt.y + rcPosition.top)};
HMONITOR hMonitor = MonitorFromPoint(ptDesktop, MONITOR_DEFAULTTONEAREST);
@@ -2915,7 +2915,7 @@ public:
}
void AllocItem(const char *text, int pixId) {
- ListItemData lid = { text, pixId };
+ const ListItemData lid = { text, pixId };
data.push_back(lid);
}
diff --git a/win32/PlatWin.h b/win32/PlatWin.h
index 1391723dd..8ce798cf1 100644
--- a/win32/PlatWin.h
+++ b/win32/PlatWin.h
@@ -19,7 +19,7 @@ extern void Platform_Initialise(void *hInstance) noexcept;
extern void Platform_Finalise(bool fromDllMain) noexcept;
constexpr RECT RectFromPRectangle(PRectangle prc) noexcept {
- RECT rc = { static_cast<LONG>(prc.left), static_cast<LONG>(prc.top),
+ const RECT rc = { static_cast<LONG>(prc.left), static_cast<LONG>(prc.top),
static_cast<LONG>(prc.right), static_cast<LONG>(prc.bottom) };
return rc;
}