armink / EasyFlash

Lightweight IoT device information storage solution: KV/IAP/LOG. | 轻量级物联网设备信息存储方案:参数存储、在线升级及日志存储 ,全新一代版本请移步至 https://github.com/armink/FlashDB
MIT License
1.99k stars 760 forks source link

内存不对齐访问 #130

Open FighterChan opened 2 years ago

FighterChan commented 2 years ago

EfErrCode ef_port_read(uint32_t addr, uint32_t buf, size_t size); EfErrCode ef_port_write(uint32_t addr, const uint32_t buf, size_t size);

第二个参数设计成uint32_t 类型,传参后指向uint8_t 类型,不会有内存非对齐访问的风险吗?

i-jaffer commented 1 year ago

我也觉得这里使用uint8_t*要好一点,不知开发者是否有其他用意

armink commented 1 year ago

是的,uint8_t * 会更好,只是由于兼容性的考虑,暂时没有调整。目前 FlashDB 已经将这块改进了。