mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
uemis: replace C-strings by std::string and std::string_view
The string code of uemis-downloader.cpp was broken in more ways than can be listed here. Notably, it brazenly refused to free any memory allocated for the parameters buffer. Using std::string and std::string_view should plug all those memory holes. That made it necessary to do some major refactoring. This was done blind and therefore will break. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
16e19b550b
commit
58b3583b3b
9 changed files with 384 additions and 403 deletions
|
@ -6,9 +6,12 @@
|
|||
#ifndef UEMIS_H
|
||||
#define UEMIS_H
|
||||
|
||||
#include "libdivecomputer.h" // for device_data_t, which is a typedef, not a struct :(
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -17,10 +20,10 @@ struct uemis_sample;
|
|||
struct dive_site;
|
||||
|
||||
struct uemis {
|
||||
void parse_divelog_binary(char *base64, struct dive *dive);
|
||||
void parse_divelog_binary(std::string_view base64, struct dive *dive);
|
||||
int get_weight_unit(uint32_t diveid) const;
|
||||
void mark_divelocation(int diveid, int divespot, struct dive_site *ds);
|
||||
void set_divelocation(int divespot, char *text, double longitude, double latitude);
|
||||
void set_divelocation(int divespot, const std::string &text, double longitude, double latitude);
|
||||
int get_divespot_id_by_diveid(uint32_t diveid) const;
|
||||
private:
|
||||
struct helper {
|
||||
|
@ -37,6 +40,7 @@ private:
|
|||
void weight_unit(int diveid, int lbs);
|
||||
};
|
||||
|
||||
std::string do_uemis_import(device_data_t *data);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue