diff options
author | Andy Shaw <andy.shaw@digia.com> | 2014-07-22 15:59:45 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@digia.com> | 2014-08-07 10:07:41 +0200 |
commit | 51ff0449344cfb110f316288f44d6300340787dd (patch) | |
tree | 6d8dd1b8b51e93907d864e75dbb359d95cb09f8b | |
parent | 8306dee38f4e315399a465b028819b0777746c55 (diff) |
Check if Start/EndPage returns non-positive value when error checking
StartPage and EndPage are documented to return a non-positive value (0 or
less) when they fail, therefore it is not enough to check if !StartPage.
Checking if is 0 or less is more accurate.
Change-Id: Ia0ff43da4e4309ba0a5983e91a0ad583aad0a955
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r-- | src/printsupport/kernel/qprintengine_win.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index b97dc6d2c2..98a0844baa 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -203,7 +203,7 @@ bool QWin32PrintEngine::newPage() bool transparent = GetBkMode(d->hdc) == TRANSPARENT; - if (!EndPage(d->hdc)) { + if (EndPage(d->hdc) <= 0) { qErrnoWarning("QWin32PrintEngine::newPage: EndPage failed"); return false; } @@ -216,7 +216,7 @@ bool QWin32PrintEngine::newPage() d->reinit = false; } - if (!StartPage(d->hdc)) { + if (StartPage(d->hdc) <= 0) { qErrnoWarning("Win32PrintEngine::newPage: StartPage failed"); return false; } @@ -235,7 +235,7 @@ bool QWin32PrintEngine::newPage() bool success = false; if (d->hdc && d->state == QPrinter::Active) { - if (EndPage(d->hdc) != SP_ERROR) { + if (EndPage(d->hdc) > 0) { // reinitialize the DC before StartPage if needed, // because resetdc is disabled between calls to the StartPage and EndPage functions // (see StartPage documentation in the Platform SDK:Windows GDI) @@ -248,7 +248,7 @@ bool QWin32PrintEngine::newPage() qErrnoWarning("QWin32PrintEngine::newPage(), ResetDC failed (2)"); d->reinit = false; } - success = (StartPage(d->hdc) != SP_ERROR); + success = (StartPage(d->hdc) > 0); } if (!success) { d->state = QPrinter::Aborted; |