Have explicit "%s" format strings in printf style statements

Not having a format string that explicitly references the arguments is
considered a potential security issue in code.
This gets rid of a compiler warning that turned into an error on Fedora 21.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-06-10 11:30:18 +02:00 committed by Dirk Hohndel
parent 2b59765da3
commit 2d7b02726e

View file

@ -532,12 +532,12 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
translate("gettextFromC", "%s<br>Subsurface dive plan<br>based on GFlow = %d and GFhigh = %d<br><br>"),
show_disclaimer ? disclaimer : empty, diveplan->gflow, diveplan->gfhigh);
if (!plan_verbatim) {
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "<table cellspacing=5%><thead><tr><th>depth</th>"));
len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", "<table cellspacing=5%><thead><tr><th>depth</th>"));
if (plan_display_runtime)
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " <th>runtime</th>"));
len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", " <th>runtime</th>"));
if (plan_display_duration)
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " <th>duration</th>"));
len += snprintf(buffer + len, sizeof(buffer) - len, " <th align=left>gas</th></tr><tbody align=right>");
len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", " <th>duration</th>"));
len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC"," <th align=left>gas</th></tr><tbody align=right>"));
}
do {
struct gasmix gasmix, newgasmix;
@ -619,7 +619,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
lastdepth = dp->depth;
} while ((dp = nextdp) != NULL);
len = strlen(buffer);
snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "</tbody></table><br>Gas consumption:<br>"));
snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", "</tbody></table><br>Gas consumption:<br>"));
for (gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) {
double volume;
const char *unit;