Moc: port to qsizetype
Simple s/int/qsizetype/. Fixes some narrowing conversion warnings. Pick-to: 6.5 Change-Id: Ied82e861298fa9763089cadc7eae6e536f1bb9ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c452a43b59
commit
44cfdfa7c0
@ -186,7 +186,7 @@ bool Generator::registerableMetaType(const QByteArray &propertyType)
|
|||||||
for (const QByteArray &oneArgTemplateType : oneArgTemplates) {
|
for (const QByteArray &oneArgTemplateType : oneArgTemplates) {
|
||||||
QByteArray ba = oneArgTemplateType + "<";
|
QByteArray ba = oneArgTemplateType + "<";
|
||||||
if (propertyType.startsWith(ba) && propertyType.endsWith(">")) {
|
if (propertyType.startsWith(ba) && propertyType.endsWith(">")) {
|
||||||
const int argumentSize = propertyType.size() - oneArgTemplateType.size() - 1
|
const qsizetype argumentSize = propertyType.size() - oneArgTemplateType.size() - 1
|
||||||
// The closing '>'
|
// The closing '>'
|
||||||
- 1
|
- 1
|
||||||
// templates inside templates have an extra whitespace char to strip.
|
// templates inside templates have an extra whitespace char to strip.
|
||||||
@ -204,7 +204,7 @@ static bool qualifiedNameEquals(const QByteArray &qualifiedName, const QByteArra
|
|||||||
{
|
{
|
||||||
if (qualifiedName == name)
|
if (qualifiedName == name)
|
||||||
return true;
|
return true;
|
||||||
int index = qualifiedName.indexOf("::");
|
const qsizetype index = qualifiedName.indexOf("::");
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return false;
|
return false;
|
||||||
return qualifiedNameEquals(qualifiedName.mid(index+2), name);
|
return qualifiedNameEquals(qualifiedName.mid(index+2), name);
|
||||||
@ -468,7 +468,7 @@ void Generator::generateCode()
|
|||||||
if (p.type.contains('*') || p.type.contains('<') || p.type.contains('>'))
|
if (p.type.contains('*') || p.type.contains('<') || p.type.contains('>'))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int s = p.type.lastIndexOf("::");
|
const qsizetype s = p.type.lastIndexOf("::");
|
||||||
if (s <= 0)
|
if (s <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ void Generator::generateCode()
|
|||||||
|
|
||||||
QByteArray thisScope = cdef->qualified;
|
QByteArray thisScope = cdef->qualified;
|
||||||
do {
|
do {
|
||||||
int s = thisScope.lastIndexOf("::");
|
const qsizetype s = thisScope.lastIndexOf("::");
|
||||||
thisScope = thisScope.left(s);
|
thisScope = thisScope.left(s);
|
||||||
QByteArray currentScope = thisScope.isEmpty() ? unqualifiedScope : thisScope + "::" + unqualifiedScope;
|
QByteArray currentScope = thisScope.isEmpty() ? unqualifiedScope : thisScope + "::" + unqualifiedScope;
|
||||||
scopeIt = knownExtraMetaObject.constFind(currentScope);
|
scopeIt = knownExtraMetaObject.constFind(currentScope);
|
||||||
@ -505,7 +505,7 @@ void Generator::generateCode()
|
|||||||
for (auto it = cdef->enumDeclarations.keyBegin(),
|
for (auto it = cdef->enumDeclarations.keyBegin(),
|
||||||
end = cdef->enumDeclarations.keyEnd(); it != end; ++it) {
|
end = cdef->enumDeclarations.keyEnd(); it != end; ++it) {
|
||||||
const QByteArray &enumKey = *it;
|
const QByteArray &enumKey = *it;
|
||||||
int s = enumKey.lastIndexOf("::");
|
const qsizetype s = enumKey.lastIndexOf("::");
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
QByteArray scope = enumKey.left(s);
|
QByteArray scope = enumKey.left(s);
|
||||||
if (scope != "Qt" && !qualifiedNameEquals(cdef->qualified, scope) && !extraList.contains(scope))
|
if (scope != "Qt" && !qualifiedNameEquals(cdef->qualified, scope) && !extraList.contains(scope))
|
||||||
@ -1617,7 +1617,7 @@ void Generator::generatePluginMetaData()
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 'Use' all namespaces.
|
// 'Use' all namespaces.
|
||||||
int pos = cdef->qualified.indexOf("::");
|
qsizetype pos = cdef->qualified.indexOf("::");
|
||||||
for ( ; pos != -1 ; pos = cdef->qualified.indexOf("::", pos + 2) )
|
for ( ; pos != -1 ; pos = cdef->qualified.indexOf("::", pos + 2) )
|
||||||
fprintf(out, "using namespace %s;\n", cdef->qualified.left(pos).constData());
|
fprintf(out, "using namespace %s;\n", cdef->qualified.left(pos).constData());
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ int runMoc(int argc, char **argv)
|
|||||||
for (const QString &arg : defines) {
|
for (const QString &arg : defines) {
|
||||||
QByteArray name = arg.toLocal8Bit();
|
QByteArray name = arg.toLocal8Bit();
|
||||||
QByteArray value("1");
|
QByteArray value("1");
|
||||||
int eq = name.indexOf('=');
|
const qsizetype eq = name.indexOf('=');
|
||||||
if (eq >= 0) {
|
if (eq >= 0) {
|
||||||
value = name.mid(eq + 1);
|
value = name.mid(eq + 1);
|
||||||
name = name.left(eq);
|
name = name.left(eq);
|
||||||
|
@ -1629,7 +1629,7 @@ void Moc::parseInterfaces(ClassDef *def)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// resolve from classnames to interface ids
|
// resolve from classnames to interface ids
|
||||||
for (int i = 0; i < iface.size(); ++i) {
|
for (qsizetype i = 0; i < iface.size(); ++i) {
|
||||||
const QByteArray iid = interface2IdMap.value(iface.at(i).className);
|
const QByteArray iid = interface2IdMap.value(iface.at(i).className);
|
||||||
if (iid.isEmpty())
|
if (iid.isEmpty())
|
||||||
error("Undefined interface");
|
error("Undefined interface");
|
||||||
|
@ -966,7 +966,7 @@ static void mergeStringLiterals(Symbols *_symbols)
|
|||||||
for (Symbols::iterator i = symbols.begin(); i != symbols.end(); ++i) {
|
for (Symbols::iterator i = symbols.begin(); i != symbols.end(); ++i) {
|
||||||
if (i->token == STRING_LITERAL) {
|
if (i->token == STRING_LITERAL) {
|
||||||
Symbols::Iterator mergeSymbol = i;
|
Symbols::Iterator mergeSymbol = i;
|
||||||
int literalsLength = mergeSymbol->len;
|
qsizetype literalsLength = mergeSymbol->len;
|
||||||
while (++i != symbols.end() && i->token == STRING_LITERAL)
|
while (++i != symbols.end() && i->token == STRING_LITERAL)
|
||||||
literalsLength += i->len - 2; // no quotes
|
literalsLength += i->len - 2; // no quotes
|
||||||
|
|
||||||
@ -1005,7 +1005,7 @@ static QByteArray searchIncludePaths(const QList<Parser::IncludePath> &includepa
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (p.isFrameworkPath) {
|
if (p.isFrameworkPath) {
|
||||||
const int slashPos = include.indexOf('/');
|
const qsizetype slashPos = include.indexOf('/');
|
||||||
if (slashPos == -1)
|
if (slashPos == -1)
|
||||||
continue;
|
continue;
|
||||||
fi.setFile(QString::fromLocal8Bit(p.path + '/' + include.left(slashPos) + ".framework/Headers/"),
|
fi.setFile(QString::fromLocal8Bit(p.path + '/' + include.left(slashPos) + ".framework/Headers/"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user