mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:03:23 +00:00
Get rid of compiler warning on format strings
This gets rid of compiler warnings "format not a string literal and no format arguments [-Wformat-security]". E.g. when building distribution packages these warnings are often treated as errors preventing the build (with good reason). Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
8873381496
commit
bdedf46e4c
3 changed files with 7 additions and 7 deletions
|
@ -1891,7 +1891,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
|
|||
snprintf(get_events, sizeof(get_events) - 1, get_events_template, cur_dive->number);
|
||||
retval = sqlite3_exec(handle, get_events, &dm4_events, 0, &err);
|
||||
if (retval != SQLITE_OK) {
|
||||
fprintf(stderr, translate("gettextFromC","Database query get_events failed.\n"));
|
||||
fprintf(stderr, "%s", translate("gettextFromC","Database query get_events failed.\n"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ static int get_gasidx(struct dive *dive, int o2, int he)
|
|||
void get_gas_string(int o2, int he, char *text, int len)
|
||||
{
|
||||
if (is_air(o2, he))
|
||||
snprintf(text, len, translate("gettextFromC","air"));
|
||||
snprintf(text, len, "%s", translate("gettextFromC","air"));
|
||||
else if (he == 0)
|
||||
snprintf(text, len, translate("gettextFromC","EAN%d"), (o2 + 5) / 10);
|
||||
else
|
||||
|
|
10
statistics.c
10
statistics.c
|
@ -215,14 +215,14 @@ static void get_ranges(char *buffer, int size)
|
|||
int i, len;
|
||||
int first, last = -1;
|
||||
|
||||
snprintf(buffer, size, translate("gettextFromC","for dives #"));
|
||||
snprintf(buffer, size, "%s", translate("gettextFromC","for dives #"));
|
||||
for (i = 0; i < dive_table.nr; i++) {
|
||||
struct dive *dive = get_dive(i);
|
||||
if (! dive->selected)
|
||||
continue;
|
||||
if (dive->number < 1) {
|
||||
/* uhh - weird numbers - bail */
|
||||
snprintf(buffer, size, translate("gettextFromC","for selected dives"));
|
||||
snprintf(buffer, size, "%s", translate("gettextFromC","for selected dives"));
|
||||
return;
|
||||
}
|
||||
len = strlen(buffer);
|
||||
|
@ -259,11 +259,11 @@ void get_selected_dives_text(char *buffer, int size)
|
|||
if (current_dive)
|
||||
snprintf(buffer, size, translate("gettextFromC","for dive #%d"), current_dive->number);
|
||||
else
|
||||
snprintf(buffer, size, translate("gettextFromC","for selected dive"));
|
||||
snprintf(buffer, size, "%s", translate("gettextFromC","for selected dive"));
|
||||
} else if (amount_selected == dive_table.nr) {
|
||||
snprintf(buffer, size, translate("gettextFromC","for all dives"));
|
||||
snprintf(buffer, size, "%s", translate("gettextFromC","for all dives"));
|
||||
} else if (amount_selected == 0) {
|
||||
snprintf(buffer, size, translate("gettextFromC","(no dives)"));
|
||||
snprintf(buffer, size, "%s", translate("gettextFromC","(no dives)"));
|
||||
} else {
|
||||
get_ranges(buffer, size);
|
||||
if (strlen(buffer) == size -1) {
|
||||
|
|
Loading…
Add table
Reference in a new issue