mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/nvs: make some methods const
This commit is contained in:
parent
49b2dfea1e
commit
3ce433cfd1
@ -33,7 +33,7 @@ public:
|
||||
return mData;
|
||||
}
|
||||
|
||||
Tenum get(size_t index)
|
||||
Tenum get(size_t index) const
|
||||
{
|
||||
assert(index >= 0 && index < Nitems);
|
||||
size_t wordIndex = index / ITEMS_PER_WORD;
|
||||
|
@ -536,7 +536,7 @@ esp_err_t Page::alterPageState(PageState state)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t Page::readEntry(size_t index, Item& dst)
|
||||
esp_err_t Page::readEntry(size_t index, Item& dst) const
|
||||
{
|
||||
auto rc = spi_flash_read(getEntryAddress(index), reinterpret_cast<uint32_t*>(&dst), sizeof(dst));
|
||||
if (rc != ESP_OK) {
|
||||
@ -658,7 +658,7 @@ void Page::invalidateCache()
|
||||
mFindInfo = CachedFindInfo();
|
||||
}
|
||||
|
||||
void Page::debugDump()
|
||||
void Page::debugDump() const
|
||||
{
|
||||
printf("state=%x addr=%x seq=%d\nfirstUsed=%d nextFree=%d used=%d erased=%d\n", mState, mBaseAddress, mSeqNumber, static_cast<int>(mFirstUsedEntry), static_cast<int>(mNextFreeEntry), mUsedEntryCount, mErasedEntryCount);
|
||||
size_t skip = 0;
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
|
||||
void invalidateCache();
|
||||
|
||||
void debugDump();
|
||||
void debugDump() const;
|
||||
|
||||
protected:
|
||||
|
||||
@ -195,7 +195,7 @@ protected:
|
||||
|
||||
esp_err_t alterPageState(PageState state);
|
||||
|
||||
esp_err_t readEntry(size_t index, Item& dst);
|
||||
esp_err_t readEntry(size_t index, Item& dst) const;
|
||||
|
||||
esp_err_t writeEntry(const Item& item);
|
||||
|
||||
@ -210,7 +210,7 @@ protected:
|
||||
return static_cast<uint8_t>(type) & 0x0f;
|
||||
}
|
||||
|
||||
uint32_t getEntryAddress(size_t entry)
|
||||
uint32_t getEntryAddress(size_t entry) const
|
||||
{
|
||||
assert(entry < ENTRY_COUNT);
|
||||
return mBaseAddress + ENTRY_DATA_OFFSET + static_cast<uint32_t>(entry) * ENTRY_SIZE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user