diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2013-12-09 19:23:31 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-12-09 18:40:02 +0100 |
commit | 8f29df6e5aa555f28d88fb54da127a835a8629de (patch) | |
tree | 1de2e9386e13aa4edeb43f7cca62fb0e4b139e53 | |
parent | 8ac58181f75e494a242126751646285d4db672bc (diff) | |
download | subsurface-8f29df6e5aa555f28d88fb54da127a835a8629de.tar.gz |
Divelogs.de: use qDebug() instead of fprintf()
Use qDebug() instead of fprintf(stderr, ...) in
prepare_dives_for_divelogs().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/subsurfacewebservices.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index a336a4864..abd5f6fc4 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -112,6 +112,7 @@ static char *prepare_dives_for_divelogs(const bool selected) struct zip_source *s[dive_table.nr]; struct zip *zip; char *error = NULL; + const QString errPrefix("divelog.de-upload:"); /* generate a random filename and create/open that file with zip_open */ QString tempfileQ = QDir::tempPath() + "/import-" + QString::number(qrand() % 99999999) + ".dld"; @@ -119,11 +120,11 @@ static char *prepare_dives_for_divelogs(const bool selected) zip = zip_open(tempfile, ZIP_CREATE, NULL); if (!zip) { - fprintf(stderr, "divelog.de-upload: cannot open file as zip\n"); + qDebug() << errPrefix << "cannot open file as zip"; return NULL; } if (!amount_selected) { - fprintf(stderr, "divelog.de-upload: no dives selected\n"); + qDebug() << errPrefix << "no dives selected"; return NULL; } @@ -136,7 +137,7 @@ static char *prepare_dives_for_divelogs(const bool selected) continue; f = tmpfile(); if (!f) { - fprintf(stderr, "divelog.de-upload: cannot create temp file\n"); + qDebug() << errPrefix << "cannot create temp file"; return NULL; } save_dive(f, dive); @@ -145,7 +146,7 @@ static char *prepare_dives_for_divelogs(const bool selected) rewind(f); membuf = (char *)malloc(streamsize + 1); if (!membuf || !fread(membuf, streamsize, 1, f)) { - fprintf(stderr, "divelog.de-upload: memory error\n"); + qDebug() << errPrefix << "memory error"; return NULL; } membuf[streamsize] = 0; @@ -157,14 +158,14 @@ static char *prepare_dives_for_divelogs(const bool selected) */ doc = xmlReadMemory(membuf, strlen(membuf), "divelog", NULL, 0); if (!doc) { - fprintf(stderr, "divelog.de-upload: xml error\n"); - continue; + qDebug() << errPrefix << "xml error"; + return NULL; } free((void *)membuf); // this call is overriding our local variable tempfile! not a good sign! xslt = get_stylesheet("divelogs-export.xslt"); if (!xslt) { - fprintf(stderr, "divelog.de-upload: missing stylesheet\n"); + qDebug() << errPrefix << "missing stylesheet"; return NULL; } transformed = xsltApplyStylesheet(xslt, doc, NULL); @@ -180,7 +181,7 @@ static char *prepare_dives_for_divelogs(const bool selected) if (s[i]) { int64_t ret = zip_add(zip, filename, s[i]); if (ret == -1) - fprintf(stderr, "divelog.de-upload: failed to include dive %d\n", i); + qDebug() << errPrefix << "failed to include dive:" << i; } } zip_close(zip); |