1
0
forked from pool/libqt5-qtbase

Accepting request 768104 from KDE:Qt:5.14

Update to 5.14.1

OBS-URL: https://build.opensuse.org/request/show/768104
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=104
This commit is contained in:
Dominique Leuenberger 2020-01-30 08:38:42 +00:00 committed by Git OBS Bridge
commit b668b82e5b
8 changed files with 22 additions and 1090 deletions

View File

@ -1,649 +0,0 @@
From abc2468e46b1f0263f79615cd8d78c559436e3d4 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Wed, 26 Jun 2019 14:18:58 +0200
Subject: [PATCH] Revert "Always escape the table names when creating the SQL
statement"
This reverts commit 461ef575bcf778ba24b0be6b775098d4b80ae5e1.
---
src/plugins/sqldrivers/mysql/qsql_mysql.cpp | 2 +-
src/plugins/sqldrivers/psql/qsql_psql.cpp | 24 +++-
.../doc/snippets/code/doc_src_sql-driver.qdoc | 13 ---
src/sql/doc/src/sql-driver.qdoc | 17 ---
src/sql/kernel/qsqldatabase.cpp | 10 --
src/sql/kernel/qsqldriver.cpp | 16 +--
.../sql/kernel/qsqldatabase/tst_databases.h | 14 +--
.../kernel/qsqldatabase/tst_qsqldatabase.cpp | 110 +++++++-----------
.../sql/kernel/qsqlquery/tst_qsqlquery.cpp | 14 ++-
.../tst_qsqlrelationaltablemodel.cpp | 14 ++-
.../qsqltablemodel/tst_qsqltablemodel.cpp | 10 ++
11 files changed, 106 insertions(+), 138 deletions(-)
Index: qtbase-everywhere-src-5.14.0-beta2/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ qtbase-everywhere-src-5.14.0-beta2/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -1551,7 +1551,7 @@ QSqlIndex QMYSQLDriver::primaryIndex(con
QSqlQuery i(createResult());
QString stmt(QLatin1String("show index from %1;"));
QSqlRecord fil = record(tablename);
- i.exec(stmt.arg(escapeIdentifier(tablename, QSqlDriver::TableName)));
+ i.exec(stmt.arg(tablename));
while (i.isActive() && i.next()) {
if (i.value(2).toString() == QLatin1String("PRIMARY")) {
idx.append(fil.field(i.value(4).toString()));
Index: qtbase-everywhere-src-5.14.0-beta2/src/plugins/sqldrivers/psql/qsql_psql.cpp
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ qtbase-everywhere-src-5.14.0-beta2/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -1402,8 +1402,16 @@ QSqlIndex QPSQLDriver::primaryIndex(cons
QString tbl = tablename;
QString schema;
qSplitTableName(tbl, schema);
- schema = stripDelimiters(schema, QSqlDriver::TableName);
- tbl = stripDelimiters(tbl, QSqlDriver::TableName);
+
+ if (isIdentifierEscaped(tbl, QSqlDriver::TableName))
+ tbl = stripDelimiters(tbl, QSqlDriver::TableName);
+ else
+ tbl = std::move(tbl).toLower();
+
+ if (isIdentifierEscaped(schema, QSqlDriver::TableName))
+ schema = stripDelimiters(schema, QSqlDriver::TableName);
+ else
+ schema = std::move(schema).toLower();
QString stmt = QStringLiteral("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
"pg_class.relname "
@@ -1438,8 +1446,16 @@ QSqlRecord QPSQLDriver::record(const QSt
QString tbl = tablename;
QString schema;
qSplitTableName(tbl, schema);
- schema = stripDelimiters(schema, QSqlDriver::TableName);
- tbl = stripDelimiters(tbl, QSqlDriver::TableName);
+
+ if (isIdentifierEscaped(tbl, QSqlDriver::TableName))
+ tbl = stripDelimiters(tbl, QSqlDriver::TableName);
+ else
+ tbl = std::move(tbl).toLower();
+
+ if (isIdentifierEscaped(schema, QSqlDriver::TableName))
+ schema = stripDelimiters(schema, QSqlDriver::TableName);
+ else
+ schema = std::move(schema).toLower();
const QString adsrc = protocol() < Version8
? QStringLiteral("pg_attrdef.adsrc")
Index: qtbase-everywhere-src-5.14.0-beta2/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
+++ qtbase-everywhere-src-5.14.0-beta2/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
@@ -237,16 +237,3 @@ Could not create database object
//! [38]
QPSQLDriver::getResult: Query results lost - probably discarded on executing another SQL query.
//! [38]
-
-//! [39]
-CREATE TABLE "testTable" ("id" INTEGER);
-//! [39]
-
-//! [40]
-QString tableString("testTable");
-QSqlQuery q;
-// Create table query is not quoted, therefore it is mapped to lower case
-q.exec(QString("CREATE TABLE %1 (id INTEGER)").arg(tableString));
-// Call toLower() on the string so that it can be matched
-QSqlRecord rec = database.record(tableString.toLower());
-//! [40]
Index: qtbase-everywhere-src-5.14.0-beta2/src/sql/doc/src/sql-driver.qdoc
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/src/sql/doc/src/sql-driver.qdoc
+++ qtbase-everywhere-src-5.14.0-beta2/src/sql/doc/src/sql-driver.qdoc
@@ -381,23 +381,6 @@
multibyte enabled PostgreSQL server can be found in the PostgreSQL
Administrator Guide, Chapter 5.
- \section3 QPSQL Case Sensitivity
-
- PostgreSQL databases will only respect case sensitivity if the table or field
- name is quoted when the table is created. So for example, a SQL query such
- as:
-
- \snippet code/doc_src_sql-driver.qdoc 39
-
- will ensure that it can be accessed with the same case that was used. If the
- table or field name is not quoted when created, the actual table name
- or field name will be lower-case. When QSqlDatabase::record() or
- QSqlDatabase::primaryIndex() access a table or field that was unquoted
- when created, the name passed to the function must be lower-case to
- ensure it is found. For example:
-
- \snippet code/doc_src_sql-driver.qdoc 40
-
\section3 QPSQL BLOB Support
Binary Large Objects are supported through the \c BYTEA field type in
Index: qtbase-everywhere-src-5.14.0-beta2/src/sql/kernel/qsqldatabase.cpp
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/src/sql/kernel/qsqldatabase.cpp
+++ qtbase-everywhere-src-5.14.0-beta2/src/sql/kernel/qsqldatabase.cpp
@@ -1096,11 +1096,6 @@ QStringList QSqlDatabase::tables(QSql::T
Returns the primary index for table \a tablename. If no primary
index exists, an empty QSqlIndex is returned.
- \note Some drivers, such as the \l {QPSQL Case Sensitivity}{QPSQL}
- driver, may may require you to pass \a tablename in lower case if
- the table was not quoted when created. See the
- \l{sql-driver.html}{Qt SQL driver} documentation for more information.
-
\sa tables(), record()
*/
@@ -1115,11 +1110,6 @@ QSqlIndex QSqlDatabase::primaryIndex(con
the table (or view) called \a tablename. The order in which the
fields appear in the record is undefined. If no such table (or
view) exists, an empty record is returned.
-
- \note Some drivers, such as the \l {QPSQL Case Sensitivity}{QPSQL}
- driver, may may require you to pass \a tablename in lower case if
- the table was not quoted when created. See the
- \l{sql-driver.html}{Qt SQL driver} documentation for more information.
*/
QSqlRecord QSqlDatabase::record(const QString& tablename) const
Index: qtbase-everywhere-src-5.14.0-beta2/src/sql/kernel/qsqldriver.cpp
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/src/sql/kernel/qsqldriver.cpp
+++ qtbase-everywhere-src-5.14.0-beta2/src/sql/kernel/qsqldriver.cpp
@@ -488,8 +488,6 @@ QString QSqlDriver::stripDelimiters(cons
QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName,
const QSqlRecord &rec, bool preparedStatement) const
{
- const auto tableNameString = tableName.isEmpty() ? QString()
- : prepareIdentifier(tableName, QSqlDriver::TableName, this);
int i;
QString s;
s.reserve(128);
@@ -502,12 +500,13 @@ QString QSqlDriver::sqlStatement(Stateme
if (s.isEmpty())
return s;
s.chop(2);
- s = QLatin1String("SELECT ") + s + QLatin1String(" FROM ") + tableNameString;
+ s.prepend(QLatin1String("SELECT ")).append(QLatin1String(" FROM ")).append(tableName);
break;
case WhereStatement:
{
- const QString tableNamePrefix = tableNameString.isEmpty()
- ? QString() : tableNameString + QLatin1Char('.');
+ const QString tableNamePrefix = tableName.isEmpty()
+ ? QString()
+ : prepareIdentifier(tableName, QSqlDriver::TableName, this) + QLatin1Char('.');
for (int i = 0; i < rec.count(); ++i) {
if (!rec.isGenerated(i))
continue;
@@ -524,7 +523,8 @@ QString QSqlDriver::sqlStatement(Stateme
break;
}
case UpdateStatement:
- s = s + QLatin1String("UPDATE ") + tableNameString + QLatin1String(" SET ");
+ s.append(QLatin1String("UPDATE ")).append(tableName).append(
+ QLatin1String(" SET "));
for (i = 0; i < rec.count(); ++i) {
if (!rec.isGenerated(i))
continue;
@@ -541,10 +541,10 @@ QString QSqlDriver::sqlStatement(Stateme
s.clear();
break;
case DeleteStatement:
- s = s + QLatin1String("DELETE FROM ") + tableNameString;
+ s.append(QLatin1String("DELETE FROM ")).append(tableName);
break;
case InsertStatement: {
- s = s + QLatin1String("INSERT INTO ") + tableNameString + QLatin1String(" (");
+ s.append(QLatin1String("INSERT INTO ")).append(tableName).append(QLatin1String(" ("));
QString vals;
for (i = 0; i < rec.count(); ++i) {
if (!rec.isGenerated(i))
Index: qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
+++ qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
@@ -80,14 +80,14 @@ inline QString fixupTableName(const QStr
return tbName;
}
-inline static QString qTableName(const QString &prefix, const char *sourceFileName,
- QSqlDatabase db, bool escape = true)
+inline static QString qTableName(const QString& prefix, const char *sourceFileName, QSqlDatabase db)
{
- const auto tableStr = fixupTableName(QString(QLatin1String("dbtst") + db.driverName() +
- QString::number(qHash(QLatin1String(sourceFileName) +
- "_" + qGetHostName().replace("-", "_")), 16) +
- "_" + prefix), db);
- return escape ? db.driver()->escapeIdentifier(tableStr, QSqlDriver::TableName) : tableStr;
+ QString tableStr = QLatin1String("dbtst");
+ if (db.driverName().toLower().contains("ODBC"))
+ tableStr += QLatin1String("_odbc");
+ return fixupTableName(QString(QLatin1String("dbtst") + db.driverName() +
+ QString::number(qHash(QLatin1String(sourceFileName) +
+ "_" + qGetHostName().replace( "-", "_" )), 16) + "_" + prefix), db);
}
inline static QString qTableName(const QString& prefix, QSqlDatabase db)
Index: qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
+++ qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
@@ -314,8 +314,10 @@ void tst_QSqlDatabase::createTestTables(
" (id integer not null, t_varchar varchar(40) not null, "
"t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar))"));
}
+
if (testWhiteSpaceNames(db.driverName())) {
- QString qry = "create table " + qTableName("qtest test", __FILE__, db)
+ QString qry = "create table "
+ + db.driver()->escapeIdentifier(tableName + " test", QSqlDriver::TableName)
+ '('
+ db.driver()->escapeIdentifier(QLatin1String("test test"), QSqlDriver::FieldName)
+ " int not null primary key)";
@@ -339,7 +341,6 @@ void tst_QSqlDatabase::dropTestTables(QS
const QString qtestTable = qTableName("qtest", __FILE__, db);
QStringList tableNames;
tableNames << qtestTable
- << qTableName("qtest test", __FILE__, db)
<< qTableName("qtestfields", __FILE__, db)
<< qTableName("qtestalter", __FILE__, db)
<< qTableName("qtest_temp", __FILE__, db)
@@ -512,9 +513,7 @@ void tst_QSqlDatabase::tables()
CHECK_DATABASE(db);
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
- const auto qtest(qTableName("qtest", __FILE__, db, false)),
- qtest_view(qTableName("qtest_view", __FILE__, db, false)),
- temp_tab(qTableName("test_tab", __FILE__, db, false));
+ const QString qtest(qTableName("qtest", __FILE__, db)), qtest_view(qTableName("qtest_view", __FILE__, db)), temp_tab(qTableName("test_tab", __FILE__, db));
bool views = true;
bool tempTables = false;
@@ -579,10 +578,10 @@ void tst_QSqlDatabase::whitespaceInIdent
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (testWhiteSpaceNames(db.driverName())) {
- const auto tableName(qTableName("qtest test", __FILE__, db, false));
+ const QString tableName(qTableName("qtest", __FILE__, db) + " test");
QVERIFY(db.tables().contains(tableName, Qt::CaseInsensitive));
- QSqlRecord rec = db.record(tableName);
+ QSqlRecord rec = db.record(db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName));
QCOMPARE(rec.count(), 1);
QCOMPARE(rec.fieldName(0), QString("test test"));
if (dbType == QSqlDriver::Oracle)
@@ -590,7 +589,7 @@ void tst_QSqlDatabase::whitespaceInIdent
else
QCOMPARE(rec.field(0).type(), QVariant::Int);
- QSqlIndex idx = db.primaryIndex(tableName);
+ QSqlIndex idx = db.primaryIndex(db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName));
QCOMPARE(idx.count(), 1);
QCOMPARE(idx.fieldName(0), QString("test test"));
if (dbType == QSqlDriver::Oracle)
@@ -608,12 +607,11 @@ void tst_QSqlDatabase::alterTable()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
const QString qtestalter(qTableName("qtestalter", __FILE__, db));
- const auto noEscapeAlterTable = qTableName("qtestalter", __FILE__, db, false);
QSqlQuery q(db);
QVERIFY_SQL(q, exec("create table " + qtestalter + " (F1 char(20), F2 char(20), F3 char(20))"));
- QSqlRecord rec = db.record(noEscapeAlterTable);
+ QSqlRecord rec = db.record(qtestalter);
QCOMPARE((int)rec.count(), 3);
int i;
@@ -625,7 +623,7 @@ void tst_QSqlDatabase::alterTable()
QSKIP("DBMS doesn't support dropping columns in ALTER TABLE statement");
}
- rec = db.record(noEscapeAlterTable);
+ rec = db.record(qtestalter);
QCOMPARE((int)rec.count(), 2);
@@ -683,16 +681,13 @@ void tst_QSqlDatabase::testRecord(const
void tst_QSqlDatabase::commonFieldTest(const FieldDef fieldDefs[], QSqlDatabase db, const int fieldCount)
{
CHECK_DATABASE(db);
- const QStringList tableNames = { qTableName("qtestfields", __FILE__, db),
- qTableName("qtestfields", __FILE__, db, false) };
- for (const QString table : tableNames) {
- QSqlRecord rec = db.record(table);
- QCOMPARE(rec.count(), fieldCount + 1);
- testRecord(fieldDefs, rec, db);
- }
+ const QString tableName = qTableName("qtestfields", __FILE__, db);
+ QSqlRecord rec = db.record(tableName);
+ QCOMPARE((int)rec.count(), fieldCount+1);
+ testRecord(fieldDefs, rec, db);
+
QSqlQuery q(db);
- // Only check the escaped entry
- QVERIFY_SQL(q, exec("select * from " + tableNames.at(0)));
+ QVERIFY_SQL(q, exec("select * from " + tableName));
}
void tst_QSqlDatabase::recordTDS()
@@ -851,8 +846,12 @@ void tst_QSqlDatabase::recordPSQL()
QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
if (dbType == QSqlDriver::PostgreSQL)
QVERIFY_SQL( q, exec("set client_min_messages='warning'"));
- q.exec("drop sequence " + qTableName("qtestfields_t_bigserial_seq", __FILE__, db));
- q.exec("drop sequence " + qTableName("qtestfields_t_serial_seq", __FILE__, db));
+ const QString tableName = qTableName("qtestfields", __FILE__, db);
+ q.exec("drop sequence " + tableName + "_t_bigserial_seq");
+ q.exec("drop sequence " + tableName + "_t_serial_seq");
+ // older psql cut off the table name
+ q.exec("drop sequence " + tableName + "_t_bigserial_seq");
+ q.exec("drop sequence " + tableName + "_t_serial_seq");
const int fieldCount = createFieldTable(fieldDefs, db);
QVERIFY(fieldCount > 0);
@@ -1206,40 +1205,27 @@ void tst_QSqlDatabase::caseSensivity()
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
bool cs = false;
- if (dbType == QSqlDriver::MySqlServer || dbType == QSqlDriver::SQLite
- || dbType == QSqlDriver::Sybase || dbType == QSqlDriver::PostgreSQL
+ if (dbType == QSqlDriver::MySqlServer || dbType == QSqlDriver::SQLite || dbType == QSqlDriver::Sybase
|| dbType == QSqlDriver::MSSqlServer || db.driverName().startsWith("QODBC"))
cs = true;
- QSqlRecord rec = db.record(qTableName("qtest", __FILE__, db, false));
+ QSqlRecord rec = db.record(qTableName("qtest", __FILE__, db));
QVERIFY((int)rec.count() > 0);
if (!cs) {
- rec = db.record(qTableName("QTEST", __FILE__, db, false).toUpper());
+ rec = db.record(qTableName("QTEST", __FILE__, db).toUpper());
QVERIFY((int)rec.count() > 0);
- rec = db.record(qTableName("qTesT", __FILE__, db, false));
+ rec = db.record(qTableName("qTesT", __FILE__, db));
QVERIFY((int)rec.count() > 0);
}
- rec = db.primaryIndex(qTableName("qtest", __FILE__, db, false));
+ rec = db.primaryIndex(qTableName("qtest", __FILE__, db));
QVERIFY((int)rec.count() > 0);
if (!cs) {
- rec = db.primaryIndex(qTableName("QTEST", __FILE__, db, false).toUpper());
+ rec = db.primaryIndex(qTableName("QTEST", __FILE__, db).toUpper());
QVERIFY((int)rec.count() > 0);
- rec = db.primaryIndex(qTableName("qTesT", __FILE__, db, false));
+ rec = db.primaryIndex(qTableName("qTesT", __FILE__, db));
QVERIFY((int)rec.count() > 0);
}
-
- // Explicit test for case sensitive table creation without quoting
- QSqlQuery qry(db);
- const auto noQuotesTable = qTableName("NoQuotes", __FILE__, db, false);
- tst_Databases::safeDropTable(db, noQuotesTable);
- QVERIFY_SQL(qry, exec("CREATE TABLE " + noQuotesTable + " (id INTEGER)"));
- QVERIFY_SQL(qry, exec("INSERT INTO " + noQuotesTable + " VALUES(1)"));
- QVERIFY_SQL(qry, exec("SELECT * FROM " + noQuotesTable));
- QVERIFY_SQL(qry, next());
- QCOMPARE(qry.value(0).toInt(), 1);
- rec = db.record(cs ? noQuotesTable.toLower() : noQuotesTable);
- QVERIFY(rec.count() > 0);
}
void tst_QSqlDatabase::noEscapedFieldNamesInRecord()
@@ -1274,19 +1260,17 @@ void tst_QSqlDatabase::psql_schemas()
const QString schemaName = qTableName("qtestschema", __FILE__, db);
QVERIFY_SQL(q, exec("CREATE SCHEMA " + schemaName));
- const auto table = schemaName + '.' + qTableName("qtesttable", __FILE__, db);
- const auto noescapeTable = qTableName("qtestschema", __FILE__, db, false) + '.' +
- qTableName("qtesttable", __FILE__, db, false);
+ QString table = schemaName + '.' + qTableName("qtesttable", __FILE__, db);
QVERIFY_SQL(q, exec("CREATE TABLE " + table + " (id int primary key, name varchar(20))"));
- QVERIFY(db.tables().contains(noescapeTable, Qt::CaseInsensitive));
+ QVERIFY(db.tables().contains(table, Qt::CaseInsensitive));
- QSqlRecord rec = db.record(noescapeTable);
+ QSqlRecord rec = db.record(table);
QCOMPARE(rec.count(), 2);
QCOMPARE(rec.fieldName(0), QString("id"));
QCOMPARE(rec.fieldName(1), QString("name"));
- QSqlIndex idx = db.primaryIndex(noescapeTable);
+ QSqlIndex idx = db.primaryIndex(table);
QCOMPARE(idx.count(), 1);
QCOMPARE(idx.fieldName(0), QString("id"));
}
@@ -1304,21 +1288,18 @@ void tst_QSqlDatabase::psql_escapedIdent
QSqlQuery q(db);
QVERIFY_SQL( q, exec("set client_min_messages='warning'"));
- const char bumpyCase[] = "qtestScHeMa";
- const QString schemaName(qTableName(bumpyCase, __FILE__, db)),
+ const QString schemaName(qTableName("qtestScHeMa", __FILE__, db)),
tableName(qTableName("qtest", __FILE__, db)),
field1Name(QLatin1String("fIeLdNaMe")),
field2Name(QLatin1String("ZuLu"));
- q.exec(QString("DROP SCHEMA %1 CASCADE").arg(schemaName));
- const auto createSchema = QString("CREATE SCHEMA %1").arg(schemaName);
+ q.exec(QString("DROP SCHEMA \"%1\" CASCADE").arg(schemaName));
+ QString createSchema = QString("CREATE SCHEMA \"%1\"").arg(schemaName);
QVERIFY_SQL(q, exec(createSchema));
- const auto createTable = QString("CREATE TABLE %1.%2 (\"%3\" int PRIMARY KEY, \"%4\" varchar(20))")
- .arg(schemaName, tableName, field1Name, field2Name);
+ QString createTable = QString("CREATE TABLE \"%1\".\"%2\" (\"%3\" int PRIMARY KEY, \"%4\" varchar(20))").arg(schemaName).arg(tableName).arg(field1Name).arg(field2Name);
QVERIFY_SQL(q, exec(createTable));
- QVERIFY(db.tables().contains(qTableName(bumpyCase, __FILE__, db, false) + '.' +
- qTableName("qtest", __FILE__, db, false), Qt::CaseSensitive));
+ QVERIFY(db.tables().contains(schemaName + '.' + tableName, Qt::CaseSensitive));
QSqlField fld1(field1Name, QVariant::Int);
QSqlField fld2(field2Name, QVariant::String);
@@ -1326,9 +1307,7 @@ void tst_QSqlDatabase::psql_escapedIdent
rec.append(fld1);
rec.append(fld2);
- QVERIFY_SQL(q, exec(drv->sqlStatement(QSqlDriver::SelectStatement,
- schemaName + '.' + tableName,
- rec, false)));
+ QVERIFY_SQL(q, exec(drv->sqlStatement(QSqlDriver::SelectStatement, db.driver()->escapeIdentifier(schemaName, QSqlDriver::TableName) + '.' + db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName), rec, false)));
rec = q.record();
QCOMPARE(rec.count(), 2);
@@ -1336,7 +1315,7 @@ void tst_QSqlDatabase::psql_escapedIdent
QCOMPARE(rec.fieldName(1), field2Name);
QCOMPARE(rec.field(0).type(), QVariant::Int);
- q.exec(QString("DROP SCHEMA %1 CASCADE").arg(schemaName));
+ q.exec(QString("DROP SCHEMA \"%1\" CASCADE").arg(schemaName));
}
void tst_QSqlDatabase::psql_escapeBytea()
@@ -2167,7 +2146,7 @@ void tst_QSqlDatabase::eventNotification
CHECK_DATABASE(db);
QSqlQuery query(db);
- const auto procedureName = qTableName("posteventProc", __FILE__, db, false);
+ QString procedureName = qTableName("posteventProc", __FILE__, db);
QString payload = "payload";
QSqlDriver &driver=*(db.driver());
QVERIFY_SQL(driver, subscribeToNotification(procedureName));
@@ -2191,22 +2170,21 @@ void tst_QSqlDatabase::eventNotification
QSKIP("QSQLITE specific test");
}
const QString tableName(qTableName("sqlitnotifytest", __FILE__, db));
- const auto noEscapeTableName(qTableName("sqlitnotifytest", __FILE__, db, false));
tst_Databases::safeDropTable(db, tableName);
QSignalSpy notificationSpy(db.driver(), SIGNAL(notification(QString)));
QSignalSpy notificationSpyExt(db.driver(), SIGNAL(notification(QString,QSqlDriver::NotificationSource,QVariant)));
QSqlQuery q(db);
QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INTEGER, realVal REAL)"));
- db.driver()->subscribeToNotification(noEscapeTableName);
+ db.driver()->subscribeToNotification(tableName);
QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)"));
QTRY_COMPARE(notificationSpy.count(), 1);
QTRY_COMPARE(notificationSpyExt.count(), 1);
QList<QVariant> arguments = notificationSpy.takeFirst();
- QCOMPARE(arguments.at(0).toString(), noEscapeTableName);
+ QCOMPARE(arguments.at(0).toString(), tableName);
arguments = notificationSpyExt.takeFirst();
- QCOMPARE(arguments.at(0).toString(), noEscapeTableName);
- db.driver()->unsubscribeFromNotification(noEscapeTableName);
+ QCOMPARE(arguments.at(0).toString(), tableName);
+ db.driver()->unsubscribeFromNotification(tableName);
QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)"));
QTRY_COMPARE(notificationSpy.count(), 0);
QTRY_COMPARE(notificationSpyExt.count(), 0);
Index: qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -1092,7 +1092,7 @@ void tst_QSqlQuery::record()
for (int i = 0; i < 3; ++i)
QCOMPARE(q.record().field(i).tableName().toLower(), lowerQTest);
q.clear();
- const auto tst_record = qTableName("tst_record", __FILE__, db, false).toLower();
+ const auto tst_record = qTableName("tst_record", __FILE__, db).toLower();
SETUP_RECORD_TABLE;
CHECK_RECORD;
q.clear();
@@ -3673,13 +3673,15 @@ void tst_QSqlQuery::QTBUG_5251()
const QString timetest(qTableName("timetest", __FILE__, db));
tst_Databases::safeDropTable(db, timetest);
QSqlQuery q(db);
- QVERIFY_SQL(q, exec(QStringLiteral("CREATE TABLE ") + timetest + QStringLiteral(" (t TIME)")));
- QVERIFY_SQL(q, exec(QStringLiteral("INSERT INTO ") + timetest +
- QStringLiteral(" VALUES ('1:2:3.666')")));
+ QVERIFY_SQL(q, exec(QStringLiteral("CREATE TABLE \"") + timetest + QStringLiteral("\" (t TIME)")));
+ QVERIFY_SQL(q, exec(QStringLiteral("INSERT INTO \"") + timetest +
+ QStringLiteral("\" VALUES ('1:2:3.666')")));
QSqlTableModel timetestModel(0,db);
timetestModel.setEditStrategy(QSqlTableModel::OnManualSubmit);
timetestModel.setTable(timetest);
+ if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
+ QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(timetestModel, select());
QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("01:02:03.666"));
@@ -3688,8 +3690,8 @@ void tst_QSqlQuery::QTBUG_5251()
QVERIFY_SQL(timetestModel, submitAll());
QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500"));
- QVERIFY_SQL(q, exec(QStringLiteral("UPDATE ") + timetest +
- QStringLiteral(" SET t = '0:11:22.33'")));
+ QVERIFY_SQL(q, exec(QStringLiteral("UPDATE \"") + timetest +
+ QStringLiteral("\" SET t = '0:11:22.33'")));
QVERIFY_SQL(timetestModel, select());
QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:11:22.330"));
Index: qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -122,13 +122,13 @@ void tst_QSqlRelationalTableModel::recre
QVERIFY_SQL( q, exec("insert into " + reltest5 + " values('mister', 'Mr')"));
if (testWhiteSpaceNames(db.driverName())) {
- const auto reltest6 = qTableName("rel test6", __FILE__, db);
+ QString reltest6 = db.driver()->escapeIdentifier(qTableName("rel", __FILE__, db) + " test6", QSqlDriver::TableName);
QVERIFY_SQL( q, exec("create table " + reltest6 + " (id int not null primary key, " + db.driver()->escapeIdentifier("city key", QSqlDriver::FieldName) +
" int, " + db.driver()->escapeIdentifier("extra field", QSqlDriver::FieldName) + " int)"));
QVERIFY_SQL( q, exec("insert into " + reltest6 + " values(1, 1,9)"));
QVERIFY_SQL( q, exec("insert into " + reltest6 + " values(2, 2,8)"));
- const auto reltest7 = qTableName("rel test7", __FILE__, db);
+ QString reltest7 = db.driver()->escapeIdentifier(qTableName("rel", __FILE__, db) + " test7", QSqlDriver::TableName);
QVERIFY_SQL( q, exec("create table " + reltest7 + " (" + db.driver()->escapeIdentifier("city id", QSqlDriver::TableName) + " int not null primary key, " + db.driver()->escapeIdentifier("city name", QSqlDriver::FieldName) + " varchar(20))"));
QVERIFY_SQL( q, exec("insert into " + reltest7 + " values(1, 'New York')"));
QVERIFY_SQL( q, exec("insert into " + reltest7 + " values(2, 'Washington')"));
@@ -170,8 +170,8 @@ void tst_QSqlRelationalTableModel::dropT
<< reltest3
<< reltest4
<< reltest5
- << qTableName("rel test6", __FILE__, db)
- << qTableName("rel test7", __FILE__, db)
+ << (qTableName("rel", __FILE__, db) + " test6")
+ << (qTableName( "rel", __FILE__, db) + " test7")
<< qTableName("CASETEST1", db)
<< qTableName("casetest1", db);
tst_Databases::safeDropTables( db, tableNames );
@@ -1379,9 +1379,9 @@ void tst_QSqlRelationalTableModel::white
if (!testWhiteSpaceNames(db.driverName()))
QSKIP("White space test irrelevant for driver");
QSqlRelationalTableModel model(0, db);
- model.setTable(qTableName("rel test6", __FILE__, db));
+ model.setTable(db.driver()->escapeIdentifier(qTableName("rel", __FILE__, db) + " test6", QSqlDriver::TableName));
model.setSort(0, Qt::DescendingOrder);
- model.setRelation(1, QSqlRelation(qTableName("rel test7", __FILE__, db),
+ model.setRelation(1, QSqlRelation(db.driver()->escapeIdentifier(qTableName("rel", __FILE__, db) + " test7", QSqlDriver::TableName),
db.driver()->escapeIdentifier("city id", QSqlDriver::FieldName),
db.driver()->escapeIdentifier("city name", QSqlDriver::FieldName)));
QVERIFY_SQL(model, select());
@@ -1547,6 +1547,8 @@ void tst_QSqlRelationalTableModel::relat
//modify the model data
QVERIFY_SQL(model, setData(model.index(0, 0), 40));
+ if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
+ QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, submit());
QVERIFY_SQL(model, setData(model.index(1, 0), 50));
QVERIFY_SQL(model, submit());
Index: qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
===================================================================
--- qtbase-everywhere-src-5.14.0-beta2.orig/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+++ qtbase-everywhere-src-5.14.0-beta2/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -384,6 +384,8 @@ void tst_QSqlTableModel::selectRow()
q.exec("UPDATE " + tbl + " SET a = 'Qt' WHERE id = 1");
QCOMPARE(model.data(idx).toString(), QString("b"));
model.selectRow(1);
+ if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
+ QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QCOMPARE(model.data(idx).toString(), QString("Qt"));
// Check if selectRow() refreshes a changed row.
@@ -440,6 +442,8 @@ void tst_QSqlTableModel::selectRowOverri
// both rows should have changed
QCOMPARE(model.data(idx).toString(), QString("Qt"));
idx = model.index(2, 1);
+ if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
+ QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QCOMPARE(model.data(idx).toString(), QString("Qt"));
q.exec("DELETE FROM " + tbl);
@@ -851,6 +855,8 @@ void tst_QSqlTableModel::insertRowFailur
// populate 1 row
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
+ if (dbType == QSqlDriver::PostgreSQL && submitpolicy != QSqlTableModel::OnManualSubmit)
+ QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, insertRecord(0, values));
QVERIFY_SQL(model, submitAll());
QVERIFY_SQL(model, select());
@@ -894,6 +900,8 @@ void tst_QSqlTableModel::insertRowFailur
// restore empty table
model.revertAll();
QVERIFY_SQL(model, removeRow(0));
+ if (dbType == QSqlDriver::PostgreSQL)
+ QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, submitAll());
QVERIFY_SQL(model, select());
QCOMPARE(model.rowCount(), 0);
@@ -2002,6 +2010,8 @@ void tst_QSqlTableModel::tableModifyWith
//Should be equivalent to QSqlQuery INSERT INTO... command)
QVERIFY_SQL(model, insertRow(0));
QVERIFY_SQL(model, setData(model.index(0,0),timeString));
+ if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL)
+ QEXPECT_FAIL("", "Currently broken for PostgreSQL due to case sensitivity problems - see QTBUG-65788", Abort);
QVERIFY_SQL(model, submitAll());
//set a filter on the table so the only record we get is the one we just made

View File

@ -1,32 +0,0 @@
From d0ed9b07eb928c7d037b3fadb7423c87d7b798b0 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Wed, 25 Dec 2019 18:54:40 +0100
Subject: [PATCH 1/3] Revert "Fix text-rendering regression on semi-transparent
background on Linux"
This reverts commit c0adcf0f226e247c1f2f515cd33d7945573e96a5.
---
src/gui/painting/qdrawhelper.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index e8d129d047..e5f752b94e 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6044,11 +6044,11 @@ static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba
// nothing
} else if (coverage == 0xffffffff && qAlpha(src) == 255) {
blend_pixel(*dst, src);
+ } else if (!colorProfile) {
+ *dst = rgbBlend(*dst, src, coverage);
} else if (*dst < 0xff000000) {
// Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
blend_pixel(*dst, src, qRgbAvg(coverage));
- } else if (!colorProfile) {
- *dst = rgbBlend(*dst, src, coverage);
} else if (srcLinear.isOpaque()) {
rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
} else {
--
2.23.0

View File

@ -1,60 +0,0 @@
From a61813ac9cd94a6e7c79ccfacca9e830f905e6dc Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Wed, 25 Dec 2019 18:54:52 +0100
Subject: [PATCH 2/3] Revert "Fix crash with gamma-corrected text blending
disabled"
This reverts commit 6db83e2584a30b1339adba18279fbfd527a10ce7.
---
src/gui/painting/qdrawhelper.cpp | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index e5f752b94e..3d06a27d8e 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5670,8 +5670,7 @@ static inline void alphamapblend_argb32(quint32 *dst, int coverage, QRgba64 srcL
QRgb s = *dst;
blend_pixel(s, src);
// Then gamma-corrected blend with glyph shape
- QRgba64 s64 = colorProfile ? colorProfile->toLinear64(s) : QRgba64::fromArgb32(s);
- grayBlendPixel(dst, coverage, s64, colorProfile);
+ grayBlendPixel(dst, coverage, colorProfile->toLinear64(s), colorProfile);
}
}
@@ -5712,9 +5711,7 @@ static inline void alphamapblend_generic(int coverage, QRgba64 *dest, int x, con
QRgba64 s = dest[x];
blend_pixel(s, src);
// Then gamma-corrected blend with glyph shape
- if (colorProfile)
- s = colorProfile->toLinear(s);
- grayBlendPixel(dest[x], coverage, s, colorProfile);
+ grayBlendPixel(dest[x], coverage, colorProfile->toLinear(s), colorProfile);
}
}
@@ -6056,8 +6053,7 @@ static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba
QRgb s = *dst;
blend_pixel(s, src);
// Then gamma-corrected blend with glyph shape
- QRgba64 s64 = colorProfile ? colorProfile->toLinear64(s) : QRgba64::fromArgb32(s);
- rgbBlendPixel(dst, coverage, s64, colorProfile);
+ rgbBlendPixel(dst, coverage, colorProfile->toLinear64(s), colorProfile);
}
}
@@ -6088,9 +6084,7 @@ static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, co
QRgba64 s = dest[x];
blend_pixel(s, src);
// Then gamma-corrected blend with glyph shape
- if (colorProfile)
- s = colorProfile->toLinear(s);
- rgbBlendPixel(dest[x], coverage, s, colorProfile);
+ rgbBlendPixel(dest[x], coverage, colorProfile->toLinear(s), colorProfile);
}
}
--
2.23.0

