[Print] Cppcheck fixes
This commit is contained in:
parent
bf1933a0c4
commit
d685534154
3 changed files with 11 additions and 7 deletions
|
@ -122,11 +122,15 @@ uint16_t ITA2String::getBits(char c) {
|
||||||
// search ITA2 table
|
// search ITA2 table
|
||||||
uint16_t code = 0x0000;
|
uint16_t code = 0x0000;
|
||||||
for(uint8_t i = 0; i < RADIOLIB_ITA2_LENGTH; i++) {
|
for(uint8_t i = 0; i < RADIOLIB_ITA2_LENGTH; i++) {
|
||||||
if(RADIOLIB_NONVOLATILE_READ_BYTE(&ITA2Table[i][0]) == c) {
|
char* ptr = const_cast<char*>(&ITA2Table[i][0]);
|
||||||
|
if(RADIOLIB_NONVOLATILE_READ_BYTE(ptr) == c) {
|
||||||
// character is in letter shift
|
// character is in letter shift
|
||||||
code = (RADIOLIB_ITA2_LTRS << 5) | i;
|
code = (RADIOLIB_ITA2_LTRS << 5) | i;
|
||||||
break;
|
break;
|
||||||
} else if(RADIOLIB_NONVOLATILE_READ_BYTE(&ITA2Table[i][1]) == c) {
|
}
|
||||||
|
|
||||||
|
ptr = const_cast<char*>(&ITA2Table[i][1]);
|
||||||
|
if(RADIOLIB_NONVOLATILE_READ_BYTE(ptr) == c) {
|
||||||
// character is in figures shift
|
// character is in figures shift
|
||||||
code = (RADIOLIB_ITA2_FIGS << 5) | i;
|
code = (RADIOLIB_ITA2_FIGS << 5) | i;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -59,7 +59,7 @@ size_t RadioLibPrint::print(const __FlashStringHelper* fstr) {
|
||||||
ITA2String ita2 = ITA2String(str);
|
ITA2String ita2 = ITA2String(str);
|
||||||
n = RadioLibPrint::print(ita2);
|
n = RadioLibPrint::print(ita2);
|
||||||
} else {
|
} else {
|
||||||
n = write((uint8_t*)str, len);
|
n = write(reinterpret_cast<uint8_t*>(str), len);
|
||||||
}
|
}
|
||||||
#if !RADIOLIB_STATIC_ONLY
|
#if !RADIOLIB_STATIC_ONLY
|
||||||
delete[] str;
|
delete[] str;
|
||||||
|
@ -73,7 +73,7 @@ size_t RadioLibPrint::print(const String& str) {
|
||||||
ITA2String ita2 = ITA2String(str.c_str());
|
ITA2String ita2 = ITA2String(str.c_str());
|
||||||
n = RadioLibPrint::print(ita2);
|
n = RadioLibPrint::print(ita2);
|
||||||
} else {
|
} else {
|
||||||
n = write((uint8_t*)str.c_str(), str.length());
|
n = write(reinterpret_cast<uint8_t*>(const_cast<char*>(str.c_str())), str.length());
|
||||||
}
|
}
|
||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ size_t RadioLibPrint::print(const char str[]) {
|
||||||
ITA2String ita2 = ITA2String(str);
|
ITA2String ita2 = ITA2String(str);
|
||||||
n = RadioLibPrint::print(ita2);
|
n = RadioLibPrint::print(ita2);
|
||||||
} else {
|
} else {
|
||||||
n = write((uint8_t*)str, strlen(str));
|
n = write(reinterpret_cast<uint8_t*>(const_cast<char*>(str)), strlen(str));
|
||||||
}
|
}
|
||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,8 @@ class RadioLibPrint {
|
||||||
uint8_t encoding = RADIOLIB_ASCII_EXTENDED;
|
uint8_t encoding = RADIOLIB_ASCII_EXTENDED;
|
||||||
const char* lineFeed = "\r\n";
|
const char* lineFeed = "\r\n";
|
||||||
|
|
||||||
size_t printNumber(unsigned long, uint8_t);
|
virtual size_t printNumber(unsigned long, uint8_t);
|
||||||
size_t printFloat(double, uint8_t);
|
virtual size_t printFloat(double, uint8_t);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue