mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
FIX: Warnings due to Qt containers now using qsizetype instead of int for sizes
https://doc.qt.io/qt-6/qtcore-changes-qt6.html#api-changes
This commit is contained in:
parent
c04377960c
commit
ef97a5d88f
@ -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,
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -218,7 +218,7 @@ public slots:
|
||||
|
||||
struct ShortcutKey {
|
||||
Shortcut s;
|
||||
int iNumUp;
|
||||
qsizetype iNumUp;
|
||||
GlobalShortcut *gs;
|
||||
};
|
||||
|
||||
|
||||
@ -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)));
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 }
|
||||
|
||||
@ -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("<h%1>%2</h%1>").arg(sectionLevel).arg(sectionName);
|
||||
const QString replacement = QString::fromLatin1("<h%1>%2</h%1>").arg(sectionLevel).arg(sectionName);
|
||||
|
||||
str.replace(match.capturedStart(), match.capturedEnd() - match.capturedStart(), replacement);
|
||||
|
||||
@ -92,7 +93,7 @@ QString unescapeURL(const QString &url) {
|
||||
/// @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 processMarkdownLink(QString &str, int &offset) {
|
||||
bool processMarkdownLink(QString &str, qsizetype &offset) {
|
||||
// Link in format [link text](url)
|
||||
static const QRegularExpression s_regex(QLatin1String("\\[([^\\]\\[]+)\\]\\(([^\\)]+)\\)"));
|
||||
|
||||
@ -126,7 +127,7 @@ bool processMarkdownLink(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 processMarkdownBold(QString &str, int &offset) {
|
||||
bool processMarkdownBold(QString &str, qsizetype &offset) {
|
||||
// Bold text is marked as **bold**
|
||||
static const QRegularExpression s_regex(QLatin1String("\\*\\*([^*]+)\\*\\*"));
|
||||
|
||||
@ -149,7 +150,7 @@ bool processMarkdownBold(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 processMarkdownItalic(QString &str, int &offset) {
|
||||
bool processMarkdownItalic(QString &str, qsizetype &offset) {
|
||||
// Italic text is marked as *italic*
|
||||
static const QRegularExpression s_regex(QLatin1String("\\*([^*]+)\\*"));
|
||||
|
||||
@ -172,7 +173,7 @@ bool processMarkdownItalic(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 processMarkdownStrikethrough(QString &str, int &offset) {
|
||||
bool processMarkdownStrikethrough(QString &str, qsizetype &offset) {
|
||||
// Strikethrough text is marked as ~~text~~
|
||||
static const QRegularExpression s_regex(QLatin1String("~~([^~]+)~~"));
|
||||
|
||||
@ -195,7 +196,7 @@ bool processMarkdownStrikethrough(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 processMarkdownBlockQuote(QString &str, int &offset) {
|
||||
bool processMarkdownBlockQuote(QString &str, qsizetype &offset) {
|
||||
// Block quotes are (consecutive) lines starting with "> "
|
||||
static const QRegularExpression s_regex(QLatin1String("^(>|>) (.|\\n(>|>) )+"),
|
||||
QRegularExpression::MultilineOption);
|
||||
@ -235,7 +236,7 @@ bool processMarkdownBlockQuote(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 processMarkdownInlineCode(QString &str, int &offset) {
|
||||
bool processMarkdownInlineCode(QString &str, qsizetype &offset) {
|
||||
// Inline code fragments are marked as `code`
|
||||
static const QRegularExpression s_regex(QLatin1String("`([^`\n]+)`"));
|
||||
|
||||
@ -258,7 +259,7 @@ bool processMarkdownInlineCode(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 processMarkdownCodeBlock(QString &str, int &offset) {
|
||||
bool processMarkdownCodeBlock(QString &str, qsizetype &offset) {
|
||||
// Code blocks are marked as ```code```
|
||||
// Also consume a potential following newline as the <pre> 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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -69,8 +69,15 @@ public:
|
||||
|
||||
setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicator);
|
||||
|
||||
const QString matchText = m_result.fullText.replace(
|
||||
m_result.begin, m_result.length, "<b>" + m_result.fullText.mid(m_result.begin, m_result.length) + "</b>");
|
||||
#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, "<b>" + m_result.fullText.mid(begin, length) + "</b>");
|
||||
|
||||
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 {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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 = {};
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -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))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user