Fix rpmdbAppendIterator() argument signedness

- Header numbers and the number of header numbers can never be negative
  here, and mismatches with everything else. Changing this is somewhat
  nasty as its a public API but then I dont think anything at all
  outside rpm itself has ever used this for anything, and the types
  were incorrect to begin with.
- Fixup the used types in the sole caller markReplacedFiles()
  accordingly. These type mismatches go deeper than that (rpmfs
  and shared file info and all) but that's a story for some other day...
This commit is contained in:
Panu Matilainen 2013-03-26 16:22:17 +02:00
parent 1a9d3421ea
commit f26513cce3
3 changed files with 7 additions and 6 deletions

View File

@ -133,9 +133,9 @@ static rpmRC markReplacedFiles(const rpmpsm psm)
sharedFileInfo sfi;
rpmdbMatchIterator mi;
Header h;
int * offsets;
unsigned int * offsets;
unsigned int prev;
int num;
unsigned int num;
if (!replaced)
return RPMRC_OK;

View File

@ -1642,15 +1642,16 @@ int rpmdbPruneIterator(rpmdbMatchIterator mi, removedHash hdrNums)
return 0;
}
int rpmdbAppendIterator(rpmdbMatchIterator mi, const int * hdrNums, int nHdrNums)
int rpmdbAppendIterator(rpmdbMatchIterator mi,
const unsigned int * hdrNums, unsigned int nHdrNums)
{
if (mi == NULL || hdrNums == NULL || nHdrNums <= 0)
if (mi == NULL || hdrNums == NULL || nHdrNums == 0)
return 1;
if (mi->mi_set == NULL)
mi->mi_set = dbiIndexSetNew(nHdrNums);
for (int i = 0; i < nHdrNums; i++) {
for (unsigned int i = 0; i < nHdrNums; i++) {
struct dbiIndexItem rec = { .hdrNum = hdrNums[i], .tagNum = 0 };
dbiIndexSetAppend(mi->mi_set, &rec, 1, 0);
}

View File

@ -79,7 +79,7 @@ unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi);
* @return 0 on success, 1 on failure (bad args)
*/
int rpmdbAppendIterator(rpmdbMatchIterator mi,
const int * hdrNums, int nHdrNums);
const unsigned int * hdrNums, unsigned int nHdrNums);
/** \ingroup rpmdb
* Add pattern to iterator selector.