Skip to content

Commit 1f8c713

Browse files
committed
Fixed warning in Stream.cpp
1 parent 37a127f commit 1f8c713

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

cores/arduino/Stream.cpp

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
/*
2-
Copyright (c) 2014 Arduino. All right reserved.
2+
Stream.cpp - adds parsing methods to Stream class
3+
Copyright (c) 2008 David A. Mellis. All right reserved.
34
4-
This library is free software; you can redistribute it and/or
5-
modify it under the terms of the GNU Lesser General Public
6-
License as published by the Free Software Foundation; either
7-
version 2.1 of the License, or (at your option) any later version.
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
89
9-
This library is distributed in the hope that it will be useful,
10-
but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12-
See the GNU Lesser General Public License for more details.
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
1314
14-
You should have received a copy of the GNU Lesser General Public
15-
License along with this library; if not, write to the Free Software
16-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17-
*/
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
Created July 2011
20+
parsing functions based on TextFinder library by Michael Margolis
21+
*/
1822

1923
#include "Arduino.h"
2024
#include "Stream.h"
@@ -71,7 +75,7 @@ void Stream::setTimeout(unsigned long timeout) // sets the maximum number of mi
7175
// find returns true if the target string is found
7276
bool Stream::find(char *target)
7377
{
74-
return findUntil(target, "");
78+
return findUntil(target, (char*)"");
7579
}
7680

7781
// reads data from the stream until the target string of given length is found
@@ -95,21 +99,21 @@ bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t
9599
size_t index = 0; // maximum target string length is 64k bytes!
96100
size_t termIndex = 0;
97101
int c;
98-
102+
99103
if( *target == 0)
100104
return true; // return true if target is a null string
101105
while( (c = timedRead()) > 0){
102-
106+
103107
if(c != target[index])
104108
index = 0; // reset index if any char does not match
105-
109+
106110
if( c == target[index]){
107111
//////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1);
108112
if(++index >= targetLen){ // return true if all chars in the target match
109113
return true;
110114
}
111115
}
112-
116+
113117
if(termLen > 0 && c == terminator[termIndex]){
114118
if(++termIndex >= termLen)
115119
return false; // return false if terminate string found before target string

0 commit comments

Comments
 (0)