diff --git a/README.md b/README.md index 042d3de..f158826 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ The library doesn't perform this conversion automatically for the following reas ## Example ```c -char line[MINMEA_MAX_LENGTH]; +char line[MINMEA_MAX_SENTENCE_LENGTH]; while (fgets(line, sizeof(line), stdin) != NULL) { switch (minmea_sentence_id(line, false)) { case MINMEA_SENTENCE_RMC: { diff --git a/example.c b/example.c index 2e1c39e..14961c3 100644 --- a/example.c +++ b/example.c @@ -16,7 +16,7 @@ int main(void) { - char line[MINMEA_MAX_LENGTH]; + char line[MINMEA_MAX_SENTENCE_LENGTH]; while (fgets(line, sizeof(line), stdin) != NULL) { printf("%s", line); switch (minmea_sentence_id(line, false)) { diff --git a/minmea.c b/minmea.c index 4476ace..89ef76b 100644 --- a/minmea.c +++ b/minmea.c @@ -47,7 +47,7 @@ bool minmea_check(const char *sentence, bool strict) uint8_t checksum = 0x00; // Sequence length is limited. - if (strlen(sentence) > MINMEA_MAX_LENGTH + 3) + if (strlen(sentence) > MINMEA_MAX_SENTENCE_LENGTH + 3) return false; // A valid sentence starts with "$". diff --git a/minmea.h b/minmea.h index 5a3bfd4..c92f579 100644 --- a/minmea.h +++ b/minmea.h @@ -23,7 +23,7 @@ extern "C" { #include #endif -#define MINMEA_MAX_LENGTH 80 +#define MINMEA_MAX_SENTENCE_LENGTH 80 enum minmea_sentence_id { MINMEA_INVALID = -1, diff --git a/tests.c b/tests.c index 6edf596..1a63380 100644 --- a/tests.c +++ b/tests.c @@ -269,7 +269,7 @@ END_TEST 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_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_magnetic; char bearing_magnetic_mark; struct minmea_float distance; char distance_units; - char name[MINMEA_MAX_LENGTH]; + char name[MINMEA_MAX_SENTENCE_LENGTH]; ck_assert(minmea_scan(sentence, "tTfdfdfcfcfcs", type, &t,