As of C++11, std::swap is noexcept. #2386 (#3645)

* As of C++11, std::swap is noexcept. #2386

* fix(Any): remove throw on swap

* fix(Any): As of C++11, std::swap is noexcept. #2386

* fix(Any): make size const #2386

* fix(SimpleRowFormatter): clang won't compile noexcept #2386

* a couple of arm fixes

* fix(Any): As of C++11, std::swap is noexcept. #2386

* fix(AnyTest): local() for POCO_NO_SOO# 2386

* test(RSACipher): RSA encryption without private key #2367

* chore(RSACipherTest): delete ciphers #2367
This commit is contained in:
Aleksandar Fabijanic
2022-06-28 19:14:36 +02:00
committed by GitHub
parent c37780726d
commit 168f1eb6e2
86 changed files with 285 additions and 146 deletions

View File

@@ -84,7 +84,7 @@ public:
X509Certificate& operator = (X509Certificate&& cert) noexcept; X509Certificate& operator = (X509Certificate&& cert) noexcept;
/// Move assignment. /// Move assignment.
void swap(X509Certificate& cert); void swap(X509Certificate& cert) noexcept;
/// Exchanges the certificate with another one. /// Exchanges the certificate with another one.
~X509Certificate(); ~X509Certificate();

View File

@@ -121,7 +121,7 @@ X509Certificate& X509Certificate::operator = (X509Certificate&& cert) noexcept
} }
void X509Certificate::swap(X509Certificate& cert) void X509Certificate::swap(X509Certificate& cert) noexcept
{ {
using std::swap; using std::swap;
swap(cert._issuerName, _issuerName); swap(cert._issuerName, _issuerName);

View File

@@ -15,7 +15,10 @@
#include "Poco/Crypto/CipherFactory.h" #include "Poco/Crypto/CipherFactory.h"
#include "Poco/Crypto/Cipher.h" #include "Poco/Crypto/Cipher.h"
#include "Poco/Crypto/X509Certificate.h" #include "Poco/Crypto/X509Certificate.h"
#include "Poco/Path.h"
#include "Poco/File.h"
#include <sstream> #include <sstream>
#include <fstream>
using namespace Poco::Crypto; using namespace Poco::Crypto;
@@ -203,6 +206,33 @@ void RSATest::testRSACipher()
std::string dec = pCipher->decryptString(enc); std::string dec = pCipher->decryptString(enc);
assertTrue (dec == val); assertTrue (dec == val);
} }
RSAKey key(RSAKey::KL_1024, RSAKey::EXP_SMALL);
std::string pubKeyFile = Poco::Path::temp() + "poco.key.pub";
std::string privKeyFile = Poco::Path::temp() + "poco.key.priv";
if (Poco::File(pubKeyFile).exists()) Poco::File(pubKeyFile).remove();
if (Poco::File(privKeyFile).exists()) Poco::File(privKeyFile).remove();
std::ofstream strPub(pubKeyFile);
std::ofstream strPriv(privKeyFile);
key.save(&strPub, &strPriv);
strPub.close();
strPriv.close();
Poco::Crypto::RSAKey encryptKey(pubKeyFile);
Poco::Crypto::RSAKey decryptKey(pubKeyFile, privKeyFile);
Poco::Crypto::CipherFactory factory;
auto iengine = factory.createCipher(encryptKey);
auto oengine = factory.createCipher(decryptKey);
std::string ss = "test_str";
auto enc = iengine->encryptString(ss);
auto dec = oengine->decryptString(enc);
assertEqual (ss, dec);
delete iengine;
delete oengine;
} }

View File

@@ -90,7 +90,7 @@ public:
return *this; return *this;
} }
void swap(Column& other) void swap(Column& other) noexcept
/// Swaps the column with another one. /// Swaps the column with another one.
{ {
using std::swap; using std::swap;
@@ -237,7 +237,7 @@ public:
return *this; return *this;
} }
void swap(Column& other) void swap(Column& other) noexcept
/// Swaps the column with another one. /// Swaps the column with another one.
{ {
using std::swap; using std::swap;
@@ -378,7 +378,7 @@ public:
return *this; return *this;
} }
void swap(Column& other) void swap(Column& other) noexcept
/// Swaps the column with another one. /// Swaps the column with another one.
{ {
using std::swap; using std::swap;
@@ -492,7 +492,7 @@ private:
template <typename C> template <typename C>
inline void swap(Column<C>& c1, Column<C>& c2) inline void swap(Column<C>& c1, Column<C>& c2) noexcept
{ {
c1.swap(c2); c1.swap(c2);
} }

View File

@@ -109,7 +109,7 @@ public:
return *_pContent != *other._pContent; return *_pContent != *other._pContent;
} }
void swap(LOB& other) void swap(LOB& other) noexcept
/// Swaps the LOB with another one. /// Swaps the LOB with another one.
{ {
using std::swap; using std::swap;
@@ -228,7 +228,7 @@ using JSON = std::string;
// //
template <typename T> template <typename T>
inline void swap(LOB<T>& b1, LOB<T>& b2) inline void swap(LOB<T>& b1, LOB<T>& b2) noexcept
{ {
b1.swap(b2); b1.swap(b2);
} }

View File

@@ -78,7 +78,7 @@ public:
MetaColumn& operator = (MetaColumn&& other) noexcept; MetaColumn& operator = (MetaColumn&& other) noexcept;
/// Assignment operator. /// Assignment operator.
void swap(MetaColumn& other); void swap(MetaColumn& other) noexcept;
/// Swaps the contents with another instance. /// Swaps the contents with another instance.
~MetaColumn(); ~MetaColumn();

View File

@@ -98,7 +98,7 @@ public:
/// Returns a copy the RowIterator backed by diff positions. /// Returns a copy the RowIterator backed by diff positions.
/// Throws RangeException if diff is larger than current position. /// Throws RangeException if diff is larger than current position.
void swap(RowIterator& other); void swap(RowIterator& other) noexcept;
/// Swaps the RowIterator with another one. /// Swaps the RowIterator with another one.
private: private:

View File

@@ -49,7 +49,7 @@ public:
~SimpleRowFormatter(); ~SimpleRowFormatter();
/// Destroys the SimpleRowFormatter. /// Destroys the SimpleRowFormatter.
void swap(SimpleRowFormatter& other); void swap(SimpleRowFormatter& other) noexcept;
/// Swaps the row formatter with another one. /// Swaps the row formatter with another one.
std::string& formatNames(const NameVecPtr pNames, std::string& formattedNames); std::string& formatNames(const NameVecPtr pNames, std::string& formattedNames);
@@ -109,9 +109,13 @@ inline std::streamsize SimpleRowFormatter::getSpacing() const
namespace std namespace std
{ {
// Note: for an unknown reason, clang refuses to compile this function as noexcept
template<> template<>
inline void swap<Poco::Data::SimpleRowFormatter>(Poco::Data::SimpleRowFormatter& s1, inline void swap<Poco::Data::SimpleRowFormatter>(Poco::Data::SimpleRowFormatter& s1,
Poco::Data::SimpleRowFormatter& s2) Poco::Data::SimpleRowFormatter& s2)
#ifndef POCO_COMPILER_CLANG
noexcept
#endif
/// Full template specalization of std:::swap for SimpleRowFormatter /// Full template specalization of std:::swap for SimpleRowFormatter
{ {
s1.swap(s2); s1.swap(s2);

View File

@@ -125,7 +125,7 @@ public:
Statement& operator = (Statement&& stmt) noexcept; Statement& operator = (Statement&& stmt) noexcept;
/// Move assignment. /// Move assignment.
void swap(Statement& other); void swap(Statement& other) noexcept;
/// Swaps the statement with another one. /// Swaps the statement with another one.
template <typename T> template <typename T>
@@ -814,7 +814,7 @@ inline const RowFormatter::Ptr& Statement::getRowFormatter()
} }
inline void swap(Statement& s1, Statement& s2) inline void swap(Statement& s1, Statement& s2) noexcept
{ {
s1.swap(s2); s1.swap(s2);
} }

View File

@@ -53,7 +53,7 @@ public:
StatementCreator& operator = (StatementCreator&& other) noexcept; StatementCreator& operator = (StatementCreator&& other) noexcept;
/// Assignment operator. /// Assignment operator.
void swap(StatementCreator& other); void swap(StatementCreator& other) noexcept;
/// Swaps the StatementCreator with another one. /// Swaps the StatementCreator with another one.
template <typename T> template <typename T>

View File

@@ -92,7 +92,7 @@ MetaColumn& MetaColumn::operator = (MetaColumn&& other) noexcept
} }
void MetaColumn::swap(MetaColumn& other) void MetaColumn::swap(MetaColumn& other) noexcept
{ {
std::swap(_name, other._name); std::swap(_name, other._name);
std::swap(_length, other._length); std::swap(_length, other._length);

View File

@@ -67,7 +67,7 @@ RowIterator& RowIterator::operator = (RowIterator&& other) noexcept
} }
void RowIterator::swap(RowIterator& other) void RowIterator::swap(RowIterator& other) noexcept
{ {
using std::swap; using std::swap;

View File

@@ -49,7 +49,7 @@ SimpleRowFormatter& SimpleRowFormatter::operator = (const SimpleRowFormatter& ro
} }
void SimpleRowFormatter::swap(SimpleRowFormatter& other) void SimpleRowFormatter::swap(SimpleRowFormatter& other) noexcept
{ {
using std::swap; using std::swap;

View File

@@ -89,7 +89,7 @@ Statement& Statement::operator = (Statement&& stmt) noexcept
return *this; return *this;
} }
void Statement::swap(Statement& other) void Statement::swap(Statement& other) noexcept
{ {
using std::swap; using std::swap;

View File

@@ -57,7 +57,7 @@ StatementCreator& StatementCreator::operator = (StatementCreator&& other) noexce
return *this; return *this;
} }
void StatementCreator::swap(StatementCreator& other) void StatementCreator::swap(StatementCreator& other) noexcept
{ {
using std::swap; using std::swap;
swap(_ptrImpl, other._ptrImpl); swap(_ptrImpl, other._ptrImpl);

View File

@@ -106,7 +106,7 @@ public:
return *this; return *this;
} }
void swap(ActiveMethod& other) void swap(ActiveMethod& other) noexcept
{ {
std::swap(_pOwner, other._pOwner); std::swap(_pOwner, other._pOwner);
std::swap(_method, other._method); std::swap(_method, other._method);
@@ -198,7 +198,7 @@ public:
return *this; return *this;
} }
void swap(ActiveMethod& other) void swap(ActiveMethod& other) noexcept
{ {
std::swap(_pOwner, other._pOwner); std::swap(_pOwner, other._pOwner);
std::swap(_method, other._method); std::swap(_method, other._method);

View File

@@ -269,7 +269,7 @@ public:
return *this; return *this;
} }
void swap(ActiveResult& result) void swap(ActiveResult& result) noexcept
{ {
using std::swap; using std::swap;
swap(_pHolder, result._pHolder); swap(_pHolder, result._pHolder);
@@ -407,7 +407,7 @@ public:
return *this; return *this;
} }
void swap(ActiveResult& result) void swap(ActiveResult& result) noexcept
{ {
using std::swap; using std::swap;
swap(_pHolder, result._pHolder); swap(_pHolder, result._pHolder);

View File

@@ -23,6 +23,9 @@
#include <cstring> #include <cstring>
#define poco_any_assert(cond) do { if (!(cond)) std::abort(); } while (0)
namespace Poco { namespace Poco {
class Any; class Any;
@@ -56,6 +59,9 @@ union Placeholder
/// (i.e. there will be no heap-allocation). The local buffer size is one byte /// (i.e. there will be no heap-allocation). The local buffer size is one byte
/// larger - [POCO_SMALL_OBJECT_SIZE + 1], additional byte value indicating /// larger - [POCO_SMALL_OBJECT_SIZE + 1], additional byte value indicating
/// where the object was allocated (0 => heap, 1 => local). /// where the object was allocated (0 => heap, 1 => local).
///
/// Important: for SOO builds, only same-type (or trivial both-empty no-op)
/// swap operation is allowed.
{ {
public: public:
struct Size struct Size
@@ -80,12 +86,10 @@ public:
destruct(false); destruct(false);
} }
void swap(Placeholder& other) void swap(Placeholder& other) noexcept
{ {
if (!isLocal() && !other.isLocal()) if (!isEmpty() || !other.isEmpty())
std::swap(pHolder, other.pHolder); std::swap(holder, other.holder);
else
throw Poco::InvalidAccessException("Placeholder::swap()");
} }
void erase() void erase()
@@ -167,7 +171,7 @@ private:
delete pHolder; delete pHolder;
} }
void swap(Placeholder& other) void swap(Placeholder& other) noexcept
{ {
std::swap(pHolder, other.pHolder); std::swap(pHolder, other.pHolder);
} }
@@ -207,7 +211,7 @@ private:
class Any class Any
/// An Any class represents a general type and is capable of storing any type, supporting type-safe extraction /// Any class represents a general type and is capable of storing any type, supporting type-safe extraction
/// of the internally stored data. /// of the internally stored data.
/// ///
/// Code taken from the Boost 1.33.1 library. Original copyright by Kevlin Henney. Modified for Poco /// Code taken from the Boost 1.33.1 library. Original copyright by Kevlin Henney. Modified for Poco
@@ -247,12 +251,11 @@ public:
{ {
} }
Any& swap(Any& other) Any& swap(Any& other) noexcept
/// Swaps the content of the two Anys. /// Swaps the content of the two Anys.
/// ///
/// When small object optimization is enabled, swap only /// If an exception occurs during swapping, the program
/// has no-throw guarantee when both (*this and other) /// execution is aborted.
/// objects are allocated on the heap.
{ {
if (this == &other) return *this; if (this == &other) return *this;
@@ -262,16 +265,15 @@ public:
} }
else else
{ {
Any tmp(*this);
try try
{ {
Any tmp(*this);
construct(other); construct(other);
other = tmp; other = tmp;
} }
catch (...) catch (...)
{ {
construct(tmp); std::abort();
throw;
} }
} }
@@ -307,7 +309,7 @@ public:
return _valueHolder.isEmpty(); return _valueHolder.isEmpty();
} }
const std::type_info & type() const const std::type_info& type() const
/// Returns the type information of the stored content. /// Returns the type information of the stored content.
/// If the Any is empty typeid(void) is returned. /// If the Any is empty typeid(void) is returned.
/// It is recommended to always query an Any for its type info before /// It is recommended to always query an Any for its type info before
@@ -316,6 +318,14 @@ public:
return empty() ? typeid(void) : content()->type(); return empty() ? typeid(void) : content()->type();
} }
bool local() const
/// Returns true if data is held locally (ie. not allocated on the heap).
/// If POCO_NO_SOO is defined, it always return false.
/// The main purpose of this function is use for testing.
{
return _valueHolder.isLocal();
}
private: private:
class ValueHolder class ValueHolder
{ {
@@ -334,7 +344,7 @@ private:
{ {
} }
virtual const std::type_info & type() const virtual const std::type_info& type() const
{ {
return typeid(ValueType); return typeid(ValueType);
} }

View File

@@ -159,7 +159,7 @@ public:
enum { static_size = N }; enum { static_size = N };
void swap (Array<T,N>& y) void swap (Array<T,N>& y) noexcept
{ {
std::swap_ranges(begin(),end(),y.begin()); std::swap_ranges(begin(),end(),y.begin());
} }
@@ -246,7 +246,7 @@ bool operator>= (const Array<T,N>& x, const Array<T,N>& y)
template<class T, std::size_t N> template<class T, std::size_t N>
inline void swap (Array<T,N>& x, Array<T,N>& y) inline void swap (Array<T,N>& x, Array<T,N>& y) noexcept
/// global swap() /// global swap()
{ {
x.swap(y); x.swap(y);

View File

@@ -194,7 +194,7 @@ public:
return assign<Other>(ptr); return assign<Other>(ptr);
} }
void swap(AutoPtr& ptr) void swap(AutoPtr& ptr) noexcept
{ {
std::swap(_ptr, ptr._ptr); std::swap(_ptr, ptr._ptr);
} }
@@ -398,7 +398,7 @@ private:
template <class C> template <class C>
inline void swap(AutoPtr<C>& p1, AutoPtr<C>& p2) inline void swap(AutoPtr<C>& p1, AutoPtr<C>& p2) noexcept
{ {
p1.swap(p2); p1.swap(p2);
} }

View File

@@ -248,7 +248,7 @@ public:
return _capacity * sizeof(T); return _capacity * sizeof(T);
} }
void swap(Buffer& other) void swap(Buffer& other) noexcept
/// Swaps the buffer with another one. /// Swaps the buffer with another one.
{ {
using std::swap; using std::swap;

View File

@@ -67,7 +67,7 @@ public:
Clock& operator = (const Clock& other); Clock& operator = (const Clock& other);
Clock& operator = (ClockVal tv); Clock& operator = (ClockVal tv);
void swap(Clock& clock); void swap(Clock& clock) noexcept;
/// Swaps the Clock with another one. /// Swaps the Clock with another one.
void update(); void update();
@@ -220,7 +220,7 @@ inline Clock::ClockDiff Clock::resolution()
} }
inline void swap(Clock& s1, Clock& s2) inline void swap(Clock& s1, Clock& s2) noexcept
{ {
s1.swap(s2); s1.swap(s2);
} }

View File

@@ -79,7 +79,7 @@
// while those smaller will be placement new-ed into an // while those smaller will be placement new-ed into an
// internal stack-auto-allocated buffer. // internal stack-auto-allocated buffer.
#if !defined(POCO_SMALL_OBJECT_SIZE) #if !defined(POCO_SMALL_OBJECT_SIZE)
#define POCO_SMALL_OBJECT_SIZE 32 #define POCO_SMALL_OBJECT_SIZE 64
#endif #endif

View File

@@ -149,7 +149,7 @@ public:
/// ///
/// Throws an InvalidArgumentException if an argument date is out of range. /// Throws an InvalidArgumentException if an argument date is out of range.
void swap(DateTime& dateTime); void swap(DateTime& dateTime) noexcept;
/// Swaps the DateTime with another one. /// Swaps the DateTime with another one.
int year() const; int year() const;
@@ -431,7 +431,7 @@ inline bool DateTime::isLeapYear(int year)
} }
inline void swap(DateTime& d1, DateTime& d2) inline void swap(DateTime& d1, DateTime& d2) noexcept
{ {
d1.swap(d2); d1.swap(d2);
} }

