From a057b026b80be3126df99503039e60f6ace4901c Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 23 Dec 2022 18:17:59 +0100 Subject: [PATCH] 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 --- src/sql/kernel/qsqldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index a547b1f15bb..010c02eafa3 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -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("qt_sql_default_connection"); +const char *QSqlDatabase::defaultConnection = "qt_sql_default_connection"; typedef QHash DriverDict;