From 081f559031fed7cde755e006b226cf06f33bd0f8 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 1 Feb 2021 01:03:40 +0200 Subject: General code cleanup Fix some clazy warnings, and some other minor code optimisations. NO_CHANGELOG --- src/kconfig_compiler/kconfig_compiler.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/kconfig_compiler/kconfig_compiler.cpp') diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp index 4f9fa3f2..a7ecd83e 100644 --- a/src/kconfig_compiler/kconfig_compiler.cpp +++ b/src/kconfig_compiler/kconfig_compiler.cpp @@ -371,20 +371,26 @@ QString defaultValue(const QString &t) QString itemType(const QString &type) { - QString t; + if (type.isEmpty()) { + return QString{}; + } - t = type; - t.replace(0, 1, t.left(1).toUpper()); + QString str = type; + str[0] = str.at(0).toUpper(); - return t; + return str; } QString itemDeclaration(const CfgEntry *e, const KConfigParameters &cfg) { + if (e->name.isEmpty()) { + return QString{}; + } + const QString type = cfg.inherits + "::Item" + itemType(e->type); QString fCap = e->name; - fCap[0] = fCap[0].toUpper(); + fCap[0] = fCap.at(0).toUpper(); const QString argSuffix = (!e->param.isEmpty()) ? (QStringLiteral("[%1]").arg(e->paramMax + 1)) : QString(); QString result; -- cgit v1.2.1