diff options
| author | Ahmad Samir <a.samirh78@gmail.com> | 2023-03-08 13:06:21 +0200 |
|---|---|---|
| committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-03-11 12:39:47 +0200 |
| commit | 8a1eb24de8ef063fc5d0c3f10a7324d95bbc8709 (patch) | |
| tree | 07391a052751cc89f2993bb051a425b59482c0b0 /src/corelib/global/qsysinfo.cpp | |
| parent | dda60cf0d1c70f186845e5bfd08dca1cd5e98a93 (diff) | |
Misc: Fix qsizetype-related narrowing coversions
Task-number: QTBUG-102461
Change-Id: I96757abc50fc45756bc1271a970f819a48021663
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qsysinfo.cpp')
| -rw-r--r-- | src/corelib/global/qsysinfo.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/global/qsysinfo.cpp b/src/corelib/global/qsysinfo.cpp index dace55b6cee..20919d0865d 100644 --- a/src/corelib/global/qsysinfo.cpp +++ b/src/corelib/global/qsysinfo.cpp @@ -352,8 +352,7 @@ static QByteArray getEtcFileFirstLine(const char *fileName) return QByteArray(); const char *ptr = buffer.constData(); - int eol = buffer.indexOf("\n"); - return QByteArray(ptr, eol).trimmed(); + return QByteArray(ptr, buffer.indexOf("\n")).trimmed(); } static bool readEtcRedHatRelease(QUnixOSVersion &v) @@ -368,9 +367,9 @@ static bool readEtcRedHatRelease(QUnixOSVersion &v) v.prettyName = QString::fromLatin1(line); const char keyword[] = "release "; - int releaseIndex = line.indexOf(keyword); + const qsizetype releaseIndex = line.indexOf(keyword); v.productType = QString::fromLatin1(line.mid(0, releaseIndex)).remove(u' '); - int spaceIndex = line.indexOf(' ', releaseIndex + strlen(keyword)); + const qsizetype spaceIndex = line.indexOf(' ', releaseIndex + strlen(keyword)); v.productVersion = QString::fromLatin1(line.mid(releaseIndex + strlen(keyword), spaceIndex > -1 ? spaceIndex - releaseIndex - int(strlen(keyword)) : -1)); return true; |
