return rc;
}
-static char * rpmfcFileDep(char * buf, int ix, rpmds this)
+static char * rpmfcFileDep(/*@returned@*/ char * buf, int ix,
+ /*@null@*/ rpmds this)
/*@modifies buf @*/
{
int_32 tagN = rpmdsTagN(this);
char deptype = 'X';
+/*@-boundswrite@*/
+ buf[0] = '\0';
+/*@=boundswrite@*/
switch (tagN) {
case RPMTAG_PROVIDENAME:
deptype = 'P';
deptype = 'R';
break;
}
- sprintf(buf, "%08d%c %s %s 0x%08x", ix, deptype,
+/*@-nullpass@*/
+ if (this != NULL)
+ sprintf(buf, "%08d%c %s %s 0x%08x", ix, deptype,
rpmdsN(this), rpmdsEVR(this), rpmdsFlags(this));
+/*@=nullpass@*/
return buf;
};
N = pav[i];
EVR = "";
Flags = dsContext;
+/*@-branchstate@*/
if (pav[i+1] && strchr("=<>", *pav[i+1])) {
i++;
for (s = pav[i]; *s; s++) {
EVR = pav[i];
assert(EVR != NULL);
}
+/*@=branchstate@*/
this = rpmdsSingle(tagN, N, EVR, Flags);
xx = rpmdsMerge(depsp, this);
/* Copy (and delete) manually generated dependencies to dictionary. */
ds = rpmdsNew(pkg->header, RPMTAG_PROVIDENAME, scareMem);
- rpmdsMerge(&fc->provides, ds);
+ xx = rpmdsMerge(&fc->provides, ds);
ds = rpmdsFree(ds);
xx = headerRemoveEntry(pkg->header, RPMTAG_PROVIDENAME);
xx = headerRemoveEntry(pkg->header, RPMTAG_PROVIDEVERSION);
xx = headerRemoveEntry(pkg->header, RPMTAG_PROVIDEFLAGS);
ds = rpmdsNew(pkg->header, RPMTAG_REQUIRENAME, scareMem);
- rpmdsMerge(&fc->requires, ds);
+ xx = rpmdsMerge(&fc->requires, ds);
ds = rpmdsFree(ds);
xx = headerRemoveEntry(pkg->header, RPMTAG_REQUIRENAME);
xx = headerRemoveEntry(pkg->header, RPMTAG_REQUIREVERSION);
p, c);
/* Add Provides: */
+/*@-branchstate@*/
if (fc->provides != NULL && (c = fc->provides->Count) > 0) {
p = (const void **) fc->provides->N;
xx = headerAddEntry(pkg->header, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE,
xx = headerAddEntry(pkg->header, RPMTAG_REQUIREFLAGS, RPM_INT32_TYPE,
p, c);
}
+/*@=branchstate@*/
/* Add dependency dictionary(#dependencies) */
p = (const void **) argiData(fc->ddictx);
ARGV_t ddict; /*!< (#dependencies) file depends dictionary */
ARGI_t ddictx; /*!< (#dependencies) file->dependency mapping */
+/*@relnull@*/
rpmds provides; /*!< (#provides) package provides */
+/*@relnull@*/
rpmds requires; /*!< (#requires) package requires */
StringBuf sb_java; /*!< concatenated list of java colored files. */
int colors;
};
+/**
+ */
typedef struct rpmfcTokens_s * rpmfcToken;
#ifdef __cplusplus
*/
void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp)
/*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/;
+ /*@modifies *fp, fc, fileSystem @*/;
+
/**
* Destroy a file classifier.
* @param fc file classifier
* @return NULL always
*/
+/*@-exportlocal@*/
/*@null@*/
rpmfc rpmfcFree(/*@only@*/ /*@null@*/ rpmfc fc)
/*@modifies fc @*/;
+/*@=exportlocal@*/
/**
* Create a file classifier.
* @return new file classifier
*/
+/*@-exportlocal@*/
rpmfc rpmfcNew(void)
/*@*/;
+/*@=exportlocal@*/
/**
* Build file class dictionary and mappings.
* @param fc file classifier
+ * @param argv files to classify
* @return 0 on success
*/
+/*@-exportlocal@*/
int rpmfcClassify(rpmfc fc, ARGV_t argv)
/*@globals global_fmagic, fileSystem, internalState @*/
/*@modifies fc, global_fmagic, fileSystem, internalState @*/;
+/*@=exportlocal@*/
/**
* Build file/package dependency dictionary and mappings.
* @param fc file classifier
* @return 0 on success
*/
+/*@-exportlocal@*/
int rpmfcApply(rpmfc fc)
/*@modifies fc @*/;
+/*@=exportlocal@*/
/**
* Generate package dependencies.
/*@=refcounttrans@*/
}
+/*@-bounds@*/
static const char ** rpmdsDupArgv(const char ** argv, int argc)
/*@*/
{
av[ac] = NULL;
return av;
}
+/*@=bounds@*/
static rpmds rpmdsDup(const rpmds this)
- /*@*/
+ /*@modifies this @*/
{
rpmds ds = xcalloc(1, sizeof(*ds));
size_t nb;
- ds->h = (this->h ? headerLink(this->h) : NULL);
+ ds->h = (this->h != NULL ? headerLink(this->h) : NULL);
+/*@-assignexpose@*/
ds->Type = this->Type;
+/*@=assignexpose@*/
ds->tagN = this->tagN;
ds->Count = this->Count;
ds->i = this->i;
ds->u = this->u;
nb = (ds->Count+1) * sizeof(*ds->N);
- ds->N = (ds->h
+ ds->N = (ds->h != NULL
? memcpy(xmalloc(nb), this->N, nb)
: rpmdsDupArgv(this->N, this->Count) );
ds->Nt = this->Nt;
nb = (ds->Count+1) * sizeof(*ds->EVR);
- ds->EVR = (ds->h
+ ds->EVR = (ds->h != NULL
? memcpy(xmalloc(nb), this->EVR, nb)
: rpmdsDupArgv(this->EVR, this->Count) );
ds->EVRt = this->EVRt;
nb = (ds->Count * sizeof(*ds->Flags));
- ds->Flags = (ds->h
+ ds->Flags = (ds->h != NULL
? this->Flags
: memcpy(xmalloc(nb), this->Flags, nb) );
ds->Ft = this->Ft;
+/*@-compmempass@*/ /* FIX: ds->Flags is kept, not only */
return rpmdsLink(ds, (ds ? ds->Type : NULL));
+/*@=compmempass@*/
}
+/*@-bounds@*/
int rpmdsFind(rpmds ds, rpmds this)
{
int comparison;
+ if (ds == NULL || this == NULL)
+ return -1;
+
ds->l = 0;
ds->u = ds->Count;
while (ds->l < ds->u) {
ds->u = ds->i;
else if (comparison > 0)
ds->l = ds->i + 1;
- else {
+ else
return ds->i;
- }
}
return -1;
}
+/*@=bounds@*/
+/*@-bounds@*/
int rpmdsMerge(rpmds * dsp, rpmds this)
{
rpmds ds;
return -1;
/* If not initialized yet, dup the 1st entry. */
+/*@-branchstate@*/
if (*dsp == NULL) {
save = this->Count;
this->Count = 1;
*dsp = rpmdsDup(this);
this->Count = save;
}
+/*@=branchstate@*/
ds = *dsp;
/*
*/
save = this->i;
this = rpmdsInit(this);
+ if (this != NULL)
while (rpmdsNext(this) >= 0) {
/*
* If this entry is already present, don't bother.
ds->Count++;
}
+/*@-nullderef@*/
this->i = save;
+/*@=nullderef@*/
return 0;
}
+/*@=bounds@*/
/**
* Split EVR into epoch, version, and release components.
* @return dependency index (or -1 if not found)
*/
/*@null@*/
-int rpmdsFind(rpmds ds, rpmds this)
- /*@*/;
+int rpmdsFind(rpmds ds, /*@null@*/ rpmds this)
+ /*@modifies ds, this @*/;
/**
* Merge a dependency set maintaining (N,EVR,Flags) sorted order.
* @return (merged) dependency index
*/
/*@null@*/
-int rpmdsMerge(/*@out@*/ rpmds * dsp, rpmds this)
- /*@*/;
+int rpmdsMerge(/*@out@*/ rpmds * dsp, /*@null@*/ rpmds this)
+ /*@modifies *dsp, this @*/;
/**
* Compare two versioned dependency ranges, looking for overlap.