hex2int: fix hex digit parsing
This commit is contained in:
parent
b341777f60
commit
c5860da6c8
4
minmea.c
4
minmea.c
@ -19,9 +19,9 @@ static int hex2int(char c)
|
||||
if (c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
if (c >= 'A' && c <= 'F')
|
||||
return c - 'A';
|
||||
return c - 'A' + 10;
|
||||
if (c >= 'a' && c <= 'f')
|
||||
return c - 'a';
|
||||
return c - 'a' + 10;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
4
tests.c
4
tests.c
@ -20,6 +20,8 @@ static const char *valid_sequences[] = {
|
||||
"$GPGGA,,,,,,0,00,99.99,,,,,,*48",
|
||||
"$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30",
|
||||
"$GPGLL,,,,,,V,N*64",
|
||||
"$GPXTE,A,A,0.67,L,N*6F",
|
||||
"$GPXTE,A,A,0.67,L,N*6f",
|
||||
NULL,
|
||||
};
|
||||
|
||||
@ -32,6 +34,8 @@ static const char *invalid_sequences[] = {
|
||||
"$$GPGGA,,,,,,0,00,99.99,,,,,,*48",
|
||||
"GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30",
|
||||
"gps: $GPGLL,,,,,,V,N",
|
||||
"$GPXTE,A,A,0.67,L,N*6e",
|
||||
"$GPXTE,A,A,0.67,L,N*6g",
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user