mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
chore(Poco): Resolve a lot of warnings, reported by g++ 13.
This commit is contained in:
parent
88c4958032
commit
c038b52f36
@ -575,11 +575,11 @@ private:
|
||||
getColumnOrParameterSize(pos, size);
|
||||
poco_assert (size > 0);
|
||||
|
||||
if (size == _maxFieldSize)
|
||||
if (static_cast<std::size_t>(size) == _maxFieldSize)
|
||||
{
|
||||
getMinValueSize(*pVal, size);
|
||||
// accommodate for terminating zero
|
||||
if (size != _maxFieldSize) ++size;
|
||||
if (static_cast<std::size_t>(size) != _maxFieldSize) ++size;
|
||||
}
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
@ -601,7 +601,7 @@ private:
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
strSize = it->size();
|
||||
if (strSize > size)
|
||||
if (strSize > static_cast<std::size_t>(size))
|
||||
{
|
||||
if (transcodeRequired()) delete pVal;
|
||||
throw LengthExceededException(Poco::format("SQLBindParameter(%s)", typeID));
|
||||
@ -646,11 +646,11 @@ private:
|
||||
getColumnOrParameterSize(pos, size);
|
||||
poco_assert(size > 0);
|
||||
|
||||
if (size == _maxFieldSize)
|
||||
if (static_cast<std::size_t>(size) == _maxFieldSize)
|
||||
{
|
||||
getMinValueSize(val, size);
|
||||
// accomodate for terminating zero
|
||||
if (size != _maxFieldSize) size += sizeof(UTF16Char);
|
||||
if (static_cast<std::size_t>(size) != _maxFieldSize) size += sizeof(UTF16Char);
|
||||
}
|
||||
|
||||
if (_vecLengthIndicator.size() <= pos)
|
||||
@ -672,7 +672,7 @@ private:
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
strSize = it->size() * sizeof(UTF16Char);
|
||||
if (strSize > size)
|
||||
if (strSize > static_cast<std::size_t>(size))
|
||||
throw LengthExceededException("ODBC::Binder::bindImplContainerUTF16String:SQLBindParameter(std::vector<UTF16String>)");
|
||||
std::memcpy(pBuf + offset, it->data(), strSize);
|
||||
offset += size;
|
||||
@ -742,7 +742,7 @@ private:
|
||||
for (; cIt != cEnd; ++cIt)
|
||||
{
|
||||
blobSize = cIt->size();
|
||||
if (blobSize > size)
|
||||
if (blobSize > static_cast<std::size_t>(size))
|
||||
throw LengthExceededException("ODBC::Binder::bindImplContainerLOB():SQLBindParameter(std::vector<BLOB>)");
|
||||
std::memcpy(_charPtrs[pos] + offset, cIt->rawContent(), blobSize * sizeof(CharType));
|
||||
offset += size;
|
||||
|
@ -526,7 +526,7 @@ void Binder::getColSizeAndPrecision(std::size_t pos,
|
||||
else foundSize = _pTypeInfo->tryGetInfo(sqlDataType, "COLUMN_SIZE", tmp);
|
||||
if (foundSize) colSize = tmp;
|
||||
|
||||
if (actualSize > colSize)
|
||||
if (actualSize > static_cast<std::size_t>(colSize))
|
||||
{
|
||||
throw LengthExceededException(Poco::format("ODBC::Binder::getColSizeAndPrecision();%d: Error binding column %z size=%z, max size=%ld)",
|
||||
__LINE__, pos, actualSize, static_cast<long>(colSize)));
|
||||
|
@ -171,7 +171,7 @@ public:
|
||||
C5 dateTimes(size);
|
||||
C6 bools;
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
for (Poco::UInt32 i = 0; i < size; ++i)
|
||||
{
|
||||
ints.push_back(i);
|
||||
strings.push_back(std::string("xyz" + Poco::NumberFormatter::format(i)));
|
||||
@ -313,7 +313,7 @@ public:
|
||||
C4 floats;
|
||||
C5 dateTimes(size);
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
for (Poco::UInt32 i = 0; i < size; ++i)
|
||||
{
|
||||
ints.push_back(i);
|
||||
strings.push_back(std::string("xyz" + Poco::NumberFormatter::format(i)));
|
||||
|
@ -403,19 +403,19 @@ public:
|
||||
/// to start iteration from beginning or end,
|
||||
/// depending on the position requested.
|
||||
{
|
||||
if (row <= (std::size_t) (_pData->size() / 2))
|
||||
if (row <= (_pData->size() / 2))
|
||||
{
|
||||
Iterator it = _pData->begin();
|
||||
Iterator end = _pData->end();
|
||||
for (int i = 0; it != end; ++it, ++i)
|
||||
for (std::size_t i = 0; it != end; ++it, ++i)
|
||||
if (i == row) return *it;
|
||||
}
|
||||
else
|
||||
{
|
||||
row = _pData->size() - row;
|
||||
RIterator it = _pData->rbegin();
|
||||
RIterator end = _pData->rend();
|
||||
for (int i = 1; it != end; ++it, ++i)
|
||||
const RIterator end = _pData->rend();
|
||||
for (std::size_t i = 1; it != end; ++it, ++i)
|
||||
if (i == row) return *it;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ private:
|
||||
{
|
||||
poco_assert (bufferSize > 0);
|
||||
|
||||
if (bufferSize > rangeLength)
|
||||
if (bufferSize > static_cast<std::size_t>(rangeLength))
|
||||
bufferSize = rangeLength;
|
||||
|
||||
Buffer<char> buffer(bufferSize);
|
||||
@ -153,8 +153,9 @@ private:
|
||||
ostr.write(buffer.begin(), n);
|
||||
if ((len < rangeLength) && istr && ostr)
|
||||
{
|
||||
if (bufferSize > (rangeLength - len))
|
||||
bufferSize = rangeLength - len;
|
||||
const std::size_t inputLen = rangeLength - len;
|
||||
if (bufferSize > inputLen)
|
||||
bufferSize = inputLen;
|
||||
istr.read(buffer.begin(), bufferSize);
|
||||
n = istr.gcount();
|
||||
}
|
||||
@ -211,7 +212,7 @@ private:
|
||||
{
|
||||
istr.seekg(rangeStart, std::ios_base::beg);
|
||||
istr.get(c);
|
||||
while (istr && ostr && (len < rangeLength))
|
||||
while (istr && ostr && (static_cast<std::streamsize>(len) < rangeLength))
|
||||
{
|
||||
ostr.put(c);
|
||||
++len;
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
/// startInterval expires.
|
||||
/// To start the timer, call the Start() method.
|
||||
|
||||
virtual ~Timer();
|
||||
~Timer() override;
|
||||
/// Stops and destroys the timer.
|
||||
|
||||
void start(const AbstractTimerCallback& method);
|
||||
@ -138,7 +138,7 @@ public:
|
||||
/// longer to execute than the timer interval.
|
||||
|
||||
protected:
|
||||
void run();
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
long _startInterval;
|
||||
@ -181,19 +181,19 @@ class TimerCallback: public AbstractTimerCallback
|
||||
/// to use this template class.
|
||||
{
|
||||
public:
|
||||
typedef void (C::*Callback)(Timer&);
|
||||
using Callback = void (C::*)(Timer &);
|
||||
|
||||
TimerCallback() = delete;
|
||||
|
||||
TimerCallback(C& object, Callback method): _pObject(&object), _method(method)
|
||||
{
|
||||
}
|
||||
|
||||
TimerCallback(const TimerCallback& callback): _pObject(callback._pObject), _method(callback._method)
|
||||
TimerCallback(const TimerCallback& callback): AbstractTimerCallback(callback), _pObject(callback._pObject), _method(callback._method)
|
||||
{
|
||||
}
|
||||
|
||||
~TimerCallback()
|
||||
{
|
||||
}
|
||||
~TimerCallback() override = default;
|
||||
|
||||
TimerCallback& operator = (const TimerCallback& callback)
|
||||
{
|
||||
@ -205,19 +205,17 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
void invoke(Timer& timer) const
|
||||
void invoke(Timer& timer) const override
|
||||
{
|
||||
(_pObject->*_method)(timer);
|
||||
}
|
||||
|
||||
AbstractTimerCallback* clone() const
|
||||
AbstractTimerCallback* clone() const override
|
||||
{
|
||||
return new TimerCallback(*this);
|
||||
}
|
||||
|
||||
private:
|
||||
TimerCallback();
|
||||
|
||||
C* _pObject;
|
||||
Callback _method;
|
||||
};
|
||||
|
@ -54,9 +54,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~DirectoryWatcherStrategy()
|
||||
{
|
||||
}
|
||||
virtual ~DirectoryWatcherStrategy() = default;
|
||||
|
||||
DirectoryWatcherStrategy() = delete;
|
||||
DirectoryWatcherStrategy(const DirectoryWatcherStrategy&) = delete;
|
||||
DirectoryWatcherStrategy& operator = (const DirectoryWatcherStrategy&) = delete;
|
||||
|
||||
DirectoryWatcher& owner()
|
||||
{
|
||||
@ -75,12 +77,11 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
ItemInfo(const ItemInfo& other):
|
||||
path(other.path),
|
||||
size(other.size),
|
||||
lastModified(other.lastModified)
|
||||
{
|
||||
}
|
||||
ItemInfo(const ItemInfo& other) = default;
|
||||
ItemInfo& operator=(const ItemInfo& ) = default;
|
||||
|
||||
ItemInfo(ItemInfo&& other) = default;
|
||||
ItemInfo& operator=(ItemInfo&& ) = default;
|
||||
|
||||
explicit ItemInfo(const File& f):
|
||||
path(f.path()),
|
||||
@ -93,12 +94,12 @@ protected:
|
||||
File::FileSize size;
|
||||
Timestamp lastModified;
|
||||
};
|
||||
typedef std::map<std::string, ItemInfo> ItemInfoMap;
|
||||
using ItemInfoMap = std::map<std::string, ItemInfo>;
|
||||
|
||||
void scan(ItemInfoMap& entries)
|
||||
{
|
||||
DirectoryIterator it(owner().directory());
|
||||
DirectoryIterator end;
|
||||
const DirectoryIterator end;
|
||||
while (it != end)
|
||||
{
|
||||
entries[it.path().getFileName()] = ItemInfo(*it);
|
||||
@ -110,14 +111,14 @@ protected:
|
||||
{
|
||||
for (auto& np: newEntries)
|
||||
{
|
||||
ItemInfoMap::iterator ito = oldEntries.find(np.first);
|
||||
const auto ito = oldEntries.find(np.first);
|
||||
if (ito != oldEntries.end())
|
||||
{
|
||||
if ((owner().eventMask() & DirectoryWatcher::DW_ITEM_MODIFIED) && !owner().eventsSuspended())
|
||||
{
|
||||
if (np.second.size != ito->second.size || np.second.lastModified != ito->second.lastModified)
|
||||
{
|
||||
Poco::File f(np.second.path);
|
||||
const Poco::File f(np.second.path);
|
||||
DirectoryWatcher::DirectoryEvent ev(f, DirectoryWatcher::DW_ITEM_MODIFIED);
|
||||
owner().itemModified(&owner(), ev);
|
||||
}
|
||||
@ -143,10 +144,6 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
DirectoryWatcherStrategy();
|
||||
DirectoryWatcherStrategy(const DirectoryWatcherStrategy&);
|
||||
DirectoryWatcherStrategy& operator = (const DirectoryWatcherStrategy&);
|
||||
|
||||
DirectoryWatcher& _owner;
|
||||
};
|
||||
|
||||
|
@ -518,8 +518,6 @@ X509* SecureSocketImpl::peerCertificate() const
|
||||
{
|
||||
LockT l(_mutex);
|
||||
|
||||
X509* pCert = nullptr;
|
||||
|
||||
if (_pSSL)
|
||||
return ::SSL_get_peer_certificate(_pSSL);
|
||||
else
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
/// _fileName is used. If member variable is empty string,
|
||||
/// document is saved to the memory stream.
|
||||
|
||||
const DataPtr data(SizeType& sz);
|
||||
DataPtr data(SizeType& sz);
|
||||
/// Returns the document content as raw data and data size in
|
||||
/// the sz argument.
|
||||
|
||||
|
@ -85,7 +85,7 @@ void Document::save(const std::string fileName)
|
||||
}
|
||||
|
||||
|
||||
const Document::DataPtr Document::data(SizeType& sz)
|
||||
Document::DataPtr Document::data(SizeType& sz)
|
||||
{
|
||||
sz = size();
|
||||
delete _pRawData;
|
||||
|
@ -47,6 +47,9 @@ public:
|
||||
virtual ~Array();
|
||||
/// Destroys the Array.
|
||||
|
||||
Array& operator=(const Array&) = default;
|
||||
Array& operator=(Array&&) = default;
|
||||
|
||||
template<typename T>
|
||||
Array& operator<<(const T& arg)
|
||||
/// Adds the argument to the array.
|
||||
@ -126,7 +129,7 @@ public:
|
||||
RedisType::Ptr element = _elements.value().at(pos);
|
||||
if ( RedisTypeTraits<T>::TypeId == element->type() )
|
||||
{
|
||||
Type<T>* concrete = dynamic_cast<Type<T>* >(element.get());
|
||||
auto* concrete = dynamic_cast<Type<T>* >(element.get());
|
||||
if ( concrete != NULL ) return concrete->value();
|
||||
}
|
||||
throw BadCastException();
|
||||
@ -296,7 +299,7 @@ struct RedisTypeTraits<Array>
|
||||
{
|
||||
value.clear();
|
||||
|
||||
Int64 length = NumberParser::parse64(input.getline());
|
||||
const Int64 length = NumberParser::parse64(input.getline());
|
||||
|
||||
if ( length != -1 )
|
||||
{
|
||||
@ -316,7 +319,8 @@ struct RedisTypeTraits<Array>
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Redis
|
||||
} // namespace Redis
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Redis_Array_INCLUDED
|
||||
|
@ -57,9 +57,12 @@ public:
|
||||
Command(const Command& copy);
|
||||
/// Creates a command by copying another one.
|
||||
|
||||
virtual ~Command();
|
||||
~Command() override;
|
||||
/// Destroys the command.
|
||||
|
||||
Command& operator=(const Command&) = default;
|
||||
Command& operator=(Command&&) = default;
|
||||
|
||||
static Command append(const std::string& key, const std::string& value);
|
||||
/// Creates and returns an APPEND command.
|
||||
|
||||
@ -282,7 +285,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Redis
|
||||
} // namespace Redis
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Redis_Command_INCLUDED
|
||||
|
@ -223,7 +223,7 @@ Array Client::sendCommands(const std::vector<Array>& commands)
|
||||
}
|
||||
_output->flush();
|
||||
|
||||
for (int i = 0; i < commands.size(); ++i)
|
||||
for (std::size_t i = 0; i < commands.size(); ++i)
|
||||
{
|
||||
results.addRedisType(readReply());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user