Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1b63cfa

Browse files
Cleanup some Stream compiler warnings from #3337
1 parent e7d5a19 commit 1b63cfa

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

‎hardware/arduino/avr/cores/arduino/Stream.cpp‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal)
6161

6262
if( c < 0 ||
6363
c == '-' ||
64-
c >= '0' && c <= '9' ||
65-
detectDecimal && c == '.') return c;
64+
(c >= '0' && c <= '9') ||
65+
(detectDecimal && c == '.')) return c;
6666

6767
switch( lookahead ){
6868
case SKIP_NONE: return -1; // Fail code.
@@ -74,6 +74,8 @@ int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal)
7474
case '\n': break;
7575
default: return -1; // Fail code.
7676
}
77+
case SKIP_ALL:
78+
break;
7779
}
7880
read(); // discard non-numeric
7981
}
@@ -138,7 +140,7 @@ long Stream::parseInt(LookaheadMode lookahead, char ignore)
138140

139141
do{
140142
if(c == ignore)
141-
; // ignore this charactor
143+
; // ignore this character
142144
else if(c == '-')
143145
isNegative = true;
144146
else if(c >= '0' && c <= '9') // is c a digit?
@@ -159,7 +161,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
159161
bool isNegative = false;
160162
bool isFraction = false;
161163
long value = 0;
162-
char c;
164+
int c;
163165
float fraction = 1.0;
164166

165167
c = peekNextDigit(lookahead, true);
@@ -182,7 +184,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
182184
read(); // consume the character we got with peek
183185
c = timedPeek();
184186
}
185-
while( (c >= '0' && c <= '9') || c == '.' && !isFraction || c == ignore );
187+
while( (c >= '0' && c <= '9') || (c == '.' && !isFraction) || c == ignore );
186188

187189
if(isNegative)
188190
value = -value;

‎hardware/arduino/sam/cores/arduino/Stream.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal )
6161

6262
if( c < 0 ||
6363
c == '-' ||
64-
c >= '0' && c <= '9' ||
65-
detectDecimal && c == '.') return c;
64+
(c >= '0' && c <= '9') ||
65+
(detectDecimal && c == '.')) return c;
6666

6767
switch( lookahead ){
6868
case SKIP_NONE: return -1; // Fail code.
@@ -74,6 +74,8 @@ int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal )
7474
case '\n': break;
7575
default: return -1; // Fail code.
7676
}
77+
case SKIP_ALL:
78+
break;
7779
}
7880
read(); // discard non-numeric
7981
}
@@ -159,7 +161,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
159161
bool isNegative = false;
160162
bool isFraction = false;
161163
long value = 0;
162-
char c;
164+
int c;
163165
float fraction = 1.0;
164166

165167
c = peekNextDigit(lookahead, true);
@@ -182,7 +184,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
182184
read(); // consume the character we got with peek
183185
c = timedPeek();
184186
}
185-
while( (c >= '0' && c <= '9') || c == '.' && !isFraction || c == ignore );
187+
while( (c >= '0' && c <= '9') || (c == '.' && !isFraction) || c == ignore );
186188

187189
if(isNegative)
188190
value = -value;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /