D24349: More (and last) fixes to compile without implicit conversion from ASCII/ByteArray

David Faure noreply at phabricator.kde.org
Sun Nov 24 15:40:10 GMT 2019


dfaure requested changes to this revision.
dfaure added a comment.
This revision now requires changes to proceed.


  Thanks!

INLINE COMMENTS

> forwardingslavebase.cpp:91
>  
> -    if (url.scheme() == q->mProtocol) {
> +    if (url.scheme() == QString::fromLatin1(q->mProtocol)) {
>          result = q->rewriteUrl(url, newURL);

QLatin1String is sufficient for comparisons (and cheaper)

> kremoteencoding.cpp:95
>  
>  const char *KRemoteEncoding::encoding() const
>  {

KF6 TODO: return QByteArray

> slavebase.h:979
>      QByteArray mProtocol;
> +    inline const QString mProtocolToStr() {
> +        return QString::fromLatin1(mProtocol);

This method should be const

> ftp.cpp:1232
>      if (!isfile) {
> -        ftpFolder(remoteEncoding()->directory(url), false);    // ignore errors
> +        ftpFolder(QString::fromLocal8Bit(remoteEncoding()->directory(url)), false);    // ignore errors
>      }

Should this be remoteEncoding()->decode(...) given that the method will then use q->remoteEncoding()->encode()?

(I'm a bit confused with kremoteencoding, I could be wrong)

> kcookiespolicies.cpp:367
> +    if (mUi.rbPolicyAccept->isChecked()) {
> +        advice = QString::fromLocal8Bit(KCookieAdvice::adviceToStr(KCookieAdvice::Accept));
> +    } else if (mUi.rbPolicyAcceptForSession->isChecked()) {

fromLatin1 is enough for adviceToStr, like you did on line 177 (so it's inconsistent)

(repeats 3 more times)

> smbrodlg.cpp:122
>        unsigned int num = ((a1 & 0x3F) << 10) | ((a2& 0x1F) << 5) | (a3 & 0x1F);
> -      password[i] = QChar((uchar)((num - 17) ^ 173)); // restore
> +      password[i] = QChar(QLatin1Char((num - 17) ^ 173)); // restore
>     }

You could remove the QChar() around I guess.

> main.cpp:199
>      for (; it != fileList.end() ; ++it) {
> -        QFileInfo info(QFile::encodeName(it->path));
> +        QFileInfo info(QString::fromLocal8Bit(QFile::encodeName(it->path)));
>          it->time = info.lastModified();

Ouch.

  QFileInfo info(it->path)

should be enough.

> main.cpp:262
>              qDebug() << sleepSecs << "seconds have passed, deleting" << info.filePath();
> -            QFile(QFile::encodeName(src)).remove();
> +            QFile(QString::fromLocal8Bit(QFile::encodeName(src))).remove();
>              // NOTE: this is not necessarily a temporary directory.

Same here

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D24349

To: ahmadsamir, dfaure, #frameworks
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191124/d8225c5a/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list