Skip to content

Commit 85c109f

Browse files
committed
Fixing warnings in Stream (Paul Stoffregen)
http://code.google.com/p/arduino/issues/detail?id=208
1 parent a2235e3 commit 85c109f

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

hardware/arduino/cores/arduino/Stream.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ int Stream::peekNextDigit()
6767
// Public Methods
6868
//////////////////////////////////////////////////////////////
6969

70-
void Stream::setTimeout( long timeout) // sets the maximum number of milliseconds to wait
70+
void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait
7171
{
72-
this->_timeout = timeout;
72+
_timeout = timeout;
7373
}
7474

7575
// find returns true if the target string is found
@@ -165,7 +165,7 @@ long Stream::parseInt(char skipChar)
165165
// as parseInt but returns a floating point value
166166
float Stream::parseFloat()
167167
{
168-
parseFloat(NO_SKIP_CHAR);
168+
return parseFloat(NO_SKIP_CHAR);
169169
}
170170

171171
// as above but the given skipChar is ignored
@@ -174,7 +174,6 @@ float Stream::parseFloat(char skipChar){
174174
boolean isNegative = false;
175175
boolean isFraction = false;
176176
long value = 0;
177-
float fValue;
178177
char c;
179178
float fraction = 1.0;
180179

@@ -223,7 +222,7 @@ int Stream::readBytes( char *buffer, size_t length)
223222

224223
int Stream::readBytesUntil( char terminator, char *buffer, size_t length)
225224
{
226-
int index = 0;
225+
unsigned int index = 0;
227226
*buffer = 0;
228227
while(index < length-1 ){
229228
int c = timedRead();

hardware/arduino/cores/arduino/Stream.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ readBytesBetween( pre_string, terminator, buffer, length)
3838
class Stream : public Print
3939
{
4040
private:
41-
long _timeout; // number of milliseconds to wait for the next char before aborting timed read
42-
long _startMillis; // used for timeout measurement
41+
unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
42+
unsigned long _startMillis; // used for timeout measurement
4343
int timedRead(); // private method to read stream with timeout
4444
int timedPeek(); // private method to peek stream with timeout
4545
int peekNextDigit(); // returns the next numeric digit in the stream or -1 if timeout
@@ -54,7 +54,7 @@ class Stream : public Print
5454

5555
// parsing methods
5656

57-
void setTimeout(long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
57+
void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
5858

5959
bool find(char *target); // reads data from the stream until the target string is found
6060
// returns true if target string is found, false if timed out (see setTimeout)

0 commit comments

Comments
 (0)