From 7d5629d8f5ec171467e8ed438dd610c7bc1df9eb Mon Sep 17 00:00:00 2001 From: Vebryn Date: Sat, 16 Dec 2017 20:03:52 +0100 Subject: [PATCH] Error into find/findUntil fonctions Structure was not properly declared. Proper way is to first initialize t structure then assigning values. --- hardware/arduino/zuno/cores/zuno/Stream.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hardware/arduino/zuno/cores/zuno/Stream.cpp b/hardware/arduino/zuno/cores/zuno/Stream.cpp index 657612b..3815c2d 100644 --- a/hardware/arduino/zuno/cores/zuno/Stream.cpp +++ b/hardware/arduino/zuno/cores/zuno/Stream.cpp @@ -100,10 +100,23 @@ bool Stream::findUntil(char *target, char *terminator) bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t termLen) { if (!terminator) { - MultiTarget t[1] = {{target, targetLen, 0}}; + MultiTarget t[1]; + + strcpy(t[0].str, target); + t[0].len = targetLen; + t[0].index = 0; + return findMulti(t, 1) == 0 ? true : false; } else { - MultiTarget t[2] = {{target, targetLen, 0}, {terminator, termLen, 0}}; + MultiTarget t[2]; + + strcpy(t[0].str, target); + t[0].len = targetLen; + t[0].index = 0; + strcpy(t[1].str, terminator); + t[1].len = termLen; + t[1].index = 0; + return findMulti(t, 2) == 0 ? true : false; } }