diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index c4fb709ddf..2c9fed530b 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -662,17 +662,11 @@ bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError & bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data) { mode_t mode = 0; - if (permissions & QFile::ReadOwner) + if (permissions & (QFile::ReadOwner | QFile::ReadUser)) mode |= S_IRUSR; - if (permissions & QFile::WriteOwner) + if (permissions & (QFile::WriteOwner | QFile::WriteUser)) mode |= S_IWUSR; - if (permissions & QFile::ExeOwner) - mode |= S_IXUSR; - if (permissions & QFile::ReadUser) - mode |= S_IRUSR; - if (permissions & QFile::WriteUser) - mode |= S_IWUSR; - if (permissions & QFile::ExeUser) + if (permissions & (QFile::ExeOwner | QFile::ExeUser)) mode |= S_IXUSR; if (permissions & QFile::ReadGroup) mode |= S_IRGRP; diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 5cca3c323e..d62c120d7e 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -1437,11 +1437,9 @@ bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Per Q_UNUSED(data); int mode = 0; - if (permissions & QFile::ReadOwner || permissions & QFile::ReadUser - || permissions & QFile::ReadGroup || permissions & QFile::ReadOther) + if (permissions & (QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther)) mode |= _S_IREAD; - if (permissions & QFile::WriteOwner || permissions & QFile::WriteUser - || permissions & QFile::WriteGroup || permissions & QFile::WriteOther) + if (permissions & (QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther)) mode |= _S_IWRITE; if (mode == 0) // not supported diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index edd3447357..25e4db0969 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -162,17 +162,11 @@ static void writeMSDosDate(uchar *dest, const QDateTime& dt) static quint32 permissionsToMode(QFile::Permissions perms) { quint32 mode = 0; - if (perms & QFile::ReadOwner) + if (perms & (QFile::ReadOwner | QFile::ReadUser)) mode |= S_IRUSR; - if (perms & QFile::WriteOwner) + if (perms & (QFile::WriteOwner | QFile::WriteUser)) mode |= S_IWUSR; - if (perms & QFile::ExeOwner) - mode |= S_IXUSR; - if (perms & QFile::ReadUser) - mode |= S_IRUSR; - if (perms & QFile::WriteUser) - mode |= S_IWUSR; - if (perms & QFile::ExeUser) + if (perms & (QFile::ExeOwner | QFile::ExeUser)) mode |= S_IXUSR; if (perms & QFile::ReadGroup) mode |= S_IRGRP; @@ -257,17 +251,11 @@ static QFile::Permissions modeToPermissions(quint32 mode) { QFile::Permissions ret; if (mode & S_IRUSR) - ret |= QFile::ReadOwner; + ret |= QFile::ReadOwner | QFile::ReadUser; if (mode & S_IWUSR) - ret |= QFile::WriteOwner; + ret |= QFile::WriteOwner | QFile::WriteUser; if (mode & S_IXUSR) - ret |= QFile::ExeOwner; - if (mode & S_IRUSR) - ret |= QFile::ReadUser; - if (mode & S_IWUSR) - ret |= QFile::WriteUser; - if (mode & S_IXUSR) - ret |= QFile::ExeUser; + ret |= QFile::ExeOwner | QFile::ExeUser; if (mode & S_IRGRP) ret |= QFile::ReadGroup; if (mode & S_IWGRP)