From 750ba10cb122154fc60ca24bd0743de6360d81be Mon Sep 17 00:00:00 2001 From: Denis Kopyrin Date: Wed, 3 Jul 2024 11:50:51 +0800 Subject: [PATCH] Fixed audiofile warnings properly (#814) * Revert "Fixed audiofile warnings (#811)" This reverts commit 500507509ba0ae8b49afd39286e8fb650b797e96. * Fixed audiofile warnings properly --- tools/audiofile/audiofile.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/audiofile/audiofile.cpp b/tools/audiofile/audiofile.cpp index bfb67899..10fb67a9 100644 --- a/tools/audiofile/audiofile.cpp +++ b/tools/audiofile/audiofile.cpp @@ -3552,6 +3552,17 @@ struct IntTypes { typedef int32_t SignedType; typedef uint32_t UnsignedT template <> struct IntTypes { typedef int32_t SignedType; typedef uint32_t UnsignedType; }; +namespace compat +{ + template + class unary_function + { + public: + using argument_type = Arg; + using result_type = R; + }; +} + template struct signConverter { @@ -3562,12 +3573,12 @@ struct signConverter static const int kMaxSignedValue = (((1 << (kScaleBits - 1)) - 1) << 1) + 1; static const int kMinSignedValue = -kMaxSignedValue - 1; - struct signedToUnsigned : public std::function + struct signedToUnsigned : public compat::unary_function { UnsignedType operator()(SignedType x) { return x - kMinSignedValue; } }; - struct unsignedToSigned : public std::function + struct unsignedToSigned : public compat::unary_function { SignedType operator()(UnsignedType x) { return x + kMinSignedValue; } }; @@ -3760,7 +3771,7 @@ private: }; template -struct intToFloat : public std::function +struct intToFloat : public compat::unary_function { Result operator()(Arg x) const { return x; } }; @@ -3826,13 +3837,13 @@ private: }; template -struct lshift : public std::function +struct lshift : public compat::unary_function { Result operator()(const Arg &x) const { return x << shift; } }; template -struct rshift : public std::function +struct rshift : public compat::unary_function { Result operator()(const Arg &x) const { return x >> shift; } }; @@ -3928,7 +3939,7 @@ private: }; template -struct floatToFloat : public std::function +struct floatToFloat : public compat::unary_function { Result operator()(Arg x) const { return x; } };