mirror of
https://github.com/agessaman/MeshCore.git
synced 2026-08-25 15:49:58 +00:00
ESP-IDF stores the mbedTLS stack error as a positive magnitude (it captures -ret), so negating it before printing produced "mbedtls:-0xFFFF8100" instead of "mbedtls:-0x7F00" for the record-buffer allocation failure. %04X is a minimum width, so nothing masked it. Normalisation moves into MQTTReplyFormat.h as mbedtlsErrorMagnitude() rather than staying inline in the bridge: inline is why this survived, since the existing test passes the already-correct magnitude straight into replyAppendf and never exercised the caller. It accepts either sign so a later SDK storing the real negative code still renders, and widens to int64_t before negating because negating INT32_MIN is undefined behaviour. MQTTReplyFormat.h also gains the stdint.h it was always missing: it compiled only because MQTTBridge.cpp pulls stdint in via other headers, and the host test includes the header standalone.