Correct lack of parentheses in conditionals

merge-requests/5/merge
Phil Taylor 2021-08-07 11:16:55 +01:00
rodzic 9ca39a0676
commit f86aa6e4f6
1 zmienionych plików z 12 dodań i 12 usunięć

Wyświetl plik

@ -287,11 +287,11 @@ void rigCtlClient::socketReadyRead()
responseCode = -1; responseCode = -1;
} }
} }
else if (command[0] == "T" || command[0] == "set_ptt") else if (command.length() > 1 & (command[0] == "T" || command[0] == "set_ptt"))
{ {
setCommand = true; setCommand = true;
if (rigCaps.hasPTTCommand) { if (rigCaps.hasPTTCommand) {
if (command.length() > 1 && command[1] == "0") { if (command[1] == "0") {
emit parent->setPTT(false); emit parent->setPTT(false);
} }
else { else {
@ -318,10 +318,10 @@ void rigCtlClient::socketReadyRead()
} }
response.append(resp); response.append(resp);
} }
else if (command[0] == "V" || command[0] == "set_vfo") else if (command.length() > 1 && (command[0] == "V" || command[0] == "set_vfo"))
{ {
setCommand = true; setCommand = true;
if (command.length() > 1 && command[1] == "?") { if (command[1] == "?") {
response.append("set_vfo: ?"); response.append("set_vfo: ?");
response.append("VFOA"); response.append("VFOA");
response.append("VFOB"); response.append("VFOB");
@ -329,7 +329,7 @@ void rigCtlClient::socketReadyRead()
response.append("Main"); response.append("Main");
response.append("MEM"); response.append("MEM");
} }
else if (command.length() > 1 && (command[1] == "VFOB" || command[1] == "Sub")) { else if (command[1] == "VFOB" || command[1] == "Sub") {
emit parent->setVFO(1); emit parent->setVFO(1);
} }
else { else {
@ -359,10 +359,10 @@ void rigCtlClient::socketReadyRead()
} }
response.append(resp); response.append(resp);
} }
else if (command[0] == "S" || command[0] == "set_split_vfo") else if (command.length() > 1 && (command[0] == "S" || command[0] == "set_split_vfo"))
{ {
setCommand = true; setCommand = true;
if (command.length() > 1 && command[1] == "1") if (command[1] == "1")
{ {
emit parent->setSplit(1); emit parent->setSplit(1);
} }
@ -496,11 +496,11 @@ void rigCtlClient::socketReadyRead()
{ {
setCommand = true; setCommand = true;
} }
else if (command[0] == "l" || command[0] == "get_level") else if (command.length() > 1 && (command[0] == "l" || command[0] == "get_level"))
{ {
QString resp; QString resp;
float value = 0; float value = 0;
if (longReply && command.length() > 1) { if (longReply) {
resp.append("Level Value: "); resp.append("Level Value: ");
} }
if (command[1] == "STRENGTH") { if (command[1] == "STRENGTH") {
@ -559,7 +559,7 @@ void rigCtlClient::socketReadyRead()
resp.append(QString("%1").arg(value)); resp.append(QString("%1").arg(value));
response.append(resp); response.append(resp);
} }
else if (command[0] == "L" || command[0] == "set_level" && command.length() > 2) else if (command.length() > 2 && (command[0] == "L" || command[0] == "set_level"))
{ {
int value; int value;
setCommand = true; setCommand = true;
@ -632,7 +632,7 @@ void rigCtlClient::socketReadyRead()
if (command.length()>2) if (command.length()>2)
qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2]; qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2];
} }
else if (command[0] == 0x88 || command[0] == "get_powerstat") else if (command.length() > 1 && (command[0] == 0x88 || command[0] == "get_powerstat"))
{ {
QString resp; QString resp;
@ -643,7 +643,7 @@ void rigCtlClient::socketReadyRead()
response.append(resp); response.append(resp);
} }
else if (command.length() > 1 && command[0] == 0x87 || command[0] == "set_powerstat") else if (command.length() > 1 && (command[0] == 0x87 || command[0] == "set_powerstat"))
{ {
setCommand = true; setCommand = true;
if (command[1] == "0") if (command[1] == "0")