mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
eliminate VS implicit conversion warnings
This commit is contained in:
@@ -184,7 +184,7 @@ std::string ECKeyImpl::getCurveName(int nid)
|
||||
std::string curveName;
|
||||
size_t len = EC_get_builtin_curves(NULL, 0);
|
||||
EC_builtin_curve* pCurves =
|
||||
(EC_builtin_curve*) OPENSSL_malloc(sizeof(EC_builtin_curve) * len);
|
||||
(EC_builtin_curve*) OPENSSL_malloc(static_cast<int>(sizeof(EC_builtin_curve) * len));
|
||||
if (!pCurves) return curveName;
|
||||
|
||||
if (!EC_get_builtin_curves(pCurves, len))
|
||||
@@ -209,7 +209,7 @@ int ECKeyImpl::getCurveNID(std::string& name)
|
||||
std::string curveName;
|
||||
size_t len = EC_get_builtin_curves(NULL, 0);
|
||||
EC_builtin_curve* pCurves =
|
||||
(EC_builtin_curve*)OPENSSL_malloc(sizeof(EC_builtin_curve) * len);
|
||||
(EC_builtin_curve*)OPENSSL_malloc(static_cast<int>(sizeof(EC_builtin_curve) * len));
|
||||
if (!pCurves) return -1;
|
||||
|
||||
if (!EC_get_builtin_curves(pCurves, len))
|
||||
|
||||
@@ -113,7 +113,7 @@ void Binder::bind(std::size_t pos, const DateTime& val, Direction dir, const Whe
|
||||
|
||||
void Binder::bind(std::size_t pos, const NullData&, Direction, const std::type_info& bindType)
|
||||
{
|
||||
sqlite3_bind_null(_pStmt, pos);
|
||||
sqlite3_bind_null(_pStmt, static_cast<int>(pos));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ bool Extractor::isNull(std::size_t pos, std::size_t)
|
||||
if (!_nulls[pos].first)
|
||||
{
|
||||
_nulls[pos].first = true;
|
||||
_nulls[pos].second = (SQLITE_NULL == sqlite3_column_type(_pStmt, pos));
|
||||
_nulls[pos].second = (SQLITE_NULL == sqlite3_column_type(_pStmt, static_cast<int>(pos)));
|
||||
}
|
||||
|
||||
return _nulls[pos].second;
|
||||
|
||||
@@ -277,7 +277,7 @@ std::size_t SQLiteStatementImpl::next()
|
||||
if (_affectedRowCount == POCO_SQLITE_INV_ROW_CNT) _affectedRowCount = 0;
|
||||
|
||||
if (extracts.size())
|
||||
_affectedRowCount += (*extracts.begin())->numOfRowsHandled();
|
||||
_affectedRowCount += static_cast<int>((*extracts.begin())->numOfRowsHandled());
|
||||
else
|
||||
{
|
||||
_stepCalled = true;
|
||||
|
||||
@@ -183,7 +183,7 @@ void SessionImpl::open(const std::string& connect)
|
||||
{
|
||||
ActiveConnector connector(connectionString(), &_pDB);
|
||||
ActiveResult<int> result = connector.connect();
|
||||
if (!result.tryWait(getLoginTimeout() * 1000))
|
||||
if (!result.tryWait(static_cast<long>(getLoginTimeout()) * 1000))
|
||||
throw ConnectionFailedException("Timed out.");
|
||||
|
||||
int rc = result.data();
|
||||
@@ -244,7 +244,7 @@ void SessionImpl::setConnectionTimeout(std::size_t timeout)
|
||||
{
|
||||
if(timeout <= std::numeric_limits<int>::max()/1000)
|
||||
{
|
||||
int tout = 1000 * timeout;
|
||||
int tout = 1000 * static_cast<int>(timeout);
|
||||
int rc = sqlite3_busy_timeout(_pDB, tout);
|
||||
if (rc != 0) Utility::throwException(rc);
|
||||
_timeout = tout;
|
||||
|
||||
@@ -1177,7 +1177,7 @@ void DataTest::testSimpleRowFormatter()
|
||||
std::streamsize sp = rf.getSpacing();
|
||||
|
||||
std::string line(std::string::size_type(sz * 5 + sp * 4), '-');
|
||||
std::string spacer(sp, ' ');
|
||||
std::string spacer(static_cast<std::size_t>(sp), ' ');
|
||||
std::ostringstream os;
|
||||
os << std::left
|
||||
<< std::setw(sz) << "field0"
|
||||
|
||||
@@ -59,7 +59,7 @@ Int64 Document::getInteger(const std::string& name) const
|
||||
if (ElementTraits<double>::TypeId == element->type())
|
||||
{
|
||||
ConcreteElement<double>* concrete = dynamic_cast<ConcreteElement<double>*>(element.get());
|
||||
if (concrete) return concrete->value();
|
||||
if (concrete) return static_cast<Int64>(concrete->value());
|
||||
}
|
||||
else if (ElementTraits<Int32>::TypeId == element->type())
|
||||
{
|
||||
|
||||
@@ -245,7 +245,7 @@ void MongoDBTest::testCursorRequest()
|
||||
Poco::MongoDB::ResponseMessage& response = cursor.next(*_mongo);
|
||||
while(1)
|
||||
{
|
||||
n += response.documents().size();
|
||||
n += static_cast<int>(response.documents().size());
|
||||
if ( response.cursorID() == 0 )
|
||||
break;
|
||||
response = cursor.next(*_mongo);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace
|
||||
int n;
|
||||
do
|
||||
{
|
||||
n = ws.receiveFrame(pBuffer.get(), _bufSize, flags);
|
||||
n = ws.receiveFrame(pBuffer.get(), static_cast<int>(_bufSize), flags);
|
||||
if (n == 0)
|
||||
break;
|
||||
ws.sendFrame(pBuffer.get(), n, flags);
|
||||
|
||||
@@ -435,7 +435,7 @@ int SecureSocketImpl::receiveBytes(void* buffer, int length, int flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = overflowSize;
|
||||
rc = static_cast<int>(overflowSize);
|
||||
std::memcpy(buffer, _overflowBuffer.begin(), rc);
|
||||
_overflowBuffer.resize(0);
|
||||
}
|
||||
@@ -1283,7 +1283,7 @@ void SecureSocketImpl::verifyCertificateChainClient(PCCERT_CONTEXT pServerCert)
|
||||
BOOL ok = CertVerifyRevocation(
|
||||
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
|
||||
CERT_CONTEXT_REVOCATION_TYPE,
|
||||
certs.size(),
|
||||
static_cast<DWORD>(certs.size()),
|
||||
(void**) &certs[0],
|
||||
CERT_VERIFY_REV_CHAIN_FLAG,
|
||||
NULL,
|
||||
@@ -1390,7 +1390,7 @@ void SecureSocketImpl::serverVerifyCertificate()
|
||||
BOOL ok = CertVerifyRevocation(
|
||||
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
|
||||
CERT_CONTEXT_REVOCATION_TYPE,
|
||||
certs.size(),
|
||||
static_cast<DWORD>(certs.size()),
|
||||
(void**) &certs[0],
|
||||
CERT_VERIFY_REV_CHAIN_FLAG,
|
||||
NULL,
|
||||
|
||||
@@ -233,7 +233,7 @@ void X509Certificate::extractNames(std::string& cmnName, std::set<std::string>&
|
||||
flags |= CRYPT_DECODE_ENABLE_PUNYCODE_FLAG;
|
||||
#endif
|
||||
Poco::Buffer<char> buffer(256);
|
||||
DWORD bufferSize = buffer.sizeBytes();
|
||||
DWORD bufferSize = static_cast<DWORD>(buffer.sizeBytes());
|
||||
BOOL rc = CryptDecodeObjectEx(
|
||||
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
|
||||
pExt->pszObjId,
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace
|
||||
int n;
|
||||
do
|
||||
{
|
||||
n = ws.receiveFrame(pBuffer.get(), _bufSize, flags);
|
||||
n = ws.receiveFrame(pBuffer.get(), static_cast<int>(_bufSize), flags);
|
||||
if (n == 0)
|
||||
break;
|
||||
ws.sendFrame(pBuffer.get(), n, flags);
|
||||
|
||||
@@ -43,13 +43,13 @@ RedisStreamBuf::~RedisStreamBuf()
|
||||
|
||||
int RedisStreamBuf::readFromDevice(char* buffer, std::streamsize len)
|
||||
{
|
||||
return _redis.receiveBytes(buffer, len);
|
||||
return _redis.receiveBytes(buffer, static_cast<int>(len));
|
||||
}
|
||||
|
||||
|
||||
int RedisStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
|
||||
{
|
||||
return _redis.sendBytes(buffer, length);
|
||||
return _redis.sendBytes(buffer, static_cast<int>(length));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ void RedisTest::testDECR()
|
||||
Poco::Int64 result = _redis.execute<Poco::Int64>(decr);
|
||||
fail("This must fail");
|
||||
}
|
||||
catch (RedisException& e)
|
||||
catch (RedisException&)
|
||||
{
|
||||
// ERR value is not an integer or out of range
|
||||
}
|
||||
@@ -338,7 +338,7 @@ void RedisTest::testError()
|
||||
BulkString result = _redis.execute<BulkString>(command);
|
||||
fail("Invalid command must throw RedisException");
|
||||
}
|
||||
catch (RedisException& e)
|
||||
catch (RedisException&)
|
||||
{
|
||||
// Must fail
|
||||
}
|
||||
|
||||
@@ -932,14 +932,15 @@ ENTROPY_DEBUG(const char * label, unsigned long entropy) {
|
||||
static unsigned long
|
||||
generate_hash_secret_salt(XML_Parser parser)
|
||||
{
|
||||
Poco::UInt64 entropy;
|
||||
(void)parser;
|
||||
#if defined(EXPAT_POCO)
|
||||
Poco::UInt64 entropy;
|
||||
Poco::RandomInputStream rstr;
|
||||
Poco::BinaryReader rrdr(rstr);
|
||||
rrdr >> entropy;
|
||||
return ENTROPY_DEBUG("RandomInputStream", entropy);
|
||||
return ENTROPY_DEBUG("RandomInputStream", (unsigned long)entropy);
|
||||
#else
|
||||
unsigned long entropy;
|
||||
(void)parser;
|
||||
#if defined(HAVE_ARC4RANDOM_BUF) || defined(__CloudABI__)
|
||||
(void)gather_time_entropy;
|
||||
arc4random_buf(&entropy, sizeof(entropy));
|
||||
|
||||
@@ -62,7 +62,7 @@ int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
std::streamsize n = (_prefix.size() > length) ? length : static_cast<std::streamsize>(_prefix.size());
|
||||
std::memcpy(buffer, _prefix.data(), n);
|
||||
_prefix.erase(0, n);
|
||||
return n;
|
||||
return static_cast<int>(n);
|
||||
}
|
||||
|
||||
if (_eofDetected)
|
||||
@@ -72,7 +72,7 @@ int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
std::streamsize n = (_postfix.size() > length) ? length : static_cast<std::streamsize>(_postfix.size());
|
||||
std::memcpy(buffer, _postfix.data(), n);
|
||||
_postfix.erase(0, n);
|
||||
return n;
|
||||
return static_cast<int>(n);
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
_postfix.erase(0, offset);
|
||||
}
|
||||
|
||||
return offset;
|
||||
return static_cast<int>(offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -159,7 +159,7 @@ int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
_postfix.erase(0, offset);
|
||||
}
|
||||
|
||||
return offset;
|
||||
return static_cast<int>(offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
}
|
||||
|
||||
_length += offset;
|
||||
return offset;
|
||||
return static_cast<int>(offset);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ int PartialStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
std::streamsize tmp = (_prefix.size() > length)? length: static_cast<std::streamsize>(_prefix.size());
|
||||
std::memcpy(buffer, _prefix.c_str(), tmp);
|
||||
_prefix = _prefix.substr(tmp);
|
||||
return tmp;
|
||||
return static_cast<int>(tmp);
|
||||
}
|
||||
|
||||
if (_numBytes == 0)
|
||||
@@ -84,7 +84,7 @@ int PartialStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
std::streamsize tmp = (_postfix.size() > length)? length: static_cast<std::streamsize>(_postfix.size());
|
||||
std::memcpy(buffer, _postfix.c_str(), tmp);
|
||||
_postfix = _postfix.substr(tmp);
|
||||
return tmp;
|
||||
return static_cast<int>(tmp);
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
@@ -99,7 +99,7 @@ int PartialStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
_pIstr->read(buffer, length);
|
||||
std::streamsize bytesRead = _pIstr->gcount();
|
||||
_numBytes -= bytesRead;
|
||||
return bytesRead;
|
||||
return static_cast<int>(bytesRead);
|
||||
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ int PartialStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
|
||||
{
|
||||
_ignoreStart -= length;
|
||||
// fake return values
|
||||
return length;
|
||||
return static_cast<int>(length);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -136,10 +136,10 @@ int PartialStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
|
||||
cnt += static_cast<std::streamsize>(_ignoreStart);
|
||||
_ignoreStart = 0;
|
||||
poco_assert (cnt < length);
|
||||
_bufferOffset = length - cnt;
|
||||
_bufferOffset = static_cast<Poco::UInt32>(length - cnt);
|
||||
std::memcpy(_buffer.begin(), buffer + cnt, _bufferOffset);
|
||||
|
||||
return length;
|
||||
return static_cast<int>(length);
|
||||
}
|
||||
}
|
||||
if (_buffer.size() > 0)
|
||||
@@ -148,7 +148,8 @@ int PartialStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
|
||||
// thus first fill the buffer with the last n bytes of the msg
|
||||
|
||||
// how much of the already cached data do we need to write?
|
||||
Poco::Int32 cache = _bufferOffset + length - _buffer.size();
|
||||
Poco::Int32 cache = static_cast<Poco::Int32>(_bufferOffset +
|
||||
static_cast<Poco::Int32>(length) - static_cast<Poco::Int32>(_buffer.size()));
|
||||
if (cache > 0)
|
||||
{
|
||||
if (cache > _bufferOffset)
|
||||
@@ -184,7 +185,7 @@ int PartialStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
|
||||
}
|
||||
|
||||
if (_pOstr->good())
|
||||
return length;
|
||||
return static_cast<int>(length);
|
||||
|
||||
throw Poco::IOException("Failed to write to output stream");
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ ZipStreamBuf::ZipStreamBuf(std::istream& istr, const ZipLocalFileHeader& fileEnt
|
||||
std::string crc(4, ' ');
|
||||
if (fileEntry.searchCRCAndSizesAfterData())
|
||||
{
|
||||
_ptrHelper = new AutoDetectInputStream(istr, init, crc, reposition, start, fileEntry.needsZip64());
|
||||
_ptrHelper = new AutoDetectInputStream(istr, init, crc, reposition, static_cast<Poco::UInt32>(start), fileEntry.needsZip64());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,7 +73,7 @@ ZipStreamBuf::ZipStreamBuf(std::istream& istr, const ZipLocalFileHeader& fileEnt
|
||||
{
|
||||
if (fileEntry.searchCRCAndSizesAfterData())
|
||||
{
|
||||
_ptrBuf = new AutoDetectInputStream(istr, "", "", reposition, start, fileEntry.needsZip64());
|
||||
_ptrBuf = new AutoDetectInputStream(istr, "", "", reposition, static_cast<Poco::UInt32>(start), fileEntry.needsZip64());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -155,7 +155,7 @@ int ZipStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
||||
{
|
||||
if (!_ptrBuf) return 0; // directory entry
|
||||
_ptrBuf->read(buffer, length);
|
||||
int cnt = _ptrBuf->gcount();
|
||||
int cnt = static_cast<int>(_ptrBuf->gcount());
|
||||
if (cnt > 0)
|
||||
{
|
||||
_crc32.update(buffer, cnt);
|
||||
@@ -193,14 +193,14 @@ int ZipStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
|
||||
return 0;
|
||||
_bytesWritten += length;
|
||||
_ptrOBuf->write(buffer, length);
|
||||
_crc32.update(buffer, length);
|
||||
return length;
|
||||
_crc32.update(buffer, static_cast<unsigned int>(length));
|
||||
return static_cast<int>(length);
|
||||
}
|
||||
|
||||
|
||||
void ZipStreamBuf::close(Poco::UInt64& extraDataSize)
|
||||
{
|
||||
extraDataSize = 0;
|
||||
extraDataSize = 0;
|
||||
if (_ptrOBuf && _pHeader)
|
||||
{
|
||||
_ptrOBuf->flush();
|
||||
|
||||
Reference in New Issue
Block a user