Merge PR #3311: Fix and refactor problems found via GCC 7's -Wimplicit-fallthrough.

This commit is contained in:
Davide Beatrici 2018-01-22 00:55:12 +01:00 committed by GitHub
commit 1b203cdc8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 36 deletions

View File

@ -164,16 +164,14 @@ bool Group::isMember(Channel *curChan, Channel *aclChan, QString name, ServerUse
int maxdesc = 1000;
int minpath = 0;
QStringList args = name.split(QLatin1String(","));
switch (args.count()) {
default:
case 3:
maxdesc = args[2].isEmpty() ? maxdesc : args[2].toInt();
case 2:
mindesc = args[1].isEmpty() ? mindesc : args[1].toInt();
case 1:
minpath = args[0].isEmpty() ? minpath : args[0].toInt();
case 0:
break;
if (args.count() >= 3) {
maxdesc = args[2].isEmpty() ? maxdesc : args[2].toInt();
}
if (args.count() >= 2) {
mindesc = args[1].isEmpty() ? mindesc : args[1].toInt();
}
if (args.count() >= 1) {
minpath = args[0].isEmpty() ? minpath : args[0].toInt();
}
Channel *home = pl->cChannel;

View File

@ -135,6 +135,7 @@ int CertWizard::nextId() const {
return 2;
else if (qrbExport->isChecked())
return 3;
return -1;
}
case 2: // Import
if (validateCert(kpCurrent))

View File

@ -201,6 +201,8 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
pasOutput = pa_stream_new(pacContext, mumble_sink_input, &pss, (pss.channels == 1) ? NULL : &pcm);
pa_stream_set_state_callback(pasOutput, stream_callback, this);
pa_stream_set_write_callback(pasOutput, write_callback, this);
break;
}
case PA_STREAM_UNCONNECTED:
do_start = true;
@ -268,7 +270,10 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
pasInput = pa_stream_new(pacContext, "Microphone", &pss, NULL);
pa_stream_set_state_callback(pasInput, stream_callback, this);
pa_stream_set_read_callback(pasInput, read_callback, this);
break;
}
case PA_STREAM_UNCONNECTED:
do_start = true;
break;
@ -330,6 +335,8 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
pasSpeaker = pa_stream_new(pacContext, mumble_echo, &pss, (pss.channels == 1) ? NULL : &pcm);
pa_stream_set_state_callback(pasSpeaker, stream_callback, this);
pa_stream_set_read_callback(pasSpeaker, read_callback, this);
break;
}
case PA_STREAM_UNCONNECTED:
do_start = true;

View File

@ -844,21 +844,25 @@ void Server::run() {
MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((buffer[0] >> 5) & 0x7);
switch (msgType) {
case MessageHandler::UDPVoiceSpeex:
case MessageHandler::UDPVoiceCELTAlpha:
case MessageHandler::UDPVoiceCELTBeta:
if (bOpus)
break;
case MessageHandler::UDPVoiceOpus: {
u->aiUdpFlag = 1;
processMsg(u, buffer, len);
break;
}
case MessageHandler::UDPPing: {
QByteArray qba;
sendMessage(u, buffer, len, qba, true);
}
if (msgType == MessageHandler::UDPVoiceSpeex ||
msgType == MessageHandler::UDPVoiceCELTAlpha ||
msgType == MessageHandler::UDPVoiceCELTBeta ||
msgType == MessageHandler::UDPVoiceOpus) {
// Allow all voice packets through by default.
bool ok = true;
// ...Unless we're in Opus mode. In Opus mode, only Opus packets are allowed.
if (bOpus && msgType != MessageHandler::UDPVoiceOpus) {
ok = false;
}
if (ok) {
u->aiUdpFlag = 1;
processMsg(u, buffer, len);
}
} else if (msgType == MessageHandler::UDPPing) {
QByteArray qba;
sendMessage(u, buffer, len, qba, true);
}
#ifdef Q_OS_UNIX
fds[i].revents = 0;
@ -1464,17 +1468,22 @@ void Server::message(unsigned int uiType, const QByteArray &qbaMsg, ServerUser *
MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((buffer[0] >> 5) & 0x7);
switch (msgType) {
case MessageHandler::UDPVoiceCELTAlpha:
case MessageHandler::UDPVoiceCELTBeta:
case MessageHandler::UDPVoiceSpeex:
if (bOpus)
break;
case MessageHandler::UDPVoiceOpus:
processMsg(u, buffer, l);
break;
default:
break;
if (msgType == MessageHandler::UDPVoiceSpeex ||
msgType == MessageHandler::UDPVoiceCELTAlpha ||
msgType == MessageHandler::UDPVoiceCELTBeta ||
msgType == MessageHandler::UDPVoiceOpus) {
// Allow all voice packets through by default.
bool ok = true;
// ...Unless we're in Opus mode. In Opus mode, only Opus packets are allowed.
if (bOpus && msgType != MessageHandler::UDPVoiceOpus) {
ok = false;
}
if (ok) {
u->aiUdpFlag = 1;
processMsg(u, buffer, 1);
}
}
return;