Skip to content

Commit

Permalink
Fix logic of the new string parsing
Browse files Browse the repository at this point in the history
There was an off-by-one on every look-up, making it always find the
first ; and returning empty strings all over the place.
  • Loading branch information
aleixpol committed Jan 10, 2018
1 parent e6e4cf4 commit be3472b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ QString Daemon::packageName(const QString &packageID)
QString Daemon::packageVersion(const QString &packageID)
{
QString ret;
int start = packageID.indexOf(QLatin1Char(';'));
int start = packageID.indexOf(QLatin1Char(';')) + 1;
if (start == -1) {
return ret;
}
Expand All @@ -249,11 +249,11 @@ QString Daemon::packageVersion(const QString &packageID)
QString Daemon::packageArch(const QString &packageID)
{
QString ret;
int start = packageID.indexOf(QLatin1Char(';'));
int start = packageID.indexOf(QLatin1Char(';')) + 1;
if (start == -1) {
return ret;
}
start = packageID.indexOf(QLatin1Char(';'), start);
start = packageID.indexOf(QLatin1Char(';'), start) + 1;
if (start == -1) {
return ret;
}
Expand All @@ -268,15 +268,15 @@ QString Daemon::packageArch(const QString &packageID)
QString Daemon::packageData(const QString &packageID)
{
QString ret;
int start = packageID.indexOf(QLatin1Char(';'));
int start = packageID.indexOf(QLatin1Char(';')) + 1;
if (start == -1) {
return ret;
}
start = packageID.indexOf(QLatin1Char(';'), start);
start = packageID.indexOf(QLatin1Char(';'), start) + 1;
if (start == -1) {
return ret;
}
start = packageID.indexOf(QLatin1Char(';'), start);
start = packageID.indexOf(QLatin1Char(';'), start) + 1;
if (start == -1) {
return ret;
}
Expand Down

0 comments on commit be3472b

Please sign in to comment.