Fix logging with dynamic GL on Windows

category() returns a const QLoggingCategory so our code does not
compile anymore. Do it differently.

Fix also the Windows error string formatting a bit.

Change-Id: Ie0b6b02947d94b7ccf4a4a57da487dfa8a15709d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
bb10
Laszlo Agocs 2014-02-14 15:39:54 +01:00 committed by The Qt Project
parent 71de22b03f
commit 25e7fe1650
1 changed files with 3 additions and 4 deletions

View File

@ -654,7 +654,7 @@ static QString qgl_windowsErrorMessage(unsigned long errorCode)
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorCode, 0, (LPTSTR)&lpMsgBuf, 0, NULL);
if (len) {
rc = QString::fromUtf16(lpMsgBuf, len);
rc += QString::fromUtf16(lpMsgBuf, len);
LocalFree(lpMsgBuf);
} else {
rc += QString::fromLatin1("<unknown error>");
@ -671,7 +671,7 @@ static HMODULE qgl_loadLib(const char *name, bool warnOnFail = true)
if (warnOnFail) {
QString msg = qgl_windowsErrorMessage(GetLastError());
qCWarning(qglLc, "Failed to load %s (%s)", name, qPrintable(msg));
qCWarning(qglLc, "Failed to load %s: %s", name, qPrintable(msg));
}
return 0;
@ -680,9 +680,8 @@ static HMODULE qgl_loadLib(const char *name, bool warnOnFail = true)
QWindowsOpenGL::QWindowsOpenGL()
: m_eglLib(0)
{
qglLc().setEnabled(QtWarningMsg, true);
if (qEnvironmentVariableIsSet("QT_OPENGLPROXY_DEBUG"))
qglLc().setEnabled(QtDebugMsg, true);
QLoggingCategory::setFilterRules(QStringLiteral("qt.gui.openglproxy=true"));
enum RequestedLib {
Unknown,