From a5f470240f31d35e694a40fe837fc4f49bc32072 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 28 Sep 2015 16:41:34 +0200 Subject: qprintengine_win.cpp: Check access to members of DOCINFO in warning. DOCINFO::lpszOutput can be 0. Task-number: QTBUG-48203 Change-Id: Ia3940b5b3200143d8d50caa8f4f44c4b22bfff75 Reviewed-by: Andy Shaw --- src/printsupport/kernel/qprintengine_win.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/printsupport/kernel/qprintengine_win.cpp') diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index b377401ed9..a4209d833a 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -93,9 +93,10 @@ static QByteArray msgBeginFailed(const char *function, const DOCINFO &d) { QString result; QTextStream str(&result); - str << "QWin32PrintEngine::begin: " << function << " failed, document \"" - << QString::fromWCharArray(d.lpszDocName) << '"'; - if (d.lpszOutput[0]) + str << "QWin32PrintEngine::begin: " << function << " failed"; + if (d.lpszDocName && d.lpszDocName[0]) + str << ", document \"" << QString::fromWCharArray(d.lpszDocName) << '"'; + if (d.lpszOutput && d.lpszOutput[0]) str << ", file \"" << QString::fromWCharArray(d.lpszOutput) << '"'; return result.toLocal8Bit(); } -- cgit v1.2.3 From bba86a01c9828d03b1564984a08561d62686d329 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 13 Oct 2015 09:26:59 +0200 Subject: Libraries: Fix single-character string literals. Use character literals where applicable. Change-Id: I8e198774c2247c1cc1d852a41b59b301199b7878 Reviewed-by: Marc Mutz --- src/printsupport/kernel/qprintengine_win.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/printsupport/kernel/qprintengine_win.cpp') diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index a4209d833a..c8ce2e482d 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1150,7 +1150,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->updateMetrics(); d->doReinit(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_Orientation," << orientation << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_Orientation," << orientation << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS break; @@ -1173,7 +1173,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->setPageSize(pageSize); d->doReinit(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_PageSize," << value.toInt() << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_PageSize," << value.toInt() << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS } @@ -1189,7 +1189,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->setPageSize(pageSize); d->doReinit(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_PaperName," << value.toString() << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_PaperName," << value.toString() << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS } @@ -1228,7 +1228,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->stretch_y = d->dpi_y / double(d->resolution); d->updateMetrics(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_Resolution," << value.toInt() << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_Resolution," << value.toInt() << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS break; @@ -1242,7 +1242,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->setPageSize(pageSize); d->doReinit(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_WindowsPageSize," << value.toInt() << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_WindowsPageSize," << value.toInt() << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS break; @@ -1258,7 +1258,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->setPageSize(pageSize); d->doReinit(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_CustomPaperSize," << value.toSizeF() << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_CustomPaperSize," << value.toSizeF() << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS } @@ -1273,7 +1273,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & margins.at(2).toReal(), margins.at(3).toReal())); d->updateMetrics(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_PageMargins," << margins << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_PageMargins," << margins << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS break; @@ -1288,7 +1288,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->setPageSize(pageSize); d->doReinit(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageSize," << pageSize << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageSize," << pageSize << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS } @@ -1301,7 +1301,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->m_pageLayout.setMargins(pair.first); d->updateMetrics(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageMargins," << pair.first << pair.second << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageMargins," << pair.first << pair.second << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS break; @@ -1317,7 +1317,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->m_pageLayout.setMargins(pageLayout.margins()); d->updateMetrics(); #ifdef QT_DEBUG_METRICS - qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageLayout," << pageLayout << ")"; + qDebug() << "QWin32PrintEngine::setProperty(PPK_QPageLayout," << pageLayout << ')'; d->debugMetrics(); #endif // QT_DEBUG_METRICS } -- cgit v1.2.3