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

sev- noreply at scummvm.org
Mon Feb 20 00:36:23 UTC 2023


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

Summary:
d48326e54c DIRECTOR: Really fix warning
a438bb678a HPL1: Fix incorrect usage of Common::remove_const


Commit: d48326e54cd6b4208dca98204c219244183be6c4
    https://github.com/scummvm/scummvm/commit/d48326e54cd6b4208dca98204c219244183be6c4
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-02-20T01:36:19+01:00

Commit Message:
DIRECTOR: Really fix warning

The purpose of Common::remove_const is not to remove the const
specifier from a variable, but to remove it from a type and define
a non-const type in the process. The previous commit to fix the
warning thus did not fix anything as the code was still doing a
C cast to remove the const specifier. The proper way to fix that
warning is to use a const_cast.

Changed paths:
    engines/director/images.cpp


diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 0412a49a0bb..a0fc42746ba 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -105,7 +105,7 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
 			for (int x = 0; x < _surface->w; x++) {
 				// We're not su[pposed to modify the image that is coming from the decoder
 				// However, in this case, we know what we're doing.
-				*Common::remove_const<byte *>::type(_surface->getBasePtr(x, y)) = 255 - *(const byte *)_surface->getBasePtr(x, y);
+				*const_cast<byte *>((const byte *)_surface->getBasePtr(x, y)) = 255 - *(const byte *)_surface->getBasePtr(x, y);
 			}
 		}
 	}


Commit: a438bb678a85ad82b4b7ce0b4c306d32888fe735
    https://github.com/scummvm/scummvm/commit/a438bb678a85ad82b4b7ce0b4c306d32888fe735
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-02-20T01:36:19+01:00

Commit Message:
HPL1: Fix incorrect usage of Common::remove_const

Changed paths:
    engines/hpl1/engine/libraries/newton/core/dgHeap.h
    engines/hpl1/engine/libraries/newton/core/dgNode.h
    engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h


diff --git a/engines/hpl1/engine/libraries/newton/core/dgHeap.h b/engines/hpl1/engine/libraries/newton/core/dgHeap.h
index 378fdb213d3..e9a8be26702 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgHeap.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgHeap.h
@@ -119,7 +119,7 @@ dgHeapBase<OBJECT, KEY>::dgHeapBase(const void *const buffer, dgInt32 sizeInByte
 //	NEWTON_ASSERT (0);
 //	m_allocated = false;
 	m_allocator = NULL;
-	m_pool = (RECORD *)Common::remove_const<void * const>::type(buffer);
+	m_pool = const_cast<RECORD *>((const RECORD *)buffer);
 	m_maxCount = dgInt32(sizeInBytes / sizeof(RECORD));
 	Flush();
 }
diff --git a/engines/hpl1/engine/libraries/newton/core/dgNode.h b/engines/hpl1/engine/libraries/newton/core/dgNode.h
index 41cb9cf857a..8a91e2119e9 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgNode.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgNode.h
@@ -173,7 +173,7 @@ dgNode<T>::~dgNode() {
 
 template<class T>
 dgRef *dgNode<T>::CreateClone() const {
-	return new T(*(T *)Common::remove_const<T *>::type(this));
+	return new T(*const_cast<T *>((const T *)this));
 }
 
 template<class T>
diff --git a/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h b/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
index 0df8f11ddb6..eba7277eb93 100644
--- a/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
+++ b/engines/hpl1/engine/libraries/newton/core/dgPolygonSoupDatabase.h
@@ -94,7 +94,7 @@ inline dgUnsigned32 dgPolygonSoupDatabase::GetTagId(const dgInt32 *face) const {
 
 inline void dgPolygonSoupDatabase::SetTagId(const dgInt32 *facePtr, dgUnsigned32 newID) const {
 	dgUnsigned32 *face;
-	face = Common::remove_const<dgUnsigned32 *>::type(facePtr);
+	face = const_cast<dgUnsigned32 *>((const dgUnsigned32 *)facePtr);
 	face[-1] = newID;
 }
 




More information about the Scummvm-git-logs mailing list