mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
Merge branch 'bugfix/btdm_nvs_get_str_or_blob' into 'master'
fix: Fix bug of function nvs_get_str_or_blob See merge request !1182
This commit is contained in:
@@ -402,6 +402,7 @@ static esp_err_t nvs_get_str_or_blob(nvs_handle handle, nvs::ItemType type, cons
|
||||
return ESP_ERR_NVS_INVALID_LENGTH;
|
||||
}
|
||||
|
||||
*length = dataSize;
|
||||
return entry.mStoragePtr->readItem(entry.mNsIndex, type, key, out_value, dataSize);
|
||||
}
|
||||
|
||||
|
@@ -530,6 +530,10 @@ TEST_CASE("nvs api tests", "[nvs]")
|
||||
TEST_ESP_ERR(ESP_ERR_NVS_INVALID_LENGTH, nvs_get_str(handle_2, "key", buf, &buf_len_short));
|
||||
CHECK(buf_len_short == buf_len);
|
||||
|
||||
size_t buf_len_long = buf_len + 1;
|
||||
TEST_ESP_OK(nvs_get_str(handle_2, "key", buf, &buf_len_long));
|
||||
CHECK(buf_len_long == buf_len);
|
||||
|
||||
TEST_ESP_OK(nvs_get_str(handle_2, "key", buf, &buf_len));
|
||||
|
||||
CHECK(0 == strcmp(buf, str));
|
||||
|
Reference in New Issue
Block a user