From 65de8b15b50c6d365b1eef14daaeb64736430d34 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Thu, 18 Dec 2025 14:49:28 +1100 Subject: Convert old style cast into more specific C++ cast. Replace magic number with symbolic constant. Avoids lint warnings. --- src/Style.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Style.cxx b/src/Style.cxx index 2c78c5241..a080f452e 100644 --- a/src/Style.cxx +++ b/src/Style.cxx @@ -62,7 +62,9 @@ int DefaultFontSize() noexcept { try { return Platform::DefaultFontSize(); } catch (...) { - return 10; + // Should never happen + constexpr int sensibleFontSize = 10; + return sensibleFontSize; } } @@ -83,5 +85,5 @@ Style::Style(const char *fontName_) noexcept : void Style::Copy(std::shared_ptr font_, const FontMeasurements &fm_) noexcept { font = std::move(font_); - (FontMeasurements &)(*this) = fm_; + static_cast(*this) = fm_; } -- cgit v1.2.3