Add support for 64bit sizes to rpmfi[SG]etFReplacedSizeIndex
This commit is contained in:
parent
f5d3a4b8a4
commit
6e6e4e95f8
24
lib/rpmfi.c
24
lib/rpmfi.c
|
@ -1078,6 +1078,7 @@ rpmfi rpmfiFree(rpmfi fi)
|
||||||
fi->fflags = _free(fi->fflags);
|
fi->fflags = _free(fi->fflags);
|
||||||
fi->vflags = _free(fi->vflags);
|
fi->vflags = _free(fi->vflags);
|
||||||
fi->fsizes = _free(fi->fsizes);
|
fi->fsizes = _free(fi->fsizes);
|
||||||
|
fi->lfsizes = _free(fi->lfsizes);
|
||||||
fi->frdevs = _free(fi->frdevs);
|
fi->frdevs = _free(fi->frdevs);
|
||||||
fi->finodes = _free(fi->finodes);
|
fi->finodes = _free(fi->finodes);
|
||||||
|
|
||||||
|
@ -1094,6 +1095,7 @@ rpmfi rpmfiFree(rpmfi fi)
|
||||||
fi->apath = _free(fi->apath);
|
fi->apath = _free(fi->apath);
|
||||||
|
|
||||||
fi->replacedSizes = _free(fi->replacedSizes);
|
fi->replacedSizes = _free(fi->replacedSizes);
|
||||||
|
fi->replacedLSizes = _free(fi->replacedLSizes);
|
||||||
|
|
||||||
fi->h = headerFree(fi->h);
|
fi->h = headerFree(fi->h);
|
||||||
|
|
||||||
|
@ -1293,11 +1295,23 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags)
|
||||||
void rpmfiSetFReplacedSizeIndex(rpmfi fi, int ix, rpm_loff_t newsize)
|
void rpmfiSetFReplacedSizeIndex(rpmfi fi, int ix, rpm_loff_t newsize)
|
||||||
{
|
{
|
||||||
if (fi != NULL && ix >= 0 && ix < fi->fc) {
|
if (fi != NULL && ix >= 0 && ix < fi->fc) {
|
||||||
if (fi->replacedSizes == NULL) {
|
/* Switch over to 64 bit variant */
|
||||||
fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
|
if (newsize > UINT32_MAX && fi->replacedLSizes == NULL) {
|
||||||
|
fi->replacedLSizes = xcalloc(fi->fc, sizeof(*fi->replacedLSizes));
|
||||||
|
/* copy 32 bit data */
|
||||||
|
if (fi->replacedSizes) {
|
||||||
|
for (int i=0; i<fi->fc; i++)
|
||||||
|
fi->replacedLSizes[i] = fi->replacedSizes[i];
|
||||||
|
fi->replacedSizes = _free(fi->replacedSizes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fi->replacedLSizes != NULL) {
|
||||||
|
fi->replacedLSizes[ix] = newsize;
|
||||||
|
} else {
|
||||||
|
if (fi->replacedSizes == NULL)
|
||||||
|
fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
|
||||||
|
fi->replacedSizes[ix] = (rpm_off_t) newsize;
|
||||||
}
|
}
|
||||||
/* XXX watch out, replacedSizes is not rpm_loff_t (yet) */
|
|
||||||
fi->replacedSizes[ix] = (rpm_off_t) newsize;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1307,6 +1321,8 @@ rpm_loff_t rpmfiFReplacedSizeIndex(rpmfi fi, int ix)
|
||||||
if (fi != NULL && ix >= 0 && ix < fi->fc) {
|
if (fi != NULL && ix >= 0 && ix < fi->fc) {
|
||||||
if (fi->replacedSizes) {
|
if (fi->replacedSizes) {
|
||||||
rsize = fi->replacedSizes[ix];
|
rsize = fi->replacedSizes[ix];
|
||||||
|
} else if (fi->replacedLSizes) {
|
||||||
|
rsize = fi->replacedLSizes[ix];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rsize;
|
return rsize;
|
||||||
|
|
|
@ -65,6 +65,7 @@ struct rpmfi_s {
|
||||||
|
|
||||||
char ** apath;
|
char ** apath;
|
||||||
rpm_off_t * replacedSizes; /*!< (TR_ADDED) */
|
rpm_off_t * replacedSizes; /*!< (TR_ADDED) */
|
||||||
|
rpm_loff_t * replacedLSizes;/*!< (TR_ADDED) */
|
||||||
int magic;
|
int magic;
|
||||||
int nrefs; /*!< Reference count. */
|
int nrefs; /*!< Reference count. */
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue