mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
core: turn struct dive string data into std::string
Much easier memory management! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2b3d2f1020
commit
3cb04d230b
34 changed files with 208 additions and 313 deletions
|
@ -193,10 +193,10 @@ void export_TeX(const char *filename, bool selected_only, bool plain, ExportCall
|
|||
put_format(&buf, "\\def\\%srating{%s}\n", ssrf, qPrintable(rating));
|
||||
put_format(&buf, "\\def\\%splot{\\includegraphics[width=9cm,height=4cm]{profile%d}}\n", ssrf, dive->number);
|
||||
put_format(&buf, "\\def\\%sprofilename{profile%d}\n", ssrf, dive->number);
|
||||
put_format(&buf, "\\def\\%scomment{%s}\n", ssrf, dive->notes ? dive->notes : "");
|
||||
put_format(&buf, "\\def\\%sbuddy{%s}\n", ssrf, dive->buddy ? dive->buddy : "");
|
||||
put_format(&buf, "\\def\\%sdivemaster{%s}\n", ssrf, dive->diveguide ? dive->diveguide : "");
|
||||
put_format(&buf, "\\def\\%ssuit{%s}\n", ssrf, dive->suit ? dive->suit : "");
|
||||
put_format(&buf, "\\def\\%scomment{%s}\n", ssrf, dive->notes.c_str());
|
||||
put_format(&buf, "\\def\\%sbuddy{%s}\n", ssrf, dive->buddy.c_str());
|
||||
put_format(&buf, "\\def\\%sdivemaster{%s}\n", ssrf, dive->diveguide.c_str());
|
||||
put_format(&buf, "\\def\\%ssuit{%s}\n", ssrf, dive->suit.c_str());
|
||||
|
||||
// Print cylinder data
|
||||
put_format(&buf, "\n%% Gas use information:\n");
|
||||
|
|
|
@ -43,17 +43,16 @@ T EditDefaultSetter<T, ID, PTR>::data(struct dive *d) const
|
|||
return d->*PTR;
|
||||
}
|
||||
|
||||
template <DiveField::Flags ID, char *dive::*PTR>
|
||||
template <DiveField::Flags ID, std::string dive::*PTR>
|
||||
void EditStringSetter<ID, PTR>::set(struct dive *d, QString v) const
|
||||
{
|
||||
free(d->*PTR);
|
||||
d->*PTR = copy_qstring(v);
|
||||
d->*PTR = v.toStdString();
|
||||
}
|
||||
|
||||
template <DiveField::Flags ID, char *dive::*PTR>
|
||||
template <DiveField::Flags ID, std::string dive::*PTR>
|
||||
QString EditStringSetter<ID, PTR>::data(struct dive *d) const
|
||||
{
|
||||
return QString(d->*PTR);
|
||||
return QString::fromStdString(d->*PTR);
|
||||
}
|
||||
|
||||
static std::vector<dive *> getDives(bool currentDiveOnly)
|
||||
|
@ -585,14 +584,13 @@ QString EditTags::fieldName() const
|
|||
// ***** Buddies *****
|
||||
QStringList EditBuddies::data(struct dive *d) const
|
||||
{
|
||||
return stringToList(d->buddy);
|
||||
return stringToList(QString::fromStdString(d->buddy));
|
||||
}
|
||||
|
||||
void EditBuddies::set(struct dive *d, const QStringList &v) const
|
||||
{
|
||||
QString text = v.join(", ");
|
||||
free(d->buddy);
|
||||
d->buddy = copy_qstring(text);
|
||||
d->buddy = text.toStdString();
|
||||
}
|
||||
|
||||
QString EditBuddies::fieldName() const
|
||||
|
@ -603,14 +601,13 @@ QString EditBuddies::fieldName() const
|
|||
// ***** DiveGuide *****
|
||||
QStringList EditDiveGuide::data(struct dive *d) const
|
||||
{
|
||||
return stringToList(d->diveguide);
|
||||
return stringToList(QString::fromStdString(d->diveguide));
|
||||
}
|
||||
|
||||
void EditDiveGuide::set(struct dive *d, const QStringList &v) const
|
||||
{
|
||||
QString text = v.join(", ");
|
||||
free(d->diveguide);
|
||||
d->diveguide = copy_qstring(text);
|
||||
d->diveguide = text.toStdString();
|
||||
}
|
||||
|
||||
QString EditDiveGuide::fieldName() const
|
||||
|
@ -618,14 +615,6 @@ QString EditDiveGuide::fieldName() const
|
|||
return Command::Base::tr("dive guide");
|
||||
}
|
||||
|
||||
static void swapCandQString(QString &q, char *&c)
|
||||
{
|
||||
QString tmp(c);
|
||||
free(c);
|
||||
c = copy_qstring(q);
|
||||
q = std::move(tmp);
|
||||
}
|
||||
|
||||
PasteState::PasteState(dive *dIn, const dive *data, dive_components what) : d(dIn)
|
||||
{
|
||||
if (what.notes)
|
||||
|
@ -698,13 +687,13 @@ PasteState::~PasteState()
|
|||
void PasteState::swap(dive_components what)
|
||||
{
|
||||
if (what.notes)
|
||||
swapCandQString(notes, d->notes);
|
||||
std::swap(notes, d->notes);
|
||||
if (what.diveguide)
|
||||
swapCandQString(diveguide, d->diveguide);
|
||||
std::swap(diveguide, d->diveguide);
|
||||
if (what.buddy)
|
||||
swapCandQString(buddy, d->buddy);
|
||||
std::swap(buddy, d->buddy);
|
||||
if (what.suit)
|
||||
swapCandQString(suit, d->suit);
|
||||
std::swap(suit, d->suit);
|
||||
if (what.rating)
|
||||
std::swap(rating, d->rating);
|
||||
if (what.visibility)
|
||||
|
@ -791,7 +780,6 @@ ReplanDive::ReplanDive(dive *source) : d(current_dive),
|
|||
when(0),
|
||||
maxdepth({0}),
|
||||
meandepth({0}),
|
||||
notes(nullptr),
|
||||
surface_pressure({0}),
|
||||
duration({0}),
|
||||
salinity(0)
|
||||
|
@ -806,7 +794,7 @@ ReplanDive::ReplanDive(dive *source) : d(current_dive),
|
|||
when = source->when;
|
||||
maxdepth = source->maxdepth;
|
||||
meandepth = source->meandepth;
|
||||
notes = copy_string(source->notes);
|
||||
notes = source->notes;
|
||||
duration = source->duration;
|
||||
salinity = source->salinity;
|
||||
surface_pressure = source->surface_pressure;
|
||||
|
@ -820,7 +808,6 @@ ReplanDive::ReplanDive(dive *source) : d(current_dive),
|
|||
|
||||
ReplanDive::~ReplanDive()
|
||||
{
|
||||
free(notes);
|
||||
}
|
||||
|
||||
bool ReplanDive::workToBeDone()
|
||||
|
@ -1376,9 +1363,9 @@ EditDive::EditDive(dive *oldDiveIn, dive *newDiveIn, dive_site *createDs, dive_s
|
|||
changedFields |= DiveField::ATM_PRESS;
|
||||
if (oldDive->dive_site != newDive->dive_site)
|
||||
changedFields |= DiveField::DIVESITE;
|
||||
if (!same_string(oldDive->diveguide, newDive->diveguide))
|
||||
if (oldDive->diveguide != newDive->diveguide)
|
||||
changedFields |= DiveField::DIVEGUIDE;
|
||||
if (!same_string(oldDive->buddy, newDive->buddy))
|
||||
if (oldDive->buddy != newDive->buddy)
|
||||
changedFields |= DiveField::BUDDY;
|
||||
if (oldDive->rating != newDive->rating)
|
||||
changedFields |= DiveField::RATING;
|
||||
|
@ -1392,13 +1379,13 @@ EditDive::EditDive(dive *oldDiveIn, dive *newDiveIn, dive_site *createDs, dive_s
|
|||
changedFields |= DiveField::SURGE;
|
||||
if (oldDive->chill != newDive->chill)
|
||||
changedFields |= DiveField::CHILL;
|
||||
if (!same_string(oldDive->suit, newDive->suit))
|
||||
if (oldDive->suit != newDive->suit)
|
||||
changedFields |= DiveField::SUIT;
|
||||
if (taglist_get_tagstring(oldDive->tags) != taglist_get_tagstring(newDive->tags)) // This is cheating. Do we have a taglist comparison function?
|
||||
changedFields |= DiveField::TAGS;
|
||||
if (oldDive->dcs[0].divemode != newDive->dcs[0].divemode)
|
||||
changedFields |= DiveField::MODE;
|
||||
if (!same_string(oldDive->notes, newDive->notes))
|
||||
if (oldDive->notes != newDive->notes)
|
||||
changedFields |= DiveField::NOTES;
|
||||
if (oldDive->salinity != newDive->salinity)
|
||||
changedFields |= DiveField::SALINITY;
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
|
||||
// Automatically generate getter and setter in the case for string assignments.
|
||||
// The third parameter is a pointer to a C-style string in the dive structure.
|
||||
template <DiveField::Flags ID, char *dive::*PTR>
|
||||
template <DiveField::Flags ID, std::string dive::*PTR>
|
||||
class EditStringSetter : public EditTemplate<QString, ID> {
|
||||
private:
|
||||
using EditTemplate<QString, ID>::EditTemplate;
|
||||
|
@ -289,10 +289,10 @@ public:
|
|||
struct PasteState {
|
||||
dive *d;
|
||||
dive_site *divesite;
|
||||
QString notes;
|
||||
QString diveguide;
|
||||
QString buddy;
|
||||
QString suit;
|
||||
std::string notes;
|
||||
std::string diveguide;
|
||||
std::string buddy;
|
||||
std::string suit;
|
||||
int rating;
|
||||
int wavesize;
|
||||
int visibility;
|
||||
|
@ -329,7 +329,7 @@ class ReplanDive : public Base {
|
|||
depth_t maxdepth, meandepth;
|
||||
struct cylinder_table cylinders;
|
||||
struct divecomputer dc;
|
||||
char *notes;
|
||||
std::string notes;
|
||||
pressure_t surface_pressure;
|
||||
duration_t duration;
|
||||
int salinity;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "units.h"
|
||||
#include "device.h"
|
||||
#include "file.h"
|
||||
#include "format.h"
|
||||
#include "divesite.h"
|
||||
#include "dive.h"
|
||||
#include "divelog.h"
|
||||
|
@ -158,16 +159,15 @@ static dc_status_t dt_libdc_buffer(unsigned char *ptr, int prf_length, int dc_mo
|
|||
static char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive, struct divelog *log, char *maxbuf)
|
||||
{
|
||||
int rc, profile_length, libdc_model;
|
||||
char *tmp_notes_str = NULL;
|
||||
unsigned char *tmp_string1 = NULL,
|
||||
*locality = NULL,
|
||||
*dive_point = NULL,
|
||||
*compl_buffer,
|
||||
*membuf = runner;
|
||||
char buffer[1024];
|
||||
unsigned char tmp_1byte;
|
||||
unsigned int tmp_2bytes;
|
||||
unsigned long tmp_4bytes;
|
||||
std::string tmp_notes_str;
|
||||
char is_nitrox = 0, is_O2 = 0, is_SCR = 0;
|
||||
|
||||
device_data_t devdata;
|
||||
|
@ -304,22 +304,22 @@ static char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive, struct
|
|||
read_bytes(1);
|
||||
switch (tmp_1byte) {
|
||||
case 1:
|
||||
dt_dive->suit = strdup(translate("gettextFromC", "No suit"));
|
||||
dt_dive->suit = "No suit";
|
||||
break;
|
||||
case 2:
|
||||
dt_dive->suit = strdup(translate("gettextFromC", "Shorty"));
|
||||
dt_dive->suit = "Shorty";
|
||||
break;
|
||||
case 3:
|
||||
dt_dive->suit = strdup(translate("gettextFromC", "Combi"));
|
||||
dt_dive->suit = "Combi";
|
||||
break;
|
||||
case 4:
|
||||
dt_dive->suit = strdup(translate("gettextFromC", "Wet suit"));
|
||||
dt_dive->suit = "Wet suit";
|
||||
break;
|
||||
case 5:
|
||||
dt_dive->suit = strdup(translate("gettextFromC", "Semidry suit"));
|
||||
dt_dive->suit = "Semidry suit";
|
||||
break;
|
||||
case 6:
|
||||
dt_dive->suit = strdup(translate("gettextFromC", "Dry suit"));
|
||||
dt_dive->suit = "Dry suit";
|
||||
break;
|
||||
default:
|
||||
// unknown, do nothing
|
||||
|
@ -449,10 +449,9 @@ static char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive, struct
|
|||
read_bytes(1);
|
||||
if (tmp_1byte != 0) {
|
||||
read_string(tmp_string1);
|
||||
snprintf(buffer, sizeof(buffer), "%s: %s\n",
|
||||
tmp_notes_str= format_string_std("%s: %s\n",
|
||||
translate("gettextFromC", "Other activities"),
|
||||
tmp_string1);
|
||||
tmp_notes_str = strdup(buffer);
|
||||
free(tmp_string1);
|
||||
}
|
||||
|
||||
|
@ -462,7 +461,7 @@ static char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive, struct
|
|||
read_bytes(1);
|
||||
if (tmp_1byte != 0) {
|
||||
read_string(tmp_string1);
|
||||
dt_dive->buddy = strdup((char *)tmp_string1);
|
||||
dt_dive->buddy = (const char *)tmp_string1;
|
||||
free(tmp_string1);
|
||||
}
|
||||
|
||||
|
@ -472,15 +471,12 @@ static char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive, struct
|
|||
read_bytes(1);
|
||||
if (tmp_1byte != 0) {
|
||||
read_string(tmp_string1);
|
||||
int len = snprintf(buffer, sizeof(buffer), "%s%s:\n%s",
|
||||
tmp_notes_str ? tmp_notes_str : "",
|
||||
dt_dive->notes = format_string_std("%s%s:\n%s",
|
||||
tmp_notes_str.c_str(),
|
||||
translate("gettextFromC", "Datatrak/Wlog notes"),
|
||||
tmp_string1);
|
||||
dt_dive->notes = (char *)calloc((len +1), 1);
|
||||
memcpy(dt_dive->notes, buffer, len);
|
||||
free(tmp_string1);
|
||||
}
|
||||
free(tmp_notes_str);
|
||||
|
||||
/*
|
||||
* Alarms 1 and Alarms2 - Bit tables - Not in Subsurface, we use the profile
|
||||
|
@ -518,7 +514,7 @@ static char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive, struct
|
|||
libdc_model = dtrak_prepare_data(tmp_1byte, devdata);
|
||||
if (!libdc_model)
|
||||
report_error(translate("gettextFromC", "[Warning] Manual dive # %d\n"), dt_dive->number);
|
||||
dt_dive->dcs[0].model = copy_string(devdata.model.c_str());
|
||||
dt_dive->dcs[0].model = devdata.model;
|
||||
|
||||
/*
|
||||
* Air usage, unknown use. Probably allows or deny manually entering gas
|
||||
|
@ -602,7 +598,7 @@ static void wlog_compl_parser(std::string &wl_mem, struct dive *dt_dive, int dco
|
|||
pos_viz = offset + 258,
|
||||
pos_tank_init = offset + 266,
|
||||
pos_suit = offset + 268;
|
||||
char *wlog_notes = NULL, *wlog_suit = NULL, *buffer = NULL;
|
||||
char *wlog_notes = NULL, *wlog_suit = NULL;
|
||||
unsigned char *runner = (unsigned char *) wl_mem.data();
|
||||
|
||||
/*
|
||||
|
@ -614,16 +610,8 @@ static void wlog_compl_parser(std::string &wl_mem, struct dive *dt_dive, int dco
|
|||
(void)memcpy(wlog_notes_temp, runner + offset, NOTES_LENGTH);
|
||||
wlog_notes = to_utf8((unsigned char *) wlog_notes_temp);
|
||||
}
|
||||
if (dt_dive->notes && wlog_notes) {
|
||||
buffer = (char *)calloc (strlen(dt_dive->notes) + strlen(wlog_notes) + 1, 1);
|
||||
sprintf(buffer, "%s%s", dt_dive->notes, wlog_notes);
|
||||
free(dt_dive->notes);
|
||||
dt_dive->notes = copy_string(buffer);
|
||||
} else if (wlog_notes) {
|
||||
dt_dive->notes = copy_string(wlog_notes);
|
||||
}
|
||||
free(buffer);
|
||||
free(wlog_notes);
|
||||
if (wlog_notes)
|
||||
dt_dive->notes += wlog_notes;
|
||||
|
||||
/*
|
||||
* Weight in Kg * 100
|
||||
|
@ -665,7 +653,7 @@ static void wlog_compl_parser(std::string &wl_mem, struct dive *dt_dive, int dco
|
|||
wlog_suit = to_utf8((unsigned char *) wlog_suit_temp);
|
||||
}
|
||||
if (wlog_suit)
|
||||
dt_dive->suit = copy_string(wlog_suit);
|
||||
dt_dive->suit = wlog_suit;
|
||||
free(wlog_suit);
|
||||
}
|
||||
|
||||
|
|
|
@ -169,10 +169,10 @@ static void free_dive_structures(struct dive *d)
|
|||
return;
|
||||
fulltext_unregister(d);
|
||||
/* free the strings */
|
||||
free(d->buddy);
|
||||
free(d->diveguide);
|
||||
free(d->notes);
|
||||
free(d->suit);
|
||||
d->buddy.clear();
|
||||
d->diveguide.clear();
|
||||
d->notes.clear();
|
||||
d->suit.clear();
|
||||
/* free tags, additional dive computers, and pictures */
|
||||
d->tags.clear();
|
||||
d->cylinders.clear();
|
||||
|
@ -206,10 +206,6 @@ void copy_dive(const struct dive *s, struct dive *d)
|
|||
memset(&d->pictures, 0, sizeof(d->pictures));
|
||||
d->full_text = NULL;
|
||||
invalidate_dive_cache(d);
|
||||
d->buddy = copy_string(s->buddy);
|
||||
d->diveguide = copy_string(s->diveguide);
|
||||
d->notes = copy_string(s->notes);
|
||||
d->suit = copy_string(s->suit);
|
||||
copy_pictures(&s->pictures, &d->pictures);
|
||||
}
|
||||
|
||||
|
@ -232,7 +228,7 @@ struct std::unique_ptr<dive> move_dive(struct dive *s)
|
|||
|
||||
#define CONDITIONAL_COPY_STRING(_component) \
|
||||
if (what._component) \
|
||||
d->_component = copy_string(s->_component)
|
||||
d->_component = s->_component
|
||||
|
||||
// copy elements, depending on bits in what that are set
|
||||
void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_components what, bool clear)
|
||||
|
@ -1316,22 +1312,15 @@ static void merge_extra_data(struct divecomputer *res,
|
|||
}
|
||||
}
|
||||
|
||||
static char *merge_text(const char *a, const char *b, const char *sep)
|
||||
static std::string merge_text(const std::string &a, const std::string &b, const char *sep)
|
||||
{
|
||||
char *res;
|
||||
if (!a && !b)
|
||||
return NULL;
|
||||
if (!a || !*a)
|
||||
return copy_string(b);
|
||||
if (!b || !*b)
|
||||
return strdup(a);
|
||||
if (!strcmp(a, b))
|
||||
return copy_string(a);
|
||||
res = (char *)malloc(strlen(a) + strlen(b) + 32);
|
||||
if (!res)
|
||||
return (char *)a;
|
||||
sprintf(res, "%s%s%s", a, sep, b);
|
||||
return res;
|
||||
if (a.empty())
|
||||
return b;
|
||||
if (b.empty())
|
||||
return a;
|
||||
if (a == b)
|
||||
return a;
|
||||
return a + sep + b;
|
||||
}
|
||||
|
||||
#define SORT(a, b) \
|
||||
|
|
|
@ -29,11 +29,11 @@ struct dive {
|
|||
struct dive_trip *divetrip = nullptr;
|
||||
timestamp_t when = 0;
|
||||
struct dive_site *dive_site = nullptr;
|
||||
char *notes = nullptr;
|
||||
char *diveguide = nullptr, *buddy = nullptr;
|
||||
std::string notes;
|
||||
std::string diveguide, buddy;
|
||||
std::string suit;
|
||||
cylinder_table cylinders;
|
||||
weightsystem_table weightsystems;
|
||||
char *suit = nullptr;
|
||||
int number = 0;
|
||||
int rating = 0;
|
||||
int wavesize = 0, current = 0, visibility = 0, surge = 0, chill = 0; /* 0 - 5 star ratings */
|
||||
|
|
|
@ -826,9 +826,9 @@ static bool has_tags(const filter_constraint &c, const struct dive *d)
|
|||
static bool has_people(const filter_constraint &c, const struct dive *d)
|
||||
{
|
||||
QStringList dive_people;
|
||||
for (const QString &s: QString(d->buddy).split(",", SKIP_EMPTY))
|
||||
for (const QString &s: QString::fromStdString(d->buddy).split(",", SKIP_EMPTY))
|
||||
dive_people.push_back(s.trimmed());
|
||||
for (const QString &s: QString(d->diveguide).split(",", SKIP_EMPTY))
|
||||
for (const QString &s: QString::fromStdString(d->diveguide).split(",", SKIP_EMPTY))
|
||||
dive_people.push_back(s.trimmed());
|
||||
return check(c, dive_people);
|
||||
}
|
||||
|
@ -866,16 +866,16 @@ static bool has_cylinder_type(const filter_constraint &c, const struct dive *d)
|
|||
static bool has_suits(const filter_constraint &c, const struct dive *d)
|
||||
{
|
||||
QStringList diveSuits;
|
||||
if (d->suit)
|
||||
diveSuits.push_back(QString(d->suit));
|
||||
if (!d->suit.empty())
|
||||
diveSuits.push_back(QString::fromStdString(d->suit));
|
||||
return check(c, diveSuits);
|
||||
}
|
||||
|
||||
static bool has_notes(const filter_constraint &c, const struct dive *d)
|
||||
{
|
||||
QStringList diveNotes;
|
||||
if (d->notes)
|
||||
diveNotes.push_back(QString(d->notes));
|
||||
if (!d->notes.empty())
|
||||
diveNotes.push_back(QString::fromStdString(d->notes));
|
||||
return check(c, diveNotes);
|
||||
}
|
||||
|
||||
|
|
|
@ -119,10 +119,10 @@ static void tokenize(QString s, std::vector<QString> &res)
|
|||
static std::vector<QString> getWords(const dive *d)
|
||||
{
|
||||
std::vector<QString> res;
|
||||
tokenize(QString(d->notes), res);
|
||||
tokenize(QString(d->diveguide), res);
|
||||
tokenize(QString(d->buddy), res);
|
||||
tokenize(QString(d->suit), res);
|
||||
tokenize(QString::fromStdString(d->notes), res);
|
||||
tokenize(QString::fromStdString(d->diveguide), res);
|
||||
tokenize(QString::fromStdString(d->buddy), res);
|
||||
tokenize(QString::fromStdString(d->suit), res);
|
||||
for (const divetag *tag: d->tags)
|
||||
tokenize(QString::fromStdString(tag->name), res);
|
||||
for (auto &cyl: d->cylinders)
|
||||
|
|
|
@ -63,7 +63,7 @@ static int cobalt_buddies(void *param, int, char **data, char **)
|
|||
struct parser_state *state = (struct parser_state *)param;
|
||||
|
||||
if (data[0])
|
||||
utf8_string(data[0], &state->cur_dive->buddy);
|
||||
utf8_string_std(data[0], &state->cur_dive->buddy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ static int cobalt_dive(void *param, int, char **data, char **)
|
|||
state->cur_dive->when = (time_t)(atol(data[1]));
|
||||
|
||||
if (data[4])
|
||||
utf8_string(data[4], &state->cur_dive->notes);
|
||||
utf8_string_std(data[4], &state->cur_dive->notes);
|
||||
|
||||
/* data[5] should have information on Units used, but I cannot
|
||||
* parse it at all based on the sample log I have received. The
|
||||
|
|
|
@ -279,10 +279,10 @@ static int divinglog_dive(void *param, int, char **data, char **)
|
|||
state->log->sites->find_or_create(std::string(data[2]))->add_dive(state->cur_dive.get());
|
||||
|
||||
if (data[3])
|
||||
utf8_string(data[3], &state->cur_dive->buddy);
|
||||
utf8_string_std(data[3], &state->cur_dive->buddy);
|
||||
|
||||
if (data[4])
|
||||
utf8_string(data[4], &state->cur_dive->notes);
|
||||
utf8_string_std(data[4], &state->cur_dive->notes);
|
||||
|
||||
if (data[5])
|
||||
state->cur_dive->dcs[0].maxdepth.mm = lrint(permissive_strtod(data[5], NULL) * 1000);
|
||||
|
@ -291,7 +291,7 @@ static int divinglog_dive(void *param, int, char **data, char **)
|
|||
state->cur_dive->dcs[0].duration.seconds = atoi(data[6]) * 60;
|
||||
|
||||
if (data[7])
|
||||
utf8_string(data[7], &state->cur_dive->diveguide);
|
||||
utf8_string_std(data[7], &state->cur_dive->diveguide);
|
||||
|
||||
if (data[8])
|
||||
state->cur_dive->airtemp.mkelvin = C_to_mkelvin(atol(data[8]));
|
||||
|
@ -305,7 +305,7 @@ static int divinglog_dive(void *param, int, char **data, char **)
|
|||
}
|
||||
|
||||
if (data[11])
|
||||
state->cur_dive->suit = strdup(data[11]);
|
||||
state->cur_dive->suit = data[11];
|
||||
|
||||
/* Divinglog has following visibility options: good, medium, bad */
|
||||
if (data[14]) {
|
||||
|
|
|
@ -150,7 +150,7 @@ static int seac_dive(void *param, int, char **data, char **)
|
|||
|
||||
// 9 = comments from seac app
|
||||
if (data[9]) {
|
||||
utf8_string(data[9], &state->cur_dive->notes);
|
||||
utf8_string_std(data[9], &state->cur_dive->notes);
|
||||
}
|
||||
|
||||
// 10 = dive duration
|
||||
|
|
|
@ -236,9 +236,9 @@ static int shearwater_dive(void *param, int, char **data, char **)
|
|||
if (data[2])
|
||||
add_dive_site(data[2], state->cur_dive.get(), state);
|
||||
if (data[3])
|
||||
utf8_string(data[3], &state->cur_dive->buddy);
|
||||
utf8_string_std(data[3], &state->cur_dive->buddy);
|
||||
if (data[4])
|
||||
utf8_string(data[4], &state->cur_dive->notes);
|
||||
utf8_string_std(data[4], &state->cur_dive->notes);
|
||||
|
||||
state->metric = atoi(data[5]) == 1 ? 0 : 1;
|
||||
|
||||
|
@ -366,9 +366,9 @@ static int shearwater_cloud_dive(void *param, int, char **data, char **)
|
|||
if (data[2])
|
||||
add_dive_site(data[2], state->cur_dive.get(), state);
|
||||
if (data[3])
|
||||
utf8_string(data[3], &state->cur_dive->buddy);
|
||||
utf8_string_std(data[3], &state->cur_dive->buddy);
|
||||
if (data[4])
|
||||
utf8_string(data[4], &state->cur_dive->notes);
|
||||
utf8_string_std(data[4], &state->cur_dive->notes);
|
||||
|
||||
state->metric = atoi(data[5]) == 1 ? 0 : 1;
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ static int dm4_dive(void *param, int, char **data, char **)
|
|||
|
||||
state->cur_dive->when = (time_t)(atol(data[1]));
|
||||
if (data[2])
|
||||
utf8_string(data[2], &state->cur_dive->notes);
|
||||
utf8_string_std(data[2], &state->cur_dive->notes);
|
||||
|
||||
/*
|
||||
* DM4 stores Duration and DiveTime. It looks like DiveTime is
|
||||
|
@ -367,7 +367,7 @@ static int dm5_dive(void *param, int, char **data, char **)
|
|||
|
||||
state->cur_dive->when = (time_t)(atol(data[1]));
|
||||
if (data[2])
|
||||
utf8_string(data[2], &state->cur_dive->notes);
|
||||
utf8_string_std(data[2], &state->cur_dive->notes);
|
||||
|
||||
if (data[3])
|
||||
state->cur_dive->duration.seconds = atoi(data[3]);
|
||||
|
|
|
@ -199,7 +199,7 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
|
|||
// Blank notes are better than the default text
|
||||
std::string notes((char *)buf + ptr, len);
|
||||
if (!starts_with(notes, "Comment ..."))
|
||||
dive->notes = strdup(notes.c_str());
|
||||
dive->notes = notes;
|
||||
ptr += len;
|
||||
|
||||
dive->id = array_uint32_le(buf + ptr);
|
||||
|
|
|
@ -240,16 +240,16 @@ static void parse_dive_location(char *, struct git_parser_state *state)
|
|||
}
|
||||
|
||||
static void parse_dive_diveguide(char *, struct git_parser_state *state)
|
||||
{ state->active_dive->diveguide = get_first_converted_string_c(state); }
|
||||
{ state->active_dive->diveguide = get_first_converted_string(state); }
|
||||
|
||||
static void parse_dive_buddy(char *, struct git_parser_state *state)
|
||||
{ state->active_dive->buddy = get_first_converted_string_c(state); }
|
||||
{ state->active_dive->buddy = get_first_converted_string(state); }
|
||||
|
||||
static void parse_dive_suit(char *, struct git_parser_state *state)
|
||||
{ state->active_dive->suit = get_first_converted_string_c(state); }
|
||||
{ state->active_dive->suit = get_first_converted_string(state); }
|
||||
|
||||
static void parse_dive_notes(char *, struct git_parser_state *state)
|
||||
{ state->active_dive->notes = get_first_converted_string_c(state); }
|
||||
{ state->active_dive->notes = get_first_converted_string(state); }
|
||||
|
||||
static void parse_dive_divesiteid(char *line, struct git_parser_state *state)
|
||||
{ state->log->sites->get_by_uuid(get_hex(line))->add_dive(state->active_dive.get()); }
|
||||
|
@ -312,10 +312,10 @@ static void parse_site_description(char *, struct git_parser_state *state)
|
|||
{ state->active_site->description = get_first_converted_string(state); }
|
||||
|
||||
static void parse_site_name(char *, struct git_parser_state *state)
|
||||
{ state->active_site->name = get_first_converted_string_c(state); }
|
||||
{ state->active_site->name = get_first_converted_string(state); }
|
||||
|
||||
static void parse_site_notes(char *, struct git_parser_state *state)
|
||||
{ state->active_site->notes = get_first_converted_string_c(state); }
|
||||
{ state->active_site->notes = get_first_converted_string(state); }
|
||||
|
||||
static void parse_site_gps(char *line, struct git_parser_state *state)
|
||||
{
|
||||
|
|
|
@ -1016,8 +1016,8 @@ static int divinglog_dive_match(struct dive *dive, const char *name, char *buf,
|
|||
MATCH("divetime", duration, &dive->dcs[0].duration) ||
|
||||
MATCH_STATE("depth", depth, &dive->dcs[0].maxdepth) ||
|
||||
MATCH_STATE("depthavg", depth, &dive->dcs[0].meandepth) ||
|
||||
MATCH("comments", utf8_string, &dive->notes) ||
|
||||
MATCH("names.buddy", utf8_string, &dive->buddy) ||
|
||||
MATCH("comments", utf8_string_std, &dive->notes) ||
|
||||
MATCH("names.buddy", utf8_string_std, &dive->buddy) ||
|
||||
MATCH("name.country", utf8_string_std, &state->country) ||
|
||||
MATCH("name.city", utf8_string_std, &state->city) ||
|
||||
MATCH_STATE("name.place", divinglog_place, dive) ||
|
||||
|
@ -1309,18 +1309,18 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf, str
|
|||
return;
|
||||
if (MATCH_STATE("name.dive", add_dive_site, dive))
|
||||
return;
|
||||
if (MATCH("suit", utf8_string, &dive->suit))
|
||||
if (MATCH("suit", utf8_string_std, &dive->suit))
|
||||
return;
|
||||
if (MATCH("divesuit", utf8_string, &dive->suit))
|
||||
if (MATCH("divesuit", utf8_string_std, &dive->suit))
|
||||
return;
|
||||
if (MATCH("notes", utf8_string, &dive->notes))
|
||||
if (MATCH("notes", utf8_string_std, &dive->notes))
|
||||
return;
|
||||
// For historic reasons, we accept dive guide as well as dive master
|
||||
if (MATCH("diveguide", utf8_string, &dive->diveguide))
|
||||
if (MATCH("diveguide", utf8_string_std, &dive->diveguide))
|
||||
return;
|
||||
if (MATCH("divemaster", utf8_string, &dive->diveguide))
|
||||
if (MATCH("divemaster", utf8_string_std, &dive->diveguide))
|
||||
return;
|
||||
if (MATCH("buddy", utf8_string, &dive->buddy))
|
||||
if (MATCH("buddy", utf8_string_std, &dive->buddy))
|
||||
return;
|
||||
if (MATCH("watersalinity", salinity, &dive->user_salinity))
|
||||
return;
|
||||
|
|
|
@ -126,8 +126,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
translate("gettextFromC", "Warning:"),
|
||||
translate("gettextFromC", "Decompression calculation aborted due to excessive time"));
|
||||
// TODO: avoid copy
|
||||
free(dive->notes);
|
||||
dive->notes = strdup(buf.c_str());
|
||||
dive->notes = buf;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -144,8 +143,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
subsurface_canonical_version(),
|
||||
translate("gettextFromC", "dive plan</b> (overlapping dives detected)"));
|
||||
// TODO: avoid copy
|
||||
free(dive->notes);
|
||||
dive->notes = strdup(buf.c_str());
|
||||
dive->notes = buf;
|
||||
return;
|
||||
} else if (diveplan->surface_interval >= 48 * 60 *60) {
|
||||
buf += format_string_std("%s (%s) %s %s",
|
||||
|
@ -613,8 +611,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
buf += "</div>\n";
|
||||
}
|
||||
// TODO: avoid copy
|
||||
free(dive->notes);
|
||||
dive->notes = strdup(buf.c_str());
|
||||
dive->notes = buf;
|
||||
#ifdef DEBUG_PLANNER_NOTES
|
||||
printf("<!DOCTYPE html>\n<html>\n\t<head><title>plannernotes</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head>\n\t<body>\n%s\t</body>\n</html>\n", dive->notes);
|
||||
#endif
|
||||
|
|
|
@ -98,10 +98,10 @@ static void show_utf8(struct membuffer *b, const char *prefix, const char *value
|
|||
|
||||
static void save_overview(struct membuffer *b, struct dive *dive)
|
||||
{
|
||||
show_utf8(b, "divemaster ", dive->diveguide, "\n");
|
||||
show_utf8(b, "buddy ", dive->buddy, "\n");
|
||||
show_utf8(b, "suit ", dive->suit, "\n");
|
||||
show_utf8(b, "notes ", dive->notes, "\n");
|
||||
show_utf8(b, "divemaster ", dive->diveguide.c_str(), "\n");
|
||||
show_utf8(b, "buddy ", dive->buddy.c_str(), "\n");
|
||||
show_utf8(b, "suit ", dive->suit.c_str(), "\n");
|
||||
show_utf8(b, "notes ", dive->notes.c_str(), "\n");
|
||||
}
|
||||
|
||||
static void save_tags(struct membuffer *b, const tag_list &tags)
|
||||
|
|
|
@ -210,11 +210,10 @@ void put_HTML_quoted(struct membuffer *b, const char *text)
|
|||
void put_HTML_notes(struct membuffer *b, const struct dive *dive, const char *pre, const char *post)
|
||||
{
|
||||
put_string(b, pre);
|
||||
if (dive->notes) {
|
||||
put_HTML_quoted(b, dive->notes);
|
||||
} else {
|
||||
if (!dive->notes.empty())
|
||||
put_HTML_quoted(b, dive->notes.c_str());
|
||||
else
|
||||
put_string(b, "--");
|
||||
}
|
||||
put_string(b, post);
|
||||
}
|
||||
|
||||
|
@ -348,9 +347,9 @@ static void write_one_dive(struct membuffer *b, const struct dive *dive, const c
|
|||
put_HTML_airtemp(b, dive, "\"air\":\"", "\",");
|
||||
put_HTML_watertemp(b, dive, "\"water\":\"", "\"");
|
||||
put_string(b, " },");
|
||||
write_attribute(b, "buddy", dive->buddy, ", ");
|
||||
write_attribute(b, "diveguide", dive->diveguide, ", ");
|
||||
write_attribute(b, "suit", dive->suit, ", ");
|
||||
write_attribute(b, "buddy", dive->buddy.c_str(), ", ");
|
||||
write_attribute(b, "diveguide", dive->diveguide.c_str(), ", ");
|
||||
write_attribute(b, "suit", dive->suit.c_str(), ", ");
|
||||
put_HTML_tags(b, dive, "\"tags\":", ",");
|
||||
if (!list_only) {
|
||||
put_cylinder_HTML(b, dive);
|
||||
|
|
|
@ -157,10 +157,10 @@ static void save_salinity(struct membuffer *b, struct divecomputer *dc)
|
|||
|
||||
static void save_overview(struct membuffer *b, struct dive *dive, bool anonymize)
|
||||
{
|
||||
show_utf8_blanked(b, dive->diveguide, " <divemaster>", "</divemaster>\n", 0, anonymize);
|
||||
show_utf8_blanked(b, dive->buddy, " <buddy>", "</buddy>\n", 0, anonymize);
|
||||
show_utf8_blanked(b, dive->notes, " <notes>", "</notes>\n", 0, anonymize);
|
||||
show_utf8_blanked(b, dive->suit, " <suit>", "</suit>\n", 0, anonymize);
|
||||
show_utf8_blanked(b, dive->diveguide.c_str(), " <divemaster>", "</divemaster>\n", 0, anonymize);
|
||||
show_utf8_blanked(b, dive->buddy.c_str(), " <buddy>", "</buddy>\n", 0, anonymize);
|
||||
show_utf8_blanked(b, dive->notes.c_str(), " <notes>", "</notes>\n", 0, anonymize);
|
||||
show_utf8_blanked(b, dive->suit.c_str(), " <suit>", "</suit>\n", 0, anonymize);
|
||||
}
|
||||
|
||||
static void put_gasmix(struct membuffer *b, struct gasmix mix)
|
||||
|
|
|
@ -43,7 +43,7 @@ QString formatSac(const dive *d)
|
|||
|
||||
QString formatNotes(const dive *d)
|
||||
{
|
||||
QString tmp = d->notes ? QString::fromUtf8(d->notes) : QString();
|
||||
QString tmp = QString::fromStdString(d->notes);
|
||||
if (is_dc_planner(&d->dcs[0])) {
|
||||
QTextDocument notes;
|
||||
#define _NOTES_BR "\n"
|
||||
|
|
|
@ -158,20 +158,15 @@ static void uemis_get_index(std::string_view buffer, int &idx)
|
|||
}
|
||||
|
||||
/* space separated */
|
||||
static void uemis_add_string(std::string_view buffer, char **text, const char *delimit)
|
||||
static void uemis_add_string(std::string_view buffer, std::string &text, const char *delimit)
|
||||
{
|
||||
/* do nothing if this is an empty buffer (Uemis sometimes returns a single
|
||||
* space for empty buffers) */
|
||||
if (buffer.empty() || buffer == " ")
|
||||
return;
|
||||
if (!*text) {
|
||||
*text = strdup(std::string(buffer).c_str());
|
||||
} else {
|
||||
std::string res = std::string(*text) + delimit;
|
||||
res += buffer;
|
||||
free(*text);
|
||||
*text = strdup(res.c_str());
|
||||
}
|
||||
if (!text.empty())
|
||||
text += delimit;
|
||||
text += buffer;
|
||||
}
|
||||
|
||||
/* still unclear if it ever reports lbs */
|
||||
|
@ -749,24 +744,24 @@ static void parse_tag(struct dive *dive, std::string_view tag, std::string_view
|
|||
uemis_get_weight(val, ws, dive->dcs[0].diveid);
|
||||
dive->weightsystems.push_back(std::move(ws));
|
||||
} else if (tag == "notes") {
|
||||
uemis_add_string(val, &dive->notes, " ");
|
||||
uemis_add_string(val, dive->notes, " ");
|
||||
} else if (tag == "u8DiveSuit") {
|
||||
int idx = 0;
|
||||
uemis_get_index(val, idx);
|
||||
if (idx > 0 && idx < (int)std::size(suit))
|
||||
uemis_add_string(translate("gettextFromC", suit[idx]), &dive->suit, " ");
|
||||
uemis_add_string(translate("gettextFromC", suit[idx]), dive->suit, " ");
|
||||
} else if (tag == "u8DiveSuitType") {
|
||||
int idx = 0;
|
||||
uemis_get_index(val, idx);
|
||||
if (idx > 0 && idx < (int)std::size(suit_type))
|
||||
uemis_add_string(translate("gettextFromC", suit_type[idx]), &dive->suit, " ");
|
||||
uemis_add_string(translate("gettextFromC", suit_type[idx]), dive->suit, " ");
|
||||
} else if (tag == "u8SuitThickness") {
|
||||
int idx = 0;
|
||||
uemis_get_index(val, idx);
|
||||
if (idx > 0 && idx < (int)std::size(suit_thickness))
|
||||
uemis_add_string(translate("gettextFromC", suit_thickness[idx]), &dive->suit, " ");
|
||||
uemis_add_string(translate("gettextFromC", suit_thickness[idx]), dive->suit, " ");
|
||||
} else if (tag == "nickname") {
|
||||
uemis_add_string(val, &dive->buddy, ",");
|
||||
uemis_add_string(val, dive->buddy, ",");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -328,17 +328,17 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
|
|||
if (what->divesite && current_dive->dive_site)
|
||||
text << tr("Dive site: ") << QString::fromStdString(current_dive->dive_site->name) << "\n";
|
||||
if (what->diveguide)
|
||||
text << tr("Dive guide: ") << current_dive->diveguide << "\n";
|
||||
text << tr("Dive guide: ") << QString::fromStdString(current_dive->diveguide) << "\n";
|
||||
if (what->buddy)
|
||||
text << tr("Buddy: ") << current_dive->buddy << "\n";
|
||||
text << tr("Buddy: ") << QString::fromStdString(current_dive->buddy) << "\n";
|
||||
if (what->rating)
|
||||
text << tr("Rating: ") + QString("*").repeated(current_dive->rating) << "\n";
|
||||
if (what->visibility)
|
||||
text << tr("Visibility: ") + QString("*").repeated(current_dive->visibility) << "\n";
|
||||
if (what->notes)
|
||||
text << tr("Notes:\n") << current_dive->notes << "\n";
|
||||
text << tr("Notes:\n") << QString::fromStdString(current_dive->notes) << "\n";
|
||||
if (what->suit)
|
||||
text << tr("Suit: ") << current_dive->suit << "\n";
|
||||
text << tr("Suit: ") << QString::fromStdString(current_dive->suit) << "\n";
|
||||
if (what-> tags) {
|
||||
text << tr("Tags: ");
|
||||
for (const divetag *tag: current_dive->tags)
|
||||
|
|
|
@ -118,7 +118,7 @@ void TabDiveEquipment::divesChanged(const QVector<dive *> &dives, DiveField fiel
|
|||
return;
|
||||
|
||||
if (field.suit)
|
||||
ui.suit->setText(QString(parent.currentDive->suit));
|
||||
ui.suit->setText(QString::fromStdString(parent.currentDive->suit));
|
||||
}
|
||||
|
||||
void TabDiveEquipment::toggleTriggeredColumn()
|
||||
|
@ -145,8 +145,8 @@ void TabDiveEquipment::updateData(const std::vector<dive *> &, dive *currentDive
|
|||
sensorDelegate.setCurrentDC(dc);
|
||||
tankUseDelegate.setCurrentDC(dc);
|
||||
|
||||
if (currentDive && currentDive->suit)
|
||||
ui.suit->setText(QString(currentDive->suit));
|
||||
if (currentDive && !currentDive->suit.empty())
|
||||
ui.suit->setText(QString::fromStdString(currentDive->suit));
|
||||
else
|
||||
ui.suit->clear();
|
||||
}
|
||||
|
|
|
@ -120,9 +120,9 @@ void TabDiveNotes::divesChanged(const QVector<dive *> &dives, DiveField field)
|
|||
if (field.tags)
|
||||
ui.tagWidget->setText(QString::fromStdString(taglist_get_tagstring(currentDive->tags)));
|
||||
if (field.buddy)
|
||||
ui.buddy->setText(currentDive->buddy);
|
||||
ui.buddy->setText(QString::fromStdString(currentDive->buddy));
|
||||
if (field.diveguide)
|
||||
ui.diveguide->setText(currentDive->diveguide);
|
||||
ui.diveguide->setText(QString::fromStdString(currentDive->diveguide));
|
||||
}
|
||||
|
||||
void TabDiveNotes::diveSiteEdited(dive_site *ds, int)
|
||||
|
@ -152,7 +152,7 @@ static bool isHtml(const QString &s)
|
|||
|
||||
void TabDiveNotes::updateNotes(const struct dive *d)
|
||||
{
|
||||
QString tmp(d->notes);
|
||||
QString tmp = QString::fromStdString(d->notes);
|
||||
if (isHtml(tmp)) {
|
||||
ui.notes->setHtml(tmp);
|
||||
} else {
|
||||
|
@ -263,8 +263,8 @@ void TabDiveNotes::updateData(const std::vector<dive *> &, dive *currentDive, in
|
|||
updateNotes(currentDive);
|
||||
updateDiveSite(currentDive);
|
||||
updateDateTime(currentDive);
|
||||
ui.diveguide->setText(currentDive->diveguide);
|
||||
ui.buddy->setText(currentDive->buddy);
|
||||
ui.diveguide->setText(QString::fromStdString(currentDive->diveguide));
|
||||
ui.buddy->setText(QString::fromStdString(currentDive->buddy));
|
||||
}
|
||||
ui.duration->setText(render_seconds_to_string(currentDive->duration.seconds));
|
||||
ui.depth->setText(get_depth_string(currentDive->maxdepth, true));
|
||||
|
|
|
@ -540,11 +540,11 @@ QVariant TemplateLayout::getValue(QString list, QString property, const State &s
|
|||
} else if (property == "meandepth") {
|
||||
return get_depth_string(d->dcs[0].meandepth.mm, true, true);
|
||||
} else if (property == "divemaster") {
|
||||
return d->diveguide;
|
||||
return QString::fromStdString(d->diveguide);
|
||||
} else if (property == "diveguide") {
|
||||
return d->diveguide;
|
||||
return QString::fromStdString(d->diveguide);
|
||||
} else if (property == "buddy") {
|
||||
return d->buddy;
|
||||
return QString::fromStdString(d->buddy);
|
||||
} else if (property == "airTemp") {
|
||||
return get_temperature_string(d->airtemp, true);
|
||||
} else if (property == "waterTemp") {
|
||||
|
@ -564,7 +564,7 @@ QVariant TemplateLayout::getValue(QString list, QString property, const State &s
|
|||
} else if (property == "singleWeight") {
|
||||
return d->weightsystems.size() <= 1;
|
||||
} else if (property == "suit") {
|
||||
return d->suit;
|
||||
return QString::fromStdString(d->suit);
|
||||
} else if (property == "cylinderList") {
|
||||
return formatFullCylinderList();
|
||||
} else if (property == "cylinders") {
|
||||
|
|
|
@ -1301,26 +1301,21 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
|
|||
k++;
|
||||
}
|
||||
}
|
||||
if (d->suit != suit) {
|
||||
if (d->suit != suit.toStdString()) {
|
||||
diveChanged = true;
|
||||
free(d->suit);
|
||||
d->suit = copy_qstring(suit);
|
||||
d->suit = suit.toStdString();
|
||||
}
|
||||
if (d->buddy != buddy) {
|
||||
if (buddy.contains(",")){
|
||||
if (d->buddy != buddy.toStdString()) {
|
||||
if (buddy.contains(","))
|
||||
buddy = buddy.replace(QRegularExpression("\\s*,\\s*"), ", ");
|
||||
}
|
||||
diveChanged = true;
|
||||
free(d->buddy);
|
||||
d->buddy = copy_qstring(buddy);
|
||||
d->buddy = buddy.toStdString();
|
||||
}
|
||||
if (d->diveguide != diveGuide) {
|
||||
if (diveGuide.contains(",")){
|
||||
if (d->diveguide != diveGuide.toStdString()) {
|
||||
if (diveGuide.contains(","))
|
||||
diveGuide = diveGuide.replace(QRegularExpression("\\s*,\\s*"), ", ");
|
||||
}
|
||||
diveChanged = true;
|
||||
free(d->diveguide);
|
||||
d->diveguide = copy_qstring(diveGuide);
|
||||
d->diveguide = diveGuide.toStdString();
|
||||
}
|
||||
// normalize the tag list we have and the one we get from the UI
|
||||
// try hard to deal with accidental white space issues
|
||||
|
@ -1349,8 +1344,7 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
|
|||
}
|
||||
if (formatNotes(d) != notes) {
|
||||
diveChanged = true;
|
||||
free(d->notes);
|
||||
d->notes = copy_qstring(notes);
|
||||
d->notes = notes.toStdString();
|
||||
}
|
||||
// now that we have it all figured out, let's see what we need
|
||||
// to update
|
||||
|
|
|
@ -28,13 +28,13 @@ void CompletionModelBase::divesChanged(const QVector<dive *> &, DiveField field)
|
|||
updateModel();
|
||||
}
|
||||
|
||||
static QStringList getCSVList(char *dive::*item)
|
||||
static QStringList getCSVList(const std::string dive::*item)
|
||||
{
|
||||
QSet<QString> set;
|
||||
struct dive *dive;
|
||||
int i = 0;
|
||||
for_each_dive (i, dive) {
|
||||
QString str(dive->*item);
|
||||
QString str = QString::fromStdString(dive->*item);
|
||||
for (const QString &value: str.split(",", SKIP_EMPTY))
|
||||
set.insert(value.trimmed());
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ QStringList SuitCompletionModel::getStrings()
|
|||
struct dive *dive;
|
||||
int i = 0;
|
||||
for_each_dive (i, dive) {
|
||||
QString suit(dive->suit);
|
||||
QString suit = QString::fromStdString(dive->suit);
|
||||
if (!list.contains(suit))
|
||||
list.append(suit);
|
||||
}
|
||||
|
|
|
@ -1093,7 +1093,7 @@ void DivePlannerPointsModel::updateDiveProfile()
|
|||
#endif
|
||||
final_deco_state = plan_deco_state;
|
||||
}
|
||||
emit calculatedPlanNotes(QString(d->notes));
|
||||
emit calculatedPlanNotes(QString::fromStdString(d->notes));
|
||||
|
||||
|
||||
#if DEBUG_PLAN
|
||||
|
@ -1268,10 +1268,10 @@ finish:
|
|||
|
||||
void DivePlannerPointsModel::computeVariationsDone(QString variations)
|
||||
{
|
||||
QString notes = QString(d->notes);
|
||||
free(d->notes);
|
||||
d->notes = copy_qstring(notes.replace("VARIATIONS", variations));
|
||||
emit calculatedPlanNotes(QString(d->notes));
|
||||
QString notes = QString::fromStdString(d->notes);
|
||||
notes = notes.replace("VARIATIONS", variations);
|
||||
d->notes = notes.toStdString();
|
||||
emit calculatedPlanNotes(notes);
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::createPlan(bool saveAsNew)
|
||||
|
@ -1298,7 +1298,7 @@ void DivePlannerPointsModel::createPlan(bool saveAsNew)
|
|||
// Try to identify old planner output and remove only this part
|
||||
// Treat user provided text as plain text.
|
||||
QTextDocument notesDocument;
|
||||
notesDocument.setHtml(current_dive->notes);
|
||||
notesDocument.setHtml(QString::fromStdString(current_dive->notes));
|
||||
QString oldnotes(notesDocument.toPlainText());
|
||||
QString disclaimer = get_planner_disclaimer();
|
||||
int disclaimerMid = disclaimer.indexOf("%s");
|
||||
|
@ -1320,8 +1320,8 @@ void DivePlannerPointsModel::createPlan(bool saveAsNew)
|
|||
}
|
||||
// Deal with line breaks
|
||||
oldnotes.replace("\n", "<br>");
|
||||
oldnotes.append(d->notes);
|
||||
d->notes = copy_qstring(oldnotes);
|
||||
oldnotes.append(QString::fromStdString(d->notes));
|
||||
d->notes = oldnotes.toStdString();
|
||||
// If we save as new create a copy of the dive here
|
||||
}
|
||||
|
||||
|
|
|
@ -287,13 +287,13 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role)
|
|||
formatDiveDuration(d));
|
||||
case MobileListModel::RatingRole: return d->rating;
|
||||
case MobileListModel::VizRole: return d->visibility;
|
||||
case MobileListModel::SuitRole: return QString(d->suit);
|
||||
case MobileListModel::SuitRole: return QString::fromStdString(d->suit);
|
||||
case MobileListModel::AirTempRole: return get_temperature_string(d->airtemp, true);
|
||||
case MobileListModel::WaterTempRole: return get_temperature_string(d->watertemp, true);
|
||||
case MobileListModel::SacRole: return formatSac(d);
|
||||
case MobileListModel::SumWeightRole: return formatSumWeight(d);
|
||||
case MobileListModel::DiveGuideRole: return QString(d->diveguide);
|
||||
case MobileListModel::BuddyRole: return QString(d->buddy);
|
||||
case MobileListModel::DiveGuideRole: return QString::fromStdString(d->diveguide);
|
||||
case MobileListModel::BuddyRole: return QString::fromStdString(d->buddy);
|
||||
case MobileListModel::TagsRole: return QString::fromStdString(taglist_get_tagstring(d->tags));
|
||||
case MobileListModel::NotesRole: return formatNotes(d);
|
||||
case MobileListModel::GpsRole: return formatDiveGPS(d);
|
||||
|
@ -334,7 +334,7 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role)
|
|||
case TOTALWEIGHT:
|
||||
return displayWeight(d, prefs.units.show_units_table);
|
||||
case SUIT:
|
||||
return QString(d->suit);
|
||||
return QString::fromStdString(d->suit);
|
||||
case CYLINDER:
|
||||
return !d->cylinders.empty() ? QString::fromStdString(d->cylinders[0].type.description) : QString();
|
||||
case SAC:
|
||||
|
@ -353,15 +353,15 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role)
|
|||
case COUNTRY:
|
||||
return QString::fromStdString(get_dive_country(d));
|
||||
case BUDDIES:
|
||||
return QString(d->buddy);
|
||||
return QString::fromStdString(d->buddy);
|
||||
case DIVEGUIDE:
|
||||
return QString(d->diveguide);
|
||||
return QString::fromStdString(d->diveguide);
|
||||
case LOCATION:
|
||||
return QString::fromStdString(get_dive_location(d));
|
||||
case GAS:
|
||||
return formatDiveGasString(d);
|
||||
case NOTES:
|
||||
return QString(d->notes);
|
||||
return QString::fromStdString(d->notes);
|
||||
case DIVEMODE:
|
||||
return QString(divemode_text_ui[(int)d->dcs[0].divemode]);
|
||||
}
|
||||
|
@ -1712,15 +1712,6 @@ static bool lessThanHelper(int diff1, int diff2)
|
|||
return diff1 < 0 || (diff1 == 0 && diff2 < 0);
|
||||
}
|
||||
|
||||
static int strCmp(const char *s1, const char *s2)
|
||||
{
|
||||
if (!s1)
|
||||
return !s2 ? 0 : -1;
|
||||
if (!s2)
|
||||
return 1;
|
||||
return QString::localeAwareCompare(QString(s1), QString(s2)); // TODO: avoid copy
|
||||
}
|
||||
|
||||
static int strCmp(const std::string &s1, const std::string &s2)
|
||||
{
|
||||
return QString::localeAwareCompare(QString::fromStdString(s1), QString::fromStdString(s2)); // TODO: avoid copy
|
||||
|
|
|
@ -264,26 +264,6 @@ static void concat(std::string &orig, const char *sep, std::string_view s)
|
|||
orig += s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Temporary funcion as long as core still has C-strings.
|
||||
* Equivalent to concat, but takes a C-string as first argument and
|
||||
* frees it. Returns a newly allocated copy.
|
||||
*
|
||||
* Note: taking "const char * const *" is an ugly hack to
|
||||
* allow passing pointer to "const char *" as well as
|
||||
* "char *". Which in turn is necessary, as this function currently
|
||||
* replaces "const char *" strings.
|
||||
*/
|
||||
static void concat(const char * const *orig_in, const char *sep, std::string_view s)
|
||||
{
|
||||
char **orig = const_cast<char **>(orig_in);
|
||||
char *to_free = *orig;
|
||||
std::string orig_std(*orig ? *orig : "");
|
||||
concat(orig_std, sep, s);
|
||||
*orig = strdup(orig_std.c_str());
|
||||
free(to_free);
|
||||
}
|
||||
|
||||
/*
|
||||
* A site may be a wreck, which has its own table.
|
||||
* Parse this table referred by the site idx. If found, put the different info items in
|
||||
|
@ -700,7 +680,7 @@ static void smtk_parse_relations(MdbHandle *mdb, struct dive *dive, char *dive_i
|
|||
dive->dcs[0].divemode = CCR;
|
||||
}
|
||||
if (!tmp.empty())
|
||||
concat(&dive->notes, "\n", format_string_std("Smartrak %s: %s", table_name, tmp.c_str()));
|
||||
concat(dive->notes, "\n", format_string_std("Smartrak %s: %s", table_name, tmp.c_str()));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -719,7 +699,7 @@ static void smtk_parse_other(struct dive *dive, const std::vector<std::string> &
|
|||
if (tag)
|
||||
taglist_add_tag(dive->tags, str);
|
||||
else
|
||||
concat(&dive->notes, "\n", format_string_std("Smartrak %s: %s", data_name, str.c_str()));
|
||||
concat(dive->notes, "\n", format_string_std("Smartrak %s: %s", data_name, str.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1023,9 +1003,9 @@ void smartrak_import(const char *file, struct divelog *log)
|
|||
smtkdive->visibility = strtod((char *)col[coln(VISIBILITY)]->bind_ptr, NULL) > 25 ? 5 : lrint(strtod((char *)col[13]->bind_ptr, NULL) / 5);
|
||||
weightsystem_t ws = { {(int)lrint(strtod((char *)col[coln(WEIGHT)]->bind_ptr, NULL) * 1000)}, std::string(), false };
|
||||
smtkdive->weightsystems.push_back(std::move(ws));
|
||||
smtkdive->suit = strdup(get(suit_list, atoi((char *)col[coln(SUITIDX)]->bind_ptr) - 1).c_str());
|
||||
smtkdive->suit = get(suit_list, atoi((char *)col[coln(SUITIDX)]->bind_ptr) - 1);
|
||||
smtk_build_location(mdb_clon, (char *)col[coln(SITEIDX)]->bind_ptr, &smtkdive->dive_site, log);
|
||||
smtkdive->buddy = strdup(smtk_locate_buddy(mdb_clon, (char *)col[0]->bind_ptr, buddy_list).c_str());
|
||||
smtkdive->buddy = smtk_locate_buddy(mdb_clon, (char *)col[0]->bind_ptr, buddy_list);
|
||||
smtk_parse_relations(mdb_clon, smtkdive.get(), (char *)col[0]->bind_ptr, "Type", "TypeRelation", type_list, true);
|
||||
smtk_parse_relations(mdb_clon, smtkdive.get(), (char *)col[0]->bind_ptr, "Activity", "ActivityRelation", activity_list, false);
|
||||
smtk_parse_relations(mdb_clon, smtkdive.get(), (char *)col[0]->bind_ptr, "Gear", "GearRelation", gear_list, false);
|
||||
|
@ -1034,7 +1014,7 @@ void smartrak_import(const char *file, struct divelog *log)
|
|||
smtk_parse_other(smtkdive.get(), underwater_list, "Underwater", (char *)col[coln(UNDERWATERIDX)]->bind_ptr, false);
|
||||
smtk_parse_other(smtkdive.get(), surface_list, "Surface", (char *)col[coln(SURFACEIDX)]->bind_ptr, false);
|
||||
smtk_parse_bookmarks(mdb_clon, smtkdive.get(), (char *)col[0]->bind_ptr);
|
||||
concat(&smtkdive->notes, "\n", std::string((char *)col[coln(REMARKS)]->bind_ptr));
|
||||
concat(smtkdive->notes, "\n", std::string((char *)col[coln(REMARKS)]->bind_ptr));
|
||||
|
||||
record_dive_to_table(smtkdive.release(), log->dives.get());
|
||||
}
|
||||
|
|
|
@ -1427,9 +1427,9 @@ struct DiveModeVariable : public StatsVariableTemplate<StatsVariable::Type::Disc
|
|||
struct PeopleBinner : public StringBinner<PeopleBinner, StringBin> {
|
||||
std::vector<QString> to_bin_values(const dive *d) const {
|
||||
std::vector<QString> dive_people;
|
||||
for (const QString &s: QString(d->buddy).split(",", SKIP_EMPTY))
|
||||
for (const QString &s: QString::fromStdString(d->buddy).split(",", SKIP_EMPTY))
|
||||
dive_people.push_back(s.trimmed());
|
||||
for (const QString &s: QString(d->diveguide).split(",", SKIP_EMPTY))
|
||||
for (const QString &s: QString::fromStdString(d->diveguide).split(",", SKIP_EMPTY))
|
||||
dive_people.push_back(s.trimmed());
|
||||
return dive_people;
|
||||
}
|
||||
|
@ -1441,8 +1441,8 @@ struct PeopleVariable : public StatsVariableTemplate<StatsVariable::Type::Discre
|
|||
return StatsTranslations::tr("People");
|
||||
}
|
||||
QString diveCategories(const dive *d) const override {
|
||||
QString buddy = QString(d->buddy).trimmed();
|
||||
QString diveguide = QString(d->diveguide).trimmed();
|
||||
QString buddy = QString::fromStdString(d->buddy).trimmed();
|
||||
QString diveguide = QString::fromStdString(d->diveguide).trimmed();
|
||||
if (!buddy.isEmpty() && !diveguide.isEmpty())
|
||||
buddy += ", ";
|
||||
return buddy + diveguide;
|
||||
|
@ -1455,7 +1455,7 @@ struct PeopleVariable : public StatsVariableTemplate<StatsVariable::Type::Discre
|
|||
struct BuddyBinner : public StringBinner<BuddyBinner, StringBin> {
|
||||
std::vector<QString> to_bin_values(const dive *d) const {
|
||||
std::vector<QString> buddies;
|
||||
for (const QString &s: QString(d->buddy).split(",", SKIP_EMPTY))
|
||||
for (const QString &s: QString::fromStdString(d->buddy).split(",", SKIP_EMPTY))
|
||||
buddies.push_back(s.trimmed());
|
||||
return buddies;
|
||||
}
|
||||
|
@ -1467,7 +1467,7 @@ struct BuddyVariable : public StatsVariableTemplate<StatsVariable::Type::Discret
|
|||
return StatsTranslations::tr("Buddies");
|
||||
}
|
||||
QString diveCategories(const dive *d) const override {
|
||||
return QString(d->buddy).trimmed();
|
||||
return QString::fromStdString(d->buddy).trimmed();
|
||||
}
|
||||
std::vector<const StatsBinner *> binners() const override {
|
||||
return { &buddy_binner };
|
||||
|
@ -1477,7 +1477,7 @@ struct BuddyVariable : public StatsVariableTemplate<StatsVariable::Type::Discret
|
|||
struct DiveGuideBinner : public StringBinner<DiveGuideBinner, StringBin> {
|
||||
std::vector<QString> to_bin_values(const dive *d) const {
|
||||
std::vector<QString> dive_guides;
|
||||
for (const QString &s: QString(d->diveguide).split(",", SKIP_EMPTY))
|
||||
for (const QString &s: QString::fromStdString(d->diveguide).split(",", SKIP_EMPTY))
|
||||
dive_guides.push_back(s.trimmed());
|
||||
return dive_guides;
|
||||
}
|
||||
|
@ -1489,7 +1489,7 @@ struct DiveGuideVariable : public StatsVariableTemplate<StatsVariable::Type::Dis
|
|||
return StatsTranslations::tr("Dive guides");
|
||||
}
|
||||
QString diveCategories(const dive *d) const override {
|
||||
return QString(d->diveguide).trimmed();
|
||||
return QString::fromStdString(d->diveguide).trimmed();
|
||||
}
|
||||
std::vector<const StatsBinner *> binners() const override {
|
||||
return { &dive_guide_binner };
|
||||
|
@ -1746,7 +1746,7 @@ struct GasContentHeVariable : GasContentVariable {
|
|||
|
||||
struct SuitBinner : public StringBinner<SuitBinner, StringBin> {
|
||||
std::vector<QString> to_bin_values(const dive *d) const {
|
||||
return { QString(d->suit) };
|
||||
return { QString::fromStdString(d->suit) };
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1756,7 +1756,7 @@ struct SuitVariable : public StatsVariableTemplate<StatsVariable::Type::Discrete
|
|||
return StatsTranslations::tr("Suit type");
|
||||
}
|
||||
QString diveCategories(const dive *d) const override {
|
||||
return QString(d->suit);
|
||||
return QString::fromStdString(d->suit);
|
||||
}
|
||||
std::vector<const StatsBinner *> binners() const override {
|
||||
return { &suit_binner };
|
||||
|
|
|
@ -378,8 +378,7 @@ void TestGitStorage::testGitStorageCloudMerge2()
|
|||
process_loaded_dives();
|
||||
dive = get_dive(1);
|
||||
QVERIFY(dive != NULL);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("These notes have been modified by TestGitStorage");
|
||||
dive->notes = "These notes have been modified by TestGitStorage";
|
||||
QCOMPARE(save_dives(cloudTestRepo.c_str()), 0);
|
||||
clear_dive_file_data();
|
||||
|
||||
|
@ -413,14 +412,11 @@ void TestGitStorage::testGitStorageCloudMerge3()
|
|||
process_loaded_dives();
|
||||
struct dive *dive;
|
||||
QVERIFY((dive = get_dive(0)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("Create multi line dive notes\nLine 2\nLine 3\nLine 4\nLine 5\nThat should be enough");
|
||||
dive->notes = "Create multi line dive notes\nLine 2\nLine 3\nLine 4\nLine 5\nThat should be enough";
|
||||
QVERIFY((dive = get_dive(1)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("Create multi line dive notes\nLine 2\nLine 3\nLine 4\nLine 5\nThat should be enough");
|
||||
dive->notes = "Create multi line dive notes\nLine 2\nLine 3\nLine 4\nLine 5\nThat should be enough";
|
||||
QVERIFY((dive = get_dive(2)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("Create multi line dive notes\nLine 2\nLine 3\nLine 4\nLine 5\nThat should be enough");
|
||||
dive->notes = "Create multi line dive notes\nLine 2\nLine 3\nLine 4\nLine 5\nThat should be enough";
|
||||
QCOMPARE(save_dives(cloudTestRepo.c_str()), 0);
|
||||
clear_dive_file_data();
|
||||
|
||||
|
@ -428,14 +424,11 @@ void TestGitStorage::testGitStorageCloudMerge3()
|
|||
QCOMPARE(parse_file(cloudTestRepo.c_str(), &divelog), 0);
|
||||
process_loaded_dives();
|
||||
QVERIFY((dive = get_dive(0)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("Create multi line dive notes\nDifferent line 2 and removed 3-5\n\nThat should be enough");
|
||||
dive->notes = "Create multi line dive notes\nDifferent line 2 and removed 3-5\n\nThat should be enough";
|
||||
QVERIFY((dive = get_dive(1)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("Line 2\nLine 3\nLine 4\nLine 5"); // keep the middle, remove first and last");
|
||||
dive->notes = "Line 2\nLine 3\nLine 4\nLine 5"; // keep the middle, remove first and last");
|
||||
QVERIFY((dive = get_dive(2)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("single line dive notes");
|
||||
dive->notes = "single line dive notes";
|
||||
git_local_only = true;
|
||||
QCOMPARE(save_dives(cloudTestRepo.c_str()), 0);
|
||||
git_local_only = false;
|
||||
|
@ -447,14 +440,11 @@ void TestGitStorage::testGitStorageCloudMerge3()
|
|||
QCOMPARE(parse_file(cloudTestRepo.c_str(), &divelog), 0);
|
||||
process_loaded_dives();
|
||||
QVERIFY((dive = get_dive(0)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("Completely different dive notes\nBut also multi line");
|
||||
dive->notes = "Completely different dive notes\nBut also multi line";
|
||||
QVERIFY((dive = get_dive(1)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("single line dive notes");
|
||||
dive->notes = "single line dive notes";
|
||||
QVERIFY((dive = get_dive(2)) != 0);
|
||||
free(dive->notes);
|
||||
dive->notes = strdup("Line 2\nLine 3\nLine 4\nLine 5"); // keep the middle, remove first and last");
|
||||
dive->notes = "Line 2\nLine 3\nLine 4\nLine 5"; // keep the middle, remove first and last");
|
||||
QCOMPARE(save_dives(cloudTestRepo.c_str()), 0);
|
||||
clear_dive_file_data();
|
||||
|
||||
|
|
|
@ -486,8 +486,7 @@ void TestPlan::testMetric()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -527,8 +526,7 @@ void TestPlan::testImperial()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -567,8 +565,7 @@ void TestPlan::testVpmbMetric45m30minTx()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -597,8 +594,7 @@ void TestPlan::testVpmbMetric60m10minTx()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -627,8 +623,7 @@ void TestPlan::testVpmbMetric60m30minAir()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -657,8 +652,7 @@ void TestPlan::testVpmbMetric60m30minEan50()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -693,8 +687,7 @@ void TestPlan::testVpmbMetric60m30minTx()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -729,8 +722,7 @@ void TestPlan::testVpmbMetric100m60min()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -772,8 +764,7 @@ void TestPlan::testMultipleGases()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -797,8 +788,7 @@ void TestPlan::testVpmbMetricMultiLevelAir()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -827,8 +817,7 @@ void TestPlan::testVpmbMetric100m10min()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -874,8 +863,7 @@ void TestPlan::testVpmbMetricRepeat()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -895,8 +883,7 @@ void TestPlan::testVpmbMetricRepeat()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -933,8 +920,7 @@ void TestPlan::testVpmbMetricRepeat()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, 1, 0);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
@ -972,8 +958,7 @@ void TestPlan::testCcrBailoutGasSelection()
|
|||
plan(&test_deco_state, &testPlan, &dive, 0, 60, stoptable, cache, true, false);
|
||||
|
||||
#if DEBUG
|
||||
free(dive.notes);
|
||||
dive.notes = NULL;
|
||||
dive.notes.clear();
|
||||
save_dive(stdout, &dive, false);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue