1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-01 03:26:58 +03:00

Fix pgm_read_ptr() (#5735)

Fix dereferencing in pgm_read_ptr() macro on 8266 and host.

Fixes #5733
This commit is contained in:
Earle F. Philhower, III
2019-02-07 18:47:44 +00:00
committed by GitHub
parent 82be4d02dc
commit 29bb7fc4c1

View File

@ -73,11 +73,11 @@ static inline uint16_t pgm_read_word_inlined(const void* addr) {
#ifdef __cplusplus
#define pgm_read_dword(addr) (*reinterpret_cast<const uint32_t*>(addr))
#define pgm_read_float(addr) (*reinterpret_cast<const float*>(addr))
#define pgm_read_ptr(addr) (*reinterpret_cast<const void*>(addr))
#define pgm_read_ptr(addr) (*reinterpret_cast<const void* const *>(addr))
#else
#define pgm_read_dword(addr) (*(const uint32_t*)(addr))
#define pgm_read_float(addr) (*(const float*)(addr))
#define pgm_read_ptr(addr) (*(const void*)(addr))
#define pgm_read_ptr(addr) (*(const void* const*)(addr))
#endif
#define pgm_read_byte_near(addr) pgm_read_byte(addr)