Skip to content

Commit

Permalink
qt6: Remove QRegExp from a couple of string replacements. (programs)
Browse files Browse the repository at this point in the history
These are simple string substitutions that don't use any of the
features of regular expressions.
  • Loading branch information
linuxdude42 committed Mar 7, 2021
1 parent 3fed50e commit ae301b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions mythtv/programs/mythbackend/httpstatus.cpp
Expand Up @@ -18,7 +18,6 @@

// Qt headers
#include <QTextStream>
#include <QRegExp>

// MythTV headers
#include "httpstatus.h"
Expand Down Expand Up @@ -1127,7 +1126,7 @@ int HttpStatus::PrintJobQueue( QTextStream &os, const QDomElement& jobs )
break;
}

QString sTitle = p.attribute( "title" , "" ); //.replace(QRegExp("\""), "&quot;");
QString sTitle = p.attribute( "title" , "" ); //.replace("\"", "&quot;");
QString sSubTitle = p.attribute( "subTitle", "" );
QDateTime startTs = MythDate::fromString( p.attribute( "startTime" ,"" ));
QDateTime endTs = MythDate::fromString( p.attribute( "endTime" ,"" ));
Expand Down Expand Up @@ -1261,7 +1260,7 @@ int HttpStatus::PrintMachineInfo( QTextStream &os, const QDomElement& info )
int nExpirable = g.attribute("expirable" , "0" ).toInt();
QString nDir = g.attribute("dir" , "" );

nDir.replace(QRegExp(","), ", ");
nDir.replace(",", ", ");

os << " Disk Usage Summary:<br />\r\n";
os << " <ul>\r\n";
Expand Down Expand Up @@ -1335,7 +1334,7 @@ int HttpStatus::PrintMachineInfo( QTextStream &os, const QDomElement& info )
QString nDir = g.attribute("dir" , "" );
QString id = g.attribute("id" , "" );

nDir.replace(QRegExp(","), ", ");
nDir.replace(",", ", ");


if (id != "total")
Expand Down
12 changes: 6 additions & 6 deletions mythtv/programs/mythfrontend/videoplayercommand.cpp
Expand Up @@ -18,9 +18,9 @@ namespace
QString ShellEscape(const QString &src)
{
return QString(src)
.replace(QRegExp("\""), "\\\"")
.replace(QRegExp("`"), "\\`")
.replace(QRegExp("\\$"), "\\$");
.replace("\"", "\\\"")
.replace("`", "\\`")
.replace("\\$", "\\$");
}

QString ExpandPlayCommand(const QString &command, const QString &filename)
Expand All @@ -40,14 +40,14 @@ namespace
QString default_handler =
gCoreContext->GetSetting("VideoDefaultPlayer");
if (tmp.contains("%s") && default_handler.contains("%s"))
default_handler = default_handler.replace(QRegExp("%s"), "");
tmp.replace(QRegExp("%d"), default_handler);
default_handler = default_handler.replace("%s", "");
tmp.replace("%d", default_handler);
}

QString arg = QString("\"%1\"").arg(ShellEscape(filename));

if (tmp.contains("%s"))
return tmp.replace(QRegExp("%s"), arg);
return tmp.replace("%s", arg);

return QString("%1 %2").arg(tmp).arg(arg);
}
Expand Down

0 comments on commit ae301b2

Please sign in to comment.