Skip to content

Commit 558747d

Browse files
authored
fix(zigbee): not using reserved word string
1 parent c7e7387 commit 558747d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Diff for: libraries/Zigbee/src/ZigbeeEP.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -246,22 +246,22 @@ void ZigbeeEP::zbReadBasicCluster(const esp_zb_zcl_attribute_t *attribute) {
246246
/* Basic cluster attributes */
247247
if (attribute->id == ESP_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID && attribute->data.type == ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING && attribute->data.value) {
248248
zbstring_t *zbstr = (zbstring_t *)attribute->data.value;
249-
std::vector<char> string(zbstr->len + 1);
250-
memcpy(string.data(), zbstr->data, zbstr->len);
251-
string[zbstr->len] = '\0';
252-
log_i("Peer Manufacturer is \"%s\"", string);
249+
std::vector<char> m_manufacturer(zbstr->len + 1);
250+
memcpy(m_manufacturer.data(), zbstr->data, zbstr->len);
251+
m_manufacturer[zbstr->len] = '\0';
252+
log_i("Peer Manufacturer is \"%s\"", m_manufacturer);
253253
free(_read_manufacturer); // Free any previously allocated memory
254-
_read_manufacturer = strdup(string.data()); // Duplicate the string for persistent storage
254+
_read_manufacturer = strdup(m_manufacturer.data()); // Duplicate the information for persistent storage
255255
xSemaphoreGive(lock);
256256
}
257257
if (attribute->id == ESP_ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID && attribute->data.type == ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING && attribute->data.value) {
258258
zbstring_t *zbstr = (zbstring_t *)attribute->data.value;
259-
std::vector<char> string(zbstr->len + 1);
260-
memcpy(string.data(), zbstr->data, zbstr->len);
261-
string[zbstr->len] = '\0';
262-
log_i("Peer Model is \"%s\"", string);
259+
std::vector<char> m_model(zbstr->len + 1);
260+
memcpy(m_model.data(), zbstr->data, zbstr->len);
261+
m_model[zbstr->len] = '\0';
262+
log_i("Peer Model is \"%s\"", m_model);
263263
free(_read_model); // Free any previously allocated memory
264-
_read_model = strdup(string.data()); // Duplicate the string for persistent storage
264+
_read_model = strdup(m_model.data()); // Duplicate the information for persistent storage
265265
xSemaphoreGive(lock);
266266
}
267267
}

0 commit comments

Comments
 (0)