QSqlDatabase: remove a pointless const_cast

The history of that one line of code is... interesting, to say the
least. `defaultConnection` was originally declared as `char *`, which
happened to work on older MSVC versions. Then it gained a workaround for
other platforms by conditionally marking it const, with a const_cast to
keep the code working on MSVC. Now it is unconditionally declared as a
const char *, but the const_cast is still there. Get rid of it.

Change-Id: Ibfb6728e05f15f540137c94f2d278bd5db988b63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2022-12-23 18:17:59 +01:00 committed by Thiago Macieira
parent 3642d5680d
commit a057b026b8

View File

@ -24,7 +24,7 @@ using namespace Qt::StringLiterals;
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QSqlDriverFactoryInterface_iid, "/sqldrivers"_L1))
const char *QSqlDatabase::defaultConnection = const_cast<char *>("qt_sql_default_connection");
const char *QSqlDatabase::defaultConnection = "qt_sql_default_connection";
typedef QHash<QString, QSqlDriverCreatorBase*> DriverDict;