return _formatCodes.key(ftype);
}
-UiStyle::StyledText UiStyle::styleString(QString s) {
+UiStyle::StyledText UiStyle::styleString(const QString &_s) {
+ QString s = _s; // we can't use call-by-value since this seems to maybe screw up Qt's implicit sharing somehow
+ // at least invalid formats are created if we do that
+
StyledText result;
QList<FormatType> fmtList;
fmtList.append(None);
curFmtRng.format = format(None);
curFmtRng.start = 0;
result.formats.append(curFmtRng);
- int pos = 0; int length;
+ int pos = 0; int length = 0;
int fgCol = -1, bgCol = -1; // marks current mIRC color
for(;;) {
pos = s.indexOf('%', pos);