From 76d19c8ccdba47088673961b7d702cdb45739c9e Mon Sep 17 00:00:00 2001 From: Pablo2048 Date: Wed, 16 Jan 2019 18:41:49 +0100 Subject: [PATCH] BugFix v trace_dump - spravne pouziti flashString --- src/trace.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/trace.cpp b/src/trace.cpp index 4ef1919..34239a4 100644 --- a/src/trace.cpp +++ b/src/trace.cpp @@ -229,14 +229,18 @@ void trace_dump(uint8_t severity, const char *prefix, uint8_t *address, size_t s print(severity, buffer, idx); } -// TODO: POZOR!!! tady si nejsem jisty, zda je spravne pouziti __FlashStringHelperu v snprintf_P !!!! void trace_dump(uint8_t severity, const __FlashStringHelper *prefix, uint8_t *address, size_t size) { char buffer[MAX_LINE_LEN + 1 + 3]; int idx = 0; if (prefix) - idx = snprintf_P(buffer, MAX_LINE_LEN, PSTR("%s"), prefix); + { + char dummy[64]; + + strcpy_P(dummy, (const char *)prefix); + idx = snprintf_P(buffer, MAX_LINE_LEN, PSTR("%s"), dummy); + } while ((idx < MAX_LINE_LEN) && size) {