Ver Fonte

rename MINMEA_MAX_LENGTH -> MINMEA_MAX_SENTENCE_LENGTH

Kosma Moczek há 3 anos atrás
pai
commit
1e2f0af7d8
5 ficheiros alterados com 6 adições e 6 exclusões
  1. 1 1
      README.md
  2. 1 1
      example.c
  3. 1 1
      minmea.c
  4. 1 1
      minmea.h
  5. 2 2
      tests.c

+ 1 - 1
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: {

+ 1 - 1
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)) {

+ 1 - 1
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 "$".

+ 1 - 1
minmea.h

@@ -23,7 +23,7 @@ extern "C" {
 #include <minmea_compat.h>
 #endif
 
-#define MINMEA_MAX_LENGTH 80
+#define MINMEA_MAX_SENTENCE_LENGTH 80
 
 enum minmea_sentence_id {
     MINMEA_INVALID = -1,

+ 2 - 2
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,