diff options
author | Ahmad Samir <[email protected]> | 2023-05-22 16:21:53 +0300 |
---|---|---|
committer | Ahmad Samir <[email protected]> | 2023-06-05 22:23:01 +0000 |
commit | e22f766bda7c405ab4daa27b553d4100dcfa811f (patch) | |
tree | 5957ab0c5cdaefa8381176479918bd8056e31f05 /src/tools/moc/generator.cpp | |
parent | 58329bbd2be6a4e7f1bf87b3c9fbaea73c8c6a66 (diff) |
Moc/Generator: fix 64-to-32 narrowing conversion warnigns
Pick-to: 6.6 6.5
Change-Id: Id1094aaba284c51c3a840a8e107abd837a825593
Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r-- | src/tools/moc/generator.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 25b2a4c62bc..097d0021428 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -70,11 +70,11 @@ QT_FOR_EACH_STATIC_TYPE(RETURN_METATYPENAME_STRING) purestSuperClass = cdef->superclassList.constFirst().first; } -static inline int lengthOfEscapeSequence(const QByteArray &s, int i) +static inline qsizetype lengthOfEscapeSequence(const QByteArray &s, qsizetype i) { if (s.at(i) != '\\' || i >= s.size() - 1) return 1; - const int startPos = i; + const qsizetype startPos = i; ++i; char ch = s.at(i); if (ch == 'x') { @@ -98,18 +98,18 @@ static inline int lengthOfEscapeSequence(const QByteArray &s, int i) static void printStringWithIndentation(FILE *out, const QByteArray &s) { static constexpr int ColumnWidth = 72; - int len = s.size(); - int idx = 0; + const qsizetype len = s.size(); + qsizetype idx = 0; do { - int spanLen = qMin(ColumnWidth - 2, len - idx); + qsizetype spanLen = qMin(ColumnWidth - 2, len - idx); // don't cut escape sequences at the end of a line - int backSlashPos = s.lastIndexOf('\\', idx + spanLen - 1); + const qsizetype backSlashPos = s.lastIndexOf('\\', idx + spanLen - 1); if (backSlashPos >= idx) { - int escapeLen = lengthOfEscapeSequence(s, backSlashPos); + const qsizetype escapeLen = lengthOfEscapeSequence(s, backSlashPos); spanLen = qBound(spanLen, backSlashPos + escapeLen - idx, len - idx); } - fprintf(out, "\n \"%.*s\"", spanLen, s.constData() + idx); + fprintf(out, "\n \"%.*s\"", int(spanLen), s.constData() + idx); idx += spanLen; } while (idx < len); } @@ -292,8 +292,8 @@ void Generator::generateCode() fprintf(out, " %4d, %4d, // classinfo\n", int(cdef->classInfoList.size()), int(cdef->classInfoList.size() ? index : 0)); index += cdef->classInfoList.size() * 2; - int methodCount = cdef->signalList.size() + cdef->slotList.size() + cdef->methodList.size(); - fprintf(out, " %4d, %4d, // methods\n", methodCount, methodCount ? index : 0); + const qsizetype methodCount = cdef->signalList.size() + cdef->slotList.size() + cdef->methodList.size(); + fprintf(out, " %4" PRIdQSIZETYPE ", %4d, // methods\n", methodCount, methodCount ? index : 0); index += methodCount * QMetaObjectPrivate::IntsPerMethod; if (cdef->revisionedMethods) index += methodCount; |