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

Run clang-tidy against Arduino 3 (#2146)

* Add macros header with more usable Arduino version defines

* Change Arduino version checking to use our version defines

* Add missing ESP8266 check

* Rename Arduino version macro to ARDUINO_VERSION_CODE

* Upgrade clang-tidy to use Arduino 3

* Fix clang-tidy warnings

* Upgrade NeoPixelBus to upstream 2.6.7

* Use Arduino-version-appropriate API to set redirect flags

* Remove now unnecessary CLANG_TIDY ifdefs

* Add preprocessor hackery to avoid including pgmspace.h

* Bump base image to 4.1.1 and update lint

* Fix nfctag

* Fix make_unique ambiguous

* Fix ignore name

* Fix ambiguous v2

* Remove unused begin

* Cast time_t to prevent issues on platforms where time_t is 32bit

Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
Oxan van Leeuwen
2021-09-13 18:55:04 +02:00
committed by GitHub
parent ed7983af41
commit 924df1e7de
30 changed files with 98 additions and 66 deletions

View File

@@ -83,11 +83,11 @@ bool NdefMessage::add_text_record(const std::string &text) { return this->add_te
bool NdefMessage::add_text_record(const std::string &text, const std::string &encoding) {
std::string payload = to_string(text.length()) + encoding + text;
return this->add_record(make_unique<NdefRecord>(TNF_WELL_KNOWN, "T", payload));
return this->add_record(std::unique_ptr<NdefRecord>{new NdefRecord(TNF_WELL_KNOWN, "T", payload)});
}
bool NdefMessage::add_uri_record(const std::string &uri) {
return this->add_record(make_unique<NdefRecord>(TNF_WELL_KNOWN, "U", uri));
return this->add_record(std::unique_ptr<NdefRecord>{new NdefRecord(TNF_WELL_KNOWN, "U", uri)});
}
std::vector<uint8_t> NdefMessage::encode() {

View File

@@ -31,13 +31,13 @@ class NfcTag {
NfcTag(std::vector<uint8_t> &uid, const std::string &tag_type, std::vector<uint8_t> &ndef_data) {
this->uid_ = uid;
this->tag_type_ = tag_type;
this->ndef_message_ = make_unique<NdefMessage>(ndef_data);
this->ndef_message_ = std::unique_ptr<NdefMessage>(new NdefMessage(ndef_data));
};
NfcTag(const NfcTag &rhs) {
uid_ = rhs.uid_;
tag_type_ = rhs.tag_type_;
if (rhs.ndef_message_ != nullptr)
ndef_message_ = make_unique<NdefMessage>(*rhs.ndef_message_);
ndef_message_ = std::unique_ptr<NdefMessage>(new NdefMessage(*rhs.ndef_message_));
}
std::vector<uint8_t> &get_uid() { return this->uid_; };