Merge pull request #228 from bensuperpc/change_cast

This commit is contained in:
flow 2022-10-23 14:28:33 -03:00 committed by Sefa Eyeoglu
parent 35e792c5de
commit fcef6321fc
No known key found for this signature in database
GPG Key ID: C10411294912A422
6 changed files with 9 additions and 9 deletions

View File

@ -72,7 +72,7 @@ bool GZip::unzip(const QByteArray &compressedBytes, QByteArray &uncompressedByte
uncompLength *= 2; uncompLength *= 2;
} }
strm.next_out = (Bytef *)(uncompressedBytes.data() + strm.total_out); strm.next_out = reinterpret_cast<Bytef *>((uncompressedBytes.data() + strm.total_out));
strm.avail_out = uncompLength - strm.total_out; strm.avail_out = uncompLength - strm.total_out;
// Inflate another chunk. // Inflate another chunk.
@ -129,7 +129,7 @@ bool GZip::zip(const QByteArray &uncompressedBytes, QByteArray &compressedBytes)
{ {
compressedBytes.resize(compressedBytes.size() * 2); compressedBytes.resize(compressedBytes.size() * 2);
} }
zs.next_out = (Bytef *) (compressedBytes.data() + offset); zs.next_out = reinterpret_cast<Bytef*>((compressedBytes.data() + offset));
temp = zs.avail_out = compressedBytes.size() - offset; temp = zs.avail_out = compressedBytes.size() - offset;
ret = deflate(&zs, Z_FINISH); ret = deflate(&zs, Z_FINISH);
offset += temp - zs.avail_out; offset += temp - zs.avail_out;

View File

@ -42,7 +42,7 @@ public:
} }
void put(QByteArray input) void put(QByteArray input)
{ {
hoedown_buffer_put(buf, (uint8_t *) input.data(), input.size()); hoedown_buffer_put(buf, reinterpret_cast<uint8_t *>(input.data()), input.size());
} }
const uint8_t * data() const const uint8_t * data() const
{ {

View File

@ -153,7 +153,7 @@ QString Task::describe()
auto name = objectName(); auto name = objectName();
if(name.isEmpty()) if(name.isEmpty())
{ {
out << QString("0x%1").arg((quintptr)this, 0, 16); out << QString("0x%1").arg(reinterpret_cast<quintptr>(this), 0, 16);
} }
else else
{ {

View File

@ -210,7 +210,7 @@ void LocalPeer::receiveConnection()
return; return;
} }
while (socket->bytesAvailable() < (int)sizeof(quint32)) while (socket->bytesAvailable() < static_cast<int>(sizeof(quint32)))
{ {
socket->waitForReadyRead(); socket->waitForReadyRead();
} }

View File

@ -445,7 +445,7 @@ void DeviceFlow::onRefreshError(QNetworkReply::NetworkError error, QNetworkReply
if(refreshReply) { if(refreshReply) {
refreshReply->deleteLater(); refreshReply->deleteLater();
} }
qDebug() << "DeviceFlow::onRefreshFinished: Error" << (int)error << " - " << errorString; qDebug() << "DeviceFlow::onRefreshFinished: Error" << static_cast<int>(error) << " - " << errorString;
} }
} }

View File

@ -55,12 +55,12 @@ uint32_t MurmurHash2(std::ifstream&& file_stream, std::size_t buffer_size, std::
// Mix 4 bytes at a time into the hash // Mix 4 bytes at a time into the hash
if (index == 0) if (index == 0)
FourBytes_MurmurHash2((unsigned char*)&data, info); FourBytes_MurmurHash2(reinterpret_cast<unsigned char*>(&data), info);
} }
} while (!file_stream.eof()); } while (!file_stream.eof());
// Do one last bit shuffle in the hash // Do one last bit shuffle in the hash
FourBytes_MurmurHash2((unsigned char*)&data, info); FourBytes_MurmurHash2(reinterpret_cast<unsigned char*>(&data), info);
delete[] buffer; delete[] buffer;
@ -72,7 +72,7 @@ void FourBytes_MurmurHash2(const unsigned char* data, IncrementalHashInfo& prev)
{ {
if (prev.len >= 4) { if (prev.len >= 4) {
// Not the final mix // Not the final mix
uint32_t k = *(uint32_t*)data; uint32_t k = *reinterpret_cast<const uint32_t*>(data);
k *= m; k *= m;
k ^= k >> r; k ^= k >> r;