[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: list separator in config entries
From: "Thomas Braxton" <kde.braxton () gmail ! com>
Date: 2007-10-12 18:44:40
Message-ID: 928c3f1b0710121144o1079b85ehc1e19bd1f2243026 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Has this been fixed yet? If not I'll commit this patch tommorrow.
[Attachment #5 (text/html)]
Has this been fixed yet? If not I'll commit this patch tommorrow.
["listfix.diff" (application/octet-stream)]
Index: kconfiggroup.cpp
===================================================================
--- kconfiggroup.cpp (revision 724209)
+++ kconfiggroup.cpp (working copy)
@@ -687,15 +687,16 @@
const QString escaped = QString(separator).prepend(QLatin1Char('\\'));
QStringList value;
- if (!data.contains(escaped)) {
- value = data.split(separator); // easy no escaped separators
+ if (!data.contains(escaped)) { // easy no escaped separators
+ foreach (QString s, data.split(separator))
+ value << s.replace("\\x5c", "\\");
} else {
// now look out for escaped separators
for(int i=0; i < data.size(); /* nothing */) {
int end = data.indexOf(separator, i);
again:
if (end < 0) { // no more separators found, end of entry
- value << data.mid(i).replace(escaped, separator);
+ value << data.mid(i).replace(escaped, separator).replace("\\x5c", "\\");
i = data.size();
} else if (end == 0) { // empty first element
value << QString();
@@ -704,7 +705,7 @@
end = data.indexOf(separator, end+1);
goto again;
} else {
- value << data.mid(i, end-i).replace(escaped, separator);
+ value << data.mid(i, end-i).replace(escaped, separator).replace("\\x5c", "\\");
i = end+1;
}
}
@@ -995,8 +996,13 @@
QList<QByteArray> balist;
- foreach(const QString &entry, list)
- balist.append(entry.toUtf8());
+ foreach(const QString &entry, list) {
+ if (entry.endsWith("\\")) {
+ QString s = entry;
+ balist << s.replace(s.lastIndexOf('\\'), 1, "\\x5c").toUtf8();
+ } else
+ balist << entry.toUtf8();
+ }
writeEntry(key, KConfigGroupPrivate::convertList(balist, sep), flags);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic