From 2c591c0f98f84626611ce25eb3686da45465af46 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 23 Mar 2020 09:39:32 +1100 Subject: perLineData is polymorphic so replace static_cast with dynamic_cast for better type safety and adherence to C++ Core Guidelines C.146. --- src/Document.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Document.cxx b/src/Document.cxx index 16a56cd52..b51d30c0c 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -186,23 +186,23 @@ void Document::RemoveLine(Sci::Line line) { } LineMarkers *Document::Markers() const noexcept { - return static_cast(perLineData[ldMarkers].get()); + return dynamic_cast(perLineData[ldMarkers].get()); } LineLevels *Document::Levels() const noexcept { - return static_cast(perLineData[ldLevels].get()); + return dynamic_cast(perLineData[ldLevels].get()); } LineState *Document::States() const noexcept { - return static_cast(perLineData[ldState].get()); + return dynamic_cast(perLineData[ldState].get()); } LineAnnotation *Document::Margins() const noexcept { - return static_cast(perLineData[ldMargin].get()); + return dynamic_cast(perLineData[ldMargin].get()); } LineAnnotation *Document::Annotations() const noexcept { - return static_cast(perLineData[ldAnnotation].get()); + return dynamic_cast(perLineData[ldAnnotation].get()); } int Document::LineEndTypesSupported() const { -- cgit v1.2.3