kopia lustrzana https://github.com/espressif/esp-idf
components/nvs: clear handles list on init, fix returning *length in nvs_get_{str,blob}
rodzic
35d50643bc
commit
7447d08605
|
@ -56,6 +56,7 @@ extern "C" esp_err_t nvs_flash_init(uint32_t baseSector, uint32_t sectorCount)
|
|||
Lock::init();
|
||||
Lock lock;
|
||||
NVS_DEBUGV("%s %d %d\r\n", __func__, baseSector, sectorCount);
|
||||
s_nvs_handles.clear();
|
||||
return s_nvs_storage.init(baseSector, sectorCount);
|
||||
}
|
||||
|
||||
|
@ -260,12 +261,15 @@ static esp_err_t nvs_get_str_or_blob(nvs_handle handle, nvs::ItemType type, cons
|
|||
return err;
|
||||
}
|
||||
|
||||
if (length != nullptr && out_value == nullptr) {
|
||||
if (length == nullptr) {
|
||||
return ESP_ERR_NVS_INVALID_LENGTH;
|
||||
}
|
||||
else if (out_value == nullptr) {
|
||||
*length = dataSize;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (length == nullptr || *length < dataSize) {
|
||||
else if (*length < dataSize) {
|
||||
*length = dataSize;
|
||||
return ESP_ERR_NVS_INVALID_LENGTH;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue