mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
fcf0bda042
commit
bfbf4934dd
13 changed files with 39 additions and 33 deletions
|
|
@ -73,7 +73,7 @@ bool uploadDiveLogsDE::prepareDives(const QString &tempfile, bool selected)
|
|||
xslt = get_stylesheet("divelogs-export.xslt");
|
||||
if (!xslt) {
|
||||
qDebug() << errPrefix << "missing stylesheet";
|
||||
report_error(tr("Stylesheet to export to divelogs.de is not found").toUtf8());
|
||||
report_error("%s", qPrintable(tr("Stylesheet to export to divelogs.de is not found")));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ bool uploadDiveLogsDE::prepareDives(const QString &tempfile, bool selected)
|
|||
if (!zip) {
|
||||
char buffer[1024];
|
||||
zip_error_to_str(buffer, sizeof buffer, error_code, errno);
|
||||
report_error(tr("Failed to create zip file for upload: %s").toUtf8(), buffer);
|
||||
report_error(qPrintable(tr("Failed to create zip file for upload: %s")), buffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ bool uploadDiveLogsDE::prepareDives(const QString &tempfile, bool selected)
|
|||
xmlDoc *doc = xmlReadMemory(mb.buffer, mb.len, "divelog", NULL, XML_PARSE_HUGE | XML_PARSE_RECOVER);
|
||||
if (!doc) {
|
||||
qWarning() << errPrefix << "could not parse back into memory the XML file we've just created!";
|
||||
report_error(tr("internal error").toUtf8());
|
||||
report_error("%s", qPrintable(tr("internal error")));
|
||||
zip_close(zip);
|
||||
QFile::remove(tempfile);
|
||||
xsltFreeStylesheet(xslt);
|
||||
|
|
@ -157,7 +157,7 @@ bool uploadDiveLogsDE::prepareDives(const QString &tempfile, bool selected)
|
|||
free_xml_params(params);
|
||||
if (!transformed) {
|
||||
qWarning() << errPrefix << "XSLT transform failed for dive: " << i;
|
||||
report_error(tr("Conversion of dive %1 to divelogs.de format failed").arg(i).toUtf8());
|
||||
report_error("%s", qPrintable(tr("Conversion of dive %1 to divelogs.de format failed").arg(i)));
|
||||
continue;
|
||||
}
|
||||
xmlDocDumpMemory(transformed, (xmlChar **)&membuf, &streamsize);
|
||||
|
|
@ -310,7 +310,7 @@ void uploadDiveLogsDE::uploadFinishedSlot()
|
|||
if (parsed) {
|
||||
if (strstr(resp, "<Login>succeeded</Login>")) {
|
||||
if (strstr(resp, "<FileCopy>failed</FileCopy>")) {
|
||||
report_error(tr("Upload failed").toUtf8());
|
||||
report_error("%s", qPrintable(tr("Upload failed")));
|
||||
return;
|
||||
}
|
||||
timeout.stop();
|
||||
|
|
@ -320,13 +320,13 @@ void uploadDiveLogsDE::uploadFinishedSlot()
|
|||
}
|
||||
timeout.stop();
|
||||
err = tr("Login failed");
|
||||
report_error(err.toUtf8());
|
||||
report_error("%s", qPrintable(err));
|
||||
emit uploadFinish(false, err);
|
||||
return;
|
||||
}
|
||||
timeout.stop();
|
||||
err = tr("Cannot parse response");
|
||||
report_error(tr("Cannot parse response").toUtf8());
|
||||
report_error("%s", qPrintable(tr("Cannot parse response")));
|
||||
emit uploadFinish(false, err);
|
||||
}
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@ void uploadDiveLogsDE::uploadTimeoutSlot()
|
|||
}
|
||||
cleanupTempFile();
|
||||
QString err(tr("divelogs.de not responding"));
|
||||
report_error(err.toUtf8());
|
||||
report_error("%s", qPrintable(err));
|
||||
emit uploadFinish(false, err);
|
||||
}
|
||||
|
||||
|
|
@ -355,6 +355,6 @@ void uploadDiveLogsDE::uploadErrorSlot(QNetworkReply::NetworkError error)
|
|||
}
|
||||
cleanupTempFile();
|
||||
QString err(tr("network error %1").arg(error));
|
||||
report_error(err.toUtf8());
|
||||
report_error("%s", qPrintable(err));
|
||||
emit uploadFinish(false, err);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue