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

Authored by dfaure on Oct 2 2018, 12:53 AM.

Details

Summary

The code is even simpler this way.

Found by using heaptrack.

Test Plan

the unittest for rgb still passes.

Diff Detail

Repository
R287 KImageFormats
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 3412
Build 3430: arc lint + arc unit
dfaure created this revision.Oct 2 2018, 12:53 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptOct 2 2018, 12:53 AM
Restricted Application edited subscribers, added: kde-frameworks-devel; removed: Frameworks. · View Herald Transcript
dfaure requested review of this revision.Oct 2 2018, 12:53 AM
cfeck accepted this revision.Oct 2 2018, 1:31 AM
cfeck added inline comments.
src/imageformats/rgb.cpp
702

head[i] → head.at(i)

This revision is now accepted and ready to land.Oct 2 2018, 1:31 AM
dfaure added inline comments.Oct 2 2018, 3:26 AM
src/imageformats/rgb.cpp
702

This would make no difference, given that I made head const...

jtamate added a subscriber: jtamate.Oct 2 2018, 6:48 AM
jtamate added inline comments.
src/imageformats/rgb.cpp
702

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.

cfeck added inline comments.Oct 2 2018, 12:13 PM
src/imageformats/rgb.cpp
702

head is a QByteArray, not a QString.

dfaure closed this revision.Oct 2 2018, 10:51 PM