Clean up string casts
ClosedPublic

Authored by gladhorn on Jul 11 2018, 9:48 PM.

Details

Summary

Compile without casting to/from ascii to avoid typical mistakes due to
implicit conversions. Fix a bunch of dubious places.

Test Plan

Things compile, tests run.

Diff Detail

Repository
R110 KScreen Library
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 774
Build 787: arc lint + arc unit
gladhorn created this revision.Jul 11 2018, 9:48 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 11 2018, 9:48 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
gladhorn requested review of this revision.Jul 11 2018, 9:48 PM
davidedmundson accepted this revision.Jul 11 2018, 9:55 PM
davidedmundson added a subscriber: davidedmundson.

cool, thanks.

tests/kwayland/waylandtestserver.cpp
39

shouldn't that be a QStringLiteral?

This revision is now accepted and ready to land.Jul 11 2018, 9:55 PM
autotests/testkwaylandbackend.cpp
88

Why true?

autotests/testlog.cpp
52

I thought when concatenating the advantage of QStringLiteral don't cut it since you already have a string so should be QLatin1String instead?

autotests/testqscreenbackend.cpp
62

Not from local 8 bit?

174–175

Could use initializer list

autotests/testscreenconfig.cpp
104

QLatin1String?

backends/fake/parser.cpp
187–189

QLatin1String?

backends/xrandr1.1/xrandr11.cpp
174

QLatin1Char?

gladhorn marked 3 inline comments as done.Jul 12 2018, 6:47 AM
gladhorn added inline comments.
autotests/testkwaylandbackend.cpp
88

Indeed, that makes no sense.

autotests/testlog.cpp
52

You are right.

autotests/testqscreenbackend.cpp
174–175

I feel the change is big enough as it is :)

backends/fake/parser.cpp
187–189

My understanding is that since it's a QMap<QString, ..> all things will be converted to QString in any case.

gladhorn updated this revision to Diff 37616.Jul 12 2018, 6:48 AM
gladhorn marked 2 inline comments as done.

Fixed some of Kai's comments, some minor things are still to do.

gladhorn added inline comments.Jul 12 2018, 6:50 AM
tests/kwayland/waylandtestserver.cpp
39

Concatenation is still faster with latin1string.

anthonyfieroni added inline comments.
backends/fake/parser.cpp
145

It should be QLatin1String on contains?

zzag added a subscriber: zzag.Jul 12 2018, 7:08 AM
zzag added inline comments.

I think micro-optimizing the tests further is simply not worth anyone's time. I'd propose taking this in (and if you spot more things, do them on top of this change).

davidedmundson accepted this revision.Jul 12 2018, 9:00 AM

I think micro-optimizing the tests further is simply not worth anyone's time

Me too.
Previous +2 applies

This revision was automatically updated to reflect the committed changes.