core: convert ostctools as C++

Replace some of the memory management by C++ idioms.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-02 09:36:00 +02:00 committed by bstoeger
parent fe0bb905f3
commit b74703b61d
4 changed files with 54 additions and 66 deletions

View file

@ -31,24 +31,24 @@ struct divelog;
struct devices;
typedef struct {
dc_descriptor_t *descriptor;
const char *vendor, *product, *devname;
const char *model, *btname;
unsigned char *fingerprint;
unsigned int fsize, fdeviceid, fdiveid;
struct dc_event_devinfo_t devinfo;
uint32_t diveid;
dc_device_t *device;
dc_context_t *context;
dc_iostream_t *iostream;
bool force_download;
bool libdc_log;
bool libdc_dump;
bool bluetooth_mode;
bool sync_time;
FILE *libdc_logfile;
struct divelog *log;
void *androidUsbDeviceDescriptor;
dc_descriptor_t *descriptor = nullptr;
const char *vendor = nullptr, *product = nullptr, *devname = nullptr;
const char *model = nullptr, *btname = nullptr;
unsigned char *fingerprint = nullptr;
unsigned int fsize = 0, fdeviceid = 0, fdiveid = 0;
struct dc_event_devinfo_t devinfo = { };
uint32_t diveid = 0;
dc_device_t *device = nullptr;
dc_context_t *context = nullptr;
dc_iostream_t *iostream = nullptr;
bool force_download = false;
bool libdc_log = false;
bool libdc_dump = false;
bool bluetooth_mode = false;
bool sync_time = false;
FILE *libdc_logfile = nullptr;
struct divelog *log = nullptr;
void *androidUsbDeviceDescriptor = nullptr;
} device_data_t;
const char *errmsg (dc_status_t rc);