Get rid of adding 'char' to a string pointer
ClosedPublic

Authored by yurchor on Sep 27 2018, 5:07 AM.

Details

Summary

In remoteLister.cpp:54 a char (address separator) is added to a pointer.

This patch allows to fix clang warning "adding 'char' to a string pointer does not append to the string"

https://build.kde.org/job/Applications/job/filelight/job/kf5-qt5%20FreeBSDQt5.11/5/warnings12Result/NORMAL/

Test Plan

Start Filelight and try to analyze some folder, seems to work as before.

Diff Detail

Repository
R352 Filelight
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
yurchor created this revision.Sep 27 2018, 5:07 AM
Restricted Application added a subscriber: kde-utils-devel. · View Herald TranscriptSep 27 2018, 5:07 AM
yurchor requested review of this revision.Sep 27 2018, 5:07 AM
mlaurent requested changes to this revision.Oct 8 2018, 5:08 AM

Better to use new Folder(QString(name + '/').toUtf8().conData()
Regards

This revision now requires changes to proceed.Oct 8 2018, 5:08 AM

Better to use new Folder(QString(name + '/').toUtf8().conData()
Regards

folder(new Folder(QString(name + '/').toUtf8().constData()))

does not compile:

no known conversion for argument 2 from ‘QChar*’ to ‘char*&’

Perhaps QString(name + QLatin1Char('/')).toUtf8().constData();

Perhaps QString(name + QLatin1Char('/')).toUtf8().constData();

This compiles even without QString(). Thanks.

P. S. I'm not an expert, but isn't it again adding a char to a pointer?

yurchor updated this revision to Diff 43103.Oct 8 2018, 6:17 AM

Reorganize according to the proposal.

mlaurent accepted this revision.Oct 8 2018, 6:45 AM
This revision is now accepted and ready to land.Oct 8 2018, 6:45 AM
This revision was automatically updated to reflect the committed changes.