diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp index e92749a126..5d96128442 100644 --- a/qmake/generators/xmloutput.cpp +++ b/qmake/generators/xmloutput.cpp @@ -113,7 +113,8 @@ QString XmlOutput::doConversion(const QString &text) // this is a way to escape characters that shouldn't be converted for (int i=0; i')) { + output += QLatin1String(">"); } else { - QChar c = text.at(i); if (c.unicode() < 0x20) { output += QString("&#x%1;").arg(c.unicode(), 2, 16, QLatin1Char('0')); } else { - output += text.at(i); + output += c; } } } diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index c0db2c3db6..30a44aeef8 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -88,6 +88,11 @@ # include #endif +#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE() +# include +# include +#endif + #ifdef Q_OS_UNIX #include #include @@ -2960,20 +2965,19 @@ enum { */ QByteArray QSysInfo::machineUniqueId() { -#ifdef Q_OS_BSD4 +#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE() + char uuid[UuidStringLen + 1]; + io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +#elif defined(Q_OS_BSD4) && defined(KERN_HOSTUUID) char uuid[UuidStringLen + 1]; size_t uuidlen = sizeof(uuid); -# ifdef KERN_HOSTUUID int name[] = { CTL_KERN, KERN_HOSTUUID }; if (sysctl(name, sizeof name / sizeof name[0], &uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) return QByteArray(uuid, uuidlen - 1); - -# else - // Darwin: no fixed value, we need to search by name - if (sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) - return QByteArray(uuid, uuidlen - 1); -# endif #elif defined(Q_OS_UNIX) // The modern name on Linux is /etc/machine-id, but that path is // unlikely to exist on non-Linux (non-systemd) systems. The old diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index d19e54154e..c0a5369cdd 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -322,8 +322,10 @@ QLibraryInfo::buildDate() #elif defined(Q_CC_MSVC) # if _MSC_VER < 1910 # define COMPILER_STRING "MSVC 2015" -# elif _MSC_VER < 2000 +# elif _MSC_VER < 1917 # define COMPILER_STRING "MSVC 2017" +# elif _MSC_VER < 2000 +# define COMPILER_STRING "MSVC 2019" # else # define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER) # endif diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index 7029cd5455..af48cdacc7 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -40,6 +40,7 @@ #include "qopenglprogrambinarycache_p.h" #include #include +#include #include #include #include @@ -102,7 +103,7 @@ static inline bool qt_ensureWritableDir(const QString &name) QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache() : m_cacheWritable(false) { - const QString subPath = QLatin1String("/qtshadercache/"); + const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + QLatin1Char('/'); const QString sharedCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation); if (!sharedCachePath.isEmpty()) { m_cacheDir = sharedCachePath + subPath; diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index f107b6eb20..3207f1944b 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -209,7 +209,7 @@ public: QStroker(); ~QStroker(); - void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = qt_real_to_fixed(width > 4 ? 1.0/width : 0.25); } + void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = qt_real_to_fixed(qBound(0.025, 1.0/width, 0.25)); } qfixed strokeWidth() const { return m_strokeWidth; } void setCapStyle(Qt::PenCapStyle capStyle) { m_capStyle = joinModeForCap(capStyle); } diff --git a/src/network/access/http2/http2protocol_p.h b/src/network/access/http2/http2protocol_p.h index f7a89859d3..7142d6f1fa 100644 --- a/src/network/access/http2/http2protocol_p.h +++ b/src/network/access/http2/http2protocol_p.h @@ -168,8 +168,10 @@ struct Q_AUTOTEST_EXPORT ProtocolParameters bool indexStrings = true; // This parameter is not negotiated via SETTINGS frames, so we have it - // as a member and will convey it to our peer as a WINDOW_UPDATE frame: - qint32 maxSessionReceiveWindowSize = Http2::maxSessionReceiveWindowSize; + // as a member and will convey it to our peer as a WINDOW_UPDATE frame. + // Note, some servers do not accept our WINDOW_UPDATE from the default + // 64 KB to the possible maximum. Let's use a half of it: + qint32 maxSessionReceiveWindowSize = Http2::maxSessionReceiveWindowSize / 2; // This is our default SETTINGS frame: // diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp index 6458454336..5f16d00dad 100644 --- a/src/platformsupport/glxconvenience/qglxconvenience.cpp +++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp @@ -261,9 +261,11 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format qCDebug(lcGlx) << "qglx_findConfig: Found non-matching but compatible FBConfig"; return compatibleCandidate; } - qCWarning(lcGlx, "qglx_findConfig: Failed to finding matching FBConfig (%d %d %d %d)", requestedRed, requestedGreen, requestedBlue, requestedAlpha); } while (qglx_reduceFormat(&format)); + if (!config) + qCWarning(lcGlx) << "qglx_findConfig: Failed to finding matching FBConfig for" << format; + return config; } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index e95eaef420..1063432dcc 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -876,10 +876,6 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current() result.options |= QSurfaceFormat::DeprecatedFunctions; if (value & GL_CONTEXT_FLAG_DEBUG_BIT) result.options |= QSurfaceFormat::DebugContext; - value = 0; - QOpenGLStaticContext::opengl32.glGetIntegerv(RESET_NOTIFICATION_STRATEGY_ARB, &value); - if (value == LOSE_CONTEXT_ON_RESET_ARB) - result.options |= QSurfaceFormat::ResetNotification; if (result.version < 0x0302) return result; // v3.2 onwards: Profiles @@ -889,6 +885,13 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current() result.profile = QSurfaceFormat::CoreProfile; else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) result.profile = QSurfaceFormat::CompatibilityProfile; + if (result.version < 0x0400) + return result; + // v4.0 onwards + value = 0; + QOpenGLStaticContext::opengl32.glGetIntegerv(RESET_NOTIFICATION_STRATEGY_ARB, &value); + if (value == LOSE_CONTEXT_ON_RESET_ARB) + result.options |= QSurfaceFormat::ResetNotification; return result; } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index f26f698e76..5e5fefca90 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -163,10 +163,12 @@ static void updateFormatFromContext(QSurfaceFormat &format) format.setOption(QSurfaceFormat::StereoBuffers); if (format.renderableType() == QSurfaceFormat::OpenGL) { - GLint value = 0; - glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &value); - if (value == GL_LOSE_CONTEXT_ON_RESET_ARB) - format.setOption(QSurfaceFormat::ResetNotification); + if (format.version() >= qMakePair(4, 0)) { + GLint value = 0; + glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &value); + if (value == GL_LOSE_CONTEXT_ON_RESET_ARB) + format.setOption(QSurfaceFormat::ResetNotification); + } if (format.version() < qMakePair(3, 0)) { format.setOption(QSurfaceFormat::DeprecatedFunctions); @@ -175,7 +177,7 @@ static void updateFormatFromContext(QSurfaceFormat &format) // Version 3.0 onwards - check if it includes deprecated functionality or is // a debug context - value = 0; + GLint value = 0; glGetIntegerv(GL_CONTEXT_FLAGS, &value); if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) format.setOption(QSurfaceFormat::DeprecatedFunctions); diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 5d566b835e..19a7975750 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -153,7 +153,7 @@ do {\ #define QTRY_IMPL(expr, timeout)\ const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \ const int qt_test_timeoutValue = timeout; \ - QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \ + { QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); } \ QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\ // Will try to wait for the expression to become true while allowing event processing diff --git a/tests/auto/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp index 0a7ba3b40b..e769f955c4 100644 --- a/tests/auto/tools/qmake/testcompiler.cpp +++ b/tests/auto/tools/qmake/testcompiler.cpp @@ -279,6 +279,13 @@ bool TestCompiler::qmake(const QString &workDir, const QString &proName, const Q << additionalArguments); } +bool TestCompiler::qmake(const QString &workDir, const QStringList &arguments) +{ + QDir d; + d.setCurrent(workDir); // ### runCommand should take a workingDir argument instead + return runCommand(qmakeCmd_, arguments); +} + bool TestCompiler::make( const QString &workPath, const QString &target, bool expectFail ) { QDir D; diff --git a/tests/auto/tools/qmake/testcompiler.h b/tests/auto/tools/qmake/testcompiler.h index 50232669c0..e22a2c6c3d 100644 --- a/tests/auto/tools/qmake/testcompiler.h +++ b/tests/auto/tools/qmake/testcompiler.h @@ -60,6 +60,8 @@ public: // executes a qmake on proName in the specified workDir, output goes to buildDir or workDir if it's null bool qmake(const QString &workDir, const QString &proName, const QString &buildDir = QString(), const QStringList &additionalArguments = QStringList()); + // executes qmake in workDir with the specified arguments + bool qmake(const QString &workDir, const QStringList &arguments); // executes a make in the specified workPath, with an optional target (eg. install) bool make( const QString &workPath, const QString &target = QString(), bool expectFail = false ); // checks if the executable exists in destDir diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index cacee30c86..8ca367773d 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -81,6 +81,7 @@ private slots: void substitutes(); void project(); void proFileCache(); + void qinstall(); void resources(); private: @@ -588,6 +589,104 @@ void tst_qmake::proFileCache() QVERIFY( test_compiler.qmake( workDir, "pro_file_cache" )); } +void tst_qmake::qinstall() +{ + const QString testName = "qinstall"; + QDir testDataDir = base_path + "/testdata"; + if (testDataDir.exists(testName)) + testDataDir.rmdir(testName); + QVERIFY(testDataDir.mkdir(testName)); + const QString workDir = testDataDir.filePath(testName); + auto qinstall = [&](const QString &src, const QString &dst, bool executable = false) { + QStringList args = {"-install", "qinstall"}; + if (executable) + args << "-exe"; + args << src << dst; + return test_compiler.qmake(workDir, args); + }; + const QFileDevice::Permissions readFlags + = QFileDevice::ReadOwner | QFileDevice::ReadUser + | QFileDevice::ReadGroup | QFileDevice::ReadOther; + const QFileDevice::Permissions writeFlags + = QFileDevice::WriteOwner | QFileDevice::WriteUser + | QFileDevice::WriteGroup | QFileDevice::WriteOther; + const QFileDevice::Permissions exeFlags + = QFileDevice::ExeOwner | QFileDevice::ExeUser + | QFileDevice::ExeGroup | QFileDevice::ExeOther; + + // install a regular file + { + QFileInfo src(testDataDir.filePath("project/main.cpp")); + QFileInfo dst("foo.cpp"); + QVERIFY(qinstall(src.filePath(), dst.filePath())); + QVERIFY(dst.exists()); + QCOMPARE(src.size(), dst.size()); + QVERIFY(dst.permissions() & readFlags); + QVERIFY(dst.permissions() & writeFlags); + QVERIFY(!(dst.permissions() & exeFlags)); + test_compiler.clearCommandOutput(); + } + + // install an executable file + { + const QString mocFilePath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + + "/moc" +#ifdef Q_OS_WIN + + ".exe" +#endif + ; + QFileInfo src(mocFilePath); + QVERIFY(src.exists()); + QVERIFY(src.permissions() & exeFlags); + QFileInfo dst("copied_" + src.fileName()); + QVERIFY(qinstall(src.filePath(), dst.filePath(), true)); + QVERIFY(dst.exists()); + QCOMPARE(src.size(), dst.size()); + QVERIFY(dst.permissions() & readFlags); + QVERIFY(dst.permissions() & writeFlags); + QVERIFY(dst.permissions() & exeFlags); + test_compiler.clearCommandOutput(); + } + + // install a read-only file + { + QFile srcfile("foo.cpp"); + QVERIFY(srcfile.setPermissions(srcfile.permissions() & ~writeFlags)); + QFileInfo src(srcfile); + QFileInfo dst("bar.cpp"); + QVERIFY(qinstall(src.filePath(), dst.filePath())); + QVERIFY(dst.exists()); + QCOMPARE(src.size(), dst.size()); + QVERIFY(dst.permissions() & readFlags); + QVERIFY(dst.permissions() & writeFlags); + QVERIFY(!(dst.permissions() & exeFlags)); + test_compiler.clearCommandOutput(); + } + + // install a directory + { + QDir src = testDataDir; + src.cd("project"); + QDir dst("narf"); + QVERIFY(qinstall(src.absolutePath(), dst.absolutePath())); + QCOMPARE(src.entryList(QDir::Files, QDir::Name), dst.entryList(QDir::Files, QDir::Name)); + test_compiler.clearCommandOutput(); + } + + // install a directory with a read-only file + { + QDir src("narf"); + QFile srcfile(src.filePath("main.cpp")); + QVERIFY(srcfile.setPermissions(srcfile.permissions() & ~writeFlags)); + QDir dst("zort"); +#ifdef Q_OS_WIN + QEXPECT_FAIL("", "QTBUG-77299", Abort); +#endif + QVERIFY(qinstall(src.absolutePath(), dst.absolutePath())); + QCOMPARE(src.entryList(QDir::Files, QDir::Name), dst.entryList(QDir::Files, QDir::Name)); + } +} + void tst_qmake::resources() { QString workDir = base_path + "/testdata/resources";