From d48326e54cd6b4208dca98204c219244183be6c4 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sat, 18 Feb 2023 21:51:17 +0000 Subject: [PATCH] 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. --- engines/director/images.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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::type(_surface->getBasePtr(x, y)) = 255 - *(const byte *)_surface->getBasePtr(x, y); + *const_cast((const byte *)_surface->getBasePtr(x, y)) = 255 - *(const byte *)_surface->getBasePtr(x, y); } } }