From 87e7e88f901430312b697131a1e7d54f60e8678f Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 12 Apr 2012 17:39:57 +0300 Subject: [PATCH] Change rpmfi replaced size functions to take index - Further preliminaries to handle file conflicts within a package. - These are internal-only interfaces so we can just change without bothering with compat wrappers. --- lib/rpmfi.c | 12 ++++++------ lib/rpmfi_internal.h | 4 ++-- lib/transaction.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/rpmfi.c b/lib/rpmfi.c index f8e2c22..42c07db 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -1239,23 +1239,23 @@ errxit: return NULL; } -void rpmfiSetFReplacedSize(rpmfi fi, rpm_loff_t newsize) +void rpmfiSetFReplacedSizeIndex(rpmfi fi, int ix, rpm_loff_t newsize) { - if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) { + if (fi != NULL && ix >= 0 && ix < fi->fc) { if (fi->replacedSizes == NULL) { fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes)); } /* XXX watch out, replacedSizes is not rpm_loff_t (yet) */ - fi->replacedSizes[fi->i] = (rpm_off_t) newsize; + fi->replacedSizes[ix] = (rpm_off_t) newsize; } } -rpm_loff_t rpmfiFReplacedSize(rpmfi fi) +rpm_loff_t rpmfiFReplacedSizeIndex(rpmfi fi, int ix) { rpm_loff_t rsize = 0; - if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) { + if (fi != NULL && ix >= 0 && ix < fi->fc) { if (fi->replacedSizes) { - rsize = fi->replacedSizes[fi->i]; + rsize = fi->replacedSizes[ix]; } } return rsize; diff --git a/lib/rpmfi_internal.h b/lib/rpmfi_internal.h index 9610d50..e945d46 100644 --- a/lib/rpmfi_internal.h +++ b/lib/rpmfi_internal.h @@ -159,10 +159,10 @@ RPM_GNUC_INTERNAL int rpmfiConfigConflictIndex(rpmfi fi, int ix); RPM_GNUC_INTERNAL -void rpmfiSetFReplacedSize(rpmfi fi, rpm_loff_t newsize); +void rpmfiSetFReplacedSizeIndex(rpmfi fi, int ix, rpm_loff_t newsize); RPM_GNUC_INTERNAL -rpm_loff_t rpmfiFReplacedSize(rpmfi fi); +rpm_loff_t rpmfiFReplacedSizeIndex(rpmfi fi, int ix); RPM_GNUC_INTERNAL void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc); diff --git a/lib/transaction.c b/lib/transaction.c index 4e89651..44bdb24 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -345,7 +345,7 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfi fi, rpmFileAction action = rpmfiDecideFate(otherFi, fi, skipMissing); rpmfsSetAction(fs, fx, action); } - rpmfiSetFReplacedSize(fi, rpmfiFSize(otherFi)); + rpmfiSetFReplacedSizeIndex(fi, fx, rpmfiFSize(otherFi)); } /** @@ -552,7 +552,7 @@ assert(otherFi != NULL); /* Update disk space info for a file. */ rpmtsUpdateDSI(ts, fiFps->entry->dev, fiFps->entry->dirName, - rpmfiFSize(fi), rpmfiFReplacedSize(fi), + rpmfiFSize(fi), rpmfiFReplacedSizeIndex(fi, i), fixupSize, rpmfsGetAction(fs, i)); } -- 2.7.4