summaryrefslogtreecommitdiff
path: root/AISCommon.c
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2025-03-04 22:46:54 +0000
committerDave Hibberd <hibby@debian.org>2025-03-04 22:46:54 +0000
commitf0b507a096d65291aedcc9f98cde1d7b8aabc024 (patch)
tree93b91137e30825ba7fbb690c29d700fba88394ad /AISCommon.c
parent9d0d20064dd879c2967a86ef0b6751c563d80196 (diff)
parentb128f2a43a16acef50de045ae6526772c04c395e (diff)
Update upstream source from tag 'upstream/6.0.24.66+repack'
Update to upstream version '6.0.24.66+repack' with Debian dir 0a1e01b2c4f9c8b665a31c0f8523e8fa0e88b6be
Diffstat (limited to 'AISCommon.c')
-rw-r--r--AISCommon.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/AISCommon.c b/AISCommon.c
index f0b6a6a..e123bb2 100644
--- a/AISCommon.c
+++ b/AISCommon.c
@@ -760,7 +760,7 @@ void SaveVesselDataBase()
void LoadNavAidDataBase()
{
- int i;
+ int i, n, count;
FILE *file;
char buf[256];
@@ -793,10 +793,12 @@ void LoadNavAidDataBase()
NavRecords = (struct NAVAIDRECORD **)malloc(NavAidCount * sizeof(void *));
+ count = 0;
+
for (i = 0; i < NavAidCount; i++)
{
navptr = (struct NAVAIDRECORD *)malloc(sizeof(struct NAVAIDRECORD));
- NavRecords[i] = navptr;
+ NavRecords[count] = navptr;
memset(navptr, 0, sizeof(struct NAVAIDRECORD));
fgets(buf, 255, file);
@@ -807,6 +809,19 @@ void LoadNavAidDataBase()
token = strtok(NULL, "|\n" );
strcpy(&navptr->name[0],token);
+ for (n = 0; n < 20; n++)
+ {
+ char c = navptr->name[n];
+
+ if (!isalpha(c) && !isdigit(c) && c != ' ' && c != '_')
+ {
+ count--;
+ break;
+ }
+ }
+
+ count++;
+
token = strtok(NULL, "|\n" );
navptr->lat = atof(token);
@@ -820,6 +835,7 @@ void LoadNavAidDataBase()
navptr->TimeLastUpdated = atoi(token);
}
+ NavAidCount = count;
fclose(file);
}