View File

@ -1,336 +0,0 @@
From 84a71a1b9e600dc641e7ace5a6b384c0e138753e Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Wed, 25 Dec 2019 18:55:01 +0100
Subject: [PATCH 3/3] Revert "Handle transparent pen color in fast text path"
This reverts commit d0d18b06458edd3b6b0712ea71c787404bbaa7e1.
---
src/gui/painting/qdrawhelper.cpp | 187 +++++++++++------------
src/gui/painting/qdrawhelper_p.h | 2 -
src/gui/painting/qpaintengine_raster.cpp | 4 +-
src/gui/painting/qrgba64_p.h | 2 -
4 files changed, 94 insertions(+), 101 deletions(-)
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 3d06a27d8e..edb363ac69 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5658,60 +5658,44 @@ static inline void alphamapblend_argb32(quint32 *dst, int coverage, QRgba64 srcL
{
if (coverage == 0) {
// nothing
- } else if (coverage == 255 || !colorProfile) {
- blend_pixel(*dst, src, coverage);
- } else if (*dst < 0xff000000) {
- // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
- blend_pixel(*dst, src, coverage);
- } else if (src >= 0xff000000) {
- grayBlendPixel(dst, coverage, srcLinear, colorProfile);
+ } else if (coverage == 255) {
+ *dst = src;
+ } else if (!colorProfile) {
+ *dst = INTERPOLATE_PIXEL_255(src, coverage, *dst, 255 - coverage);
} else {
- // First do naive blend with text-color
- QRgb s = *dst;
- blend_pixel(s, src);
- // Then gamma-corrected blend with glyph shape
- grayBlendPixel(dst, coverage, colorProfile->toLinear64(s), colorProfile);
+ if (*dst >= 0xff000000) {
+ grayBlendPixel(dst, coverage, srcLinear, colorProfile);
+ } else {
+ // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
+ *dst = INTERPOLATE_PIXEL_255(src, coverage, *dst, 255 - coverage);
+ }
}
}
#if QT_CONFIG(raster_64bit)
-
-static inline void grayBlendPixel(QRgba64 &dst, int coverage, QRgba64 srcLinear, const QColorTrcLut *colorProfile)
-{
- // Do a gammacorrected gray alphablend...
- QRgba64 dstColor = dst;
- if (colorProfile) {
- if (dstColor.isOpaque())
- dstColor = colorProfile->toLinear(dstColor);
- else if (!dstColor.isTransparent())
- dstColor = colorProfile->toLinear(dstColor.unpremultiplied()).premultiplied();
- }
-
- blend_pixel(dstColor, srcLinear, coverage);
-
- if (colorProfile) {
- if (dstColor.isOpaque())
- dstColor = colorProfile->fromLinear(dstColor);
- else if (!dstColor.isTransparent())
- dstColor = colorProfile->fromLinear(dstColor.unpremultiplied()).premultiplied();
- }
- dst = dstColor;
-}
-
static inline void alphamapblend_generic(int coverage, QRgba64 *dest, int x, const QRgba64 &srcLinear, const QRgba64 &src, const QColorTrcLut *colorProfile)
{
if (coverage == 0) {
// nothing
} else if (coverage == 255) {
- blend_pixel(dest[x], src);
- } else if (src.isOpaque()) {
- grayBlendPixel(dest[x], coverage, srcLinear, colorProfile);
+ dest[x] = src;
} else {
- // First do naive blend with text-color
- QRgba64 s = dest[x];
- blend_pixel(s, src);
- // Then gamma-corrected blend with glyph shape
- grayBlendPixel(dest[x], coverage, colorProfile->toLinear(s), colorProfile);
+ QRgba64 dstColor = dest[x];
+ if (colorProfile) {
+ if (dstColor.isOpaque())
+ dstColor = colorProfile->toLinear(dstColor);
+ else if (!dstColor.isTransparent())
+ dstColor = colorProfile->toLinear(dstColor.unpremultiplied()).premultiplied();
+ }
+
+ dstColor = interpolate255(srcLinear, coverage, dstColor, 255 - coverage);
+ if (colorProfile) {
+ if (dstColor.isOpaque())
+ dstColor = colorProfile->fromLinear(dstColor);
+ else if (!dstColor.isTransparent())
+ dstColor = colorProfile->fromLinear(dstColor.unpremultiplied()).premultiplied();
+ }
+ dest[x] = dstColor;
}
}
@@ -5730,8 +5714,12 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA8Text();
QRgba64 srcColor = color;
- if (colorProfile && color.isOpaque())
- srcColor = colorProfile->toLinear(srcColor);
+ if (colorProfile) {
+ if (color.isOpaque())
+ srcColor = colorProfile->toLinear(srcColor);
+ else
+ srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
+ }
alignas(8) QRgba64 buffer[BufferSize];
const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format];
@@ -5804,8 +5792,12 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA8Text();
QRgba64 srcColor = color;
- if (colorProfile && color.isOpaque())
- srcColor = colorProfile->toLinear(srcColor);
+ if (colorProfile) {
+ if (color.isOpaque())
+ srcColor = colorProfile->toLinear(srcColor);
+ else
+ srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
+ }
quint32 buffer[BufferSize];
const DestFetchProc destFetch = destFetchProc[rasterBuffer->format];
@@ -5880,7 +5872,7 @@ void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer,
int mapWidth, int mapHeight, int mapStride,
const QClipData *clip, bool useGammaCorrection)
{
- if (useGammaCorrection || !color.isOpaque()) {
+ if (useGammaCorrection) {
qt_alphamapblit_generic(rasterBuffer, x, y, color, map, mapWidth, mapHeight, mapStride, clip, useGammaCorrection);
return;
}
@@ -5939,8 +5931,12 @@ static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer,
colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA8Text();
QRgba64 srcColor = color;
- if (colorProfile && color.isOpaque())
- srcColor = colorProfile->toLinear(srcColor);
+ if (colorProfile) {
+ if (color.isOpaque())
+ srcColor = colorProfile->toLinear(srcColor);
+ else
+ srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
+ }
if (!clip) {
quint32 *dest = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x;
@@ -6035,59 +6031,48 @@ static inline QRgb rgbBlend(QRgb d, QRgb s, uint rgbAlpha)
#endif
}
-static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba64 &srcLinear, quint32 src, const QColorTrcLut *colorProfile)
+#if QT_CONFIG(raster_64bit)
+static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, const QRgba64 &srcLinear, const QRgba64 &src, const QColorTrcLut *colorProfile)
{
if (coverage == 0xff000000) {
// nothing
- } else if (coverage == 0xffffffff && qAlpha(src) == 255) {
- blend_pixel(*dst, src);
- } else if (!colorProfile) {
- *dst = rgbBlend(*dst, src, coverage);
- } else if (*dst < 0xff000000) {
- // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
- blend_pixel(*dst, src, qRgbAvg(coverage));
- } else if (srcLinear.isOpaque()) {
- rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
+ } else if (coverage == 0xffffffff) {
+ dest[x] = src;
} else {
- // First do naive blend with text-color
- QRgb s = *dst;
- blend_pixel(s, src);
- // Then gamma-corrected blend with glyph shape
- rgbBlendPixel(dst, coverage, colorProfile->toLinear64(s), colorProfile);
+ QRgba64 dstColor = dest[x];
+ if (dstColor.isOpaque()) {
+ if (colorProfile)
+ dstColor = colorProfile->toLinear(dstColor);
+ dstColor = rgbBlend(dstColor, srcLinear, coverage);
+ if (colorProfile)
+ dstColor = colorProfile->fromLinear(dstColor);
+ dest[x] = dstColor;
+ } else {
+ // Do a gray alphablend.
+ alphamapblend_generic(qRgbAvg(coverage), dest, x, srcLinear, src, colorProfile);
+ }
}
}
+#endif
-#if QT_CONFIG(raster_64bit)
-static inline void rgbBlendPixel(QRgba64 &dst, int coverage, QRgba64 slinear, const QColorTrcLut *colorProfile)
-{
- // Do a gammacorrected RGB alphablend...
- const QRgba64 dlinear = colorProfile ? colorProfile->toLinear64(dst) : dst;
-
- QRgba64 blend = rgbBlend(dlinear, slinear, coverage);
-
- dst = colorProfile ? colorProfile->fromLinear(blend) : blend;
-}
-
-static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, const QRgba64 &srcLinear, const QRgba64 &src, const QColorTrcLut *colorProfile)
+static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba64 &srcLinear, quint32 src, const QColorTrcLut *colorProfile)
{
if (coverage == 0xff000000) {
// nothing
} else if (coverage == 0xffffffff) {
- blend_pixel(dest[x], src);
- } else if (!dest[x].isOpaque()) {
- // Do a gray alphablend.
- alphamapblend_generic(qRgbAvg(coverage), dest, x, srcLinear, src, colorProfile);
- } else if (src.isOpaque()) {
- rgbBlendPixel(dest[x], coverage, srcLinear, colorProfile);
- } else {
- // First do naive blend with text-color
- QRgba64 s = dest[x];
- blend_pixel(s, src);
- // Then gamma-corrected blend with glyph shape
- rgbBlendPixel(dest[x], coverage, colorProfile->toLinear(s), colorProfile);
+ *dst = src;
+ } else if (*dst < 0xff000000) {
+ // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
+ const int a = qRgbAvg(coverage);
+ *dst = INTERPOLATE_PIXEL_255(src, a, *dst, 255 - a);
+ } else if (!colorProfile) {
+ *dst = rgbBlend(*dst, src, coverage);
+ } else {
+ rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
}
}
+#if QT_CONFIG(raster_64bit)
static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
int x, int y, const QRgba64 &color,
const uint *src, int mapWidth, int mapHeight, int srcStride,
@@ -6102,8 +6087,12 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA32Text();
QRgba64 srcColor = color;
- if (colorProfile && color.isOpaque())
- srcColor = colorProfile->toLinear(srcColor);
+ if (colorProfile) {
+ if (color.isOpaque())
+ srcColor = colorProfile->toLinear(srcColor);
+ else
+ srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
+ }
alignas(8) QRgba64 buffer[BufferSize];
const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format];
@@ -6175,8 +6164,12 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA32Text();
QRgba64 srcColor = color;
- if (colorProfile && color.isOpaque())
- srcColor = colorProfile->toLinear(srcColor);
+ if (colorProfile) {
+ if (color.isOpaque())
+ srcColor = colorProfile->toLinear(srcColor);
+ else
+ srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
+ }
quint32 buffer[BufferSize];
const DestFetchProc destFetch = destFetchProc[rasterBuffer->format];
@@ -6249,8 +6242,12 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA32Text();
QRgba64 srcColor = color;
- if (colorProfile && color.isOpaque())
- srcColor = colorProfile->toLinear(srcColor);
+ if (colorProfile) {
+ if (color.isOpaque())
+ srcColor = colorProfile->toLinear(srcColor);
+ else
+ srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
+ }
if (!clip) {
quint32 *dst = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x;
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index dd42b96d79..9c5d525722 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -671,8 +671,6 @@ static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src)
static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha)
{
- if (const_alpha == 255)
- return blend_pixel(dst, src);
if (src != 0) {
const quint32 s = BYTE_MUL(src, const_alpha);
dst = s + BYTE_MUL(dst, qAlpha(~s));
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 40c822076b..87312b920a 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -842,8 +842,8 @@ void QRasterPaintEngine::updateRasterState()
const QPainter::CompositionMode mode = s->composition_mode;
s->flags.fast_text = (s->penData.type == QSpanData::Solid)
&& s->intOpacity == 256
- && (mode == QPainter::CompositionMode_SourceOver
- || (mode == QPainter::CompositionMode_Source
+ && (mode == QPainter::CompositionMode_Source
+ || (mode == QPainter::CompositionMode_SourceOver
&& s->penData.solidColor.isOpaque()));
}
diff --git a/src/gui/painting/qrgba64_p.h b/src/gui/painting/qrgba64_p.h
index d145dbfbea..ca879de27c 100644
--- a/src/gui/painting/qrgba64_p.h
+++ b/src/gui/painting/qrgba64_p.h
@@ -284,8 +284,6 @@ static Q_ALWAYS_INLINE void blend_pixel(QRgba64 &dst, QRgba64 src)
static Q_ALWAYS_INLINE void blend_pixel(QRgba64 &dst, QRgba64 src, const int const_alpha)
{
- if (const_alpha == 255)
- return blend_pixel(dst, src);
if (!src.isTransparent()) {
src = multiplyAlpha255(src, const_alpha);
dst = src + multiplyAlpha65535(dst, 65535 - src.alpha());
--
2.23.0

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Mon Jan 27 13:13:57 UTC 2020 - Fabian Vogt <fabian@ritter-vogt.de>
- Update to 5.14.1:
* New bugfix release
* Fixes CVE-2020-0570
* For more details please see:
http://code.qt.io/cgit/qt/qtbase.git/plain/dist/changes-5.14.1/?h=v5.14.1
- Drop patch, should be addressed by applications meanwhile:
* 0001-Revert-Always-escape-the-table-names-when-creating-t.patch
- Drop patches, now upstream:
* 0001-Revert-Fix-text-rendering-regression-on-semi-transpa.patch
* 0002-Revert-Fix-crash-with-gamma-corrected-text-blending-.patch
* 0003-Revert-Handle-transparent-pen-color-in-fast-text-pat.patch
-------------------------------------------------------------------
Fri Dec 27 13:07:32 UTC 2019 - Fabian Vogt <fabian@ritter-vogt.de>

View File

@ -36,16 +36,16 @@
%endif
Name: libqt5-qtbase
Version: 5.14.0
Version: 5.14.1
Release: 0
Summary: C++ Program Library, Core Components
License: LGPL-3.0-only or GPL-3.0-with-Qt-Company-Qt-exception-1.1
Group: System/Libraries
Url: https://www.qt.io
%define base_name libqt5
%define real_version 5.14.0
%define so_version 5.14.0
%define tar_version qtbase-everywhere-src-5.14.0
%define real_version 5.14.1
%define so_version 5.14.1
%define tar_version qtbase-everywhere-src-5.14.1
Source: https://download.qt.io/official_releases/qt/5.14/%{real_version}/submodules/%{tar_version}.tar.xz
# to get mtime of file:
Source1: libqt5-qtbase.changes
@ -65,12 +65,6 @@ Patch21: 0001-Revert-Blacklist-nouveau-and-llvmpipe-for-multithrea.patch
Patch22: 0002-Revert-qtlite-Fix-build-libs-with-no-feature-regular.patch
Patch23: 0003-Revert-White-list-more-recent-Mesa-version-for-multi.patch
Patch24: fix-fixqt4headers.patch
# Revert to restore compatibility with akonadi and possibly other applications
Patch30: 0001-Revert-Always-escape-the-table-names-when-creating-t.patch
# Reverts to avoid text rendering bug (QTBUG-80982)
Patch40: 0001-Revert-Fix-text-rendering-regression-on-semi-transpa.patch
Patch41: 0002-Revert-Fix-crash-with-gamma-corrected-text-blending-.patch
Patch42: 0003-Revert-Handle-transparent-pen-color-in-fast-text-pat.patch
# patches 1000-2000 and above from upstream 5.14 branch #
# patches 2000-3000 and above from upstream 5.15/dev branch #
# Not accepted yet, https://codereview.qt-project.org/c/qt/qtbase/+/255384

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4ef921c0f208a1624439801da8b3f4344a3793b660ce1095f2b7f5c4246b9463
size 49713412

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d9d423a6e7bcf1055c0372fc029f14a6fe67dd62c67b83095cde68b60b762cf7
size 49828188