summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstorageinfo_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qstorageinfo_unix.cpp')
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index 5f3fa32482..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)