fix: Deprecated QString::SkipEmptyParts

This commit is contained in:
Sirius Bakke 2020-10-05 20:49:37 +02:00
parent a5e14a9664
commit bc40683f2a
13 changed files with 96 additions and 27 deletions

View File

@ -1256,7 +1256,11 @@ QString CompilerDriver::formSingleRuleCompileOutput(const QString &generated_cod
// compilers we assemble here may consist of a bunch of
// empty lines separated by LF. Need to account for that.
QString res = generated_code;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QString res2 = res.split("\n", Qt::SkipEmptyParts).join("").replace(" ", "");
#else
QString res2 = res.split("\n", QString::SkipEmptyParts).join("").replace(" ", "");
#endif
if (res2.isEmpty()) res = all_errors.join("\n");
return res;
}

View File

@ -755,9 +755,11 @@ int main(int argc, char * const *argv)
usage_import();
exit(1);
}
QStringList components = QString::fromUtf8(object.c_str())
.split("/", QString::SkipEmptyParts);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList components = QString::fromUtf8(object.c_str()).split("/", Qt::SkipEmptyParts);
#else
QStringList components = QString::fromUtf8(object.c_str()).split("/", QString::SkipEmptyParts);
#endif
string fw_name = components.last().toUtf8().constData();
Library *library = nullptr;

View File

@ -148,8 +148,11 @@ void PFImporter::run()
*/
QString list_str = list_of_items.cap(1);
list_str.replace(",", "");
QStringList items = list_str.split(QRegExp("\\s"),
QString::SkipEmptyParts);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList items = list_str.split(QRegExp("\\s"), Qt::SkipEmptyParts);
#else
QStringList items = list_str.split(QRegExp("\\s"), QString::SkipEmptyParts);
#endif
qDebug() << items;
bool has_address = false;

View File

