mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
planner: use std::move() to store planner notes
Avoids a copy and makes coverity happy (rightfully so). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
aa3a93a466
commit
38fe08e5e1
1 changed files with 3 additions and 7 deletions
|
@ -143,9 +143,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
||||||
buf += format_string_std("<span style='color: red;'>%s </span> %s<br/>",
|
buf += format_string_std("<span style='color: red;'>%s </span> %s<br/>",
|
||||||
translate("gettextFromC", "Warning:"), message);
|
translate("gettextFromC", "Warning:"), message);
|
||||||
|
|
||||||
// TODO: avoid copy
|
dive->notes = std::move(buf);
|
||||||
dive->notes = buf;
|
|
||||||
dive->notes = strdup(buf.c_str());
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -162,8 +160,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
||||||
translate("gettextFromC", "Subsurface"),
|
translate("gettextFromC", "Subsurface"),
|
||||||
subsurface_canonical_version(),
|
subsurface_canonical_version(),
|
||||||
translate("gettextFromC", "dive plan</b> (overlapping dives detected)"));
|
translate("gettextFromC", "dive plan</b> (overlapping dives detected)"));
|
||||||
// TODO: avoid copy
|
dive->notes = std::move(buf);
|
||||||
dive->notes = buf;
|
|
||||||
return;
|
return;
|
||||||
} else if (diveplan->surface_interval >= 48 * 60 *60) {
|
} else if (diveplan->surface_interval >= 48 * 60 *60) {
|
||||||
buf += format_string_std("%s (%s) %s %s",
|
buf += format_string_std("%s (%s) %s %s",
|
||||||
|
@ -630,8 +627,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
||||||
if (o2warning_exist)
|
if (o2warning_exist)
|
||||||
buf += "</div>\n";
|
buf += "</div>\n";
|
||||||
}
|
}
|
||||||
// TODO: avoid copy
|
dive->notes = std::move(buf);
|
||||||
dive->notes = buf;
|
|
||||||
#ifdef DEBUG_PLANNER_NOTES
|
#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);
|
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
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue