Merge pull request #41 from vpetrigo/update/allow_only_CR_ending
minmea: Allow lines with only CR ending
This commit is contained in:
commit
74a4744792
7
minmea.c
7
minmea.c
@ -79,8 +79,13 @@ bool minmea_check(const char *sentence, bool strict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The only stuff allowed at this point is a newline.
|
// The only stuff allowed at this point is a newline.
|
||||||
if (*sentence && strcmp(sentence, "\n") && strcmp(sentence, "\r\n"))
|
while (*sentence == '\r' || *sentence == '\n') {
|
||||||
|
sentence++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*sentence) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
8
tests.c
8
tests.c
@ -18,6 +18,11 @@
|
|||||||
|
|
||||||
static const char *valid_sentences_nochecksum[] = {
|
static const char *valid_sentences_nochecksum[] = {
|
||||||
"$GPTXT,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
"$GPTXT,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
|
"$GPTXT,hello\n",
|
||||||
|
"$GPTXT,hello\r",
|
||||||
|
"$GPTXT,hello\r\n",
|
||||||
|
"$GPTXT,hello\r\n\r\n",
|
||||||
|
"$GPTXT,hello\n\r\r\n",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,6 +61,9 @@ static const char *invalid_sentences[] = {
|
|||||||
"gps: $GPGLL,,,,,,V,N",
|
"gps: $GPGLL,,,,,,V,N",
|
||||||
"$GPXTE,A,A,0.67,L,N*6e",
|
"$GPXTE,A,A,0.67,L,N*6e",
|
||||||
"$GPXTE,A,A,0.67,L,N*6g",
|
"$GPXTE,A,A,0.67,L,N*6g",
|
||||||
|
"$GPTXT,hello\n ",
|
||||||
|
"$GPTXT,hello\r*24",
|
||||||
|
"$GPTXT,hello\r\n$",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user