mirror of https://github.com/arendst/Tasmota.git
Add RemoveAllSpaces()
This commit is contained in:
parent
3d2e77f320
commit
53cfabdbca
|
@ -377,6 +377,23 @@ char* Trim(char* p)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* RemoveAllSpaces(char* p)
|
||||||
|
{
|
||||||
|
// remove any white space from the base64
|
||||||
|
char *cursor = p;
|
||||||
|
uint32_t offset = 0;
|
||||||
|
while (1) {
|
||||||
|
*cursor = *(cursor + offset);
|
||||||
|
if ((' ' == *cursor) || ('\t' == *cursor) || ('\n' == *cursor)) { // if space found, remove this char until end of string
|
||||||
|
offset++;
|
||||||
|
} else {
|
||||||
|
if (0 == *cursor) { break; }
|
||||||
|
cursor++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
char* NoAlNumToUnderscore(char* dest, const char* source)
|
char* NoAlNumToUnderscore(char* dest, const char* source)
|
||||||
{
|
{
|
||||||
char* write = dest;
|
char* write = dest;
|
||||||
|
|
|
@ -1078,17 +1078,7 @@ void CmndTlsKey(void) {
|
||||||
memcpy_P(spi_buffer, tls_spi_start, tls_spi_len);
|
memcpy_P(spi_buffer, tls_spi_start, tls_spi_len);
|
||||||
|
|
||||||
// remove any white space from the base64
|
// remove any white space from the base64
|
||||||
char *cursor = XdrvMailbox.data;
|
RemoveAllSpaces(XdrvMailbox.data);
|
||||||
uint32_t offset = 0;
|
|
||||||
while (1) {
|
|
||||||
*cursor = *(cursor + offset);
|
|
||||||
if ((' ' == *cursor) || ('\t' == *cursor) || ('\n' == *cursor)) { // if space found, remove this char until end of string
|
|
||||||
offset++;
|
|
||||||
} else {
|
|
||||||
if (0 == *cursor) { break; }
|
|
||||||
cursor++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// allocate buffer for decoded base64
|
// allocate buffer for decoded base64
|
||||||
uint32_t bin_len = decode_base64_length((unsigned char*)XdrvMailbox.data);
|
uint32_t bin_len = decode_base64_length((unsigned char*)XdrvMailbox.data);
|
||||||
|
|
Loading…
Reference in New Issue