Don't use automatic string conversions

* Disables automatic conversions from 8-bit strings (char *) to unicode
  QStrings.
* Disables automatic conversion from QString to 8-bit strings (char *).
* Disables automatic conversions from QByteArray to const char * or const
  void *.
* Disables automatic conversions from QString (or char *) to QUrl.
* Use QStringBuilder for more efficient string creation.

It make us aware of string and encoding conversions.
This commit is contained in:
Luís Pereira
2018-07-30 19:32:53 +01:00
committed by Chih-Hsuan Yen
parent e3adf1abe2
commit c6880070e9
15 changed files with 177 additions and 172 deletions
+3 -3
View File
@@ -42,7 +42,7 @@ ShellCommand::ShellCommand(const QString & fullCommand)
QChar ch = fullCommand[i];
const bool isLastChar = ( i == fullCommand.count() - 1 );
const bool isQuote = ( ch == '\'' || ch == '\"' );
const bool isQuote = ( ch == QLatin1Char('\'') || ch == QLatin1Char('\"') );
if ( !isLastChar && isQuote ) {
inQuotes = !inQuotes;
@@ -68,7 +68,7 @@ ShellCommand::ShellCommand(const QString & command , const QStringList & argumen
}
QString ShellCommand::fullCommand() const
{
return _arguments.join(QChar(' '));
return _arguments.join(QLatin1Char(' '));
}
QString ShellCommand::command() const
{
@@ -153,7 +153,7 @@ static bool expandEnv( QString & text )
int len = pos2 - pos;
QString key = text.mid( pos+1, len-1);
QString value =
QString::fromLocal8Bit( ::getenv(key.toLocal8Bit()) );
QString::fromLocal8Bit( qgetenv(key.toLocal8Bit().constData()) );
if ( !value.isEmpty() ) {
expanded = true;