From 11ebaf673f39899cb36755e368503795a5384e1a Mon Sep 17 00:00:00 2001 From: Alexander Duda Date: Sat, 18 Oct 2014 14:22:27 +0200 Subject: [PATCH] fix warning in template Scalar::mul gcc < 4.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this particular case t shadows transpose of the base class Matx: types.hpp:1805:14: warning: declaration of ‘t’ shadows a member of 'this' [-Wshadow] Changelog gcc 4.8: The option -Wshadow no longer warns if a declaration shadows a function declaration. This warning is problematic because it prevents the module opencv_contrib/modules/ruby to pass the build process --- modules/core/doc/basic_structures.rst | 2 +- modules/core/include/opencv2/core/types.hpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/core/doc/basic_structures.rst b/modules/core/doc/basic_structures.rst index 8f75344c23..048ee7e71a 100644 --- a/modules/core/doc/basic_structures.rst +++ b/modules/core/doc/basic_structures.rst @@ -534,7 +534,7 @@ Template class for a 4-element vector derived from Vec. template operator Scalar_() const; //! per-element product - Scalar_<_Tp> mul(const Scalar_<_Tp>& t, double scale=1 ) const; + Scalar_<_Tp> mul(const Scalar_<_Tp>& a, double scale=1 ) const; // returns (v0, -v1, -v2, -v3) Scalar_<_Tp> conj() const; diff --git a/modules/core/include/opencv2/core/types.hpp b/modules/core/include/opencv2/core/types.hpp index dc4c30775e..a9a0a30843 100644 --- a/modules/core/include/opencv2/core/types.hpp +++ b/modules/core/include/opencv2/core/types.hpp @@ -493,7 +493,7 @@ public: template operator Scalar_() const; //! per-element product - Scalar_<_Tp> mul(const Scalar_<_Tp>& t, double scale=1 ) const; + Scalar_<_Tp> mul(const Scalar_<_Tp>& a, double scale=1 ) const; // returns (v0, -v1, -v2, -v3) Scalar_<_Tp> conj() const; @@ -1802,12 +1802,12 @@ Scalar_<_Tp> Scalar_<_Tp>::all(_Tp v0) template inline -Scalar_<_Tp> Scalar_<_Tp>::mul(const Scalar_<_Tp>& t, double scale ) const +Scalar_<_Tp> Scalar_<_Tp>::mul(const Scalar_<_Tp>& a, double scale ) const { - return Scalar_<_Tp>(saturate_cast<_Tp>(this->val[0] * t.val[0] * scale), - saturate_cast<_Tp>(this->val[1] * t.val[1] * scale), - saturate_cast<_Tp>(this->val[2] * t.val[2] * scale), - saturate_cast<_Tp>(this->val[3] * t.val[3] * scale)); + return Scalar_<_Tp>(saturate_cast<_Tp>(this->val[0] * a.val[0] * scale), + saturate_cast<_Tp>(this->val[1] * a.val[1] * scale), + saturate_cast<_Tp>(this->val[2] * a.val[2] * scale), + saturate_cast<_Tp>(this->val[3] * a.val[3] * scale)); } template inline