From 93679c6c60382029e9e8750ef2facc8e29e0fcf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 8 Jan 2025 12:46:53 +0100 Subject: [PATCH] Removed templated & unsafe Image*::data() APIs deprecated in 2019.10. --- doc/changelog.dox | 3 +++ src/Magnum/Image.h | 44 ------------------------------------ src/Magnum/ImageView.h | 24 -------------------- src/Magnum/Trade/ImageData.h | 22 ------------------ 4 files changed, 3 insertions(+), 90 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index fed07ac89..aafe51be5 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -1745,6 +1745,9 @@ See also: - @cpp TextureTools::distanceField() @ce, use the @ref TextureTools::DistanceFieldGL class instead. - Removed APIs deprecated in 2019.10, in particular: + - Templated @cpp Image*::data() @ce APIs returning a pointer which + allowed for dangerous data access without any bounds, type or layout + checks, use @ref Image::pixels() instead - @cpp Trade::ImporterFileCallbackPolicy @ce, use the @ref InputFileCallbackPolicy enum instead; additionally there was @cpp Trade::ImporterFileCallbackPolicy::LoadPernament @ce containing a diff --git a/src/Magnum/Image.h b/src/Magnum/Image.h index dee4f88cd..0e923e9ce 100644 --- a/src/Magnum/Image.h +++ b/src/Magnum/Image.h @@ -441,28 +441,6 @@ template class Image { */ Containers::Array data() const && = delete; - #ifdef MAGNUM_BUILD_DEPRECATED - /** - * @brief Image data in a particular type - * @m_deprecated_since{2019,10} Use non-templated @ref data() together - * with @ref Corrade::Containers::arrayCast() instead for properly - * bounds-checked type conversion. - */ - template CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") T* data() { - return reinterpret_cast(_data.data()); - } - - /** - * @brief Image data in a particular type - * @m_deprecated_since{2019,10} Use non-templated @ref data() together - * with @ref Corrade::Containers::arrayCast() instead for properly - * bounds-checked type conversion. - */ - template CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const T* data() const { - return reinterpret_cast(_data.data()); - } - #endif - /** * @brief Pixel data * @m_since{2019,10} @@ -720,28 +698,6 @@ template class CompressedImage { */ Containers::Array data() const && = delete; - #ifdef MAGNUM_BUILD_DEPRECATED - /** - * @brief Image data in a particular type - * @m_deprecated_since{2019,10} Use non-templated @ref data() together - * with @ref Corrade::Containers::arrayCast() instead for properly - * bounds-checked type conversion. - */ - template CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") T* data() { - return reinterpret_cast(_data.data()); - } - - /** - * @brief Image data in a particular type - * @m_deprecated_since{2019,10} Use non-templated @ref data() together - * with @ref Corrade::Containers::arrayCast() instead for properly - * bounds-checked type conversion. - */ - template CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const T* data() const { - return reinterpret_cast(_data.data()); - } - #endif - /** * @brief Release data storage * diff --git a/src/Magnum/ImageView.h b/src/Magnum/ImageView.h index e931204db..2bde3d93a 100644 --- a/src/Magnum/ImageView.h +++ b/src/Magnum/ImageView.h @@ -468,18 +468,6 @@ template class ImageView { */ Containers::ArrayView data() const { return _data; } - #ifdef MAGNUM_BUILD_DEPRECATED - /** - * @brief Image data in a particular type - * @m_deprecated_since{2019,10} Use non-templated @ref data() together - * with @ref Corrade::Containers::arrayCast() instead for properly - * bounds-checked type conversion. - */ - template CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const U* data() const { - return reinterpret_cast(_data.data()); - } - #endif - /** * @brief Set image data * @@ -862,18 +850,6 @@ template class CompressedImageView { /** @brief Raw image data */ Containers::ArrayView data() const { return _data; } - #ifdef MAGNUM_BUILD_DEPRECATED - /** - * @brief Image data in a particular type - * @m_deprecated_since{2019,10} Use non-templated @ref data() together - * with @ref Corrade::Containers::arrayCast() instead for properly - * bounds-checked type conversion. - */ - template CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const U* data() const { - return reinterpret_cast(_data.data()); - } - #endif - /** * @brief Set image data * diff --git a/src/Magnum/Trade/ImageData.h b/src/Magnum/Trade/ImageData.h index 3c746e5ba..3f7584495 100644 --- a/src/Magnum/Trade/ImageData.h +++ b/src/Magnum/Trade/ImageData.h @@ -808,28 +808,6 @@ template class ImageData { */ Containers::ArrayView mutableData() &; - #ifdef MAGNUM_BUILD_DEPRECATED - /** - * @brief Image data in a particular type - * @m_deprecated_since{2019,10} Use non-templated @ref data() together - * with @ref Corrade::Containers::arrayCast() instead for properly - * bounds-checked type conversion. - */ - template CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") T* data() { - return reinterpret_cast(_data.data()); - } - - /** - * @brief Image data in a particular type - * @m_deprecated_since{2019,10} Use non-templated @ref data() together - * with @ref Corrade::Containers::arrayCast() instead for properly - * bounds-checked type conversion. - */ - template CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const T* data() const { - return reinterpret_cast(_data.data()); - } - #endif - /** * @brief Pixel data * @m_since{2019,10}