aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-03-29 18:13:45 +1100
committerNeil <nyamatongwe@gmail.com>2025-03-29 18:13:45 +1100
commit9ccbd1eb1fb1c53fc7be721f98b0acb207e56723 (patch)
treedeb7b969d7e0ec42b5456dc92a14b01d5084598d
parent908be66566d803445c613a2dbe9fbc901d4be7e3 (diff)
downloadscintilla-mirror-9ccbd1eb1fb1c53fc7be721f98b0acb207e56723.tar.gz
Simplify some boolean expressions and place brackets around subexpressions.
-rw-r--r--win32/ScintillaWin.cxx14
-rw-r--r--win32/SurfaceD2D.cxx4
-rw-r--r--win32/SurfaceGDI.cxx2
3 files changed, 8 insertions, 12 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index b128f6e30..5b88b715c 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -2674,7 +2674,7 @@ int ScintillaWin::SetScrollInfo(int nBar, LPCSCROLLINFO lpsi, BOOL bRedraw) noex
}
bool ScintillaWin::GetScrollInfo(int nBar, LPSCROLLINFO lpsi) noexcept {
- return ::GetScrollInfo(MainHWND(), nBar, lpsi) ? true : false;
+ return ::GetScrollInfo(MainHWND(), nBar, lpsi);
}
// Change the scroll position but avoid repaint if changing to same value
@@ -3343,7 +3343,7 @@ void ScintillaWin::ImeStartComposition() {
// The logfont for the IME is recreated here.
const int styleHere = pdoc->StyleIndexAt(sel.MainCaret());
LOGFONTW lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L""};
- int sizeZoomed = vs.styles[styleHere].size + vs.zoomLevel * FontSizeMultiplier;
+ int sizeZoomed = vs.styles[styleHere].size + (vs.zoomLevel * FontSizeMultiplier);
if (sizeZoomed <= 2 * FontSizeMultiplier) // Hangs if sizeZoomed <= 1
sizeZoomed = 2 * FontSizeMultiplier;
// The negative is to allow for leading
@@ -3888,13 +3888,9 @@ bool ScintillaWin::Unregister() noexcept {
}
bool ScintillaWin::HasCaretSizeChanged() const noexcept {
- if (
- ( (0 != vs.caret.width) && (sysCaretWidth != vs.caret.width) )
- || ((0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight))
- ) {
- return true;
- }
- return false;
+ return
+ ((0 != vs.caret.width) && (sysCaretWidth != vs.caret.width))
+ || ((0 != vs.lineHeight) && (sysCaretHeight != vs.lineHeight));
}
BOOL ScintillaWin::CreateSystemCaret() {
diff --git a/win32/SurfaceD2D.cxx b/win32/SurfaceD2D.cxx
index 47a529fe3..39b02fa7e 100644
--- a/win32/SurfaceD2D.cxx
+++ b/win32/SurfaceD2D.cxx
@@ -786,13 +786,13 @@ void SurfaceD2D::Ellipse(PRectangle rc, FillStroke fillStroke) {
return;
const D2D1_POINT_2F centre = DPointFromPoint(rc.Centre());
- const FLOAT radiusFill = static_cast<FLOAT>(rc.Width() / 2.0f - fillStroke.stroke.width);
+ const FLOAT radiusFill = static_cast<FLOAT>((rc.Width() / 2.0f) - fillStroke.stroke.width);
const D2D1_ELLIPSE ellipseFill = { centre, radiusFill, radiusFill };
D2DPenColourAlpha(fillStroke.fill.colour);
pRenderTarget->FillEllipse(ellipseFill, pBrush.Get());
- const FLOAT radiusOutline = static_cast<FLOAT>(rc.Width() / 2.0f - fillStroke.stroke.width / 2.0f);
+ const FLOAT radiusOutline = static_cast<FLOAT>((rc.Width() / 2.0f) - (fillStroke.stroke.width / 2.0f));
const D2D1_ELLIPSE ellipseOutline = { centre, radiusOutline, radiusOutline };
D2DPenColourAlpha(fillStroke.stroke.colour);
diff --git a/win32/SurfaceGDI.cxx b/win32/SurfaceGDI.cxx
index 528a64573..9fc1ee50c 100644
--- a/win32/SurfaceGDI.cxx
+++ b/win32/SurfaceGDI.cxx
@@ -461,7 +461,7 @@ public:
PLATFORM_ASSERT(y >= 0);
PLATFORM_ASSERT(x < size.cx);
PLATFORM_ASSERT(y < size.cy);
- pixels[y * size.cx + x] = value;
+ pixels[(y * size.cx) + x] = value;
}
void SetSymmetric(LONG x, LONG y, DWORD value) noexcept;
};