mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue