mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Planner: correct output of planner mode
Previously we used strncat to output VPM mode without correctly defining the length of the string, and didn't do anything for recreational mode. This resulted in the output being junk recycled from the previous temp string. We could use strncat if the string length were defined, but using snprintf will make it simpler to include the VPM conservatism when that has been implemented. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
aa4ed491fd
commit
361ddd9634
1 changed files with 4 additions and 1 deletions
|
@ -542,7 +542,10 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
|||
snprintf(temp, sizeof(temp), translate("gettextFromC", "based on Buhlmann ZHL-16B with GFlow = %d and GFhigh = %d"),
|
||||
diveplan->gflow, diveplan->gfhigh);
|
||||
} else if (prefs.deco_mode == VPMB){
|
||||
strncat(temp, translate("gettextFromC", "based on VPM-B"), sizeof(temp) - 1);
|
||||
snprintf(temp, sizeof(temp), translate("gettextFromC", "based on VPM-B"));
|
||||
} else if (prefs.deco_mode == RECREATIONAL){
|
||||
snprintf(temp, sizeof(temp), translate("gettextFromC", "recreational mode based on Buhlmann ZHL-16B with GFlow = %d and GFhigh = %d"),
|
||||
diveplan->gflow, diveplan->gfhigh);
|
||||
}
|
||||
len += snprintf(buffer + len, sizeof(buffer) - len, "<div><b>%s</b><br>%s</div><br>",
|
||||
translate("gettextFromC", "Subsurface dive plan"), temp);
|
||||
|
|
Loading…
Add table
Reference in a new issue