View File

@@ -67,7 +67,7 @@ public:
{ {
} }
Pair& swap(Pair& other) Pair& swap(Pair& other) noexcept
/// Swaps the content of the two Pairs. /// Swaps the content of the two Pairs.
{ {
std::swap(_data, other._data); std::swap(_data, other._data);

View File

@@ -173,7 +173,7 @@ public:
_data.clear(); _data.clear();
} }
inline void swap(Struct& other) inline void swap(Struct& other) noexcept
/// Swap content of Struct with another Struct /// Swap content of Struct with another Struct
{ {
_data.swap(other._data); _data.swap(other._data);

View File

@@ -103,7 +103,7 @@ public:
File& operator = (const Path& path); File& operator = (const Path& path);
/// Assignment operator. /// Assignment operator.
void swap(File& file); void swap(File& file) noexcept;
/// Swaps the file with another one. /// Swaps the file with another one.
const std::string& path() const; const std::string& path() const;
@@ -312,7 +312,7 @@ inline bool File::operator >= (const File& file) const
} }
inline void swap(File& f1, File& f2) inline void swap(File& f1, File& f2) noexcept
{ {
f1.swap(f2); f1.swap(f2);
} }

View File

@@ -120,7 +120,7 @@ public:
return *this; return *this;
} }
void swap(HashMap& map) void swap(HashMap& map) noexcept
/// Swaps the HashMap with another one. /// Swaps the HashMap with another one.
{ {
_table.swap(map._table); _table.swap(map._table);

View File

@@ -74,7 +74,7 @@ public:
return *this; return *this;
} }
void swap(HashSet& set) void swap(HashSet& set) noexcept
/// Swaps the HashSet with another one. /// Swaps the HashSet with another one.
{ {
_table.swap(set._table); _table.swap(set._table);

View File

@@ -98,7 +98,7 @@ public:
return *this; return *this;
} }
void swap(ConstIterator& it) void swap(ConstIterator& it) noexcept
{ {
using std::swap; using std::swap;
// uninitialized iterators crash when swapped // uninitialized iterators crash when swapped
@@ -192,7 +192,7 @@ public:
return *this; return *this;
} }
void swap(Iterator& it) void swap(Iterator& it) noexcept
{ {
ConstIterator::swap(it); ConstIterator::swap(it);
} }
@@ -265,7 +265,7 @@ public:
return *this; return *this;
} }
void swap(LinearHashTable& table) void swap(LinearHashTable& table) noexcept
/// Swaps the LinearHashTable with another one. /// Swaps the LinearHashTable with another one.
{ {
using std::swap; using std::swap;

View File

@@ -87,7 +87,7 @@ public:
return *this; return *this;
} }
void swap(ListMap& map) void swap(ListMap& map) noexcept
/// Swaps the ListMap with another one. /// Swaps the ListMap with another one.
{ {
_container.swap(map._container); _container.swap(map._container);

View File

@@ -376,7 +376,7 @@ inline void LocalDateTime::adjustForTzd()
} }
inline void swap(LocalDateTime& d1, LocalDateTime& d2) inline void swap(LocalDateTime& d1, LocalDateTime& d2) noexcept
{ {
d1.swap(d2); d1.swap(d2);
} }

