aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2016-12-29 15:41:44 +0100
committerGravatar Subsurface <dirk@subsurface-divelog.org>2017-01-12 14:15:53 -0800
commit70e2404492bb6fd19bd865985e1622260e2d7e54 (patch)
tree99cb933c7b32742919a4c4feb3af19f3fb135b4a /core
parentd11dfd2f45fbf0a036d3e2089ff86a0ada43f2e0 (diff)
downloadsubsurface-70e2404492bb6fd19bd865985e1622260e2d7e54.tar.gz
Stop accessing the internals of dc_descriptor_t
This removes our own declaration of dc_descriptor_t and all our accesses to its internals, and switches to use the libdivecomputer functions to access those instead. Signed-off-by: Anton Lundin <glance@acc.umu.se>
Diffstat (limited to 'core')
-rw-r--r--core/libdivecomputer.c6
-rw-r--r--core/libdivecomputer.h7
-rw-r--r--core/ostctools.c4
3 files changed, 5 insertions, 12 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 5bdbb9e63..8a8b215e8 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -1079,14 +1079,14 @@ dc_status_t libdc_buffer_parser(struct dive *dive, device_data_t *data, unsigned
dc_status_t rc;
dc_parser_t *parser = NULL;
- switch (data->descriptor->type) {
+ switch (dc_descriptor_get_type(data->descriptor)) {
case DC_FAMILY_UWATEC_ALADIN:
case DC_FAMILY_UWATEC_MEMOMOUSE:
rc = uwatec_memomouse_parser_create(&parser, data->context, 0, 0);
break;
case DC_FAMILY_UWATEC_SMART:
case DC_FAMILY_UWATEC_MERIDIAN:
- rc = uwatec_smart_parser_create (&parser, data->context, data->descriptor->model, 0, 0);
+ rc = uwatec_smart_parser_create (&parser, data->context, dc_descriptor_get_model(data->descriptor), 0, 0);
break;
case DC_FAMILY_HW_OSTC:
#if defined(SSRF_CUSTOM_SERIAL)
@@ -1120,7 +1120,7 @@ dc_status_t libdc_buffer_parser(struct dive *dive, device_data_t *data, unsigned
}
// Do not parse Aladin/Memomouse headers as they are fakes
// Do not return on error, we can still parse the samples
- if (data->descriptor->type != DC_FAMILY_UWATEC_ALADIN && data->descriptor->type != DC_FAMILY_UWATEC_MEMOMOUSE) {
+ if (dc_descriptor_get_type(data->descriptor) != DC_FAMILY_UWATEC_ALADIN && dc_descriptor_get_type(data->descriptor) != DC_FAMILY_UWATEC_MEMOMOUSE) {
rc = libdc_header_parser (parser, data, dive);
if (rc != DC_STATUS_SUCCESS) {
report_error("Error parsing the dive header data. Dive # %d\nStatus = %s", dive->number, errmsg(rc));
diff --git a/core/libdivecomputer.h b/core/libdivecomputer.h
index ecf4dff63..aba972d28 100644
--- a/core/libdivecomputer.h
+++ b/core/libdivecomputer.h
@@ -18,13 +18,6 @@
extern "C" {
#endif
-struct dc_descriptor_t {
- const char *vendor;
- const char *product;
- dc_family_t type;
- unsigned int model;
-};
-
/* don't forget to include the UI toolkit specific display-XXX.h first
to get the definition of progressbar_t */
typedef struct device_data_t
diff --git a/core/ostctools.c b/core/ostctools.c
index caf7dc2fc..c3fb66c64 100644
--- a/core/ostctools.c
+++ b/core/ostctools.c
@@ -20,8 +20,8 @@ static int ostc_prepare_data(int data_model, dc_family_t dc_fam, device_data_t *
data_descriptor = get_descriptor(dc_fam, data_model);
if (data_descriptor) {
dev_data->descriptor = data_descriptor;
- dev_data->vendor = copy_string(data_descriptor->vendor);
- dev_data->model = copy_string(data_descriptor->product);
+ dev_data->vendor = copy_string(dc_descriptor_get_vendor(data_descriptor));
+ dev_data->model = copy_string(dc_descriptor_get_product(data_descriptor));
} else {
return 0;
}