c++ min() wants args of the same type (https://en.cppreference.com/w/cpp/algorithm/min).

This allows us to compile with -fno-permissive (gcc default).
This commit is contained in:
Josh Bailey 2022-03-15 17:31:49 +13:00
parent 67a6ef4d9c
commit 48ca1177f4
1 changed files with 2 additions and 2 deletions

View File

@ -751,13 +751,13 @@ char *Adafruit_GPS::parseStr(char *buff, char *p, int n) {
char *e = strchr(p, ','); char *e = strchr(p, ',');
int len = 0; int len = 0;
if (e) { if (e) {
len = min(e - p, n - 1); len = min(int(e - p), n - 1);
strncpy(buff, p, len); // copy up to the comma strncpy(buff, p, len); // copy up to the comma
buff[len] = 0; buff[len] = 0;
} else { } else {
e = strchr(p, '*'); e = strchr(p, '*');
if (e) { if (e) {
len = min(e - p, n - 1); len = min(int(e - p), n - 1);
strncpy(buff, p, len); // or up to the * strncpy(buff, p, len); // or up to the *
buff[e - p] = 0; buff[e - p] = 0;
} else { } else {