Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"

This commit is contained in:
Qt Forward Merge Bot 2019-08-15 01:00:30 +02:00
commit 66a1975200
13 changed files with 155 additions and 27 deletions

View File

@ -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<text.count(); ++i) {
if (text.at(i) == QLatin1Char('&')) {
const QChar c = text.at(i);
if (c == QLatin1Char('&')) {
if ( (i + 7) < text.count() &&
text.at(i + 1) == QLatin1Char('#') &&
text.at(i + 2) == QLatin1Char('x') &&
@ -122,12 +123,15 @@ QString XmlOutput::doConversion(const QString &text)
} else {
output += QLatin1String("&amp;");
}
} else if (c == QLatin1Char('<')) {
output += QLatin1String("&lt;");
} else if (c == QLatin1Char('>')) {
output += QLatin1String("&gt;");
} 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;
}
}
}

View File

@ -88,6 +88,11 @@
# include <sys/systeminfo.h>
#endif
#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE(<IOKit/IOKitLib.h>)
# include <IOKit/IOKitLib.h>
# include <private/qcore_mac_p.h>
#endif
#ifdef Q_OS_UNIX
#include <sys/utsname.h>
#include <private/qcore_unix_p.h>
@ -2960,20 +2965,19 @@ enum {
*/
QByteArray QSysInfo::machineUniqueId()
{
#ifdef Q_OS_BSD4
#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE(<IOKit/IOKitLib.h>)
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

View File

@ -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

View File

@ -40,6 +40,7 @@
#include "qopenglprogrambinarycache_p.h"
#include <QOpenGLContext>
#include <QOpenGLExtraFunctions>
#include <QSysInfo>
#include <QStandardPaths>
#include <QDir>
#include <QSaveFile>
@ -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;

View File

@ -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); }

View File

@ -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:
//

View File

@ -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;
}

View File

@ -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;
}

View File

@ -163,10 +163,12 @@ static void updateFormatFromContext(QSurfaceFormat &format)
format.setOption(QSurfaceFormat::StereoBuffers);
if (format.renderableType() == QSurfaceFormat::OpenGL) {
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);

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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";