Przeglądaj źródła

fix warning: comparison of unsigned expression < 0 is always false

teensy4-core
Frank 8 lat temu
rodzic
commit
7b4e6aea9b
1 zmienionych plików z 2 dodań i 2 usunięć
  1. +2
    -2
      teensy3/WString.cpp

+ 2
- 2
teensy3/WString.cpp Wyświetl plik



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 );


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++) {

Ładowanie…
Anuluj
Zapisz