diff --git a/src/ChannelListenerManager.cpp b/src/ChannelListenerManager.cpp
index b922924ec..82f8f5aad 100644
--- a/src/ChannelListenerManager.cpp
+++ b/src/ChannelListenerManager.cpp
@@ -70,13 +70,13 @@ const QSet< unsigned int > ChannelListenerManager::getListenedChannelsForUser(un
int ChannelListenerManager::getListenerCountForChannel(unsigned int channelID) const {
QReadLocker lock(&m_listenerLock);
- return m_listenedChannels[channelID].size();
+ return static_cast< int >(m_listenedChannels[channelID].size());
}
int ChannelListenerManager::getListenedChannelCountForUser(unsigned int userSession) const {
QReadLocker lock(&m_listenerLock);
- return m_listeningUsers[userSession].size();
+ return static_cast< int >(m_listeningUsers[userSession].size());
}
void ChannelListenerManager::setListenerVolumeAdjustment(unsigned int userSession, unsigned int channelID,
diff --git a/src/Group.cpp b/src/Group.cpp
index 09c42825f..a31b35c2a 100644
--- a/src/Group.cpp
+++ b/src/Group.cpp
@@ -195,7 +195,7 @@ bool Group::appliesToUser(const Channel ¤tChannel, const Channel &aclChann
channel = channel->cParent;
}
- int requiredChannelIndex = currentChannelHierarchy.indexOf(contextChannel);
+ auto requiredChannelIndex = currentChannelHierarchy.indexOf(contextChannel);
Q_ASSERT(requiredChannelIndex != -1);
requiredChannelIndex += requiredChannelOffset;
@@ -211,10 +211,10 @@ bool Group::appliesToUser(const Channel ¤tChannel, const Channel &aclChann
return RET_FALSE;
}
- const int minDepth = requiredChannelIndex + minDescendantLevel;
- const int maxDepth = requiredChannelIndex + maxDescendantLevel;
+ const auto minDepth = requiredChannelIndex + minDescendantLevel;
+ const auto maxDepth = requiredChannelIndex + maxDescendantLevel;
- const int totalDepth = homeChannelHierarchy.count() - 1;
+ const auto totalDepth = homeChannelHierarchy.count() - 1;
matches = (totalDepth >= minDepth) && (totalDepth <= maxDepth);
} else {
diff --git a/src/ProcessResolver.cpp b/src/ProcessResolver.cpp
index f3c9363fd..69e3b2d25 100644
--- a/src/ProcessResolver.cpp
+++ b/src/ProcessResolver.cpp
@@ -154,14 +154,14 @@ void ProcessResolver::doResolve() {
QByteArray cmdline = f.readAll();
f.close();
- int nul = cmdline.indexOf('\0');
+ const auto nul = cmdline.indexOf('\0');
if (nul != -1) {
cmdline.truncate(nul);
}
QString exe = QString::fromUtf8(cmdline);
if (exe.contains(QLatin1String("\\"))) {
- int lastBackslash = exe.lastIndexOf(QLatin1String("\\"));
+ const auto lastBackslash = exe.lastIndexOf(QLatin1String("\\"));
if (exe.length() > lastBackslash + 1) {
baseName = exe.mid(lastBackslash + 1);
}
diff --git a/src/ServerResolver.cpp b/src/ServerResolver.cpp
index 316fe069b..a2572c4c5 100644
--- a/src/ServerResolver.cpp
+++ b/src/ServerResolver.cpp
@@ -26,8 +26,8 @@ public:
quint16 m_origPort;
QList< QDnsServiceRecord > m_srvQueue;
- QMap< int, int > m_hostInfoIdToIndexMap;
- int m_srvQueueRemain;
+ QMap< qsizetype, qsizetype > m_hostInfoIdToIndexMap;
+ qsizetype m_srvQueueRemain;
QList< ServerResolverRecord > m_resolved;
@@ -66,7 +66,7 @@ void ServerResolverPrivate::srvResolved() {
m_srvQueueRemain = m_srvQueue.count();
if (resolver->error() == QDnsLookup::NoError && m_srvQueueRemain > 0) {
- for (int i = 0; i < m_srvQueue.count(); i++) {
+ for (decltype(m_srvQueue.count()) i = 0; i < m_srvQueue.count(); i++) {
QDnsServiceRecord record = m_srvQueue.at(i);
int hostInfoId = QHostInfo::lookupHost(record.target(), this, SLOT(hostResolved(QHostInfo)));
m_hostInfoIdToIndexMap[hostInfoId] = i;
@@ -79,9 +79,13 @@ void ServerResolverPrivate::srvResolved() {
}
void ServerResolverPrivate::hostResolved(QHostInfo hostInfo) {
- int lookupId = hostInfo.lookupId();
- int idx = m_hostInfoIdToIndexMap[lookupId];
+ const int lookupId = hostInfo.lookupId();
+ const qsizetype idx = m_hostInfoIdToIndexMap[lookupId];
+#if QT_VERSION >= 0x060000
QDnsServiceRecord record = m_srvQueue.at(idx);
+#else
+ QDnsServiceRecord record = m_srvQueue.at(static_cast< int >(idx));
+#endif
if (hostInfo.error() == QHostInfo::NoError) {
QList< QHostAddress > resolvedAddresses = hostInfo.addresses();
diff --git a/src/mumble/ACLEditor.cpp b/src/mumble/ACLEditor.cpp
index 7d990e047..cc8d06af2 100644
--- a/src/mumble/ACLEditor.cpp
+++ b/src/mumble/ACLEditor.cpp
@@ -790,7 +790,7 @@ void ACLEditor::on_qpbACLUp_clicked() {
if (!as || as->bInherited)
return;
- int idx = qlACLs.indexOf(as);
+ const auto idx = qlACLs.indexOf(as);
if (idx <= numInheritACL + 1)
return;
@@ -808,7 +808,7 @@ void ACLEditor::on_qpbACLDown_clicked() {
if (!as || as->bInherited)
return;
- int idx = qlACLs.indexOf(as) + 1;
+ const auto idx = qlACLs.indexOf(as) + 1;
if (idx >= qlACLs.count())
return;
diff --git a/src/mumble/AudioConfigDialog.cpp b/src/mumble/AudioConfigDialog.cpp
index cf83d6fa8..9df347bd6 100644
--- a/src/mumble/AudioConfigDialog.cpp
+++ b/src/mumble/AudioConfigDialog.cpp
@@ -96,16 +96,16 @@ QIcon AudioInputDialog::icon() const {
}
void AudioInputDialog::load(const Settings &r) {
- int i;
QList< QString > keys;
if (AudioInputRegistrar::qmNew)
keys = AudioInputRegistrar::qmNew->keys();
else
keys.clear();
- i = keys.indexOf(AudioInputRegistrar::current);
- if (i >= 0)
- loadComboBox(qcbSystem, i);
+
+ const auto index = keys.indexOf(AudioInputRegistrar::current);
+ if (index >= 0)
+ loadComboBox(qcbSystem, static_cast< int >(index));
verifyMicrophonePermission();
@@ -701,16 +701,16 @@ QString AudioOutputDialog::getCurrentlySelectedOutputInterfaceName() const {
}
void AudioOutputDialog::load(const Settings &r) {
- int i;
QList< QString > keys;
if (AudioOutputRegistrar::qmNew)
keys = AudioOutputRegistrar::qmNew->keys();
else
keys.clear();
- i = keys.indexOf(AudioOutputRegistrar::current);
- if (i >= 0)
- loadComboBox(qcbSystem, i);
+
+ const auto index = keys.indexOf(AudioOutputRegistrar::current);
+ if (index >= 0)
+ loadComboBox(qcbSystem, static_cast< int >(index));
loadCheckBox(qcbExclusive, r.bExclusiveOutput);
loadSlider(qsDelay, r.iOutputDelay);
diff --git a/src/mumble/AudioOutputSpeech.cpp b/src/mumble/AudioOutputSpeech.cpp
index 7a168e1f4..ec582e7f4 100644
--- a/src/mumble/AudioOutputSpeech.cpp
+++ b/src/mumble/AudioOutputSpeech.cpp
@@ -346,7 +346,7 @@ bool AudioOutputSpeech::prepareSampleBuffer(unsigned int frameCount) {
// packet normally in order to be able to play it.
decodedSamples = opus_decode_float(
opusState, qba.isEmpty() ? nullptr : reinterpret_cast< const unsigned char * >(qba.constData()),
- qba.size(), pOut, static_cast< int >(iAudioBufferSize), 0);
+ static_cast< opus_int32 >(qba.size()), pOut, static_cast< int >(iAudioBufferSize), 0);
} else {
// If the packet is non-empty, but the associated user is locally muted,
// we don't have to decode the packet. Instead it is enough to know how many
diff --git a/src/mumble/BanEditor.cpp b/src/mumble/BanEditor.cpp
index 30fb7eed9..97ff26243 100644
--- a/src/mumble/BanEditor.cpp
+++ b/src/mumble/BanEditor.cpp
@@ -121,7 +121,7 @@ void BanEditor::on_qpbAdd_clicked() {
if (ok) {
qlBans << b;
refreshBanList();
- qlwBans->setCurrentRow(qlBans.indexOf(b));
+ qlwBans->setCurrentRow(static_cast< int >(qlBans.indexOf(b)));
}
qlwBans->setCurrentRow(-1);
@@ -136,7 +136,7 @@ void BanEditor::on_qpbUpdate_clicked() {
if (ok) {
qlBans.replace(idx, b);
refreshBanList();
- qlwBans->setCurrentRow(qlBans.indexOf(b));
+ qlwBans->setCurrentRow(static_cast< int >(qlBans.indexOf(b)));
}
}
}
@@ -174,8 +174,7 @@ void BanEditor::refreshBanList() {
qlwBans->addItem(ban.qsUsername);
}
- int n = qlBans.count();
- setWindowTitle(tr("Ban List - %n Ban(s)", "", n));
+ setWindowTitle(tr("Ban List - %n Ban(s)", "", static_cast< int >(qlBans.count())));
}
void BanEditor::on_qleSearch_textChanged(const QString &match) {
diff --git a/src/mumble/Cert.cpp b/src/mumble/Cert.cpp
index 69b5b28d5..b685cfbf1 100644
--- a/src/mumble/Cert.cpp
+++ b/src/mumble/Cert.cpp
@@ -436,7 +436,7 @@ Settings::KeyPair CertWizard::importCert(QByteArray data, const QString &pw) {
Settings::KeyPair kp;
int ret = 0;
- mem = BIO_new_mem_buf(data.data(), data.size());
+ mem = BIO_new_mem_buf(data.data(), static_cast< int >(data.size()));
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
pkcs = d2i_PKCS12_bio(mem, nullptr);
if (pkcs) {
diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp
index bd5555674..5f42cc021 100644
--- a/src/mumble/ConnectDialog.cpp
+++ b/src/mumble/ConnectDialog.cpp
@@ -931,12 +931,12 @@ void ConnectDialogEdit::accept() {
// If the user accidentally added a schema or path part, drop it now.
// We can't do so during editing as that is quite jarring.
- const int schemaPos = server.indexOf(QLatin1String("://"));
+ const auto schemaPos = server.indexOf(QLatin1String("://"));
if (schemaPos != -1) {
server.remove(0, schemaPos + 3);
}
- const int pathPos = server.indexOf(QLatin1Char('/'));
+ const auto pathPos = server.indexOf(QLatin1Char('/'));
if (pathPos != -1) {
server.resize(pathPos);
}
diff --git a/src/mumble/CustomElements.cpp b/src/mumble/CustomElements.cpp
index c4520f75e..d0e55f6a8 100644
--- a/src/mumble/CustomElements.cpp
+++ b/src/mumble/CustomElements.cpp
@@ -289,11 +289,11 @@ unsigned int ChatbarTextEdit::completeAtCursor() {
target = qlsUsernames.first();
tc.insertText(target);
} else {
- bool bBaseIsName = false;
- int iend = tc.position();
- int istart = toPlainText().lastIndexOf(QLatin1Char(' '), iend - 1) + 1;
- QString base = toPlainText().mid(istart, iend - istart);
- tc.setPosition(istart);
+ bool bBaseIsName = false;
+ const int iend = tc.position();
+ const auto istart = toPlainText().lastIndexOf(QLatin1Char(' '), iend - 1) + 1;
+ const QString base = toPlainText().mid(istart, iend - istart);
+ tc.setPosition(static_cast< int >(istart));
tc.setPosition(iend, QTextCursor::KeepAnchor);
if (qlsUsernames.last() == base) {
diff --git a/src/mumble/GlobalShortcut.cpp b/src/mumble/GlobalShortcut.cpp
index 657f2d950..ddc2ec685 100644
--- a/src/mumble/GlobalShortcut.cpp
+++ b/src/mumble/GlobalShortcut.cpp
@@ -964,7 +964,7 @@ void GlobalShortcutEngine::remap() {
sk->gs = gs;
foreach (const QVariant &button, sc.qlButtons) {
- int idx = qlButtonList.indexOf(button);
+ auto idx = qlButtonList.indexOf(button);
if (idx == -1) {
qlButtonList << button;
qlShortcutList << QList< ShortcutKey * >();
@@ -1037,7 +1037,7 @@ bool GlobalShortcutEngine::handleButton(const QVariant &button, bool down) {
}
}
- int idx = qlButtonList.indexOf(button);
+ const auto idx = qlButtonList.indexOf(button);
if (idx == -1)
return false;
diff --git a/src/mumble/GlobalShortcut.h b/src/mumble/GlobalShortcut.h
index d7a9f35e0..53b4a1210 100644
--- a/src/mumble/GlobalShortcut.h
+++ b/src/mumble/GlobalShortcut.h
@@ -218,7 +218,7 @@ public slots:
struct ShortcutKey {
Shortcut s;
- int iNumUp;
+ qsizetype iNumUp;
GlobalShortcut *gs;
};
diff --git a/src/mumble/JackAudio.cpp b/src/mumble/JackAudio.cpp
index c0276f083..13189973f 100644
--- a/src/mumble/JackAudio.cpp
+++ b/src/mumble/JackAudio.cpp
@@ -273,7 +273,8 @@ bool JackAudioSystem::initialize() {
Global::get().s.bJackStartServer ? JackNullOption : JackNoStartServer, &status);
if (!client) {
const auto errors = jackStatusToStringList(status);
- qWarning("JackAudioSystem: unable to open client due to %i errors:", errors.count());
+ qWarning("JackAudioSystem: unable to open client due to %lld errors:",
+ static_cast< qsizetype >(errors.count()));
for (auto i = 0; i < errors.count(); ++i) {
qWarning("JackAudioSystem: %s", qPrintable(errors.at(i)));
}
diff --git a/src/mumble/LCD.cpp b/src/mumble/LCD.cpp
index 8208352c1..2f343f4ad 100644
--- a/src/mumble/LCD.cpp
+++ b/src/mumble/LCD.cpp
@@ -351,7 +351,7 @@ void LCD::updateUserView() {
const int iHeight = size.height();
const int iUsersPerColumn = iHeight / iFontHeight;
const int iSplitterWidth = Global::get().s.iLCDUserViewSplitterWidth;
- const int iUserColumns = (entries.count() + iUsersPerColumn - 1) / iUsersPerColumn;
+ const int iUserColumns = static_cast< int >((entries.count() + iUsersPerColumn - 1) / iUsersPerColumn);
int iColumns = iUserColumns;
int iColumnWidth = 1;
diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp
index a78c18350..221be5f97 100644
--- a/src/mumble/Log.cpp
+++ b/src/mumble/Log.cpp
@@ -828,7 +828,7 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own
}
// Message notification with static sounds
- int connectedUsers = 0;
+ qsizetype connectedUsers = 0;
{
QReadLocker lock(&ClientUser::c_qrwlUsers);
connectedUsers = ClientUser::c_qmUsers.size();
@@ -863,7 +863,7 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own
const QStringList qslAllowed = allowedSchemes();
QRegularExpressionMatch match = identifyURL.match(plain);
- int pos = 0;
+ qsizetype pos = 0;
while (match.hasMatch()) {
QUrl url(match.captured(0).toLower());
@@ -883,12 +883,20 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own
else
replacement = tr("%1 link").arg(url.scheme());
+#if QT_VERSION >= 0x060000
plain.replace(pos, match.capturedLength(), replacement);
+#else
+ plain.replace(static_cast< int >(pos), match.capturedLength(), replacement);
+#endif
} else {
pos += match.capturedLength();
}
+#if QT_VERSION >= 0x060000
match = identifyURL.match(plain, pos);
+#else
+ match = identifyURL.match(plain, static_cast< int >(pos));
+#endif
}
#ifndef USE_NO_TTS
diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp
index ef57ae276..b1ba0ec36 100644
--- a/src/mumble/MainWindow.cpp
+++ b/src/mumble/MainWindow.cpp
@@ -3818,23 +3818,23 @@ void MainWindow::customEvent(QEvent *evt) {
ServerHandlerMessageEvent *shme = static_cast< ServerHandlerMessageEvent * >(evt);
#ifdef QT_NO_DEBUG
-# define PROCESS_MUMBLE_TCP_MESSAGE(name, value) \
- case Mumble::Protocol::TCPMessageType::name: { \
- MumbleProto::name msg; \
- if (msg.ParseFromArray(shme->qbaMsg.constData(), shme->qbaMsg.size())) \
- msg##name(msg); \
- break; \
+# define PROCESS_MUMBLE_TCP_MESSAGE(name, value) \
+ case Mumble::Protocol::TCPMessageType::name: { \
+ MumbleProto::name msg; \
+ if (msg.ParseFromArray(shme->qbaMsg.constData(), static_cast< int >(shme->qbaMsg.size()))) \
+ msg##name(msg); \
+ break; \
}
#else
-# define PROCESS_MUMBLE_TCP_MESSAGE(name, value) \
- case Mumble::Protocol::TCPMessageType::name: { \
- MumbleProto::name msg; \
- if (msg.ParseFromArray(shme->qbaMsg.constData(), shme->qbaMsg.size())) { \
- printf("%s:\n", #name); \
- msg.PrintDebugString(); \
- msg##name(msg); \
- } \
- break; \
+# define PROCESS_MUMBLE_TCP_MESSAGE(name, value) \
+ case Mumble::Protocol::TCPMessageType::name: { \
+ MumbleProto::name msg; \
+ if (msg.ParseFromArray(shme->qbaMsg.constData(), static_cast< int >(shme->qbaMsg.size()))) { \
+ printf("%s:\n", #name); \
+ msg.PrintDebugString(); \
+ msg##name(msg); \
+ } \
+ break; \
}
#endif
switch (shme->type) { MUMBLE_ALL_TCP_MESSAGES }
diff --git a/src/mumble/Markdown.cpp b/src/mumble/Markdown.cpp
index 8c1d1d5b8..cdae0c552 100644
--- a/src/mumble/Markdown.cpp
+++ b/src/mumble/Markdown.cpp
@@ -14,11 +14,12 @@ namespace Markdown {
const QLatin1String regularLineBreakPlaceholder("%<\\!!linebreak!!//>@");
/// Just a wrapper for QRegularExpression::match().
-static QRegularExpressionMatch regexMatch(const QRegularExpression ®ex, const QString &subject, int &offset) {
+static QRegularExpressionMatch regexMatch(const QRegularExpression ®ex, const QString &subject, qsizetype &offset) {
#if QT_VERSION >= 0x060000
return regex.match(subject, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchorAtOffsetMatchOption);
#else
- return regex.match(subject, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
+ return regex.match(subject, static_cast< int >(offset), QRegularExpression::NormalMatch,
+ QRegularExpression::AnchoredMatchOption);
#endif
}
@@ -28,7 +29,7 @@ static QRegularExpressionMatch regexMatch(const QRegularExpression ®ex, const
/// @param offset The offset at which the matching shall be done. This will be modified to point right after
/// replacement text, if such a replacement has been made.
/// @returns Whether a replacement has been made
-bool processEscapedChar(QString &str, int &offset) {
+bool processEscapedChar(QString &str, qsizetype &offset) {
static const QRegularExpression s_regex(QLatin1String("\\\\(.)"));
const QRegularExpressionMatch match = regexMatch(s_regex, str, offset);
@@ -52,17 +53,17 @@ bool processEscapedChar(QString &str, int &offset) {
/// @param offset The offset at which the matching shall be done. This will be modified to point right after
/// replacement text, if such a replacement has been made.
/// @returns Whether a replacement has been made
-bool processMarkdownHeader(QString &str, int &offset) {
+bool processMarkdownHeader(QString &str, qsizetype &offset) {
// Match a markdown section heading. Also eat up a potential following newline in order to
// not create a huge spacing after the heading
static const QRegularExpression s_regex(QLatin1String("^(#+) (.*)"), QRegularExpression::MultilineOption);
const QRegularExpressionMatch match = regexMatch(s_regex, str, offset);
if (match.hasMatch()) {
- int sectionLevel = match.captured(1).size();
- QString sectionName = match.captured(2).trimmed().toHtmlEscaped();
+ const auto sectionLevel = match.captured(1).size();
+ const QString sectionName = match.captured(2).trimmed().toHtmlEscaped();
- QString replacement = QString::fromLatin1("
tag will cause a linebreak anyways
static const QRegularExpression s_regex(QLatin1String("```.*\\n((?:[^`]|``?[^`]?)*)```(\\r\\n|\\n|\\r)?"));
@@ -300,7 +301,7 @@ bool processMarkdownCodeBlock(QString &str, int &offset) {
/// @param offset The offset at which the matching shall be done. This will be modified to point right after
/// replacement text, if such a replacement has been made.
/// @returns Whether a replacement has been made
-bool processPlainLink(QString &str, int &offset) {
+bool processPlainLink(QString &str, qsizetype &offset) {
// We support links with prefixed protocol (e.g. https://bla.com) and prefixed with www (e.g. www.bla.com)
// The last part of the regex matches percent encoded characters in the url
// See also https://stackoverflow.com/a/1547940/3907364
@@ -327,12 +328,20 @@ bool processPlainLink(QString &str, int &offset) {
return false;
}
-void escapeCharacter(QString &str, int &offset) {
+void escapeCharacter(QString &str, qsizetype &offset) {
+#if QT_VERSION >= 0x060000
QString tmp(str[offset]);
+#else
+ QString tmp(str[static_cast< int >(offset)]);
+#endif
tmp = tmp.toHtmlEscaped();
+#if QT_VERSION >= 0x060000
if (tmp.size() == 1 && tmp[0] == str[offset]) {
+#else
+ if (tmp.size() == 1 && tmp[0] == str[static_cast< int >(offset)]) {
+#endif
// Nothing to escape
return;
}
@@ -342,10 +351,18 @@ void escapeCharacter(QString &str, int &offset) {
QString second;
if (offset > 0) {
+#if QT_VERSION >= 0x060000
first = str.left(offset);
+#else
+ first = str.left(static_cast< int >(offset));
+#endif
}
if (offset < str.size() - 1) {
+#if QT_VERSION >= 0x060000
second = str.right(str.size() - offset - 1);
+#else
+ second = str.right(str.size() - static_cast< int >(offset) - 1);
+#endif
}
str = first + tmp + second;
@@ -355,7 +372,7 @@ void escapeCharacter(QString &str, int &offset) {
QString markdownToHTML(const QString &markdownInput) {
QString htmlString = markdownInput;
- int offset = 0;
+ qsizetype offset = 0;
while (offset < htmlString.size()) {
// The trick here is to know that in a condition the or-branches are only
diff --git a/src/mumble/OverlayClient.cpp b/src/mumble/OverlayClient.cpp
index 827d86fbe..4b9513fb0 100644
--- a/src/mumble/OverlayClient.cpp
+++ b/src/mumble/OverlayClient.cpp
@@ -387,7 +387,7 @@ void OverlayClient::readyReadMsgInit(unsigned int length) {
OverlayMsg om;
om.omh.uiMagic = OVERLAY_MAGIC_NUMBER;
om.omh.uiType = OVERLAY_MSGTYPE_SHMEM;
- om.omh.iLength = key.length();
+ om.omh.iLength = static_cast< int >(key.length());
Q_ASSERT(sizeof(om.oms.a_cName) >= static_cast< size_t >(key.length())); // Name should be auto-generated and short
memcpy(om.oms.a_cName, key.constData(), static_cast< std::size_t >(key.length()));
qlsSocket->write(om.headerbuffer, static_cast< int >(sizeof(OverlayMsgHeader)) + om.omh.iLength);
diff --git a/src/mumble/PulseAudio.cpp b/src/mumble/PulseAudio.cpp
index a110b0f43..81069e6aa 100644
--- a/src/mumble/PulseAudio.cpp
+++ b/src/mumble/PulseAudio.cpp
@@ -828,7 +828,8 @@ void PulseAudioSystem::stream_restore_read_callback(pa_context *c, const pa_ext_
} else {
// verify missing list is empty
if (pas->qhMissingSinks.count() > 0) {
- qWarning("PulseAudio: Failed to match %d stream(s).", pas->qhMissingSinks.count());
+ qWarning("PulseAudio: Failed to match %lld stream(s).",
+ static_cast< qsizetype >(pas->qhMissingSinks.count()));
pas->qhMissingSinks.clear();
}
diff --git a/src/mumble/RichTextEditor.cpp b/src/mumble/RichTextEditor.cpp
index 06b1f20e2..7a4898b86 100644
--- a/src/mumble/RichTextEditor.cpp
+++ b/src/mumble/RichTextEditor.cpp
@@ -69,7 +69,7 @@ static QString decodeMimeString(const QByteArray &src) {
# pragma warning(pop)
#endif
const char *ptr = src.constData();
- int len = src.length();
+ auto len = src.length();
while (len && (ptr[len - 1] == 0))
--len;
return QString::fromUtf8(ptr, len);
diff --git a/src/mumble/SearchDialog.cpp b/src/mumble/SearchDialog.cpp
index 9a2cb84e9..a91aea83a 100644
--- a/src/mumble/SearchDialog.cpp
+++ b/src/mumble/SearchDialog.cpp
@@ -69,8 +69,15 @@ public:
setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicator);
- const QString matchText = m_result.fullText.replace(
- m_result.begin, m_result.length, "" + m_result.fullText.mid(m_result.begin, m_result.length) + "");
+#if QT_VERSION >= 0x060000
+ const qsizetype begin = m_result.begin;
+ const qsizetype length = m_result.length;
+#else
+ const auto begin = static_cast< int >(m_result.begin);
+ const auto length = static_cast< int >(m_result.length);
+#endif
+ const QString matchText =
+ m_result.fullText.replace(begin, length, "" + m_result.fullText.mid(begin, length) + "");
setData(MATCH_COLUMN, Qt::DisplayRole, std::move(matchText));
setData(MATCH_COLUMN, SearchDialogItemDelegate::CHANNEL_TREE_ROLE, m_result.channelHierarchy);
@@ -261,11 +268,11 @@ void SearchDialog::clearSearchResults() {
}
SearchResult regularSearch(const QString &source, const QString &searchTerm, SearchType type, bool caseSensitive) {
- constexpr int FROM = 0;
- int startIndex = source.indexOf(searchTerm, FROM, caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);
+ constexpr int FROM = 0;
+ const auto startIndex = source.indexOf(searchTerm, FROM, caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);
if (startIndex >= 0) {
- int length = searchTerm.size();
+ const auto length = searchTerm.size();
return { startIndex, length, type, source, "" };
} else {
@@ -279,8 +286,8 @@ SearchResult regexSearch(const QString &source, const QRegularExpression ®ex,
if (match.hasMatch()) {
// Found
- int startIndex = match.capturedStart();
- int length = match.capturedEnd() - startIndex;
+ const auto startIndex = match.capturedStart();
+ const auto length = match.capturedEnd() - startIndex;
return { startIndex, length, type, source, "" };
} else {
diff --git a/src/mumble/SearchDialog.h b/src/mumble/SearchDialog.h
index ac7683cf6..a9010007f 100644
--- a/src/mumble/SearchDialog.h
+++ b/src/mumble/SearchDialog.h
@@ -37,8 +37,8 @@ enum class SearchType { User, Channel };
* on it.
*/
struct SearchResult {
- int32_t begin = -1;
- int32_t length = -1;
+ int64_t begin = -1;
+ int64_t length = -1;
SearchType type;
QString fullText;
QString channelHierarchy;
diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp
index 5aeeb9f24..f9c8db973 100644
--- a/src/mumble/ServerHandler.cpp
+++ b/src/mumble/ServerHandler.cpp
@@ -635,7 +635,7 @@ void ServerHandler::message(Mumble::Protocol::TCPMessageType type, const QByteAr
}
} else if (type == Mumble::Protocol::TCPMessageType::Ping) {
MumbleProto::Ping msg;
- if (msg.ParseFromArray(qbaMsg.constData(), qbaMsg.size())) {
+ if (msg.ParseFromArray(qbaMsg.constData(), static_cast< int >(qbaMsg.size()))) {
ConnectionPtr connection(cConnection);
if (!connection)
return;
diff --git a/src/mumble/ServerInformation.cpp b/src/mumble/ServerInformation.cpp
index d9ceb89b5..c28be5054 100644
--- a/src/mumble/ServerInformation.cpp
+++ b/src/mumble/ServerInformation.cpp
@@ -61,7 +61,7 @@ void ServerInformation::updateServerInformation() {
Global::get().sh->getConnectionInfo(host, port, userName, password);
- const int userCount = ModelItem::c_qhUsers.count();
+ const auto userCount = ModelItem::c_qhUsers.count();
const unsigned int maxUserCount = Global::get().uiMaxUsers;
QString release = Global::get().sh->qsRelease;
diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp
index a29425cd4..3bb3e2c02 100644
--- a/src/mumble/Settings.cpp
+++ b/src/mumble/Settings.cpp
@@ -87,8 +87,8 @@ bool ShortcutTarget::operator==(const ShortcutTarget &o) const {
return (iChannel == o.iChannel) && (bLinks == o.bLinks) && (bChildren == o.bChildren) && (qsGroup == o.qsGroup);
}
-quint32 qHash(const ShortcutTarget &t) {
- quint32 h = t.bForceCenter ? 0x55555555 : 0xaaaaaaaa;
+std::size_t qHash(const ShortcutTarget &t) {
+ std::size_t h = t.bForceCenter ? 0x55555555 : 0xaaaaaaaa;
if (t.bCurrentSelection) {
h ^= 0x20000000;
@@ -109,8 +109,8 @@ quint32 qHash(const ShortcutTarget &t) {
return h;
}
-quint32 qHash(const QList< ShortcutTarget > &l) {
- quint32 h = static_cast< quint32 >(l.count());
+std::size_t qHash(const QList< ShortcutTarget > &l) {
+ auto h = static_cast< std::size_t >(l.count());
foreach (const ShortcutTarget &st, l)
h ^= qHash(st);
return h;
@@ -1112,8 +1112,8 @@ void Settings::legacyLoad(const QString &path) {
if (pluginKey.contains(QLatin1String("_"))) {
// The key contains the filename as well as the hash
- int index = pluginKey.lastIndexOf(QLatin1String("_"));
- pluginHash = pluginKey.right(pluginKey.size() - index - 1);
+ const auto index = pluginKey.lastIndexOf(QLatin1String("_"));
+ pluginHash = pluginKey.right(pluginKey.size() - index - 1);
} else {
pluginHash = pluginKey;
}
diff --git a/src/mumble/Settings.h b/src/mumble/Settings.h
index a75df408c..85fd94994 100644
--- a/src/mumble/Settings.h
+++ b/src/mumble/Settings.h
@@ -86,8 +86,8 @@ struct ShortcutTarget {
Q_DECLARE_METATYPE(ShortcutTarget)
-quint32 qHash(const ShortcutTarget &);
-quint32 qHash(const QList< ShortcutTarget > &);
+std::size_t qHash(const ShortcutTarget &);
+std::size_t qHash(const QList< ShortcutTarget > &);
struct PluginSetting {
QString path = {};
diff --git a/src/mumble/TalkingUI.cpp b/src/mumble/TalkingUI.cpp
index e145eb697..b7dde372e 100644
--- a/src/mumble/TalkingUI.cpp
+++ b/src/mumble/TalkingUI.cpp
@@ -296,10 +296,10 @@ QString createChannelName(const Channel *chan, bool abbreviateName, int minPrefi
// We also want to abbreviate names that nominally have the same amount of characters before and
// after abbreviation. However as we're typically not using mono-spaced fonts, the abbreviation
// indicator might still occupy less space than the original text.
- const int abbreviableSize = minPrefixChars + minPostfixChars + abbreviationIndicator.size();
+ const auto abbreviableSize = minPrefixChars + minPostfixChars + abbreviationIndicator.size();
// Iterate over all names and check how many of them could be abbreviated
- int totalCharCount = reachedRoot ? separator.size() : 0;
+ auto totalCharCount = reachedRoot ? separator.size() : 0;
for (int i = 0; i < nameList.size(); i++) {
totalCharCount += nameList[i].size();
@@ -311,7 +311,7 @@ QString createChannelName(const Channel *chan, bool abbreviateName, int minPrefi
QString groupName = reachedRoot ? separator : QString();
- for (int i = nameList.size() - 1; i >= 0; i--) {
+ for (decltype(nameList.size()) i = nameList.size() - 1; i >= 0; i--) {
if (totalCharCount > idealMaxChars && nameList[i].size() >= abbreviableSize
&& (abbreviateCurrentChannel || i != 0)) {
// Abbreviate the names as much as possible
diff --git a/src/mumble/UserListModel.cpp b/src/mumble/UserListModel.cpp
index 532cd0616..b4c6625a9 100644
--- a/src/mumble/UserListModel.cpp
+++ b/src/mumble/UserListModel.cpp
@@ -34,7 +34,7 @@ int UserListModel::rowCount(const QModelIndex &parentIndex) const {
if (parentIndex.isValid())
return 0;
- return m_userList.size();
+ return static_cast< int >(m_userList.size());
}
int UserListModel::columnCount(const QModelIndex &parentIndex) const {
diff --git a/src/mumble/UserModel.cpp b/src/mumble/UserModel.cpp
index 49d2fab12..c56f32878 100644
--- a/src/mumble/UserModel.cpp
+++ b/src/mumble/UserModel.cpp
@@ -155,7 +155,7 @@ int ModelItem::rowOfSelf() const {
}
int ModelItem::rows() const {
- return qlChildren.count();
+ return static_cast< int >(qlChildren.count());
}
int ModelItem::insertIndex(Channel *c) const {
@@ -174,7 +174,7 @@ int ModelItem::insertIndex(Channel *c) const {
}
qlpc << c;
std::sort(qlpc.begin(), qlpc.end(), Channel::lessThan);
- return qlpc.indexOf(c) + (bUsersTop ? ocount : 0);
+ return static_cast< int >(qlpc.indexOf(c) + (bUsersTop ? ocount : 0));
}
int ModelItem::insertIndex(ClientUser *p, bool userIsListener) const {
@@ -207,7 +207,8 @@ int ModelItem::insertIndex(ClientUser *p, bool userIsListener) const {
// Make sure that the a user is always added to other users either all above or all below
// sub-channels) and also make sure that listeners are grouped together and directly above
// normal users.
- return qlclientuser.indexOf(p) + (bUsersTop ? 0 : ocount) + (userIsListener ? 0 : listenerCount);
+ return static_cast< int >(qlclientuser.indexOf(p) + (bUsersTop ? 0 : ocount)
+ + (userIsListener ? 0 : listenerCount));
}
QString ModelItem::hash() const {
@@ -841,7 +842,7 @@ void UserModel::recursiveClone(const ModelItem *old, ModelItem *item, QModelInde
if (old->qlChildren.isEmpty())
return;
- beginInsertRows(index(item), 0, old->qlChildren.count());
+ beginInsertRows(index(item), 0, static_cast< int >(old->qlChildren.count()));
for (int i = 0; i < old->qlChildren.count(); ++i) {
ModelItem *o = old->qlChildren.at(i);
@@ -866,7 +867,7 @@ ModelItem *UserModel::moveItem(ModelItem *oldparent, ModelItem *newparent, Model
// Here's the idea. We insert the item, update persistent indexes, THEN remove it.
// Get the current position of the item under its parent (aka its "row")
- int oldrow = oldparent->qlChildren.indexOf(oldItem);
+ auto oldrow = static_cast< int >(oldparent->qlChildren.indexOf(oldItem));
// Get the row of the item at its new position. This depends on whether we're moving a
// channel or a user.
@@ -1093,7 +1094,7 @@ void UserModel::removeUser(ClientUser *p) {
ModelItem *item = ModelItem::c_qhUsers.value(p);
ModelItem *citem = ModelItem::c_qhChannels.value(c);
- int row = citem->qlChildren.indexOf(item);
+ const auto row = static_cast< int >(citem->qlChildren.indexOf(item));
beginRemoveRows(index(citem), row, row);
c->removeUser(p);
@@ -1484,7 +1485,7 @@ void UserModel::removeChannelListener(ModelItem *item, ModelItem *citem) {
return;
}
- int row = citem->qlChildren.indexOf(item);
+ const auto row = static_cast< int >(citem->qlChildren.indexOf(item));
beginRemoveRows(index(citem), row, row);
citem->qlChildren.removeAt(row);
diff --git a/src/mumble/UserView.cpp b/src/mumble/UserView.cpp
index 4551ea50e..24a40a7a6 100644
--- a/src/mumble/UserView.cpp
+++ b/src/mumble/UserView.cpp
@@ -65,7 +65,7 @@ void UserDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &o, painter, o.widget);
// resize rect to exclude the icons
- o.rect = option.rect.adjusted(0, 0, -m_iconTotalDimension * ql.count(), 0);
+ o.rect = option.rect.adjusted(0, 0, static_cast< int >(-m_iconTotalDimension * ql.count()), 0);
// draw icon
QRect decorationRect = style->subElementRect(QStyle::SE_ItemViewItemDecoration, &o, o.widget);
@@ -79,8 +79,8 @@ void UserDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
colorRole);
// draw icons to original rect
- QRect ps = QRect(option.rect.right() - (ql.size() * m_iconTotalDimension), option.rect.y(),
- ql.size() * m_iconTotalDimension, option.rect.height());
+ const QRect ps = QRect(option.rect.right() - (static_cast< int >(ql.size() * m_iconTotalDimension)),
+ option.rect.y(), static_cast< int >(ql.size() * m_iconTotalDimension), option.rect.height());
for (int i = 0; i < ql.size(); ++i) {
QRect r = ps;
@@ -100,7 +100,7 @@ bool UserDelegate::helpEvent(QHelpEvent *evt, QAbstractItemView *view, const QSt
const QModelIndex firstColumnIdx = index.sibling(index.row(), 1);
QVariant data = m->data(firstColumnIdx);
QList< QVariant > iconList = data.toList();
- const int offset = iconList.size() * -m_iconTotalDimension;
+ const auto offset = static_cast< int >(iconList.size() * -m_iconTotalDimension);
const int firstIconPos = option.rect.topRight().x() + offset;
if (evt->pos().x() >= firstIconPos) {
@@ -157,9 +157,9 @@ void UserView::mouseReleaseEvent(QMouseEvent *evt) {
QModelIndex idx = indexAt(clickPosition);
if ((evt->button() == Qt::LeftButton) && idx.isValid()) {
- UserModel *userModel = qobject_cast< UserModel * >(model());
- ClientUser *clientUser = userModel->getUser(idx);
- Channel *channel = userModel->getChannel(idx);
+ UserModel *userModel = qobject_cast< UserModel * >(model());
+ const ClientUser *clientUser = userModel->getUser(idx);
+ const Channel *channel = userModel->getChannel(idx);
// This is the x offset of the _beginning_ of the comment icon starting from the
// right.
diff --git a/src/mumble/VoiceRecorder.cpp b/src/mumble/VoiceRecorder.cpp
index 2ce85ab53..f383a0bfd 100644
--- a/src/mumble/VoiceRecorder.cpp
+++ b/src/mumble/VoiceRecorder.cpp
@@ -122,7 +122,7 @@ QString VoiceRecorder::expandTemplateVariables(const QString &path, const QStrin
QString tmp;
tmp.reserve(str.length() * 2);
- for (int i = 0; i < str.size(); ++i) {
+ for (decltype(str.size()) i = 0; i < str.size(); ++i) {
bool replaced = false;
if (str[i] == QLatin1Char('%')) {
QHashIterator< const QString, QString > it(vars);
diff --git a/src/mumble/XMLTools.cpp b/src/mumble/XMLTools.cpp
index f9e108bfd..3c5ff7359 100644
--- a/src/mumble/XMLTools.cpp
+++ b/src/mumble/XMLTools.cpp
@@ -28,10 +28,10 @@ void XMLTools::recurseParse(QXmlStreamReader &reader, QXmlStreamWriter &writer,
QStringList styles = stylestring.split(QLatin1String(";"), QString::SkipEmptyParts);
#endif
foreach (QString s, styles) {
- s = s.simplified();
- int idx = s.indexOf(QLatin1Char(':'));
- QString key = (idx > 0) ? s.left(idx).simplified() : s;
- QString val = (idx > 0) ? s.mid(idx + 1).simplified() : QString();
+ s = s.simplified();
+ const auto idx = s.indexOf(QLatin1Char(':'));
+ const QString key = (idx > 0) ? s.left(idx).simplified() : s;
+ const QString val = (idx > 0) ? s.mid(idx + 1).simplified() : QString();
if (!pstyle.contains(key) || (pstyle.value(key) != val)) {
style.insert(key, val);
diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp
index a22b35732..3261083f7 100644
--- a/src/mumble/main.cpp
+++ b/src/mumble/main.cpp
@@ -175,7 +175,7 @@ int main(int argc, char **argv) {
// which other switches are modifying. If it is parsed first, the order of the arguments does not matter.
QString settingsFile;
QStringList args = a.arguments();
- const int index = std::max(args.lastIndexOf(QLatin1String("-c")), args.lastIndexOf(QLatin1String("--config")));
+ const auto index = std::max(args.lastIndexOf(QLatin1String("-c")), args.lastIndexOf(QLatin1String("--config")));
if (index >= 0) {
if (index + 1 < args.count()) {
QFile inifile(args.at(index + 1));
diff --git a/src/murmur/Cert.cpp b/src/murmur/Cert.cpp
index 12b1f67d6..93dc190ec 100644
--- a/src/murmur/Cert.cpp
+++ b/src/murmur/Cert.cpp
@@ -32,12 +32,12 @@ bool Server::isKeyForCert(const QSslKey &key, const QSslCertificate &cert) {
EVP_PKEY *pkey = nullptr;
BIO *mem = nullptr;
- mem = BIO_new_mem_buf(qbaKey.data(), qbaKey.size());
+ mem = BIO_new_mem_buf(qbaKey.data(), static_cast< int >(qbaKey.size()));
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
pkey = d2i_PrivateKey_bio(mem, nullptr);
BIO_free(mem);
- mem = BIO_new_mem_buf(qbaCert.data(), qbaCert.size());
+ mem = BIO_new_mem_buf(qbaCert.data(), static_cast< int >(qbaCert.size()));
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
x509 = d2i_X509_bio(mem, nullptr);
BIO_free(mem);
diff --git a/src/murmur/Meta.cpp b/src/murmur/Meta.cpp
index 7b2ae9d4a..7b5976964 100644
--- a/src/murmur/Meta.cpp
+++ b/src/murmur/Meta.cpp
@@ -540,7 +540,8 @@ bool MetaParams::loadSSLSettings() {
}
if (ql.size() > 0) {
tmpIntermediates = ql;
- qCritical("MetaParams: Adding %d intermediate certificates from certificate file.", ql.size());
+ qCritical("MetaParams: Adding %lld intermediate certificates from certificate file.",
+ static_cast< qsizetype >(ql.size()));
}
}
diff --git a/src/murmur/PBKDF2.cpp b/src/murmur/PBKDF2.cpp
index a0ced9fc7..4558d1083 100644
--- a/src/murmur/PBKDF2.cpp
+++ b/src/murmur/PBKDF2.cpp
@@ -96,9 +96,10 @@ QString PBKDF2::getHash(const QString &hexSalt, const QString &password, int ite
const QByteArray utf8Password = password.toUtf8();
const QByteArray salt = QByteArray::fromHex(hexSalt.toLatin1());
- if (PKCS5_PBKDF2_HMAC(utf8Password.constData(), utf8Password.size(),
- reinterpret_cast< const unsigned char * >(salt.constData()), salt.size(), iterationCount,
- EVP_sha384(), DERIVED_KEY_LENGTH, reinterpret_cast< unsigned char * >(hash.data()))
+ if (PKCS5_PBKDF2_HMAC(utf8Password.constData(), static_cast< int >(utf8Password.size()),
+ reinterpret_cast< const unsigned char * >(salt.constData()), static_cast< int >(salt.size()),
+ iterationCount, EVP_sha384(), DERIVED_KEY_LENGTH,
+ reinterpret_cast< unsigned char * >(hash.data()))
== 0) {
qFatal("PBKDF2: PKCS5_PBKDF2_HMAC failed: %s", ERR_error_string(ERR_get_error(), nullptr));
return QString();
@@ -111,7 +112,7 @@ QString PBKDF2::getHash(const QString &hexSalt, const QString &password, int ite
QString PBKDF2::getSalt() {
QByteArray salt(SALT_LENGTH, 0);
- CryptographicRandom::fillBuffer(salt.data(), salt.size());
+ CryptographicRandom::fillBuffer(salt.data(), static_cast< int >(salt.size()));
return QString::fromLatin1(salt.toHex());
}
diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp
index e0ccd09ad..be3a5d7e4 100644
--- a/src/murmur/Server.cpp
+++ b/src/murmur/Server.cpp
@@ -1706,8 +1706,8 @@ void Server::message(Mumble::Protocol::TCPMessageType type, const QByteArray &qb
}
if (type == Mumble::Protocol::TCPMessageType::UDPTunnel) {
- int len = qbaMsg.size();
- if (len < 2 || static_cast< unsigned int >(len) > Mumble::Protocol::MAX_UDP_PACKET_SIZE) {
+ const auto len = qbaMsg.size();
+ if (len < 2 || static_cast< std::size_t >(len) > Mumble::Protocol::MAX_UDP_PACKET_SIZE) {
// Drop messages that are too small to be senseful or that are bigger than allowed
return;
}
@@ -1743,28 +1743,28 @@ void Server::message(Mumble::Protocol::TCPMessageType type, const QByteArray &qb
}
#ifdef QT_NO_DEBUG
-# define PROCESS_MUMBLE_TCP_MESSAGE(name, value) \
- case Mumble::Protocol::TCPMessageType::name: { \
- MumbleProto::name msg; \
- if (msg.ParseFromArray(qbaMsg.constData(), qbaMsg.size())) { \
- msg.DiscardUnknownFields(); \
- msg##name(u, msg); \
- } \
- break; \
+# define PROCESS_MUMBLE_TCP_MESSAGE(name, value) \
+ case Mumble::Protocol::TCPMessageType::name: { \
+ MumbleProto::name msg; \
+ if (msg.ParseFromArray(qbaMsg.constData(), static_cast< int >(qbaMsg.size()))) { \
+ msg.DiscardUnknownFields(); \
+ msg##name(u, msg); \
+ } \
+ break; \
}
#else
-# define PROCESS_MUMBLE_TCP_MESSAGE(name, value) \
- case Mumble::Protocol::TCPMessageType::name: { \
- MumbleProto::name msg; \
- if (msg.ParseFromArray(qbaMsg.constData(), qbaMsg.size())) { \
- if (type != Mumble::Protocol::TCPMessageType::Ping) { \
- printf("== %s:\n", #name); \
- msg.PrintDebugString(); \
- } \
- msg.DiscardUnknownFields(); \
- msg##name(u, msg); \
- } \
- break; \
+# define PROCESS_MUMBLE_TCP_MESSAGE(name, value) \
+ case Mumble::Protocol::TCPMessageType::name: { \
+ MumbleProto::name msg; \
+ if (msg.ParseFromArray(qbaMsg.constData(), static_cast< int >(qbaMsg.size()))) { \
+ if (type != Mumble::Protocol::TCPMessageType::Ping) { \
+ printf("== %s:\n", #name); \
+ msg.PrintDebugString(); \
+ } \
+ msg.DiscardUnknownFields(); \
+ msg##name(u, msg); \
+ } \
+ break; \
}
#endif
@@ -1792,7 +1792,7 @@ void Server::tcpTransmitData(QByteArray a, unsigned int id) {
Connection *c = qhUsers.value(id);
if (c) {
QByteArray qba;
- int len = a.size();
+ const auto len = a.size();
qba.resize(len + 6);
unsigned char *uc = reinterpret_cast< unsigned char * >(qba.data());
@@ -2319,7 +2319,7 @@ bool Server::isTextAllowed(QString &text, bool &changed) {
}
return ((iMaxTextMessageLength == 0) || (text.length() <= iMaxTextMessageLength));
} else {
- int length = text.length();
+ auto length = text.length();
// No limits
if ((iMaxTextMessageLength == 0) && (iMaxImageMessageLength == 0))