OVMS3-idf/components/nvs_flash/src
Ivan Grokhotkov e314f42b0c nvs: fix Page::findItem and Storage::findItem regression
When read caching was added, Page::findItem started modifying itemIndex reference argument even if item wasn't found.
Incidentally, Storage::findItem reused itemIndex when starting search at next page.
So,
- if the first page had a cached index (findItem was called for that page), and it pointed to a non-zero index,
- first page has a few empty items at the end (but is marked full),
- next search looked up the item on the second page,
- index of the item on the second page was less than the cached index on the first page,
then the search would fail because cached starting index was reused.

This change fixes both sides of the problem:
- Page::findItem shouldn't modify itemIndex argument if item is not found
- Storage::findItem should not reuse itemIndex between pages

Two tests have been added.
2016-11-03 20:18:30 +08:00
..
compressed_enum_table.hpp components/nvs: make some methods const 2016-08-23 12:08:00 +08:00
intrusive_list.h Initial public version 2016-08-17 23:08:22 +08:00
nvs.hpp Initial public version 2016-08-17 23:08:22 +08:00
nvs_api.cpp nvs: fix memory leaks in HashList and nvs_close 2016-10-26 12:25:53 +08:00
nvs_item_hash_list.cpp nvs: fix memory leaks in HashList and nvs_close 2016-10-26 12:25:53 +08:00
nvs_item_hash_list.hpp nvs: fix memory leaks in HashList and nvs_close 2016-10-26 12:25:53 +08:00
nvs_page.cpp nvs: fix Page::findItem and Storage::findItem regression 2016-11-03 20:18:30 +08:00
nvs_page.hpp components/nvs: add erase function 2016-09-23 08:08:03 +08:00
nvs_pagemanager.cpp Add test for compiling in release mode, fix warnings and errors which appeared 2016-10-17 13:40:10 +08:00
nvs_pagemanager.hpp components/nvs: fix formatting 2016-09-22 21:05:47 +08:00
nvs_platform.hpp components/nvs: fix build, use log library instead of printf 2016-09-23 09:00:28 +08:00
nvs_storage.cpp nvs: fix Page::findItem and Storage::findItem regression 2016-11-03 20:18:30 +08:00
nvs_storage.hpp components/nvs: add erase function 2016-09-23 08:08:03 +08:00
nvs_types.cpp components/nvs: maintain item hash list at page level 2016-09-21 18:02:52 +08:00
nvs_types.hpp components/nvs: fix formatting 2016-09-22 21:05:47 +08:00