qstorageinfo_p.h: fix -Wunused-function
Make shouldIncludeFs() class- instead of file-static by moving it into QStorageInfoPrivate. Ditto isParentOf(). Put the functions under Q_OS_UNIX. Fixes Clang -Wunused-function, and removes a non-q/Q-prefixed name from the global namespace. Amends 543ae6e6a43519b9fca6758c4a8c78625fcb2c86. Manual conflict resolution for 6.8: - tracked a user of shouldIncludeFs() that needs a QStorageInfoPrivate:: prefix added from qstorageinfo_linux.cpp to qstorageinfo_linux_p.h Pick-to: 6.7 Task-number: QTBUG-77059 Task-number: QTBUG-126219 Change-Id: I4cc62ae044d74919d73d08f6ce3ad57f2e00b4c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 5cd154de63c517728d42ed322cb5f2965ef5f6ec) Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
This commit is contained in:
parent
848cc2bf27
commit
7df3f20b91
@ -215,7 +215,8 @@ doParseMountInfo(const QByteArray &mountinfo, FilterMountInfo filter = FilterMou
|
||||
continue;
|
||||
info.fsType = fields[FsType].toByteArray();
|
||||
|
||||
if (filter == FilterMountInfo::Filtered && !shouldIncludeFs(info.mountPoint, info.fsType))
|
||||
if (filter == FilterMountInfo::Filtered
|
||||
&& !QStorageInfoPrivate::shouldIncludeFs(info.mountPoint, info.fsType))
|
||||
continue;
|
||||
|
||||
std::optional<dev_t> devno = deviceNumber(fields[DevNo]);
|
||||
|
@ -90,6 +90,18 @@ public:
|
||||
void retrieveVolumeInfo();
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
// Common helper functions
|
||||
template <typename String>
|
||||
static bool isParentOf(const String &parent, const QString &dirName)
|
||||
{
|
||||
return dirName.startsWith(parent) &&
|
||||
(dirName.size() == parent.size() || dirName.at(parent.size()) == u'/' ||
|
||||
parent.size() == 1);
|
||||
}
|
||||
static inline bool shouldIncludeFs(const QString &mountDir, const QByteArray &fsType);
|
||||
#endif
|
||||
|
||||
public:
|
||||
QString rootPath;
|
||||
QByteArray device;
|
||||
@ -107,16 +119,8 @@ public:
|
||||
bool valid = false;
|
||||
};
|
||||
|
||||
// Common helper functions
|
||||
template <typename String>
|
||||
static bool isParentOf(const String &parent, const QString &dirName)
|
||||
{
|
||||
return dirName.startsWith(parent) &&
|
||||
(dirName.size() == parent.size() || dirName.at(parent.size()) == u'/' ||
|
||||
parent.size() == 1);
|
||||
}
|
||||
|
||||
static inline bool shouldIncludeFs(const QString &mountDir, const QByteArray &fsType)
|
||||
#ifdef Q_OS_UNIX
|
||||
bool QStorageInfoPrivate::shouldIncludeFs(const QString &mountDir, const QByteArray &fsType)
|
||||
{
|
||||
#if defined(Q_OS_ANDROID)
|
||||
// "rootfs" is the filesystem type of "/" on Android
|
||||
@ -158,6 +162,7 @@ static inline bool shouldIncludeFs(const QString &mountDir, const QByteArray &fs
|
||||
// size checking in QStorageInfo::mountedVolumes()
|
||||
return true;
|
||||
}
|
||||
#endif // Q_OS_UNIX
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user