Skip to content

Commit

Permalink
RCSwitch: fix error with newer gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
xkonni committed Mar 25, 2020
1 parent 1a33f88 commit 13055a1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions RCSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ char* RCSwitch::getCodeWordB(int nAddressCode, int nChannelCode, boolean bStatus

const char* code[5] = { "FFFF", "0FFF", "F0FF", "FF0F", "FFF0" };
if (nAddressCode < 1 || nAddressCode > 4 || nChannelCode < 1 || nChannelCode > 4) {
return '\0';
sReturn[0] = '\0';
return sReturn;
}
for (int i = 0; i<4; i++) {
sReturn[nReturnPos++] = code[nAddressCode][i];
Expand Down Expand Up @@ -258,7 +259,8 @@ char* RCSwitch::getCodeWordA(char* sGroup, int nChannelCode, boolean bStatus) {
const char* code[6] = { "FFFFF", "0FFFF", "F0FFF", "FF0FF", "FFF0F", "FFFF0" };

if (nChannelCode < 1 || nChannelCode > 5) {
return '\0';
sReturn[0] = '\0';
return sReturn;
}

for (int i = 0; i<5; i++) {
Expand All @@ -267,7 +269,8 @@ char* RCSwitch::getCodeWordA(char* sGroup, int nChannelCode, boolean bStatus) {
} else if (sGroup[i] == '1') {
sReturn[nReturnPos++] = '0';
} else {
return '\0';
sReturn[0] = '\0';
return sReturn;
}
}

Expand Down Expand Up @@ -332,7 +335,8 @@ char* RCSwitch::getCodeWordD(char* sGroup, int nChannelCode, boolean bStatus) {
//const char* code[6] = { "FFFFF", "0FFFF", "F0FFF", "FF0FF", "FFF0F", "FFFF0" }; //former conversion of socket number to binary

if (nChannelCode < 1 || nChannelCode > 31) {
return '\0';
sReturn[0] = '\0';
return sReturn;
}

for (int i = 0; i<5; i++) {
Expand All @@ -341,7 +345,8 @@ char* RCSwitch::getCodeWordD(char* sGroup, int nChannelCode, boolean bStatus) {
} else if (sGroup[i] == '1') {
sReturn[nReturnPos++] = '0';
} else {
return '\0';
sReturn[0] = '\0';
return sReturn;
}
}

Expand Down Expand Up @@ -385,7 +390,8 @@ char* RCSwitch::getCodeWordC(char sFamily, int nGroup, int nDevice, boolean bSta
int nReturnPos = 0;

if ( (byte)sFamily < 97 || (byte)sFamily > 112 || nGroup < 1 || nGroup > 4 || nDevice < 1 || nDevice > 4) {
return '\0';
sReturn[0] = '\0';
return sReturn;
}

char* sDeviceGroupCode = dec2binWzerofill( (nDevice-1) + (nGroup-1)*4, 4 );
Expand Down

0 comments on commit 13055a1

Please sign in to comment.