summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--divesite.c2
-rw-r--r--divesitehelpers.cpp4
-rw-r--r--load-git.c2
-rw-r--r--parse-xml.c2
-rw-r--r--qt-models/divelocationmodel.cpp2
-rw-r--r--qt-ui/maintab.cpp2
-rw-r--r--save-git.c2
-rw-r--r--save-xml.c2
-rw-r--r--taxonomy.c8
-rw-r--r--taxonomy.h18
10 files changed, 22 insertions, 22 deletions
diff --git a/divesite.c b/divesite.c
index cd8ee8a7d..547b6b0dd 100644
--- a/divesite.c
+++ b/divesite.c
@@ -176,7 +176,7 @@ void copy_dive_site(struct dive_site *orig, struct dive_site *copy)
} else {
if (copy->taxonomy.category == NULL)
copy->taxonomy.category = alloc_taxonomy();
- for (int i = 0; i < NR_CATEGORIES; i++) {
+ for (int i = 0; i < TC_NR_CATEGORIES; i++) {
free((void *)copy->taxonomy.category[i].value);
copy->taxonomy.category[i] = orig->taxonomy.category[i];
copy->taxonomy.category[i].value = copy_string(orig->taxonomy.category[i].value);
diff --git a/divesitehelpers.cpp b/divesitehelpers.cpp
index dae47e013..1f323a537 100644
--- a/divesitehelpers.cpp
+++ b/divesitehelpers.cpp
@@ -89,7 +89,7 @@ void ReverseGeoLookupThread::run() {
if (ds->taxonomy.category == NULL)
ds->taxonomy.category = alloc_taxonomy();
// get all the data - OCEAN is special, so start at COUNTRY
- for (int j = COUNTRY; j < NR_CATEGORIES; j++) {
+ for (int j = TC_COUNTRY; j < TC_NR_CATEGORIES; j++) {
if (firstData[taxonomy_api_names[j]].isValid()) {
ds->taxonomy.category[ri].category = j;
ds->taxonomy.category[ri].origin = taxonomy::GEOCODED;
@@ -137,7 +137,7 @@ void ReverseGeoLookupThread::run() {
if (oceanName["name"].isValid()) {
if (ds->taxonomy.category == NULL)
ds->taxonomy.category = alloc_taxonomy();
- ds->taxonomy.category[ds->taxonomy.nr].category = OCEAN;
+ ds->taxonomy.category[ds->taxonomy.nr].category = TC_OCEAN;
ds->taxonomy.category[ds->taxonomy.nr].origin = taxonomy::GEOCODED;
ds->taxonomy.category[ds->taxonomy.nr].value = copy_string(qPrintable(oceanName["name"].toString()));
ds->taxonomy.nr++;
diff --git a/load-git.c b/load-git.c
index 7cfad325f..20c1ad351 100644
--- a/load-git.c
+++ b/load-git.c
@@ -307,7 +307,7 @@ static void parse_site_geo(char *line, struct membuffer *str, void *_ds)
if (ds->taxonomy.category == NULL)
ds->taxonomy.category = alloc_taxonomy();
int nr = ds->taxonomy.nr;
- if (nr < NR_CATEGORIES) {
+ if (nr < TC_NR_CATEGORIES) {
struct taxonomy *t = &ds->taxonomy.category[nr];
t->value = strdup(mb_cstring(str));
sscanf(line, "cat %d origin %d \"", &t->category, &t->origin);
diff --git a/parse-xml.c b/parse-xml.c
index 879e31fd2..4c2077702 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -1449,7 +1449,7 @@ static void try_to_fill_dive_site(struct dive_site **ds_p, const char *name, cha
if (MATCH("origin.geo", get_index, (int *)&ds->taxonomy.category[ds->taxonomy.nr].origin))
return;
if (MATCH("value.geo", utf8_string, &ds->taxonomy.category[ds->taxonomy.nr].value)) {
- if (ds->taxonomy.nr < NR_CATEGORIES)
+ if (ds->taxonomy.nr < TC_NR_CATEGORIES)
ds->taxonomy.nr++;
return;
}
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index 3d3c77616..42af4f63a 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -117,7 +117,7 @@ GeoReferencingOptionsModel::GeoReferencingOptionsModel(QObject *parent) : QStrin
{
QStringList list;
int i;
- for (i = 0; i < NR_CATEGORIES; i++)
+ for (i = 0; i < TC_NR_CATEGORIES; i++)
list << taxonomy_category_names[i];
setStringList(list);
}
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 591f665d5..a4b1722bd 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -515,7 +515,7 @@ void MainTab::updateDiveInfo(bool clear)
locationTag = "<small><small>(tags: ";
QString connector = "";
for (int i = 0; i < 3; i++) {
- for (int j = 0; j < NR_CATEGORIES; j++) {
+ for (int j = 0; j < TC_NR_CATEGORIES; j++) {
if (ds->taxonomy.category[j].category == prefs.geocoding.category[i]) {
locationTag += connector + QString(ds->taxonomy.category[j].value);
connector = " / ";
diff --git a/save-git.c b/save-git.c
index ff82ca841..a8e0582f3 100644
--- a/save-git.c
+++ b/save-git.c
@@ -900,7 +900,7 @@ static void save_divesites(git_repository *repo, struct dir *tree)
if (prefs.geocoding.enable_geocoding)
for (int j = 0; j < ds->taxonomy.nr; j++) {
struct taxonomy *t = &ds->taxonomy.category[j];
- if (t->category != NONE) {
+ if (t->category != TC_NONE) {
put_format(&b, "geo cat %d origin %d ", t->category, t->origin);
show_utf8(&b, "", t->value, "\n" );
}
diff --git a/save-xml.c b/save-xml.c
index a81d4258d..c8ce6fdf1 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -543,7 +543,7 @@ void save_dives_buffer(struct membuffer *b, const bool select_only)
put_format(b, ">\n");
for (int j = 0; j < ds->taxonomy.nr; j++) {
struct taxonomy *t = &ds->taxonomy.category[j];
- if (t->category != NONE) {
+ if (t->category != TC_NONE) {
put_format(b, "<geo cat='%d'", t->category);
put_format(b, " origin='%d'", t->origin);
show_utf8(b, t->value, " value='", "'/>\n", 1);
diff --git a/taxonomy.c b/taxonomy.c
index 2c101962a..2b71648c1 100644
--- a/taxonomy.c
+++ b/taxonomy.c
@@ -2,7 +2,7 @@
#include "gettext.h"
#include <stdlib.h>
-char *taxonomy_category_names[NR_CATEGORIES] = {
+char *taxonomy_category_names[TC_NR_CATEGORIES] = {
QT_TRANSLATE_NOOP("getTextFromC", "None"),
QT_TRANSLATE_NOOP("getTextFromC", "Ocean"),
QT_TRANSLATE_NOOP("getTextFromC", "Country"),
@@ -12,7 +12,7 @@ char *taxonomy_category_names[NR_CATEGORIES] = {
};
// these are the names for geoname.org
-char *taxonomy_api_names[NR_CATEGORIES] = {
+char *taxonomy_api_names[TC_NR_CATEGORIES] = {
"none",
"name",
"countryName",
@@ -23,13 +23,13 @@ char *taxonomy_api_names[NR_CATEGORIES] = {
struct taxonomy *alloc_taxonomy()
{
- return calloc(NR_CATEGORIES, sizeof(struct taxonomy));
+ return calloc(TC_NR_CATEGORIES, sizeof(struct taxonomy));
}
void free_taxonomy(struct taxonomy *t)
{
if (t) {
- for (int i = 0; i < NR_CATEGORIES; i++)
+ for (int i = 0; i < TC_NR_CATEGORIES; i++)
free((void *)t[i].value);
free(t);
}
diff --git a/taxonomy.h b/taxonomy.h
index fef6364e2..b6a062a08 100644
--- a/taxonomy.h
+++ b/taxonomy.h
@@ -6,17 +6,17 @@ extern "C" {
#endif
enum taxonomy_category {
- NONE,
- OCEAN,
- COUNTRY,
- ADMIN_L1,
- ADMIN_L2,
- LOCALNAME,
- NR_CATEGORIES
+ TC_NONE,
+ TC_OCEAN,
+ TC_COUNTRY,
+ TC_ADMIN_L1,
+ TC_ADMIN_L2,
+ TC_LOCALNAME,
+ TC_NR_CATEGORIES
};
-extern char *taxonomy_category_names[NR_CATEGORIES];
-extern char *taxonomy_api_names[NR_CATEGORIES];
+extern char *taxonomy_category_names[TC_NR_CATEGORIES];
+extern char *taxonomy_api_names[TC_NR_CATEGORIES];
struct taxonomy {
int category; /* the category for this tag: ocean, country, admin_l1, admin_l2, localname, etc */