mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 15:18:16 +00:00
fix: change token type in split_to_int_vector_ from string to uint8_t for improved type safety
This commit is contained in:
parent
6fb093aa1d
commit
f51f5cd70b
@ -340,7 +340,7 @@ void DynamicLampComponent::restore_lamp_values_(uint8_t lamp_number) {
|
|||||||
std::vector<uint8_t> DynamicLampComponent::split_to_int_vector_(const std::string& s, const std::string& delimiter) {
|
std::vector<uint8_t> DynamicLampComponent::split_to_int_vector_(const std::string& s, const std::string& delimiter) {
|
||||||
std::vector<uint8_t> tokens;
|
std::vector<uint8_t> tokens;
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
std::string token;
|
uint8_t token;
|
||||||
while ((pos = s.find(delimiter)) != std::string::npos) {
|
while ((pos = s.find(delimiter)) != std::string::npos) {
|
||||||
c_substr = s.substr(0, pos).c_str();
|
c_substr = s.substr(0, pos).c_str();
|
||||||
token = static_cast<uint8_t>(atoi(c_substr));
|
token = static_cast<uint8_t>(atoi(c_substr));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user