Fixing warnings (unsigned comparisons to 0). (maniacbug)

This commit is contained in:
David A. Mellis 2012-01-02 12:57:23 -05:00
parent c441bc1a0d
commit cce4ef7c69
2 changed files with 3 additions and 3 deletions

View File

@ -500,7 +500,7 @@ int String::lastIndexOf( char theChar ) const
int String::lastIndexOf(char ch, unsigned int fromIndex) const int String::lastIndexOf(char ch, unsigned int fromIndex) const
{ {
if (fromIndex >= len || fromIndex < 0) return -1; if (fromIndex >= len) return -1;
char tempchar = buffer[fromIndex + 1]; char tempchar = buffer[fromIndex + 1];
buffer[fromIndex + 1] = '\0'; buffer[fromIndex + 1] = '\0';
char* temp = strrchr( buffer, ch ); char* temp = strrchr( buffer, ch );
@ -516,7 +516,7 @@ int String::lastIndexOf(const String &s2) const
int String::lastIndexOf(const String &s2, unsigned int fromIndex) const int String::lastIndexOf(const String &s2, unsigned int fromIndex) const
{ {
if (s2.len == 0 || len == 0 || s2.len > len || fromIndex < 0) return -1; if (s2.len == 0 || len == 0 || s2.len > len) return -1;
if (fromIndex >= len) fromIndex = len - 1; if (fromIndex >= len) fromIndex = len - 1;
int found = -1; int found = -1;
for (char *p = buffer; p <= buffer + fromIndex; p++) { for (char *p = buffer; p <= buffer + fromIndex; p++) {

View File

@ -298,7 +298,7 @@ void Servo::writeMicroseconds(int value)
{ {
// calculate and store the values for the given channel // calculate and store the values for the given channel
byte channel = this->servoIndex; byte channel = this->servoIndex;
if( (channel >= 0) && (channel < MAX_SERVOS) ) // ensure channel is valid if( (channel < MAX_SERVOS) ) // ensure channel is valid
{ {
if( value < SERVO_MIN() ) // ensure pulse width is valid if( value < SERVO_MIN() ) // ensure pulse width is valid
value = SERVO_MIN(); value = SERVO_MIN();