rename MINMEA_MAX_LENGTH -> MINMEA_MAX_SENTENCE_LENGTH
This commit is contained in:
parent
6915c08c59
commit
1e2f0af7d8
@ -75,7 +75,7 @@ The library doesn't perform this conversion automatically for the following reas
|
|||||||
## Example
|
## Example
|
||||||
|
|
||||||
```c
|
```c
|
||||||
char line[MINMEA_MAX_LENGTH];
|
char line[MINMEA_MAX_SENTENCE_LENGTH];
|
||||||
while (fgets(line, sizeof(line), stdin) != NULL) {
|
while (fgets(line, sizeof(line), stdin) != NULL) {
|
||||||
switch (minmea_sentence_id(line, false)) {
|
switch (minmea_sentence_id(line, false)) {
|
||||||
case MINMEA_SENTENCE_RMC: {
|
case MINMEA_SENTENCE_RMC: {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
char line[MINMEA_MAX_LENGTH];
|
char line[MINMEA_MAX_SENTENCE_LENGTH];
|
||||||
while (fgets(line, sizeof(line), stdin) != NULL) {
|
while (fgets(line, sizeof(line), stdin) != NULL) {
|
||||||
printf("%s", line);
|
printf("%s", line);
|
||||||
switch (minmea_sentence_id(line, false)) {
|
switch (minmea_sentence_id(line, false)) {
|
||||||
|
2
minmea.c
2
minmea.c
@ -47,7 +47,7 @@ bool minmea_check(const char *sentence, bool strict)
|
|||||||
uint8_t checksum = 0x00;
|
uint8_t checksum = 0x00;
|
||||||
|
|
||||||
// Sequence length is limited.
|
// Sequence length is limited.
|
||||||
if (strlen(sentence) > MINMEA_MAX_LENGTH + 3)
|
if (strlen(sentence) > MINMEA_MAX_SENTENCE_LENGTH + 3)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// A valid sentence starts with "$".
|
// A valid sentence starts with "$".
|
||||||
|
2
minmea.h
2
minmea.h
@ -23,7 +23,7 @@ extern "C" {
|
|||||||
#include <minmea_compat.h>
|
#include <minmea_compat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MINMEA_MAX_LENGTH 80
|
#define MINMEA_MAX_SENTENCE_LENGTH 80
|
||||||
|
|
||||||
enum minmea_sentence_id {
|
enum minmea_sentence_id {
|
||||||
MINMEA_INVALID = -1,
|
MINMEA_INVALID = -1,
|
||||||
|
4
tests.c
4
tests.c
@ -269,7 +269,7 @@ END_TEST
|
|||||||
|
|
||||||
START_TEST(test_minmea_scan_s)
|
START_TEST(test_minmea_scan_s)
|
||||||
{
|
{
|
||||||
char value[MINMEA_MAX_LENGTH];
|
char value[MINMEA_MAX_SENTENCE_LENGTH];
|
||||||
|
|
||||||
ck_assert(minmea_scan(",bar,baz", "s", value) == true);
|
ck_assert(minmea_scan(",bar,baz", "s", value) == true);
|
||||||
ck_assert_str_eq(value, "");
|
ck_assert_str_eq(value, "");
|
||||||
@ -402,7 +402,7 @@ START_TEST(test_minmea_scan_complex2)
|
|||||||
struct minmea_float bearing_true; char bearing_true_mark;
|
struct minmea_float bearing_true; char bearing_true_mark;
|
||||||
struct minmea_float bearing_magnetic; char bearing_magnetic_mark;
|
struct minmea_float bearing_magnetic; char bearing_magnetic_mark;
|
||||||
struct minmea_float distance; char distance_units;
|
struct minmea_float distance; char distance_units;
|
||||||
char name[MINMEA_MAX_LENGTH];
|
char name[MINMEA_MAX_SENTENCE_LENGTH];
|
||||||
ck_assert(minmea_scan(sentence, "tTfdfdfcfcfcs",
|
ck_assert(minmea_scan(sentence, "tTfdfdfcfcfcs",
|
||||||
type,
|
type,
|
||||||
&t,
|
&t,
|
||||||
|
Loading…
Reference in New Issue
Block a user