View File

@@ -277,7 +277,7 @@ inline int Message::getSourceLine() const
} }
inline void swap(Message& m1, Message& m2) inline void swap(Message& m1, Message& m2) noexcept
{ {
m1.swap(m2); m1.swap(m2);
} }

View File

@@ -177,7 +177,7 @@ public:
return *this; return *this;
} }
void swap(Nullable& other) void swap(Nullable& other) noexcept
/// Swaps this Nullable with other. /// Swaps this Nullable with other.
{ {
std::swap(_value, other._value); std::swap(_value, other._value);
@@ -310,7 +310,7 @@ private:
template <typename C> template <typename C>
inline void swap(Nullable<C>& n1, Nullable<C>& n2) inline void swap(Nullable<C>& n1, Nullable<C>& n2) noexcept
{ {
n1.swap(n2); n1.swap(n2);
} }

View File

@@ -141,7 +141,7 @@ public:
return *this; return *this;
} }
void swap(Optional& other) void swap(Optional& other) noexcept
{ {
std::swap(_value, other._value); std::swap(_value, other._value);
std::swap(_isSpecified, other._isSpecified); std::swap(_isSpecified, other._isSpecified);
@@ -185,7 +185,7 @@ private:
template <typename C> template <typename C>
inline void swap(Optional<C>& n1, Optional<C>& n2) inline void swap(Optional<C>& n1, Optional<C>& n2) noexcept
{ {
n1.swap(n2); n1.swap(n2);
} }

View File

@@ -102,7 +102,7 @@ public:
Path& operator = (const char* path); Path& operator = (const char* path);
/// Assigns a string containing a path in native format. /// Assigns a string containing a path in native format.
void swap(Path& path); void swap(Path& path) noexcept;
/// Swaps the path with another one. /// Swaps the path with another one.
Path& assign(const std::string& path); Path& assign(const std::string& path);
@@ -495,7 +495,7 @@ inline char Path::pathSeparator()
} }
inline void swap(Path& p1, Path& p2) inline void swap(Path& p1, Path& p2) noexcept
{ {
p1.swap(p2); p1.swap(p2);
} }

View File

@@ -81,7 +81,7 @@ public:
SharedMemory& operator = (const SharedMemory& other); SharedMemory& operator = (const SharedMemory& other);
/// Assigns another SharedMemory object. /// Assigns another SharedMemory object.
void swap(SharedMemory& other); void swap(SharedMemory& other) noexcept;
/// Swaps the SharedMemory object with another one. /// Swaps the SharedMemory object with another one.
char* begin() const; char* begin() const;
@@ -100,7 +100,7 @@ private:
// //
// inlines // inlines
// //
inline void SharedMemory::swap(SharedMemory& other) inline void SharedMemory::swap(SharedMemory& other) noexcept
{ {
using std::swap; using std::swap;
swap(_pImpl, other._pImpl); swap(_pImpl, other._pImpl);

View File

@@ -239,7 +239,7 @@ public:
return assign<Other>(ptr); return assign<Other>(ptr);
} }
void swap(SharedPtr& ptr) void swap(SharedPtr& ptr) noexcept
{ {
std::swap(_ptr, ptr._ptr); std::swap(_ptr, ptr._ptr);
std::swap(_pCounter, ptr._pCounter); std::swap(_pCounter, ptr._pCounter);

View File

@@ -91,7 +91,7 @@ public:
return *this; return *this;
} }
void swap(SimpleHashTable& ht) void swap(SimpleHashTable& ht) noexcept
{ {
using std::swap; using std::swap;
swap(_entries, ht._entries); swap(_entries, ht._entries);

View File

@@ -81,7 +81,7 @@ public:
TextBufferIterator& operator = (const TextBufferIterator& it); TextBufferIterator& operator = (const TextBufferIterator& it);
/// Assignment operator. /// Assignment operator.
void swap(TextBufferIterator& it); void swap(TextBufferIterator& it) noexcept;
/// Swaps the iterator with another one. /// Swaps the iterator with another one.
int operator * () const; int operator * () const;
@@ -127,7 +127,7 @@ inline bool TextBufferIterator::operator != (const TextBufferIterator& it) const
} }
inline void swap(TextBufferIterator& it1, TextBufferIterator& it2) inline void swap(TextBufferIterator& it1, TextBufferIterator& it2) noexcept
{ {
it1.swap(it2); it1.swap(it2);
} }

View File

@@ -77,7 +77,7 @@ public:
TextIterator& operator = (const TextIterator& it); TextIterator& operator = (const TextIterator& it);
/// Assignment operator. /// Assignment operator.
void swap(TextIterator& it); void swap(TextIterator& it) noexcept;
/// Swaps the iterator with another one. /// Swaps the iterator with another one.
int operator * () const; int operator * () const;
@@ -123,7 +123,7 @@ inline bool TextIterator::operator != (const TextIterator& it) const
} }
inline void swap(TextIterator& it1, TextIterator& it2) inline void swap(TextIterator& it1, TextIterator& it2) noexcept
{ {
it1.swap(it2); it1.swap(it2);
} }

View File

@@ -77,7 +77,7 @@ public:
return *this; return *this;
} }
void swap(Timespan& timespan); void swap(Timespan& timespan) noexcept;
/// Swaps the Timespan with another one. /// Swaps the Timespan with another one.
bool operator == (const Timespan& ts) const; bool operator == (const Timespan& ts) const;
@@ -300,7 +300,7 @@ inline bool Timespan::operator <= (TimeDiff microSeconds) const
} }
inline void swap(Timespan& s1, Timespan& s2) inline void swap(Timespan& s1, Timespan& s2) noexcept
{ {
s1.swap(s2); s1.swap(s2);
} }

View File

