core: enable compiler warngings for report_error and report_info

printf() is a horrible interface as it does no type checking.
Let's at least use the compiler to check format strings and
arguments. This obviously doesn't work for translated strings
and using report_error on translated strings is dubious. But OK.

Had to convert a number of report_error() calls to supress
warnings.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-12 09:17:50 +01:00 committed by Dirk Hohndel
parent fcf0bda042
commit bfbf4934dd
13 changed files with 39 additions and 33 deletions

View file

@ -688,7 +688,7 @@ int datatrak_import(std::string &mem, std::string &wl_mem, struct divelog *log)
// Verify fileheader, get number of dives in datatrak divelog, zero on error
numdives = read_file_header((unsigned char *)mem.data());
if (!numdives) {
report_error(translate("gettextFromC", "[Error] File is not a DataTrak file. Aborted"));
report_error("%s", translate("gettextFromC", "[Error] File is not a DataTrak file. Aborted"));
goto bail;
}
// Verify WLog .add file, Beginning sequence and Nº dives
@ -711,7 +711,7 @@ int datatrak_import(std::string &mem, std::string &wl_mem, struct divelog *log)
if (!wl_mem.empty())
wlog_compl_parser(wl_mem, ptdive, i);
if (runner == NULL) {
report_error(translate("gettextFromC", "Error: no dive"));
report_error("%s", translate("gettextFromC", "Error: no dive"));
free(ptdive);
rc = 1;
goto out;