[Scummvm-git-logs] scummvm master -> a04bb51bf5984896ba1b9c9fadef0b1f7ae73f8b

aquadran noreply at scummvm.org
Sat Feb 10 11:17:43 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a04bb51bf5 ICB: compile fix for GCC 14


Commit: a04bb51bf5984896ba1b9c9fadef0b1f7ae73f8b
    https://github.com/scummvm/scummvm/commit/a04bb51bf5984896ba1b9c9fadef0b1f7ae73f8b
Author: Christian Krause (chkr at plauener.de)
Date: 2024-02-10T12:17:39+01:00

Commit Message:
ICB: compile fix for GCC 14

- cast const away to allow modification (as intended according to
  existing comments)

Changed paths:
    engines/icb/common/px_array.h


diff --git a/engines/icb/common/px_array.h b/engines/icb/common/px_array.h
index 5ee18b37fa3..c52f375d1b1 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<Type> *)this)->ResizeArray(n);
-		((const rcActArray<Type> *)this)->m_userPosition = n + 1;
+		// Remove any 'constness' for a resize
+		(const_cast<rcActArray<Type> *>(this))->ResizeArray(n);
+		(const_cast<rcActArray<Type> *>(this))->m_userPosition = n + 1;
 	}
 
 	return (*(m_contents[n]));
@@ -304,8 +304,8 @@ template <class Type> const Type rcIntArray<Type>::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<Type> *)this)->ResizeArray(index);
-		((const rcIntArray<Type> *)this)->m_userPosition = index + 1;
+		(const_cast<rcIntArray<Type> *>(this))->ResizeArray(index);
+		(const_cast<rcIntArray<Type> *>(this))->m_userPosition = index + 1;
 	}
 
 	return m_contents[index];




More information about the Scummvm-git-logs mailing list