mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
EEPROM: round requested size to 4 byte boundary (#659)
This commit is contained in:
parent
3a3f25997c
commit
afd0ca23a0
@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
EEPROM.cpp - esp8266 EEPROM emulation
|
EEPROM.cpp - esp8266 EEPROM emulation
|
||||||
|
|
||||||
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
||||||
This file is part of the esp8266 core for Arduino environment.
|
This file is part of the esp8266 core for Arduino environment.
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
@ -34,7 +34,7 @@ EEPROMClass::EEPROMClass(uint32_t sector)
|
|||||||
: _sector(sector)
|
: _sector(sector)
|
||||||
, _data(0)
|
, _data(0)
|
||||||
, _size(0)
|
, _size(0)
|
||||||
, _dirty(false)
|
, _dirty(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,6 +44,8 @@ void EEPROMClass::begin(size_t size) {
|
|||||||
if (size > SPI_FLASH_SEC_SIZE)
|
if (size > SPI_FLASH_SEC_SIZE)
|
||||||
size = SPI_FLASH_SEC_SIZE;
|
size = SPI_FLASH_SEC_SIZE;
|
||||||
|
|
||||||
|
size = (size + 3) & (~3);
|
||||||
|
|
||||||
if (_data) {
|
if (_data) {
|
||||||
delete[] _data;
|
delete[] _data;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user