diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h index f608ca48f5..cb06665a9f 100644 --- a/src/corelib/io/qfile.h +++ b/src/corelib/io/qfile.h @@ -27,6 +27,12 @@ namespace std { QT_BEGIN_NAMESPACE #ifdef Q_OS_WIN + +#if QT_DEPRECATED_SINCE(6,6) +QT_DEPRECATED_VERSION_X_6_6("Use QNtfsPermissionCheckGuard RAII class instead.") +Q_CORE_EXPORT extern int qt_ntfs_permission_lookup; // defined in qfilesystemengine_win.cpp +#endif + Q_CORE_EXPORT bool qEnableNtfsPermissionChecks() noexcept; Q_CORE_EXPORT bool qDisableNtfsPermissionChecks() noexcept; Q_CORE_EXPORT bool qAreNtfsPermissionChecksEnabled() noexcept; diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index fbc55954cb..49f375c4bb 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -381,11 +381,15 @@ constexpr QFileDevice::Permissions toSpecificPermissions(PermissionTag tag, } // anonymous namespace #endif // QT_CONFIG(fslibs) - -Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0; +#if QT_DEPRECATED_SINCE(6,6) +int qt_ntfs_permission_lookup = 0; +#endif static QBasicAtomicInt qt_ntfs_permission_lookup_v2 = Q_BASIC_ATOMIC_INITIALIZER(0); +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + /*! \internal @@ -395,7 +399,7 @@ static QBasicAtomicInt qt_ntfs_permission_lookup_v2 = Q_BASIC_ATOMIC_INITIALIZER bool qEnableNtfsPermissionChecks() noexcept { return qt_ntfs_permission_lookup_v2.fetchAndAddRelaxed(1) - + qt_ntfs_permission_lookup +QT_IF_DEPRECATED_SINCE(6, 6, /*nothing*/, + qt_ntfs_permission_lookup) != 0; } @@ -408,7 +412,7 @@ bool qEnableNtfsPermissionChecks() noexcept bool qDisableNtfsPermissionChecks() noexcept { return qt_ntfs_permission_lookup_v2.fetchAndSubRelaxed(1) - + qt_ntfs_permission_lookup +QT_IF_DEPRECATED_SINCE(6, 6, /*nothing*/, + qt_ntfs_permission_lookup) == 1; } @@ -421,8 +425,10 @@ bool qDisableNtfsPermissionChecks() noexcept bool qAreNtfsPermissionChecksEnabled() noexcept { return qt_ntfs_permission_lookup_v2.loadRelaxed() - + qt_ntfs_permission_lookup; +QT_IF_DEPRECATED_SINCE(6, 6, /*nothing*/, + qt_ntfs_permission_lookup) + ; } +QT_WARNING_POP /*! \class QNativeFilePermissions diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index c8048c21c8..a7b3464fd6 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -171,7 +171,9 @@ private slots: #ifdef Q_OS_WIN void permissionsNtfs_data(); void permissionsNtfs(); +#if QT_DEPRECATED_SINCE(6,6) void deprecatedNtfsPermissionCheck(); +#endif #endif void setPermissions_data(); void setPermissions(); @@ -1418,6 +1420,9 @@ void tst_QFile::permissionsNtfs() permissions(); } +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +#if QT_DEPRECATED_SINCE(6,6) void tst_QFile::deprecatedNtfsPermissionCheck() { QScopedValueRollback guard(qt_ntfs_permission_lookup); @@ -1428,6 +1433,8 @@ void tst_QFile::deprecatedNtfsPermissionCheck() qt_ntfs_permission_lookup--; QCOMPARE(qAreNtfsPermissionChecksEnabled(), false); } +#endif +QT_WARNING_POP #endif