aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Engelhardt <[email protected]>2024-05-21 13:41:50 +0000
committerGitHub <[email protected]>2024-05-21 13:41:50 +0000
commit15f3b945800962adc808a2138360b3fd2b6b0806 (patch)
treeaad66128cd73359bf36a415c99bb936de56ded17
parentFix OpenSSL initialization #299 (#300) (diff)
downloadvmime-15f3b945800962adc808a2138360b3fd2b6b0806.tar.gz
vmime-15f3b945800962adc808a2138360b3fd2b6b0806.zip
Resolve compiler warnings (#302)
* build: replace class noncopyable by C++11 deleted function declaration C++11 is mandatory since commit v0.9.2-48-g8564b2f8, therefore we can exercise the =delete keyword in class declarations to prohibit copying. * build: resolve -Woverloaded-virtual warnings context.hpp:109:26: warning: "virtual vmime::context& vmime::context::operator=(const vmime::context&)’ was hidden [-Woverloaded-virtual=] 109 | virtual context& operator=(const context& ctx); | ^~~~~~~~ generationContext.hpp:153:28: note: by ‘vmime::generationContext& vmime::generationContext::operator=(const vmime::generationContext&)’ 153 | generationContext& operator=(const generationContext& ctx); | ^~~~~~~~ AFAICS, there is no point in having "virtual" on an assignment operator. Any derived classes' operator= has different signature anyway. It is also the only class with a virtual operator=, so that's an indicator for oddness as well. * build: resolve -Wdeprecated-declarations warnings encoding.cpp: In static member function "static const vmime::encoding vmime::encoding::decideImpl(std::__cxx11::basic_string<char>::const_iterator, std::__cxx11::basic_string<char>::const_iterator)": encoding.cpp:161:29: warning: "std::binder2nd<_Operation> std::bind2nd(const _Operation&, const _Tp&) [with _Operation = less<unsigned char>; _Tp = int]" is deprecated: use "std::bind" instead [-Wdeprecated-declarations] 161 | std::bind2nd(std::less<unsigned char>(), 127) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++11 is mandatory, so just use a lambda already.
-rw-r--r--src/vmime/base.hpp17
-rw-r--r--src/vmime/context.hpp2
-rw-r--r--src/vmime/encoding.cpp4
-rw-r--r--src/vmime/utility/stream.hpp7
4 files changed, 7 insertions, 23 deletions
diff --git a/src/vmime/base.hpp b/src/vmime/base.hpp
index 77824771..34b8b535 100644
--- a/src/vmime/base.hpp
+++ b/src/vmime/base.hpp
@@ -232,23 +232,6 @@ namespace vmime {
return const_pointer_cast <X, Y>(obj);
}
-
- /** Inherit from this class to indicate the subclass is not copyable,
- * ie. you want to prohibit copy construction and copy assignment.
- */
- class VMIME_EXPORT noncopyable {
-
- protected:
-
- noncopyable() { }
- virtual ~noncopyable() { }
-
- private:
-
- noncopyable(const noncopyable&);
- void operator=(const noncopyable&);
- };
-
} // vmime
diff --git a/src/vmime/context.hpp b/src/vmime/context.hpp
index 1d009500..1c9f6216 100644
--- a/src/vmime/context.hpp
+++ b/src/vmime/context.hpp
@@ -106,7 +106,7 @@ protected:
context();
context(const context& ctx);
- virtual context& operator=(const context& ctx);
+ context& operator=(const context& ctx);
void copyFrom(const context& ctx);
bool m_internationalizedEmail;
diff --git a/src/vmime/encoding.cpp b/src/vmime/encoding.cpp
index 132c010f..e66e268a 100644
--- a/src/vmime/encoding.cpp
+++ b/src/vmime/encoding.cpp
@@ -157,9 +157,7 @@ const encoding encoding::decideImpl(
const string::difference_type length = end - begin;
const string::difference_type count = std::count_if(
- begin, end,
- std::bind2nd(std::less<unsigned char>(), 127)
- );
+ begin, end, [](unsigned char x) { return x < 127; });
// All is in 7-bit US-ASCII --> 7-bit (or Quoted-Printable...)
if (length == count) {
diff --git a/src/vmime/utility/stream.hpp b/src/vmime/utility/stream.hpp
index 9aa13923..8ea94df0 100644
--- a/src/vmime/utility/stream.hpp
+++ b/src/vmime/utility/stream.hpp
@@ -38,9 +38,12 @@ namespace utility {
/** Base class for input/output stream.
*/
-class VMIME_EXPORT stream : public object, private noncopyable {
-
+class VMIME_EXPORT stream : public object {
public:
+ stream() = default;
+ /* Presence of move-ctor/move-asg inhibits default copy-ctor/copy-asg */
+ stream(stream &&) = default;
+ stream &operator=(stream &&) = default;
virtual ~stream() { }