Skip to content

Commit 822b9fb

Browse files
committed
make use of language size helpers
1 parent 206456f commit 822b9fb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cores/esp8266/Updater.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,16 @@ bool UpdaterClass::end(bool evenIfRemaining){
230230
// If expectedSigLen is non-zero, we expect the last four bytes of the buffer to
231231
// contain a matching length field, preceded by the bytes of the signature itself.
232232
// But if expectedSigLen is zero, we expect neither a signature nor a length field;
233-
static constexpr uint32_t sigSize = 4;
233+
static constexpr uint32_t SigSize = sizeof(uint32_t);
234234
const uint32_t expectedSigLen = _verify->length();
235-
const uint32_t sigLenAddr = _startAddress + _size - sigSize;
235+
const uint32_t sigLenAddr = _startAddress + _size - SigSize;
236236
uint32_t sigLen = 0;
237237

238238
#ifdef DEBUG_UPDATER
239239
DEBUG_UPDATER.printf_P(PSTR("[Updater] expected sigLen: %lu\n"), expectedSigLen);
240240
#endif
241241
if (expectedSigLen > 0) {
242-
ESP.flashRead(sigLenAddr, &sigLen, sigSize);
242+
ESP.flashRead(sigLenAddr, &sigLen, SigSize);
243243
#ifdef DEBUG_UPDATER
244244
DEBUG_UPDATER.printf_P(PSTR("[Updater] sigLen from flash: %lu\n"), sigLen);
245245
#endif
@@ -253,12 +253,12 @@ bool UpdaterClass::end(bool evenIfRemaining){
253253

254254
auto binSize = _size;
255255
if (expectedSigLen > 0) {
256-
if (binSize < (sigLen + sigSize)) {
256+
if (binSize < (sigLen + SigSize)) {
257257
_setError(UPDATE_ERROR_SIGN);
258258
_reset();
259259
return false;
260260
}
261-
binSize -= (sigLen + sigSize);
261+
binSize -= (sigLen + SigSize);
262262
#ifdef DEBUG_UPDATER
263263
DEBUG_UPDATER.printf_P(PSTR("[Updater] Adjusted size (without the signature and sigLen): %lu\n"), binSize);
264264
#endif

0 commit comments

Comments
 (0)