fix: MongoDB deleted copy constructor #4187

This commit is contained in:
Aleksandar Fabijanic 2023-10-16 00:47:42 +02:00
parent 5e1904b5f8
commit 22379ff9c1
2 changed files with 6 additions and 11 deletions

View File

@ -117,19 +117,14 @@ public:
}
// Disable copy to prevent unwanted release of resources: C++11 way
PooledConnection(const PooledConnection&) = delete;
PooledConnection& operator=(const PooledConnection&) = delete;
PooledConnection(const PooledConnection&) = delete;
PooledConnection& operator=(const PooledConnection&) = delete;
// Enable move semantics
PooledConnection(PooledConnection&& other) = default;
PooledConnection& operator=(PooledConnection&&) = default;
// Enable move semantics
PooledConnection(PooledConnection&& other) = default;
PooledConnection& operator=(PooledConnection&&) = default;
private:
// Disable copy to prevent unwanted release of resources: pre C++11 way
PooledConnection(const PooledConnection&);
PooledConnection& operator=(const PooledConnection&);
Poco::ObjectPool<Connection, Connection::Ptr>& _pool;
Connection::Ptr _connection;
};

View File

@ -247,7 +247,7 @@ void OpMsgMessage::send(std::ostream& ostr)
wdoc.flush();
const std::string& identifier = commandIdentifier(_commandName);
const Poco::Int32 size = sizeof(size) + identifier.size() + 1 + ssdoc.tellp();
const Poco::Int32 size = static_cast<Poco::Int32>(sizeof(size) + identifier.size() + 1 + ssdoc.tellp());
writer << PAYLOAD_TYPE_1;
writer << size;
writer.writeCString(identifier.c_str());