mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Cleanup some Stream compiler warnings from #3337
This commit is contained in:
parent
e7d5a19c7c
commit
1b63cfa6a4
@ -61,8 +61,8 @@ int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal)
|
|||||||
|
|
||||||
if( c < 0 ||
|
if( c < 0 ||
|
||||||
c == '-' ||
|
c == '-' ||
|
||||||
c >= '0' && c <= '9' ||
|
(c >= '0' && c <= '9') ||
|
||||||
detectDecimal && c == '.') return c;
|
(detectDecimal && c == '.')) return c;
|
||||||
|
|
||||||
switch( lookahead ){
|
switch( lookahead ){
|
||||||
case SKIP_NONE: return -1; // Fail code.
|
case SKIP_NONE: return -1; // Fail code.
|
||||||
@ -74,6 +74,8 @@ int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal)
|
|||||||
case '\n': break;
|
case '\n': break;
|
||||||
default: return -1; // Fail code.
|
default: return -1; // Fail code.
|
||||||
}
|
}
|
||||||
|
case SKIP_ALL:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
read(); // discard non-numeric
|
read(); // discard non-numeric
|
||||||
}
|
}
|
||||||
@ -138,7 +140,7 @@ long Stream::parseInt(LookaheadMode lookahead, char ignore)
|
|||||||
|
|
||||||
do{
|
do{
|
||||||
if(c == ignore)
|
if(c == ignore)
|
||||||
; // ignore this charactor
|
; // ignore this character
|
||||||
else if(c == '-')
|
else if(c == '-')
|
||||||
isNegative = true;
|
isNegative = true;
|
||||||
else if(c >= '0' && c <= '9') // is c a digit?
|
else if(c >= '0' && c <= '9') // is c a digit?
|
||||||
@ -159,7 +161,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
|
|||||||
bool isNegative = false;
|
bool isNegative = false;
|
||||||
bool isFraction = false;
|
bool isFraction = false;
|
||||||
long value = 0;
|
long value = 0;
|
||||||
char c;
|
int c;
|
||||||
float fraction = 1.0;
|
float fraction = 1.0;
|
||||||
|
|
||||||
c = peekNextDigit(lookahead, true);
|
c = peekNextDigit(lookahead, true);
|
||||||
@ -182,7 +184,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
|
|||||||
read(); // consume the character we got with peek
|
read(); // consume the character we got with peek
|
||||||
c = timedPeek();
|
c = timedPeek();
|
||||||
}
|
}
|
||||||
while( (c >= '0' && c <= '9') || c == '.' && !isFraction || c == ignore );
|
while( (c >= '0' && c <= '9') || (c == '.' && !isFraction) || c == ignore );
|
||||||
|
|
||||||
if(isNegative)
|
if(isNegative)
|
||||||
value = -value;
|
value = -value;
|
||||||
|
@ -61,8 +61,8 @@ int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal )
|
|||||||
|
|
||||||
if( c < 0 ||
|
if( c < 0 ||
|
||||||
c == '-' ||
|
c == '-' ||
|
||||||
c >= '0' && c <= '9' ||
|
(c >= '0' && c <= '9') ||
|
||||||
detectDecimal && c == '.') return c;
|
(detectDecimal && c == '.')) return c;
|
||||||
|
|
||||||
switch( lookahead ){
|
switch( lookahead ){
|
||||||
case SKIP_NONE: return -1; // Fail code.
|
case SKIP_NONE: return -1; // Fail code.
|
||||||
@ -74,6 +74,8 @@ int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal )
|
|||||||
case '\n': break;
|
case '\n': break;
|
||||||
default: return -1; // Fail code.
|
default: return -1; // Fail code.
|
||||||
}
|
}
|
||||||
|
case SKIP_ALL:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
read(); // discard non-numeric
|
read(); // discard non-numeric
|
||||||
}
|
}
|
||||||
@ -159,7 +161,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
|
|||||||
bool isNegative = false;
|
bool isNegative = false;
|
||||||
bool isFraction = false;
|
bool isFraction = false;
|
||||||
long value = 0;
|
long value = 0;
|
||||||
char c;
|
int c;
|
||||||
float fraction = 1.0;
|
float fraction = 1.0;
|
||||||
|
|
||||||
c = peekNextDigit(lookahead, true);
|
c = peekNextDigit(lookahead, true);
|
||||||
@ -182,7 +184,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
|
|||||||
read(); // consume the character we got with peek
|
read(); // consume the character we got with peek
|
||||||
c = timedPeek();
|
c = timedPeek();
|
||||||
}
|
}
|
||||||
while( (c >= '0' && c <= '9') || c == '.' && !isFraction || c == ignore );
|
while( (c >= '0' && c <= '9') || (c == '.' && !isFraction) || c == ignore );
|
||||||
|
|
||||||
if(isNegative)
|
if(isNegative)
|
||||||
value = -value;
|
value = -value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user