QXmlInputSource is deprecated in qt5.15. Port it to QXmlStreamReader
ClosedPublic

Authored by mlaurent on Jan 24 2020, 7:18 AM.

Details

Summary

QXmlInputSource is deprecated in qt5.15

Test Plan

autotest ok

Diff Detail

Repository
R237 KConfig
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mlaurent created this revision.Jan 24 2020, 7:18 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 24 2020, 7:18 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
mlaurent requested review of this revision.Jan 24 2020, 7:18 AM
mlaurent edited the test plan for this revision. (Show Details)Jan 24 2020, 7:18 AM
mlaurent added a reviewer: dfaure.
apol added a subscriber: apol.Jan 24 2020, 2:33 PM

Looks good otherwise, this code is pretty well tested too, so I quite trust we aren't breaking it horribly.

Trying to compile the rest of KDE Software against this patch would also be useful.

src/gui/kconfigloader.cpp
125–131

You can trim before toString, this way we save some string allocations.

mlaurent updated this revision to Diff 74348.Jan 25 2020, 7:51 AM

Trim better calling toString()

mlaurent updated this revision to Diff 74349.Jan 25 2020, 8:01 AM

We need to open QIODevice. Now all works correctly after rebuilding all

apol added inline comments.Jan 26 2020, 1:14 PM
src/gui/kconfigloader.cpp
77

No need to construct a QString if it's just to check if it's empty.

105–106

This comparison doesn't need to be onto a converted QString. You can compare against the QStringRef and use QStringRef::compare to make it case insensitive.

138–139

Use QStringRef::compare()

193–194

I'd also use QStringRef::compare here

mlaurent marked 4 inline comments as done.Jan 27 2020, 6:23 AM
mlaurent updated this revision to Diff 74406.Jan 27 2020, 6:27 AM

Use QStringRef::compare

apol added inline comments.Jan 27 2020, 2:19 PM
src/gui/kconfigloader.cpp
124–125

You can use QStringRef::compare() in this if sequence over here too.

mlaurent updated this revision to Diff 74428.Jan 27 2020, 2:23 PM

Use QStringRef here too

apol accepted this revision.Jan 27 2020, 2:55 PM
This revision is now accepted and ready to land.Jan 27 2020, 2:55 PM
This revision was automatically updated to reflect the committed changes.
kossebau added inline comments.
src/gui/kconfigloader.cpp
87

This logic is inverted., no? We should be at token document end when reader.atEnd() turns true. In any case on successful parse this condition is met here and false returned.

No caller seems to check the return value of ConfigLoaderHandler::parse(), thus nobody noticed?