diff options
Diffstat (limited to 'src/corelib/io/qstorageinfo_unix.cpp')
-rw-r--r-- | src/corelib/io/qstorageinfo_unix.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 89b6dfea9d..be3bf0252d 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -451,32 +451,35 @@ inline bool QStorageIterator::next() const char *const stop = ptr + len - 1; // parse the line - bool ok; mnt.mnt_freq = 0; mnt.mnt_passno = 0; - mnt.mount_id = qstrntoll(ptr, stop - ptr, const_cast<const char **>(&ptr), 10, &ok); - if (!ok) + auto r = qstrntoll(ptr, stop - ptr, 10); + if (!r.ok()) return false; + mnt.mount_id = r.result; - int parent_id = qstrntoll(ptr, stop - ptr, const_cast<const char **>(&ptr), 10, &ok); - Q_UNUSED(parent_id); - if (!ok) + r = qstrntoll(r.endptr, stop - r.endptr, 10); + if (!r.ok()) return false; + int parent_id = r.result; + Q_UNUSED(parent_id); - int rdevmajor = qstrntoll(ptr, stop - ptr, const_cast<const char **>(&ptr), 10, &ok); - if (!ok) + r = qstrntoll(r.endptr, stop - r.endptr, 10); + if (!r.ok()) return false; - if (*ptr != ':') + if (*r.endptr != ':') return false; - int rdevminor = qstrntoll(ptr + 1, stop - ptr - 1, const_cast<const char **>(&ptr), 10, &ok); - if (!ok) + int rdevmajor = r.result; + r = qstrntoll(r.endptr + 1, stop - r.endptr - 1, 10); + if (!r.ok()) return false; - mnt.rdev = makedev(rdevmajor, rdevminor); + mnt.rdev = makedev(rdevmajor, r.result); - if (*ptr != ' ') + if (*r.endptr != ' ') return false; + ptr = const_cast<char *>(r.endptr); mnt.subvolume = ++ptr; ptr = parseMangledPath(ptr); if (!ptr) @@ -711,8 +714,8 @@ void QStorageInfoPrivate::initRootPath() const QString mountDir = it.rootPath(); const QByteArray fsName = it.fileSystemType(); // we try to find most suitable entry - if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.length()) { - maxLength = mountDir.length(); + if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.size()) { + maxLength = mountDir.size(); rootPath = mountDir; device = it.device(); fileSystemType = fsName; |