summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rick Walsh <rickmwalsh@gmail.com>2015-07-23 23:36:11 +1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-23 08:12:29 -0700
commit361ddd96344ece56e8d2059375b45b13c0532c86 (patch)
tree890b2b985715109878cfa2700e871f4be2c93b1f
parentaa4ed491fdac62d011fc66d39c364b104a95b6e3 (diff)
downloadsubsurface-361ddd96344ece56e8d2059375b45b13c0532c86.tar.gz
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>
-rw-r--r--planner.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/planner.c b/planner.c
index e5685a499..9fe5c1d05 100644
--- a/planner.c
+++ b/planner.c
@@ -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);