Skip to content

Commit e836e7c

Browse files
committed
EEPROM: round requested size to 4 byte boundary (#659)
1 parent 57240be commit e836e7c

File tree

1 file changed

+5
-3
lines changed
  • hardware/esp8266com/esp8266/libraries/EEPROM

1 file changed

+5
-3
lines changed

hardware/esp8266com/esp8266/libraries/EEPROM/EEPROM.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
1+
/*
22
EEPROM.cpp - esp8266 EEPROM emulation
33
44
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
55
This file is part of the esp8266 core for Arduino environment.
6-
6+
77
This library is free software; you can redistribute it and/or
88
modify it under the terms of the GNU Lesser General Public
99
License as published by the Free Software Foundation; either
@@ -34,7 +34,7 @@ EEPROMClass::EEPROMClass(uint32_t sector)
3434
: _sector(sector)
3535
, _data(0)
3636
, _size(0)
37-
, _dirty(false)
37+
, _dirty(false)
3838
{
3939
}
4040

@@ -44,6 +44,8 @@ void EEPROMClass::begin(size_t size) {
4444
if (size > SPI_FLASH_SEC_SIZE)
4545
size = SPI_FLASH_SEC_SIZE;
4646

47+
size = (size + 3) & (~3);
48+
4749
if (_data) {
4850
delete[] _data;
4951
}

0 commit comments

Comments
 (0)