[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/sysadmin/libqapt/src
From: Jonathan Michael Thomas <echidnaman () kubuntu ! org>
Date: 2011-01-06 14:24:10
Message-ID: 20110106142410.B7D86AC8B0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1212315 by jmthomas:
Use a pkgTagSection object from libapt-pkg to parse the control field instead of rolling our own.
M +9 -7 package.cpp
--- trunk/extragear/sysadmin/libqapt/src/package.cpp #1212314:1212315
@@ -512,17 +512,19 @@
pkgRecords::Parser &rec = d->records->Lookup(ver.FileList());
const char *start, *stop;
rec.GetRec(start, stop);
+
+ pkgTagSection sec;
QString record(start);
- QStringList lines = record.split(QLatin1Char('\n'));
-
- Q_FOREACH (const QString &line, lines) {
- if (line.startsWith(name)) {
- field = line.split(QLatin1String(": ")).at(1);
- break;
+ if(!sec.Scan(start, stop-start+1)) {
+ return field;
}
- }
+ field = QString::fromStdString(sec.FindS(name.latin1()));
+
+ // Can replace the above with this if my APT patch gets accepted
+ // field = QString::fromStdString(rec.RecordField(name.latin1()));
+
return field;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic