1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-04 04:12:23 +01:00

Avoid non-const globals and enable clang-tidy check (#1892)

This commit is contained in:
Stefan Agner
2021-06-10 22:19:44 +02:00
committed by GitHub
parent 360effcb72
commit 501f88ca86
376 changed files with 466 additions and 468 deletions

View File

@@ -3,7 +3,7 @@
namespace esphome {
namespace nfc {
static const char *TAG = "nfc.ndef_message";
static const char *const TAG = "nfc.ndef_message";
NdefMessage::NdefMessage(std::vector<uint8_t> &data) {
ESP_LOGV(TAG, "Building NdefMessage with %zu bytes", data.size());

View File

@@ -3,7 +3,7 @@
namespace esphome {
namespace nfc {
static const char *TAG = "nfc.ndef_record";
static const char *const TAG = "nfc.ndef_record";
uint32_t NdefRecord::get_encoded_size() {
uint32_t size = 2;

View File

@@ -16,42 +16,42 @@ static const uint8_t TNF_UNCHANGED = 0x06;
static const uint8_t TNF_RESERVED = 0x07;
static const uint8_t PAYLOAD_IDENTIFIERS_COUNT = 0x23;
static const char *PAYLOAD_IDENTIFIERS[] = {"",
"http://www.",
"https://www.",
"http://",
"https://",
"tel:",
"mailto:",
"ftp://anonymous:anonymous@",
"ftp://ftp.",
"ftps://",
"sftp://",
"smb://",
"nfs://",
"ftp://",
"dav://",
"news:",
"telnet://",
"imap:",
"rtsp://",
"urn:",
"pop:",
"sip:",
"sips:",
"tftp:",
"btspp://",
"btl2cap://",
"btgoep://",
"tcpobex://",
"irdaobex://",
"file://",
"urn:epc:id:",
"urn:epc:tag:",
"urn:epc:pat:",
"urn:epc:raw:",
"urn:epc:",
"urn:nfc:"};
static const char *const PAYLOAD_IDENTIFIERS[] = {"",
"http://www.",
"https://www.",
"http://",
"https://",
"tel:",
"mailto:",
"ftp://anonymous:anonymous@",
"ftp://ftp.",
"ftps://",
"sftp://",
"smb://",
"nfs://",
"ftp://",
"dav://",
"news:",
"telnet://",
"imap:",
"rtsp://",
"urn:",
"pop:",
"sip:",
"sips:",
"tftp:",
"btspp://",
"btl2cap://",
"btgoep://",
"tcpobex://",
"irdaobex://",
"file://",
"urn:epc:id:",
"urn:epc:tag:",
"urn:epc:pat:",
"urn:epc:raw:",
"urn:epc:",
"urn:nfc:"};
class NdefRecord {
public:

View File

@@ -4,7 +4,7 @@
namespace esphome {
namespace nfc {
static const char *TAG = "nfc";
static const char *const TAG = "nfc";
std::string format_uid(std::vector<uint8_t> &uid) {
char buf[(uid.size() * 2) + uid.size() - 1];

View File

@@ -32,9 +32,9 @@ static const uint8_t MIFARE_CMD_READ = 0x30;
static const uint8_t MIFARE_CMD_WRITE = 0xA0;
static const uint8_t MIFARE_CMD_WRITE_ULTRALIGHT = 0xA2;
static const char *MIFARE_CLASSIC = "Mifare Classic";
static const char *NFC_FORUM_TYPE_2 = "NFC Forum Type 2";
static const char *ERROR = "Error";
static const char *const MIFARE_CLASSIC = "Mifare Classic";
static const char *const NFC_FORUM_TYPE_2 = "NFC Forum Type 2";
static const char *const ERROR = "Error";
static const uint8_t DEFAULT_KEY[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
static const uint8_t NDEF_KEY[6] = {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7};

View File

@@ -3,7 +3,7 @@
namespace esphome {
namespace nfc {
static const char *TAG = "nfc.tag";
static const char *const TAG = "nfc.tag";
} // namespace nfc
} // namespace esphome