Use 'auto' to avoid duplicating the type name

This commit is contained in:
thalieht
2019-02-13 17:12:02 +02:00
parent 947c7e1d64
commit d8cbc9266a
25 changed files with 68 additions and 68 deletions

View File

@@ -74,7 +74,7 @@ Server::Server(IRequestHandler *requestHandler, QObject *parent)
setProxy(QNetworkProxy::NoProxy);
QSslSocket::setDefaultCiphers(safeCipherList());
QTimer *dropConnectionTimer = new QTimer(this);
auto *dropConnectionTimer = new QTimer(this);
connect(dropConnectionTimer, &QTimer::timeout, this, &Server::dropTimedOutConnection);
dropConnectionTimer->start(CONNECTIONS_SCAN_INTERVAL * 1000);
}
@@ -102,7 +102,7 @@ void Server::incomingConnection(qintptr socketDescriptor)
static_cast<QSslSocket *>(serverSocket)->startServerEncryption();
}
Connection *c = new Connection(serverSocket, m_requestHandler, this);
auto *c = new Connection(serverSocket, m_requestHandler, this);
m_connections.append(c);
}

View File

@@ -171,7 +171,7 @@ QString GeoIPDatabase::lookup(const QHostAddress &hostAddr) const
ptr += m_recordBytes;
quint32 id = 0;
uchar *idPtr = reinterpret_cast<uchar *>(&id);
auto *idPtr = reinterpret_cast<uchar *>(&id);
memcpy(&idPtr[4 - m_recordBytes], ptr, m_recordBytes);
fromBigEndian(idPtr, 4);
@@ -298,7 +298,7 @@ QVariantHash GeoIPDatabase::readMetadata() const
if (index >= 0) {
if (m_size > MAX_METADATA_SIZE)
index += (m_size - MAX_METADATA_SIZE); // from begin of all data
quint32 offset = static_cast<quint32>(index + strlen(METADATA_BEGIN_MARK));
auto offset = static_cast<quint32>(index + strlen(METADATA_BEGIN_MARK));
QVariant metadata = readDataField(offset);
if (metadata.userType() == QMetaType::QVariantHash)
return metadata.toHash();

View File

@@ -183,7 +183,7 @@ bool ScanFoldersModel::setData(const QModelIndex &index, const QVariant &value,
return false;
if (role == Qt::UserRole) {
PathType type = static_cast<PathType>(value.toInt());
auto type = static_cast<PathType>(value.toInt());
if (type == CUSTOM_LOCATION)
return false;

View File

@@ -97,7 +97,7 @@ namespace
if (sizeInBytes < 0) return false;
int i = 0;
qreal rawVal = static_cast<qreal>(sizeInBytes);
auto rawVal = static_cast<qreal>(sizeInBytes);
while ((rawVal >= 1024.) && (i <= static_cast<int>(Utils::Misc::SizeUnit::ExbiByte))) {
rawVal /= 1024.;