@ -178,7 +178,11 @@ string NATCompiler_ipt::PrintRule::_printRuleLabel(NATRule *rule)
/* do not put comment in the script if it is intended for linksys */
if (!nocomm || compiler->inSingleRuleCompileMode())
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList comm = QString(rule->getComment().c_str()).split("\n", Qt::SkipEmptyParts);
#else
QStringList comm = QString(rule->getComment().c_str()).split("\n", QString::SkipEmptyParts);
#endif
foreach(QString line, comm)
{
res << "# " << line.toStdString() << endl;

View File

@ -483,7 +483,11 @@ QString OSConfigurator_linux24::addressTableWrapper(FWObject *rule,
int pos = address_table_re.indexIn(command);
if (pos > -1)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList command_lines = QString(command).split("\n", Qt::SkipEmptyParts);
#else
QStringList command_lines = QString(command).split("\n", QString::SkipEmptyParts);
#endif
if (command_lines.size() > 1)
{
command_lines.push_front("{");
@ -570,8 +574,11 @@ string OSConfigurator_linux24::printRunTimeWrappers(FWObject *rule,
if (!no_wrapper)
{
QStringList command_lines =
QString(combined_command).split("\n", QString::SkipEmptyParts);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList command_lines = QString(combined_command).split("\n", Qt::SkipEmptyParts);
#else
QStringList command_lines = QString(combined_command).split("\n", QString::SkipEmptyParts);
#endif
if (command_lines.size() > 1)
{
command_lines.push_front("{");

View File

@ -203,7 +203,11 @@ string PolicyCompiler_ipt::PrintRule::_printRuleLabel(PolicyRule *rule)
/* do not put comment in the script if it is intended for linksys */
if (!nocomm || compiler->inSingleRuleCompileMode())
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList comm = QString(rule->getComment().c_str()).split("\n", Qt::SkipEmptyParts);
#else
QStringList comm = QString(rule->getComment().c_str()).split("\n", QString::SkipEmptyParts);
#endif
foreach(QString line, comm)
{
res << "# " << line.toStdString() << endl;

View File

@ -361,8 +361,13 @@ void FirewallInstaller::packSSHArgs(QStringList &args)
#endif
if (!cnf->sshArgs.isEmpty())
if (!cnf->sshArgs.isEmpty()) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
args += cnf->sshArgs.split(" ", Qt::SkipEmptyParts);
#else
args += cnf->sshArgs.split(" ", QString::SkipEmptyParts);
#endif
}
if (cnf->verbose) args.push_back("-v");
@ -469,8 +474,13 @@ void FirewallInstaller::packSCPArgs(const QString &local_name,
#endif
if (!cnf->scpArgs.isEmpty())
if (!cnf->scpArgs.isEmpty()) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
args += cnf->scpArgs.split(" ", Qt::SkipEmptyParts);
#else
args += cnf->scpArgs.split(" ", QString::SkipEmptyParts);
#endif
}
args.push_back("-q");
@ -604,7 +614,11 @@ void FirewallInstaller::executeExternalInstallScript(const QString &command,
args.push_back(wdir);
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
args += script_args.trimmed().split(" ", Qt::SkipEmptyParts);
#else
args += script_args.trimmed().split(" ", QString::SkipEmptyParts);
#endif
args.push_back(cnf->fwobj->getName().c_str());

View File

@ -248,11 +248,14 @@ void FirewallInstallerCisco::activatePolicy(const QString&, const QString&)
replaceMacrosInCommand(&post_config);
ssh_object->loadPreConfigCommands(
pre_config.expand().split("\n", QString::SkipEmptyParts) );
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
ssh_object->loadPreConfigCommands( pre_config.expand().split("\n", Qt::SkipEmptyParts) );
ssh_object->loadPostConfigCommands( post_config.expand().split("\n", Qt::SkipEmptyParts) );
#else
ssh_object->loadPreConfigCommands( pre_config.expand().split("\n", QString::SkipEmptyParts) );
ssh_object->loadPostConfigCommands( post_config.expand().split("\n", QString::SkipEmptyParts) );
#endif
ssh_object->loadPostConfigCommands(
post_config.expand().split("\n", QString::SkipEmptyParts) );
Configlet activation(host_os, os_family, "installer_commands_reg_user");
activation.removeComments();
@ -271,8 +274,11 @@ void FirewallInstallerCisco::activatePolicy(const QString&, const QString&)
config_lines.join("\n"));
}
ssh_object->loadActivationCommands(
activation.expand().split("\n", QString::SkipEmptyParts) );
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
ssh_object->loadActivationCommands( activation.expand().split("\n", Qt::SkipEmptyParts) );
#else
ssh_object->loadActivationCommands( activation.expand().split("\n", QString::SkipEmptyParts) );
#endif
runSSHSession(ssh_object);

View File

@ -207,11 +207,13 @@ void FirewallInstallerJuniper::activatePolicy(const QString&, const QString&)
replaceMacrosInCommand(&post_config);
ssh_object->loadPreConfigCommands(
pre_config.expand().split("\n", QString::SkipEmptyParts) );
ssh_object->loadPostConfigCommands(
post_config.expand().split("\n", QString::SkipEmptyParts) );
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
ssh_object->loadPreConfigCommands( pre_config.expand().split("\n", Qt::SkipEmptyParts) );
ssh_object->loadPostConfigCommands( post_config.expand().split("\n", Qt::SkipEmptyParts) );
#else
ssh_object->loadPreConfigCommands( pre_config.expand().split("\n", QString::SkipEmptyParts) );
ssh_object->loadPostConfigCommands( post_config.expand().split("\n", QString::SkipEmptyParts) );
#endif
Configlet activation(host_os, os_family, "installer_commands_reg_user");
activation.removeComments();
@ -227,8 +229,11 @@ void FirewallInstallerJuniper::activatePolicy(const QString&, const QString&)
config_lines.join("\n"));
}
ssh_object->loadActivationCommands(
activation.expand().split("\n", QString::SkipEmptyParts) );
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
ssh_object->loadActivationCommands( activation.expand().split("\n", Qt::SkipEmptyParts) );
#else
ssh_object->loadActivationCommands( activation.expand().split("\n", QString::SkipEmptyParts) );
#endif
runSSHSession(ssh_object);

View File

@ -206,11 +206,13 @@ void FirewallInstallerProcurve::activatePolicy(const QString&, const QString&)
replaceMacrosInCommand(&post_config);
ssh_object->loadPreConfigCommands(
pre_config.expand().split("\n", QString::SkipEmptyParts) );
ssh_object->loadPostConfigCommands(
post_config.expand().split("\n", QString::SkipEmptyParts) );
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
ssh_object->loadPreConfigCommands( pre_config.expand().split("\n", Qt::SkipEmptyParts) );
ssh_object->loadPostConfigCommands( post_config.expand().split("\n", Qt::SkipEmptyParts) );
#else
ssh_object->loadPreConfigCommands( pre_config.expand().split("\n", QString::SkipEmptyParts) );
ssh_object->loadPostConfigCommands( post_config.expand().split("\n", QString::SkipEmptyParts) );
#endif
Configlet activation(host_os, os_family, "installer_commands_reg_user");
activation.removeComments();
@ -226,8 +228,13 @@ void FirewallInstallerProcurve::activatePolicy(const QString&, const QString&)
config_lines.join("\n"));
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
ssh_object->loadActivationCommands(
activation.expand().split("\n", Qt::SkipEmptyParts) );
#else
ssh_object->loadActivationCommands(
activation.expand().split("\n", QString::SkipEmptyParts) );
#endif
runSSHSession(ssh_object);

View File

@ -996,7 +996,11 @@ static bool filterMatchesCommand(const QString &text,
QRegExp rx("(?:(port)|(ip)):(.*)", Qt::CaseInsensitive);
if (!rx.exactMatch(text)) return false;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList args = rx.cap(3).split(",", Qt::SkipEmptyParts);
#else
QStringList args = rx.cap(3).split(",", QString::SkipEmptyParts);
#endif
if (rx.pos(1) != -1)
return (filterMatchesPortRange(args, item->getFWObject()));

View File

@ -565,7 +565,11 @@ void SSHSession::readFromStdout()
QString lastLine = "";
// split on LF
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
QStringList bufLines = buf.split("\n", Qt::KeepEmptyParts);
#else
QStringList bufLines = buf.split("\n", QString::KeepEmptyParts);
#endif
// if buf ends with a LF character, the last element in the list is
// an empty string

View File

@ -210,7 +210,12 @@ Can't compile firewall policy."),
args.push_back(compiler.c_str());
QString qs = fwopt->getStr("cmdline").c_str();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
args += qs.split(" ", Qt::SkipEmptyParts);
#else
args += qs.split(" ", QString::SkipEmptyParts);
#endif
args.push_back("-v");
args.push_back("-f");