MS QNativeFilePermissions: fix unused member and capture warnings

Two members are only used in code that's conditioned on pseudo-feature
fslibs, which was defined in qfilesystemengine_win.cpp; move that
definition to qfiledevice_p.h so that the members's existence can be
conditioned on the same #if-ery as their use. The bootstrap build was
broken by the warning.

In the code that uses them, a lambda captured this but didn't use it,
causing the non-bootstrap build to get a warning (hence error) and
fail. So remove the unnecessary capture. Also suppressed warnings on
an unused function.

This amends commit 174af05400f6344a11f4aa2228244c954cbbca97

Pick-to: 6.3
Task-number: QTBUG-79750
Change-Id: Ib29f3200b7736bc07df68aeec4fc6f568c8f4ddb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
This commit is contained in:
Edward Welbourne 2022-03-04 11:26:10 +01:00
parent 3febcd6286
commit aa4a2bb1e1
2 changed files with 13 additions and 11 deletions

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -62,6 +62,11 @@
# include <qt_windows.h>
# include <winnt.h> // for SECURITY_DESCRIPTOR
# include <optional>
# if defined(QT_BOOTSTRAPPED)
# define QT_FEATURE_fslibs -1
# else
# define QT_FEATURE_fslibs 1
# endif // QT_BOOTSTRAPPED
#endif
QT_BEGIN_NAMESPACE
@ -155,9 +160,11 @@ private:
static constexpr auto MaxACLSize =
sizeof(ACL) + (sizeof(ACCESS_ALLOWED_ACE) + SECURITY_MAX_SID_SIZE) * MaxNumACEs;
SECURITY_DESCRIPTOR sd;
SECURITY_ATTRIBUTES sa;
#if QT_CONFIG(fslibs)
SECURITY_DESCRIPTOR sd;
alignas(DWORD) char aclStorage[MaxACLSize];
#endif
};
#endif // Q_OS_UNIX

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -138,12 +138,6 @@ typedef struct _REPARSE_DATA_BUFFER {
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
#endif
#if defined(QT_BOOTSTRAPPED)
# define QT_FEATURE_fslibs -1
#else
# define QT_FEATURE_fslibs 1
#endif // QT_BOOTSTRAPPED
#if QT_CONFIG(fslibs)
#include <aclapi.h>
#include <authz.h>
@ -411,6 +405,7 @@ constexpr NonSpecificPermissions toNonSpecificPermissions(PermissionTag tag,
return NonSpecificPermissions::fromInt((permissions.toInt() >> int(tag)) & 0x7);
}
[[maybe_unused]] // Not currently used; included to show how to do it (without bit-rotting).
constexpr QFileDevice::Permissions toSpecificPermissions(PermissionTag tag,
NonSpecificPermissions permissions)
{
@ -477,8 +472,8 @@ QNativeFilePermissions::QNativeFilePermissions(std::optional<QFileDevice::Permis
ACCESS_MASK denyMask, allowMask;
};
auto makeMasks = [this, isDir](NonSpecificPermissions allowPermissions,
NonSpecificPermissions denyPermissions, bool owner) {
auto makeMasks = [isDir](NonSpecificPermissions allowPermissions,
NonSpecificPermissions denyPermissions, bool owner) {
constexpr ACCESS_MASK AllowRead = FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA;
constexpr ACCESS_MASK DenyRead = FILE_READ_DATA | FILE_READ_EA;