From: Tomas Mlcoch Date: Fri, 27 Jan 2012 11:36:43 +0000 (+0100) Subject: Fix 'time modification' while getting changelogs X-Git-Tag: upstream/0.2.1~572 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5389685f352cd4a55fb8516197512872af14a7cc;p=services%2Fcreaterepo_c.git Fix 'time modification' while getting changelogs --- diff --git a/parsehdr.c b/parsehdr.c index 312f4c4..28bb943 100644 --- a/parsehdr.c +++ b/parsehdr.c @@ -309,13 +309,6 @@ Package *parse_header(Header hdr, gint64 mtime, gint64 size, const char *checksu (changelog_limit > 0)) { gint64 time = rpmtdGetNumber(changelogtimes); - if (last_time == time) { - time += time_offset; - time_offset++; - } else { - last_time = time; - time_offset = 1; - } ChangelogEntry *changelog = changelog_entry_new(); changelog->author = rpmtdGetString(changelognames); @@ -324,8 +317,23 @@ Package *parse_header(Header hdr, gint64 mtime, gint64 size, const char *checksu pkg->changelogs = g_slist_prepend(pkg->changelogs, changelog); changelog_limit--; - } + // If a previous entry has the same time, increment time of the previous + // entry by one. Ugly but works! + if (last_time == time) { + int tmp_time = time; + GSList *previous = pkg->changelogs; + while ((previous = g_slist_next(previous)) != NULL && + ((ChangelogEntry *) (previous->data))->date == tmp_time) { + ((ChangelogEntry *) (previous->data))->date++; + tmp_time++; + } + } else { + last_time = time; + } + + + } //pkg->changelogs = g_slist_reverse (pkg->changelogs); }