Project

General

Profile

Bug #365

Replace QString("...").arg(param1).arg(param2) with QString("...").arg(param1,param2) everywhere

Added by Sputnick about 16 years ago. Updated almost 16 years ago.

Status:
Resolved
Priority:
Immediate
Assignee:
Category:
Quassel Core
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Version:
0.13.1
OS:
Any

Description

[10:26:13] <coekie> it might be a good idea to replace QString("...").arg(param1).arg(param2) with QString("...").arg(param1,param2) everywhere
[10:26:33] <coekie> I haven't found anything concrete really dangerous with that, but it's a real recipe for trouble
[10:26:37] <Sput> why is that?
[10:27:18] <coekie> worst I see is that trying to ban "sel" on channel "#quas%2", will actually set the mode on #quassel
[10:27:48] <coekie> the code says: QString("MODE %1 +b %2").arg(banChannel).arg(banUser);
[10:27:53] <Sput> but arg(QString, QString) is just a convenience wrapper for arg(QString).arg(QString)
[10:27:59] <Sput> isn't it?
[10:28:11] <coekie> no, the api docs even say why :)
[10:28:28] <coekie> "this is the same as str.arg(a1).arg(a2), except that the strings a1 and a2 are replaced in one pass. This can make a difference if a1 contains e.g. %1"
[10:28:35] <Sput> oh
[10:28:57] Sput trackers
[10:29:17] <coekie> and String("MODE %1 +b %2").arg("#quas%2") -> QString("MODE #quas%2 +b %2").arg("sel") -> QString("MODE #quassel +b sel")
[10:30:03] <coekie> as I said, nothing dangerous right now, but if you do it everywhere, you might end up doing it somewhere where it *is
dangerous :)
[10:45:09] <coekie> uhm, trying to part #test%2 makes my client go aware
[10:47:37] <coekie> awire = client keeps printing "Invalid format code in string: coekieq () has left #coekietest%ttp://quassel-irc.org - ..." and doesn't respond anymore

Associated revisions

Revision 7cfd704e (diff)
Added by Manuel Nickschas about 16 years ago

Fixing .arg().arg() in UserInputHandler, fixes BR #365

Also available in: Atom PDF