@@ -77,7 +77,7 @@ public:
Timestamp& operator = (const Timestamp& other); Timestamp& operator = (const Timestamp& other);
Timestamp& operator = (TimeVal tv); Timestamp& operator = (TimeVal tv);
void swap(Timestamp& timestamp); void swap(Timestamp& timestamp) noexcept;
/// Swaps the Timestamp with another one. /// Swaps the Timestamp with another one.
void update(); void update();
@@ -260,7 +260,7 @@ inline Timestamp::TimeDiff Timestamp::resolution()
} }
inline void swap(Timestamp& s1, Timestamp& s2) inline void swap(Timestamp& s1, Timestamp& s2) noexcept
{ {
s1.swap(s2); s1.swap(s2);
} }

View File

@@ -109,7 +109,7 @@ public:
/// Parses and assigns an URI from the given string. Throws a /// Parses and assigns an URI from the given string. Throws a
/// SyntaxException if the uri is not valid. /// SyntaxException if the uri is not valid.
void swap(URI& uri); void swap(URI& uri) noexcept;
/// Swaps the URI with another one. /// Swaps the URI with another one.
void clear(); void clear();
@@ -412,7 +412,7 @@ inline unsigned short URI::getSpecifiedPort() const
} }
inline void swap(URI& u1, URI& u2) inline void swap(URI& u1, URI& u2) noexcept
{ {
u1.swap(u2); u1.swap(u2);
} }

View File

@@ -70,7 +70,7 @@ public:
URIRedirection(const URIRedirection& redir); URIRedirection(const URIRedirection& redir);
URIRedirection& operator = (const URIRedirection& redir); URIRedirection& operator = (const URIRedirection& redir);
void swap(URIRedirection& redir); void swap(URIRedirection& redir) noexcept;
const std::string& uri() const; const std::string& uri() const;
/// Returns the new URI. /// Returns the new URI.

View File

@@ -70,7 +70,7 @@ public:
UUID& operator = (const UUID& uuid); UUID& operator = (const UUID& uuid);
/// Assignment operator. /// Assignment operator.
void swap(UUID& uuid); void swap(UUID& uuid) noexcept;
/// Swaps the UUID with another one. /// Swaps the UUID with another one.
void parse(const std::string& uuid); void parse(const std::string& uuid);
@@ -207,7 +207,7 @@ inline bool UUID::isNull() const
} }
inline void swap(UUID& u1, UUID& u2) inline void swap(UUID& u1, UUID& u2) noexcept
{ {
u1.swap(u2); u1.swap(u2);
} }

View File

