From a04bb51bf5984896ba1b9c9fadef0b1f7ae73f8b Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Tue, 6 Feb 2024 23:54:44 +0100 Subject: [PATCH] ICB: compile fix for GCC 14 - cast const away to allow modification (as intended according to existing comments) --- engines/icb/common/px_array.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/icb/common/px_array.h b/engines/icb/common/px_array.h index 5ee18b37fa3e..c52f375d1b14 100644 --- a/engines/icb/common/px_array.h +++ b/engines/icb/common/px_array.h @@ -100,9 +100,9 @@ const Type &T_MYACTARRAY::operator[](uint32 n) const { // It is permissable to look at an element that has not been defined, as the constructor assures // that the contents are valid if (n >= m_userPosition) { - // We must cast this to a type that can change - ((const rcActArray *)this)->ResizeArray(n); - ((const rcActArray *)this)->m_userPosition = n + 1; + // Remove any 'constness' for a resize + (const_cast *>(this))->ResizeArray(n); + (const_cast *>(this))->m_userPosition = n + 1; } return (*(m_contents[n])); @@ -304,8 +304,8 @@ template const Type rcIntArray::operator[](uint32 index) cons // It is permissable to look at an element that has not been defined, as it will have been set to 0 if (index >= m_userPosition) { // Remove any 'constness' for a resize - ((const rcIntArray *)this)->ResizeArray(index); - ((const rcIntArray *)this)->m_userPosition = index + 1; + (const_cast *>(this))->ResizeArray(index); + (const_cast *>(this))->m_userPosition = index + 1; } return m_contents[index];