Upravy na zaklade clang-tidy
This commit is contained in:
parent
a3da39e6aa
commit
1692a2adf4
@ -13,7 +13,7 @@ bool isBase64(const char *p)
|
|||||||
return false;
|
return false;
|
||||||
do {
|
do {
|
||||||
c = *p;
|
c = *p;
|
||||||
if (isalnum(c)) // alphanumberics are OK
|
if (isalnum(c)) // alphanumerics are OK
|
||||||
continue;
|
continue;
|
||||||
if (c == '/' || c == '+' || c == '=') // + or / or = is OK.
|
if (c == '/' || c == '+' || c == '=') // + or / or = is OK.
|
||||||
continue;
|
continue;
|
||||||
@ -31,7 +31,7 @@ void strEncode(String &str)
|
|||||||
char c;
|
char c;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint32_t cid = ESP_getChipId();
|
uint32_t cid = ESP_getChipId();
|
||||||
uint32_t *pkey = (uint32_t *)&key[0];
|
uint32_t* pkey = (uint32_t *)&key[0];
|
||||||
uint8_t data[str.length()];
|
uint8_t data[str.length()];
|
||||||
|
|
||||||
*pkey = cid;
|
*pkey = cid;
|
||||||
@ -54,11 +54,8 @@ void strDecode(String &str)
|
|||||||
|
|
||||||
const char *src = &str[0];
|
const char *src = &str[0];
|
||||||
uint8_t key[4];
|
uint8_t key[4];
|
||||||
unsigned int enciphidx = 0;
|
|
||||||
unsigned int i;
|
|
||||||
uint8_t b;
|
|
||||||
uint32_t cid = ESP_getChipId();
|
uint32_t cid = ESP_getChipId();
|
||||||
uint32_t *pkey = (uint32_t *)&key[0];
|
uint32_t* pkey = (uint32_t *)&key[0];
|
||||||
uint8_t data[str.length()];
|
uint8_t data[str.length()];
|
||||||
String result = F("");
|
String result = F("");
|
||||||
|
|
||||||
@ -66,6 +63,10 @@ void strDecode(String &str)
|
|||||||
unsigned int clen = base64_decode_chars(src, str.length(), (char *)data);
|
unsigned int clen = base64_decode_chars(src, str.length(), (char *)data);
|
||||||
|
|
||||||
if (0 != clen) {
|
if (0 != clen) {
|
||||||
|
unsigned int enciphidx = 0;
|
||||||
|
unsigned int i;
|
||||||
|
uint8_t b;
|
||||||
|
|
||||||
*pkey = cid;
|
*pkey = cid;
|
||||||
for (i = 0; i < clen; i++) {
|
for (i = 0; i < clen; i++) {
|
||||||
b = data[i];
|
b = data[i];
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef _ENCSTRING_HPP_
|
#pragma once
|
||||||
#define _ENCSTRING_HPP_
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,5 +23,3 @@ void strDecode(String &str);
|
|||||||
* @return false Retezec neni kodovany pomoci Base64
|
* @return false Retezec neni kodovany pomoci Base64
|
||||||
*/
|
*/
|
||||||
bool isBase64(const char *p);
|
bool isBase64(const char *p);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user