D15890: kimg_rgb: optimize away QRegExp and QString::fromLocal8Bit.

Jaime Torres Amate noreply at phabricator.kde.org
Tue Oct 2 07:49:00 BST 2018


jtamate added inline comments.

INLINE COMMENTS

> rgb.cpp:702
>  
> -    const QRegExp regexp(QLatin1String("^\x01\xda\x01[\x01\x02]"));
> -    QString data(QString::fromLocal8Bit(head));
> -
> -    return data.contains(regexp);
> +    return head.size() >= 4 && head.startsWith("\x01\xda\x01") && (head[3] == 1 || head[3] == 2);
>  }

Shouldn't it be QLatin1String("\x01\xda\x01")?
startsWith has a QLatin1String overloaded method, but will it be used if a char* is used as argument or will it use the QString method? I just don't know the answer.
Otherwise, +1.

REPOSITORY
  R287 KImageFormats

BRANCH
  master

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

To: dfaure, cfeck
Cc: jtamate, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181002/cda7a9ee/attachment.html>


More information about the Kde-frameworks-devel mailing list