@@ -622,7 +622,7 @@ public:
return erase_impl(key, hash); return erase_impl(key, hash);
} }
void swap(ordered_hash& other) { void swap(ordered_hash& other) noexcept {
using std::swap; using std::swap;
swap(static_cast<Hash&>(*this), static_cast<Hash&>(other)); swap(static_cast<Hash&>(*this), static_cast<Hash&>(other));

View File

@@ -400,7 +400,7 @@ public:
void swap(ordered_map& other) { other.m_ht.swap(m_ht); } void swap(ordered_map& other) noexcept { other.m_ht.swap(m_ht); }
/* /*
* Lookup * Lookup

View File

@@ -324,7 +324,7 @@ public:
void swap(ordered_set& other) { other.m_ht.swap(m_ht); } void swap(ordered_set& other) noexcept { other.m_ht.swap(m_ht); }
/* /*
* Lookup * Lookup

View File

@@ -85,7 +85,7 @@ Clock& Clock::operator = (ClockVal tv)
} }
void Clock::swap(Clock& timestamp) void Clock::swap(Clock& timestamp) noexcept
{ {
std::swap(_clock, timestamp._clock); std::swap(_clock, timestamp._clock);
} }

View File

@@ -177,7 +177,7 @@ DateTime& DateTime::assign(int year, int month, int day, int hour, int minute, i
} }
void DateTime::swap(DateTime& dateTime) void DateTime::swap(DateTime& dateTime) noexcept
{ {
std::swap(_utcTime, dateTime._utcTime); std::swap(_utcTime, dateTime._utcTime);
std::swap(_year, dateTime._year); std::swap(_year, dateTime._year);

View File

@@ -93,7 +93,7 @@ File& File::operator = (const Path& path)
} }
void File::swap(File& file) void File::swap(File& file) noexcept
{ {
swapImpl(file); swapImpl(file);
} }

View File

@@ -169,7 +169,7 @@ Path& Path::operator = (const char* path)
} }
void Path::swap(Path& path) void Path::swap(Path& path) noexcept
{ {
std::swap(_node, path._node); std::swap(_node, path._node);
std::swap(_device, path._device); std::swap(_device, path._device);

View File

@@ -86,7 +86,7 @@ TextBufferIterator& TextBufferIterator::operator = (const TextBufferIterator& it
} }
void TextBufferIterator::swap(TextBufferIterator& it) void TextBufferIterator::swap(TextBufferIterator& it) noexcept
{ {
std::swap(_pEncoding, it._pEncoding); std::swap(_pEncoding, it._pEncoding);
std::swap(_it, it._it); std::swap(_it, it._it);

View File

@@ -83,7 +83,7 @@ TextIterator& TextIterator::operator = (const TextIterator& it)
} }
void TextIterator::swap(TextIterator& it) void TextIterator::swap(TextIterator& it) noexcept
{ {
std::swap(_pEncoding, it._pEncoding); std::swap(_pEncoding, it._pEncoding);
std::swap(_it, it._it); std::swap(_it, it._it);

View File

@@ -84,7 +84,7 @@ Timespan& Timespan::assign(long seconds, long microSeconds)
} }
void Timespan::swap(Timespan& timespan) void Timespan::swap(Timespan& timespan) noexcept
{ {
std::swap(_span, timespan._span); std::swap(_span, timespan._span);
} }

View File

@@ -192,7 +192,7 @@ Timestamp& Timestamp::operator = (TimeVal tv)
} }
void Timestamp::swap(Timestamp& timestamp) void Timestamp::swap(Timestamp& timestamp) noexcept
{ {
std::swap(_ts, timestamp._ts); std::swap(_ts, timestamp._ts);
} }

View File

@@ -197,7 +197,7 @@ URI& URI::operator = (const char* uri)
} }
void URI::swap(URI& uri) void URI::swap(URI& uri) noexcept
{ {
std::swap(_scheme, uri._scheme); std::swap(_scheme, uri._scheme);
std::swap(_userInfo, uri._userInfo); std::swap(_userInfo, uri._userInfo);

View File

@@ -49,7 +49,7 @@ URIRedirection& URIRedirection::operator = (const URIRedirection& redir)
} }
void URIRedirection::swap(URIRedirection& redir) void URIRedirection::swap(URIRedirection& redir) noexcept
{ {
std::swap(_uri, redir._uri); std::swap(_uri, redir._uri);
} }

View File

@@ -109,7 +109,7 @@ UUID& UUID::operator = (const UUID& uuid)
} }
void UUID::swap(UUID& uuid) void UUID::swap(UUID& uuid) noexcept
{ {
std::swap(_timeLow, uuid._timeLow); std::swap(_timeLow, uuid._timeLow);
std::swap(_timeMid, uuid._timeMid); std::swap(_timeMid, uuid._timeMid);

View File

@@ -184,8 +184,33 @@ void AnyTest::testAnyBadCast()
void AnyTest::testAnySwap() void AnyTest::testAnySwap()
{ {
Any empty1, empty2;
assertTrue (empty1.empty());
assertTrue (empty2.empty());
empty1.swap(empty2);
assertTrue (empty1.empty());
assertTrue (empty2.empty());
std::string text = "test message"; std::string text = "test message";
empty1 = text;
assertTrue (!empty1.empty());
assertTrue (empty2.empty());
assertTrue (text == AnyCast<std::string>(empty1));
empty1.swap(empty2);
assertTrue (empty1.empty());
assertTrue (!empty2.empty());
assertTrue (text == AnyCast<std::string>(empty2));
Any original = text, swapped; Any original = text, swapped;
#ifdef POCO_NO_SOO
assertFalse (original.local());
#else
assertTrue (original.local());
#endif
assertFalse (original.empty());
assertFalse (swapped.local());
assertTrue (swapped.empty());
std::string* originalPtr = AnyCast<std::string>(&original); std::string* originalPtr = AnyCast<std::string>(&original);
Any* swapResult = &original.swap(swapped); Any* swapResult = &original.swap(swapped);
@@ -194,10 +219,80 @@ void AnyTest::testAnySwap()
assertTrue (swapped.type() == typeid(std::string)); assertTrue (swapped.type() == typeid(std::string));
assertTrue (text == AnyCast<std::string>(swapped)); assertTrue (text == AnyCast<std::string>(swapped));
assertTrue (0 != originalPtr); assertTrue (0 != originalPtr);
#ifdef POCO_NO_SOO // pointers only match when heap-allocated
assertTrue (originalPtr == AnyCast<std::string>(&swapped));
#endif
assertTrue (swapResult == &original); assertTrue (swapResult == &original);
struct BigObject
{
Poco::UInt64 one = 1;
Poco::UInt64 two = 2;
Poco::UInt64 three = 3;
Poco::UInt64 four = 4;
Poco::UInt64 five = 5;
Poco::UInt64 six = 6;
Poco::UInt64 seven = 7;
Poco::UInt64 eight = 8;
Poco::UInt64 nine = 9;
bool operator==(const BigObject& other)
{
return one == other.one &&
two == other.two &&
three == other.three &&
four == other.four &&
five == other.five &&
six == other.six &&
seven == other.seven &&
eight == other.eight &&
nine == other.nine;
}
};
poco_assert (sizeof(BigObject) > POCO_SMALL_OBJECT_SIZE);
BigObject bigObject;
Any bigOriginal = bigObject, swappedBig;
assertFalse (bigOriginal.local());
assertFalse (bigOriginal.empty());
assertFalse (swappedBig.local());
assertTrue (swappedBig.empty());
BigObject* bigPtr = AnyCast<BigObject>(&bigOriginal);
Any* swapBigResult = &bigOriginal.swap(swappedBig);
assertTrue (bigOriginal.empty());
assertTrue (!swappedBig.empty());
assertTrue (swappedBig.type() == typeid(BigObject));
assertTrue (bigObject == AnyCast<BigObject>(swappedBig));
assertTrue (0 != bigPtr);
assertTrue (swapBigResult == &bigOriginal);
// assure proper assignment behavior after swapping
original = text;
bigOriginal = bigObject;
#ifdef POCO_NO_SOO
assertFalse (original.local());
#else
assertTrue (original.local());
#endif
assertFalse (bigOriginal.local());
Any temp = original;
#ifdef POCO_NO_SOO
assertFalse (temp.local());
#else
assertTrue (temp.local());
#endif
original = bigOriginal;
assertTrue (bigObject == AnyCast<BigObject>(original));
assertFalse (original.local());
bigOriginal = temp;
assertTrue (text == AnyCast<std::string>(bigOriginal));
#ifdef POCO_NO_SOO
assertFalse (bigOriginal.local());
#else
assertTrue (bigOriginal.local());
#endif
} }

View File

@@ -316,7 +316,7 @@ void NumberParserTest::testParseError()
try try
{ {
const char test[] = { -23, -108, -103, -24, -81, -81, 0 }; const char test[] = { char(-23), char(-108), char(-103), char(-24), char(-81), char(-81), 0 };
Poco::NumberParser::parse(test); Poco::NumberParser::parse(test);
failmsg("must throw SyntaxException"); failmsg("must throw SyntaxException");
} catch (SyntaxException&) { } } catch (SyntaxException&) { }

View File

@@ -58,7 +58,7 @@ public:
HostEntry& operator = (const HostEntry& entry); HostEntry& operator = (const HostEntry& entry);
/// Assigns another HostEntry. /// Assigns another HostEntry.
void swap(HostEntry& hostEntry); void swap(HostEntry& hostEntry) noexcept;
/// Swaps the HostEntry with another one. /// Swaps the HostEntry with another one.
~HostEntry(); ~HostEntry();
@@ -111,7 +111,7 @@ inline const HostEntry::AddressList& HostEntry::addresses() const
} }
inline void swap(HostEntry& h1, HostEntry& h2) inline void swap(HostEntry& h1, HostEntry& h2) noexcept
{ {
h1.swap(h2); h1.swap(h2);
} }

View File

@@ -59,7 +59,7 @@ public:
MailRecipient& operator = (const MailRecipient& recipient); MailRecipient& operator = (const MailRecipient& recipient);
/// Assigns another recipient. /// Assigns another recipient.
void swap(MailRecipient& recipient); void swap(MailRecipient& recipient) noexcept;
/// Exchanges the content of two recipients. /// Exchanges the content of two recipients.
RecipientType getType() const; RecipientType getType() const;
@@ -108,7 +108,7 @@ inline const std::string& MailRecipient::getRealName() const
} }
inline void swap(MailRecipient& r1, MailRecipient& r2) inline void swap(MailRecipient& r1, MailRecipient& r2) noexcept
{ {
r1.swap(r2); r1.swap(r2);
} }

View File

@@ -59,7 +59,7 @@ public:
MediaType& operator = (const std::string& mediaType); MediaType& operator = (const std::string& mediaType);
/// Assigns another media type. /// Assigns another media type.
void swap(MediaType& mediaType); void swap(MediaType& mediaType) noexcept;
/// Swaps the MediaType with another one. /// Swaps the MediaType with another one.
void setType(const std::string& type); void setType(const std::string& type);
@@ -163,7 +163,7 @@ inline const NameValueCollection& MediaType::parameters() const
} }
inline void swap(MediaType& m1, MediaType& m2) inline void swap(MediaType& m1, MediaType& m2) noexcept
{ {
m1.swap(m2); m1.swap(m2);
} }

View File

@@ -60,7 +60,7 @@ public:
NameValueCollection& operator = (NameValueCollection&& nvc) noexcept; NameValueCollection& operator = (NameValueCollection&& nvc) noexcept;
/// Moves the name-value pairs of another NameValueCollection to this one. /// Moves the name-value pairs of another NameValueCollection to this one.
void swap(NameValueCollection& nvc); void swap(NameValueCollection& nvc) noexcept;
/// Swaps the NameValueCollection with another one. /// Swaps the NameValueCollection with another one.
const std::string& operator [] (const std::string& name) const; const std::string& operator [] (const std::string& name) const;
@@ -120,7 +120,7 @@ private:
// //
// inlines // inlines
// //
inline void swap(NameValueCollection& nvc1, NameValueCollection& nvc2) inline void swap(NameValueCollection& nvc1, NameValueCollection& nvc2) noexcept
{ {
nvc1.swap(nvc2); nvc1.swap(nvc2);
} }

View File

@@ -126,7 +126,7 @@ public:
bool operator == (const NetworkInterface& other) const; bool operator == (const NetworkInterface& other) const;
/// Operator equal. Compares interface indices. /// Operator equal. Compares interface indices.
void swap(NetworkInterface& other); void swap(NetworkInterface& other) noexcept;
/// Swaps the NetworkInterface with another one. /// Swaps the NetworkInterface with another one.
unsigned index() const; unsigned index() const;

View File

@@ -123,7 +123,7 @@ HostEntry& HostEntry::operator = (const HostEntry& entry)
} }
void HostEntry::swap(HostEntry& hostEntry) void HostEntry::swap(HostEntry& hostEntry) noexcept
{ {
std::swap(_name, hostEntry._name); std::swap(_name, hostEntry._name);
std::swap(_aliases, hostEntry._aliases); std::swap(_aliases, hostEntry._aliases);

View File

@@ -65,7 +65,7 @@ MailRecipient& MailRecipient::operator = (const MailRecipient& recipient)
} }
void MailRecipient::swap(MailRecipient& recipient) void MailRecipient::swap(MailRecipient& recipient) noexcept
{ {
std::swap(_type, recipient._type); std::swap(_type, recipient._type);
std::swap(_address, recipient._address); std::swap(_address, recipient._address);

View File

@@ -89,7 +89,7 @@ MediaType& MediaType::operator = (const std::string& mediaType)
} }
void MediaType::swap(MediaType& mediaType) void MediaType::swap(MediaType& mediaType) noexcept
{ {
std::swap(_type, mediaType._type); std::swap(_type, mediaType._type);
std::swap(_subType, mediaType._subType); std::swap(_subType, mediaType._subType);

View File

@@ -63,7 +63,7 @@ NameValueCollection& NameValueCollection::operator = (NameValueCollection&& nvc)
} }
void NameValueCollection::swap(NameValueCollection& nvc) void NameValueCollection::swap(NameValueCollection& nvc) noexcept
{ {
std::swap(_map, nvc._map); std::swap(_map, nvc._map);
} }

View File

@@ -637,7 +637,7 @@ NetworkInterface& NetworkInterface::operator = (const NetworkInterface& interfc)
} }
void NetworkInterface::swap(NetworkInterface& other) void NetworkInterface::swap(NetworkInterface& other) noexcept
{ {
using std::swap; using std::swap;
swap(_pImpl, other._pImpl); swap(_pImpl, other._pImpl);

View File

@@ -85,7 +85,7 @@ public:
X509Certificate& operator = (X509Certificate&& cert) noexcept; X509Certificate& operator = (X509Certificate&& cert) noexcept;
/// Move-assigns a certificate. /// Move-assigns a certificate.
void swap(X509Certificate& cert); void swap(X509Certificate& cert) noexcept;
/// Exchanges the certificate with another one. /// Exchanges the certificate with another one.
~X509Certificate(); ~X509Certificate();

View File

@@ -116,7 +116,7 @@ X509Certificate& X509Certificate::operator = (X509Certificate&& cert) noexcept
} }
void X509Certificate::swap(X509Certificate& cert) void X509Certificate::swap(X509Certificate& cert) noexcept
{ {
using std::swap; using std::swap;
swap(cert._issuerName, _issuerName); swap(cert._issuerName, _issuerName);

View File

@@ -49,21 +49,21 @@ public:
enum Size enum Size
{ {
PAGE_SIZE_LETTER = HPDF_PAGE_SIZE_LETTER, PAGE_SIZE_LETTER = HPDF_PAGE_SIZE_LETTER,
/// 8<> x 11 (Inches), 612 x 792 px /// 8<> x 11 (Inches), 612 x 792 px
PAGE_SIZE_LEGAL = HPDF_PAGE_SIZE_LEGAL, PAGE_SIZE_LEGAL = HPDF_PAGE_SIZE_LEGAL,
/// 8<> x 14 (Inches), 612 x 1008 px /// 8<> x 14 (Inches), 612 x 1008 px
PAGE_SIZE_A3 = HPDF_PAGE_SIZE_A3, PAGE_SIZE_A3 = HPDF_PAGE_SIZE_A3,
/// 297 <20> 420 (mm), 841.89 x 1199.551 px /// 297 <20> 420 (mm), 841.89 x 1199.551 px
PAGE_SIZE_A4 = HPDF_PAGE_SIZE_A4, PAGE_SIZE_A4 = HPDF_PAGE_SIZE_A4,
/// 210 <20> 297 (mm), 595.276 x 841.89 px /// 210 <20> 297 (mm), 595.276 x 841.89 px
PAGE_SIZE_A5 = HPDF_PAGE_SIZE_A5, PAGE_SIZE_A5 = HPDF_PAGE_SIZE_A5,
/// 148 <20> 210 (mm), 419.528 x 595.276 px /// 148 <20> 210 (mm), 419.528 x 595.276 px
PAGE_SIZE_B4 = HPDF_PAGE_SIZE_B4, PAGE_SIZE_B4 = HPDF_PAGE_SIZE_B4,
/// 250 <20> 353 (mm), 708.661 x 1000.63 px /// 250 <20> 353 (mm), 708.661 x 1000.63 px
PAGE_SIZE_B5 = HPDF_PAGE_SIZE_B5, PAGE_SIZE_B5 = HPDF_PAGE_SIZE_B5,
/// 176 <20> 250 (mm), 498.898 x 708.661 px /// 176 <20> 250 (mm), 498.898 x 708.661 px
PAGE_SIZE_EXECUTIVE = HPDF_PAGE_SIZE_EXECUTIVE, PAGE_SIZE_EXECUTIVE = HPDF_PAGE_SIZE_EXECUTIVE,
/// 7<> x 10<31> (Inches), 522 x 756 px /// 7<> x 10<31> (Inches), 522 x 756 px
PAGE_SIZE_US4x6 = HPDF_PAGE_SIZE_US4x6, PAGE_SIZE_US4x6 = HPDF_PAGE_SIZE_US4x6,
/// 4 x 6 (Inches), 288 x 432 px /// 4 x 6 (Inches), 288 x 432 px
PAGE_SIZE_US4x8 = HPDF_PAGE_SIZE_US4x8, PAGE_SIZE_US4x8 = HPDF_PAGE_SIZE_US4x8,
@@ -165,7 +165,7 @@ public:
bool operator == (const Page& other) const; bool operator == (const Page& other) const;
/// Equality operator. /// Equality operator.
void swap(Page& other); void swap(Page& other) noexcept;
/// Swaps this page with another. /// Swaps this page with another.
void setWidth(float value); void setWidth(float value);
@@ -301,19 +301,19 @@ public:
/// Appends a path from the current point to the specified point.. /// Appends a path from the current point to the specified point..
void curveTo(const std::vector<float>& values); void curveTo(const std::vector<float>& values);
/// Appends a B<>zier curve to the current path using two specified points. /// Appends a B<>zier curve to the current path using two specified points.
/// The point (x1, y1) and the point (x2, y2) are used as the control points /// The point (x1, y1) and the point (x2, y2) are used as the control points
/// for a B<>zier curve and current point is moved to the point (x3, y3) /// for a B<>zier curve and current point is moved to the point (x3, y3)
void curveToRight(float x2, float y2, float x3, float y3); void curveToRight(float x2, float y2, float x3, float y3);
/// Appends a B<>zier curve to the right of the current point using two specified points. /// Appends a B<>zier curve to the right of the current point using two specified points.
/// The current point and the point (x2, y2) are used as the control points /// The current point and the point (x2, y2) are used as the control points
/// for a B<>zier curve and current point is moved to the point (x3, y3) /// for a B<>zier curve and current point is moved to the point (x3, y3)
void curveToLeft(float x2, float y2, float x3, float y3); void curveToLeft(float x2, float y2, float x3, float y3);
/// Appends a B<>zier curve to the left of the current point using two specified points. /// Appends a B<>zier curve to the left of the current point using two specified points.
/// The current point and the point (x2, y2) are used as the control points /// The current point and the point (x2, y2) are used as the control points
/// for a B<>zier curve and current point is moved to the point (x3, y3) /// for a B<>zier curve and current point is moved to the point (x3, y3)
void closePath(); void closePath();
/// Appends a straight line from the current point to the start point of sub path. /// Appends a straight line from the current point to the start point of sub path.

View File

@@ -74,7 +74,7 @@ public:
return _pPDF == other._pPDF && _resource == other._resource; return _pPDF == other._pPDF && _resource == other._resource;
} }
void swap(Resource& other) void swap(Resource& other) noexcept
{ {
using std::swap; using std::swap;

View File

@@ -67,7 +67,7 @@ bool Page::operator == (const Page& other) const
} }
void Page::swap(Page& other) void Page::swap(Page& other) noexcept
{ {
using std::swap; using std::swap;

View File

@@ -62,7 +62,7 @@ public:
ArchiveEntry& operator = (const ArchiveEntry& entry); ArchiveEntry& operator = (const ArchiveEntry& entry);
/// Assignment operator. /// Assignment operator.
void swap(ArchiveEntry& entry); void swap(ArchiveEntry& entry) noexcept;
/// Swaps the entry with another one. /// Swaps the entry with another one.
EntryType type() const; EntryType type() const;

View File

@@ -65,7 +65,7 @@ ArchiveEntry& ArchiveEntry::operator = (const ArchiveEntry& entry)
} }
void ArchiveEntry::swap(ArchiveEntry& entry) void ArchiveEntry::swap(ArchiveEntry& entry) noexcept
{ {
std::swap(_type, entry._type); std::swap(_type, entry._type);
std::swap(_path, entry._path); std::swap(_path, entry._path);

View File

@@ -91,7 +91,7 @@ public:
Option& operator = (const Option& option); Option& operator = (const Option& option);
/// Assignment operator. /// Assignment operator.
void swap(Option& option); void swap(Option& option) noexcept;
/// Swaps the option with another one. /// Swaps the option with another one.
Option& shortName(const std::string& name); Option& shortName(const std::string& name);

View File

@@ -113,7 +113,7 @@ Option& Option::operator = (const Option& option)
} }
void Option::swap(Option& option) void Option::swap(Option& option) noexcept
{ {
std::swap(_shortName, option._shortName); std::swap(_shortName, option._shortName);
std::swap(_fullName, option._fullName); std::swap(_fullName, option._fullName);

View File

@@ -59,7 +59,7 @@ public:
Name& operator = (Name&& name) noexcept; Name& operator = (Name&& name) noexcept;
/// Move assignment. /// Move assignment.
void swap(Name& name); void swap(Name& name) noexcept;
/// Swaps the name with another one. /// Swaps the name with another one.
void assign(const XMLString& qname); void assign(const XMLString& qname);
@@ -132,7 +132,7 @@ inline const XMLString& Name::localName() const
} }
inline void swap(Name& n1, Name& n2) inline void swap(Name& n1, Name& n2) noexcept
{ {
n1.swap(n2); n1.swap(n2);
} }

View File

@@ -47,7 +47,7 @@ public:
QName& operator = (const QName& qname); QName& operator = (const QName& qname);
QName& operator = (QName&& qname) noexcept; QName& operator = (QName&& qname) noexcept;
void swap(QName& qname); void swap(QName& qname) noexcept;
const std::string& namespaceURI() const; const std::string& namespaceURI() const;
/// Returns the namespace URI part of the name. /// Returns the namespace URI part of the name.

View File

@@ -93,7 +93,7 @@ Name& Name::operator = (Name&& name) noexcept
} }
void Name::swap(Name& name) void Name::swap(Name& name) noexcept
{ {
std::swap(_qname, name._qname); std::swap(_qname, name._qname);
std::swap(_namespaceURI, name._namespaceURI); std::swap(_namespaceURI, name._namespaceURI);

View File

@@ -83,7 +83,7 @@ QName& QName::operator = (QName&& qname) noexcept
} }
void QName::swap(QName& qname) void QName::swap(QName& qname) noexcept
{ {
std::swap(_ns, qname._ns); std::swap(_ns, qname._ns);
std::swap(_name, qname._name); std::swap(_name, qname._name);

View File

@@ -43,7 +43,7 @@ SHAREDLIBLINKEXT = .so
CFLAGS = -std=c11 $(ARCHFLAGS) CFLAGS = -std=c11 $(ARCHFLAGS)
CFLAGS32 = CFLAGS32 =
CFLAGS64 = CFLAGS64 =
CXXFLAGS = -std=c++14 -Wall -Wno-sign-compare $(ARCHFLAGS) CXXFLAGS = -std=c++14 -Wall -Wno-sign-compare -Wno-psabi $(ARCHFLAGS)
CXXFLAGS32 = CXXFLAGS32 =
CXXFLAGS64 = CXXFLAGS64 =
LINKFLAGS = LINKFLAGS =