-/*@-type@*/ /* FIX: annotate db3 methods */
+/* FIX: annotate db3 methods */
/** \ingroup db3
* \file rpmdb/db3.c
*/
-/*@unchecked@*/
static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#include "system.h"
#define DB_CLIENT DB_RPCCLIENT
#endif
-/*@access rpmdb @*/
-/*@access dbiIndex @*/
-/*@access dbiIndexSet @*/
/** \ingroup dbi
* Hash database statistics.
*/
-/*@-fielduse@*/
struct dbiHStats_s {
unsigned int hash_magic; /*!< hash database magic number. */
unsigned int hash_version; /*!< version of the hash database. */
unsigned int bt_dup_pgfree; /*!< no. of bytes free in duplicate pages. */
unsigned int bt_over_pgfree;/*!< no. of bytes free in overflow pages. */
};
-/*@=fielduse@*/
#ifdef NOTNOW
static const char * bfstring(unsigned int x, const char * xbf)
#endif /* NOTNOW */
-/*@-globuse -mustmod @*/ /* FIX: rpmError not annotated yet. */
static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
int rc = error;
if (printit && rc) {
- /*@-moduncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
if (msg)
rpmError(RPMERR_DBERR, _("db%d error(%d) from %s: %s\n"),
dbi->dbi_api, rc, msg, db_strerror(error));
else
rpmError(RPMERR_DBERR, _("db%d error(%d): %s\n"),
dbi->dbi_api, rc, db_strerror(error));
- /*@=moduncon@*/
}
return rc;
}
-/*@=globuse =mustmod @*/
static int db_fini(dbiIndex dbi, const char * dbhome,
- /*@null@*/ const char * dbfile,
- /*@unused@*/ /*@null@*/ const char * dbsubfile)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ const char * dbfile,
+ const char * dbsubfile)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
DB_ENV * dbenv = rpmdb->db_dbenv;
if (rpmdb->db_remove_env) {
int xx;
- /*@-moduncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
xx = db_env_create(&dbenv, 0);
- /*@=moduncon@*/
xx = cvtdberr(dbi, "db_env_create", xx, _debug);
#if (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR != 0) || (DB_VERSION_MAJOR == 4)
xx = dbenv->remove(dbenv, dbhome, 0);
return rc;
}
-static int db3_fsync_disable(/*@unused@*/ int fd)
- /*@*/
+static int db3_fsync_disable(int fd)
{
return 0;
}
* @return 0 == shared.
*/
static int db3_pthread_nptl(void)
- /*@*/
{
pthread_mutex_t mutex;
pthread_mutexattr_t mutexattr, *mutexattrp = NULL;
#endif
#endif
-/*@-moduncon@*/ /* FIX: annotate db3 methods */
+/* FIX: annotate db3 methods */
static int db_init(dbiIndex dbi, const char * dbhome,
- /*@null@*/ const char * dbfile,
- /*@unused@*/ /*@null@*/ const char * dbsubfile,
- /*@out@*/ DB_ENV ** dbenvp)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem @*/
- /*@modifies dbi, *dbenvp, fileSystem @*/
+ const char * dbfile,
+ const char * dbsubfile,
+ DB_ENV ** dbenvp)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
DB_ENV *dbenv = NULL;
return 1;
/* XXX HACK */
- /*@-assignexpose@*/
if (rpmdb->db_errfile == NULL)
rpmdb->db_errfile = stderr;
- /*@=assignexpose@*/
eflags = (dbi->dbi_oeflags | dbi->dbi_eflags);
if (eflags & DB_JOINENV) eflags &= DB_JOINENV;
goto errxit;
{ int xx;
- /*@-noeffectuncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
/* 4.1: dbenv->set_app_dispatch(???) */
/* 4.1: dbenv->set_alloc(???) */
dbenv->set_errcall(dbenv, (void *) rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile);
dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
- /*@=noeffectuncon@*/
/* 4.1: dbenv->set_feedback(???) */
/* 4.1: dbenv->set_flags(???) */
const char * tmpdir;
root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-/*@-boundsread@*/
if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
root = NULL;
-/*@=boundsread@*/
-/*@-mods@*/
tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
-/*@=mods@*/
xx = dbenv->set_tmp_dir(dbenv, tmpdir);
xx = cvtdberr(dbi, "dbenv->set_tmp_dir", xx, _debug);
tmpdir = _free(tmpdir);
if (rc)
goto errxit;
-/*@-boundswrite@*/
*dbenvp = dbenv;
-/*@=boundswrite@*/
return 0;
}
return rc;
}
-/*@=moduncon@*/
static int db3sync(dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
DB * db = dbi->dbi_db;
int rc = 0;
static int db3cdup(dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcp, fileSystem @*/
{
int rc;
-/*@-boundswrite@*/
if (dbcp) *dbcp = NULL;
-/*@=boundswrite@*/
rc = dbcursor->c_dup(dbcursor, dbcp, flags);
rc = cvtdberr(dbi, "dbcursor->c_dup", rc, _debug);
- /*@-nullstate @*/ /* FIX: *dbcp can be NULL */
+ /* FIX: *dbcp can be NULL */
return rc;
- /*@=nullstate @*/
}
-/*@-mustmod@*/
-static int db3cclose(dbiIndex dbi, /*@only@*/ /*@null@*/ DBC * dbcursor,
- /*@unused@*/ unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+static int db3cclose(dbiIndex dbi, DBC * dbcursor,
+ unsigned int flags)
{
int rc = -2;
}
return rc;
}
-/*@=mustmod@*/
static int db3copen(dbiIndex dbi, DB_TXN * txnid,
- /*@null@*/ /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
+ DBC ** dbcp, unsigned int dbiflags)
{
DB * db = dbi->dbi_db;
DBC * dbcursor = NULL;
rc = cvtdberr(dbi, "db->cursor", rc, _debug);
if (dbcp)
- /*@-boundswrite -onlytrans@*/ *dbcp = dbcursor; /*@=boundswrite =onlytrans@*/
+ *dbcp = dbcursor;
else
(void) db3cclose(dbi, dbcursor, 0);
}
static int db3cput(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
- /*@unused@*/ unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ unsigned int flags)
{
DB * db = dbi->dbi_db;
int rc;
return rc;
}
-/*@-mustmod@*/
static int db3cdel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
{
DB * db = dbi->dbi_db;
int rc;
return rc;
}
-/*@=mustmod@*/
-/*@-mustmod@*/
static int db3cget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *data, fileSystem @*/
{
DB * db = dbi->dbi_db;
int _printit;
return rc;
}
-/*@=mustmod@*/
-/*@-mustmod@*/
static int db3cpget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * pkey,
DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *data, fileSystem @*/
{
DB * db = dbi->dbi_db;
int _printit;
return rc;
}
-/*@=mustmod@*/
static int db3ccount(dbiIndex dbi, DBC * dbcursor,
- /*@null@*/ /*@out@*/ unsigned int * countp,
- /*@unused@*/ unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *countp, fileSystem @*/
+ unsigned int * countp,
+ unsigned int flags)
{
db_recno_t count = 0;
int rc = 0;
rc = dbcursor->c_count(dbcursor, &count, flags);
rc = cvtdberr(dbi, "dbcursor->c_count", rc, _debug);
if (rc) return rc;
-/*@-boundswrite@*/
if (countp) *countp = count;
-/*@=boundswrite@*/
return rc;
}
-static int db3byteswapped(dbiIndex dbi) /*@*/
+static int db3byteswapped(dbiIndex dbi)
{
DB * db = dbi->dbi_db;
int rc = 0;
}
static int db3stat(dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
DB * db = dbi->dbi_db;
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
return rc;
}
-/*@-mustmod@*/
static int db3associate(dbiIndex dbi, dbiIndex dbisecondary,
int (*callback)(DB *, const DBT *, const DBT *, DBT *),
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
DB * db = dbi->dbi_db;
DB * secondary = dbisecondary->dbi_db;
int rc;
-/*@-moduncon@*/ /* FIX: annotate db3 methods */
+/* FIX: annotate db3 methods */
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
DB_TXN * txnid = NULL;
assert(db != NULL);
rc = db->associate(db, secondary, callback, flags);
#endif
-/*@=moduncon@*/
rc = cvtdberr(dbi, "db->associate", rc, _debug);
return rc;
}
-/*@=mustmod@*/
-/*@-mustmod@*/
static int db3join(dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
DB * db = dbi->dbi_db;
int rc;
assert(db != NULL);
-/*@-moduncon@*/ /* FIX: annotate db3 methods */
+/* FIX: annotate db3 methods */
rc = db->join(db, curslist, dbcp, flags);
-/*@=moduncon@*/
rc = cvtdberr(dbi, "db->join", rc, _debug);
return rc;
}
-/*@=mustmod@*/
-/*@-moduncon@*/ /* FIX: annotate db3 methods */
-static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+/* FIX: annotate db3 methods */
+static int db3close(dbiIndex dbi, unsigned int flags)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
const char * urlfn = NULL;
* Get the prefix/root component and directory path.
*/
root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-/*@-boundsread@*/
if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
root = NULL;
-/*@=boundsread@*/
home = (dbi->dbi_home ? dbi->dbi_home : rpmdb->db_home);
/*
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
- /*@-mods@*/
urlfn = rpmGenPath(root, home, NULL);
- /*@=mods@*/
(void) urlPath(urlfn, &dbhome);
if (dbi->dbi_temporary) {
dbfile = NULL;
if (rpmdb->db_dbenv != NULL && dbi->dbi_use_dbenv) {
if (rpmdb->db_opens == 1) {
- /*@-nullstate@*/
xx = db_fini(dbi, (dbhome ? dbhome : ""), dbfile, dbsubfile);
- /*@=nullstate@*/
rpmdb->db_dbenv = NULL;
}
rpmdb->db_opens--;
if (dbi->dbi_verify_on_close && !dbi->dbi_temporary) {
DB_ENV * dbenv = NULL;
- /*@-moduncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
rc = db_env_create(&dbenv, 0);
- /*@=moduncon@*/
rc = cvtdberr(dbi, "db_env_create", rc, _debug);
if (rc || dbenv == NULL) goto exit;
- /*@-noeffectuncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
dbenv->set_errcall(dbenv, (void *) rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile);
dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
/* dbenv->set_paniccall(???) */
- /*@=noeffectuncon@*/
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT));
(dbi->dbi_verbose & DB_VERB_WAITSFOR));
if (dbi->dbi_tmpdir) {
- /*@-mods@*/
const char * tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
- /*@=mods@*/
rc = dbenv->set_tmp_dir(dbenv, tmpdir);
rc = cvtdberr(dbi, "dbenv->set_tmp_dir", rc, _debug);
tmpdir = _free(tmpdir);
rc = cvtdberr(dbi, "dbenv->open", rc, _debug);
if (rc) goto exit;
- /*@-moduncon -nullstate@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
rc = db_create(&db, dbenv, 0);
- /*@=moduncon =nullstate@*/
rc = cvtdberr(dbi, "db_create", rc, _debug);
if (db != NULL) {
- /*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/", dbfile, NULL);
- /*@=mods@*/
rc = db->verify(db, dbf, NULL, NULL, flags);
rc = cvtdberr(dbi, "db->verify", rc, _debug);
return rc;
}
-/*@=moduncon@*/
static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
- /*@globals rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies *dbip, fileSystem, internalState @*/
{
- /*@-nestedextern -shadow@*/
extern struct _dbiVec db3vec;
- /*@=nestedextern =shadow@*/
const char * urlfn = NULL;
const char * root;
const char * home;
u_int32_t oflags;
int _printit;
-/*@-boundswrite@*/
if (dbip)
*dbip = NULL;
-/*@=boundswrite@*/
/*
* Parse db configuration parameters.
*/
- /*@-mods@*/
if ((dbi = db3New(rpmdb, rpmtag)) == NULL)
- /*@-nullstate@*/
return 1;
- /*@=nullstate@*/
- /*@=mods@*/
dbi->dbi_api = DB_VERSION_MAJOR;
/*
* Get the prefix/root component and directory path.
*/
root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-/*@-boundsread@*/
if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
root = NULL;
-/*@=boundsread@*/
home = (dbi->dbi_home ? dbi->dbi_home : rpmdb->db_home);
/*
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
- /*@-mods@*/
urlfn = rpmGenPath(root, home, NULL);
- /*@=mods@*/
(void) urlPath(urlfn, &dbhome);
if (dbi->dbi_temporary) {
dbfile = NULL;
}
} else { /* dbhome is writable, check for persistent dbenv. */
- /*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
- /*@=mods@*/
if (access(dbf, F_OK) == -1) {
/* ... non-existent (or unwritable) DBENV, will create ... */
if ((oflags & DB_CREATE) && (oflags & DB_RDONLY)) {
/* dbhome is writable, and DB->open flags may conflict. */
const char * dbfn = (dbfile ? dbfile : tagName(dbi->dbi_rpmtag));
- /*@-mods@*/
const char * dbf = rpmGetPath(dbhome, "/", dbfn, NULL);
- /*@=mods@*/
if (access(dbf, F_OK) == -1) {
/* File does not exist, DB->open might create ... */
dbi->dbi_verify_on_close = 0;
if (dbi->dbi_use_dbenv) {
- /*@-mods@*/
if (rpmdb->db_dbenv == NULL) {
rc = db_init(dbi, dbhome, dbfile, dbsubfile, &dbenv);
if (rc == 0) {
dbenv = rpmdb->db_dbenv;
rpmdb->db_opens++;
}
- /*@=mods@*/
}
rpmMessage(RPMMESS_DEBUG, _("opening db index %s/%s %s mode=0x%x\n"),
if (rc == 0) {
static int _lockdbfd = 0;
- /*@-moduncon@*/ /* FIX: annotate db3 methods */
+ /* FIX: annotate db3 methods */
rc = db_create(&db, dbenv, dbi->dbi_cflags);
- /*@=moduncon@*/
rc = cvtdberr(dbi, "db_create", rc, _debug);
if (rc == 0 && db != NULL) {
if (dbfile) nb += 1 + strlen(dbfile);
dbfullpath = t = alloca(nb + 1);
-/*@-boundswrite@*/
t = stpcpy(t, dbhome);
if (dbfile)
t = stpcpy( stpcpy( t, "/"), dbfile);
-/*@=boundswrite@*/
#ifdef HACK /* XXX necessary to support dbsubfile */
dbpath = (!dbi->dbi_use_dbenv && !dbi->dbi_temporary)
? dbfullpath : dbfile;
rc = 1;
} else {
struct flock l;
-/*@-boundswrite@*/
memset(&l, 0, sizeof(l));
-/*@=boundswrite@*/
l.l_whence = 0;
l.l_start = 0;
l.l_len = 0;
if (rc == 0 && dbi->dbi_db != NULL && dbip != NULL) {
dbi->dbi_vec = &db3vec;
-/*@-boundswrite@*/
*dbip = dbi;
-/*@=boundswrite@*/
} else {
dbi->dbi_verify_on_close = 0;
(void) db3close(dbi, 0);
urlfn = _free(urlfn);
- /*@-nullstate -compmempass@*/
return rc;
- /*@=nullstate =compmempass@*/
}
/** \ingroup db3
*/
-/*@-exportheadervar@*/
-/*@observer@*/ /*@unchecked@*/
struct _dbiVec db3vec = {
DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
db3open, db3close, db3sync, db3associate, db3join,
db3copen, db3cclose, db3cdup, db3cdel, db3cget, db3cpget, db3cput, db3ccount,
db3byteswapped, db3stat
};
-/*@=exportheadervar@*/
-/*@=type@*/
#include "rpmdb.h"
#include "debug.h"
-/*@access rpmdb@*/
-/*@access dbiIndex@*/
-/*@access dbiIndexSet@*/
#if (DB_VERSION_MAJOR == 3) || (DB_VERSION_MAJOR == 4)
#define __USE_DB3 1
-/*@-exportlocal -exportheadervar@*/
-/*@unchecked@*/
struct _dbiIndex db3dbi;
-/*@=exportlocal =exportheadervar@*/
-/*@unchecked@*/
static int dbi_use_cursors;
-/*@unchecked@*/
static int dbi_tear_down;
-/*@-compmempass -immediatetrans -exportlocal -exportheadervar@*/
/** \ingroup db3
*/
-/*@unchecked@*/
struct poptOption rdbOptions[] = {
/* XXX DB_CXX_NO_EXCEPTIONS */
#if defined(DB_CLIENT)
POPT_TABLEEND
};
-/*@=compmempass =immediatetrans =exportlocal =exportheadervar@*/
dbiIndex db3Free(dbiIndex dbi)
{
}
/** @todo Set a reasonable "last gasp" default db config. */
-/*@observer@*/ /*@unchecked@*/
static const char *db3_config_default =
"db3:hash:mpool:cdb:usecursors:verbose:mp_mmapsize=8Mb:cachesize=512Kb:pagesize=512:perms=0644";
-/*@-bounds@*/
dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
{
dbiIndex dbi = xcalloc(1, sizeof(*dbi));
}
/* Parse the options for the database element(s). */
- /*@-branchstate@*/
if (dbOpts && *dbOpts && *dbOpts != '%') {
char *o, *oe;
char *p, *pe;
/* Find and terminate next key=value pair. Save next start point. */
for (oe = o; oe && *oe; oe++) {
if (xisspace(*oe))
- /*@innerbreak@*/ break;
+ break;
if (oe[0] == ':' && !(oe[1] == '/' && oe[2] == '/'))
- /*@innerbreak@*/ break;
+ break;
}
if (oe && *oe)
*oe++ = '\0';
/* Find key in option table. */
for (opt = rdbOptions; opt->longName != NULL; opt++) {
if (strcmp(tok, opt->longName))
- /*@innercontinue@*/ continue;
- /*@innerbreak@*/ break;
+ continue;
+ break;
}
if (opt->longName == NULL) {
rpmError(RPMERR_DBCONFIG,
case POPT_ARG_NONE:
(void) poptSaveInt((int *)opt->arg, argInfo, 1L);
- /*@switchbreak@*/ break;
+ break;
case POPT_ARG_VAL:
(void) poptSaveInt((int *)opt->arg, argInfo, (long)opt->val);
- /*@switchbreak@*/ break;
+ break;
case POPT_ARG_STRING:
{ const char ** t = opt->arg;
- /*@-mods@*/
if (t) {
-/*@-unqualifiedtrans@*/ /* FIX: opt->arg annotation in popt.h */
+/* FIX: opt->arg annotation in popt.h */
*t = _free(*t);
-/*@=unqualifiedtrans@*/
*t = xstrdup( (p ? p : "") );
}
- /*@=mods@*/
- } /*@switchbreak@*/ break;
+ } break;
case POPT_ARG_INT:
case POPT_ARG_LONG:
continue;
}
(void) poptSaveLong((long *)opt->arg, argInfo, aLong);
- /*@switchbreak@*/ break;
+ break;
} else {
if (aLong > INT_MAX || aLong < INT_MIN) {
rpmError(RPMERR_DBCONFIG,
}
(void) poptSaveInt((int *)opt->arg, argInfo, aLong);
}
- } /*@switchbreak@*/ break;
+ } break;
default:
- /*@switchbreak@*/ break;
+ break;
}
}
/*=========*/
}
- /*@=branchstate@*/
dbOpts = _free(dbOpts);
- /*@-assignexpose@*/
-/*@i@*/ *dbi = db3dbi; /* structure assignment */
- /*@=assignexpose@*/
+ *dbi = db3dbi; /* structure assignment */
memset(&db3dbi, 0, sizeof(db3dbi));
if (!(dbi->dbi_perms & 0600))
dbi->dbi_perms = 0644;
dbi->dbi_mode = rpmdb->db_mode;
- /*@-assignexpose -newreftrans@*/ /* FIX: figger rpmdb/dbi refcounts */
-/*@i@*/ dbi->dbi_rpmdb = rpmdb;
- /*@=assignexpose =newreftrans@*/
+ /* FIX: figger rpmdb/dbi refcounts */
+ dbi->dbi_rpmdb = rpmdb;
dbi->dbi_rpmtag = rpmtag;
/*
* Inverted lists have join length of 2, primary data has join length of 1.
*/
- /*@-sizeoftype@*/
switch (rpmtag) {
case RPMDBI_PACKAGES:
case RPMDBI_DEPENDS:
dbi->dbi_jlen = 2 * sizeof(int_32);
break;
}
- /*@=sizeoftype@*/
dbi->dbi_byteswapped = -1; /* -1 unknown, 0 native order, 1 alien order */
if ((dbi->dbi_bt_flags | dbi->dbi_h_flags) & DB_DUP)
dbi->dbi_permit_dups = 1;
- /*@-globstate@*/ /* FIX: *(rdbOptions->arg) reachable */
+ /* FIX: *(rdbOptions->arg) reachable */
return dbi;
- /*@=globstate@*/
}
-/*@=bounds@*/
-/*@-boundswrite@*/
const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
{
static char buf[256];
}
return buf;
}
-/*@=boundswrite@*/
#endif
* @param dirName string to locate in cache
* @return pointer to directory name entry (or NULL if not found).
*/
-static /*@null@*/ const struct fprintCacheEntry_s * cacheContainsDirectory(
+static const struct fprintCacheEntry_s * cacheContainsDirectory(
fingerPrintCache cache,
const char * dirName)
- /*@*/
{
const void ** data;
if (htGetEntry(cache->ht, dirName, &data, NULL, NULL))
return NULL;
-/*@-boundsread@*/
return data[0];
-/*@=boundsread@*/
}
/**
* @param scareMemory
* @return pointer to the finger print associated with a file path.
*/
-/*@-bounds@*/ /* LCL: segfault */
+/* LCL: segfault */
static fingerPrint doLookup(fingerPrintCache cache,
const char * dirName, const char * baseName, int scareMemory)
- /*@modifies cache @*/
{
char dir[PATH_MAX];
const char * cleanDirName;
cdnl = strlen(cleanDirName);
if (*cleanDirName == '/') {
- /*@-branchstate@*/
if (!scareMemory)
cleanDirName =
rpmCleanPath(strcpy(alloca(cdnl+1), dirName));
- /*@=branchstate@*/
} else {
scareMemory = 0; /* XXX causes memory leak */
/* if the current directory doesn't exist, we might fail.
oh well. likewise if it's too long. */
dir[0] = '\0';
- /*@-branchstate@*/
if (realpath(".", dir) != NULL) {
end = dir + strlen(dir);
if (end[-1] != '/') *end++ = '/';
cleanDirName = dir;
cdnl = end - dir;
}
- /*@=branchstate@*/
}
fp.entry = NULL;
fp.subDir = NULL;
fp.baseName = NULL;
- /*@-nullret@*/
if (cleanDirName == NULL) return fp; /* XXX can't happen */
- /*@=nullret@*/
buf = strcpy(alloca(cdnl + 1), cleanDirName);
end = buf + cdnl;
char * dn = xmalloc(nb);
struct fprintCacheEntry_s * newEntry = (void *)dn;
- /*@-usereleased@*/ /* LCL: contiguous malloc confusion */
+ /* LCL: contiguous malloc confusion */
dn += sizeof(*newEntry);
strcpy(dn, (*buf != '\0' ? buf : "/"));
newEntry->ino = sb.st_ino;
newEntry->dirName = dn;
fp.entry = newEntry;
- /*@-kepttrans -dependenttrans @*/
htAddEntry(cache->ht, dn, fp.entry);
- /*@=kepttrans =dependenttrans @*/
- /*@=usereleased@*/
}
if (fp.entry) {
fp.baseName = baseName;
if (!scareMemory && fp.subDir != NULL)
fp.subDir = xstrdup(fp.subDir);
- /*@-compdef@*/ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
+ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
return fp;
- /*@=compdef@*/
}
/* stat of '/' just failed! */
*end = '\0';
}
- /*@notreached@*/
- /*@-compdef@*/ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
- /*@-nullret@*/ return fp; /*@=nullret@*/ /* LCL: can't happen. */
- /*@=compdef@*/
+ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
+ return fp; /* LCL: can't happen. */
}
-/*@=bounds@*/
fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
const char * baseName, int scareMemory)
ch = 0;
chptr = fp->baseName;
-/*@-boundsread@*/
while (*chptr != '\0') ch ^= *chptr++;
-/*@=boundsread@*/
hash |= ((unsigned)ch) << 24;
hash |= (((((unsigned)fp->entry->dev) >> 8) ^ fp->entry->dev) & 0xFF) << 16;
return hash;
}
-/*@-boundsread@*/
int fpEqual(const void * key1, const void * key2)
{
const fingerPrint *k1 = key1;
return 0;
/* Otherwise, compare fingerprints by value. */
- /*@-nullpass@*/ /* LCL: whines about (*k2).subdir */
+ /* LCL: whines about (*k2).subdir */
if (FP_EQUAL(*k1, *k2))
return 0;
- /*@=nullpass@*/
return 1;
}
-/*@=boundsread@*/
-/*@-bounds@*/
void fpLookupList(fingerPrintCache cache, const char ** dirNames,
const char ** baseNames, const uint_32 * dirIndexes,
int fileCount, fingerPrint * fpList)
}
}
}
-/*@=bounds@*/
#ifdef UNUSED
/**
* @retval fpList pointer to array of finger prints
*/
static
-void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
- /*@modifies h, cache, *fpList @*/;
+void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList);
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
/**
*/
-typedef /*@abstract@*/ struct fprintCache_s * fingerPrintCache;
+typedef struct fprintCache_s * fingerPrintCache;
/**
* @todo Convert to pointer and make abstract.
/*! directory finger print entry (the directory path is stat(2)-able */
const struct fprintCacheEntry_s * entry;
/*! trailing sub-directory path (directories that are not stat(2)-able */
-/*@owned@*/ /*@null@*/ const char * subDir;
-/*@dependent@*/ const char * baseName; /*!< file base name */
+const char * subDir;
+const char * baseName; /*!< file base name */
};
/** */
* @param numItems number of fingerprint items
* @return 0 always
*/
-int rpmdbFindFpList(/*@null@*/ rpmdb db, fingerPrint * fpList,
- /*@out@*/ dbiIndexSet * matchList, int numItems)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, *matchList, rpmGlobalMacroContext,
- fileSystem, internalState @*/;
+int rpmdbFindFpList(rpmdb db, fingerPrint * fpList,
+ dbiIndexSet * matchList, int numItems);
/* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */
* @param sizeHint number of elements expected
* @return pointer to initialized fingerprint cache
*/
-/*@only@*/ fingerPrintCache fpCacheCreate(int sizeHint)
- /*@*/;
+fingerPrintCache fpCacheCreate(int sizeHint);
/**
* Destroy finger print cache.
* @param cache pointer to fingerprint cache
* @return NULL always
*/
-/*@null@*/
-fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
- /*@modifies cache @*/;
+fingerPrintCache fpCacheFree(fingerPrintCache cache);
/**
* Return finger print of a file path.
* @return pointer to the finger print associated with a file path.
*/
fingerPrint fpLookup(fingerPrintCache cache, const char * dirName,
- const char * baseName, int scareMemory)
- /*@modifies cache @*/;
+ const char * baseName, int scareMemory);
/**
* Return hash value for a finger print.
* @param key pointer to finger print entry
* @return hash value
*/
-unsigned int fpHashFunction(const void * key)
- /*@*/;
+unsigned int fpHashFunction(const void * key);
/**
* Compare two finger print entries.
* @param key2 finger print 2
* @return result of comparing key1 and key2
*/
-int fpEqual(const void * key1, const void * key2)
- /*@*/;
+int fpEqual(const void * key1, const void * key2);
/**
* Return finger prints of an array of file paths.
*/
void fpLookupList(fingerPrintCache cache, const char ** dirNames,
const char ** baseNames, const uint_32 * dirIndexes,
- int fileCount, fingerPrint * fpList)
- /*@modifies cache, *fpList @*/;
+ int fileCount, fingerPrint * fpList);
#ifdef __cplusplus
}
int type;
int count;
-/*@-boundswrite@*/
if (np) {
if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
&& type == RPM_STRING_TYPE && count == 1))
&& type == RPM_STRING_TYPE && count == 1))
*rp = NULL;
}
-/*@=boundswrite@*/
return 0;
}
int headerNEVRA(Header h, const char **np,
- /*@unused@*/ const char **ep, const char **vp, const char **rp,
+ const char **ep, const char **vp, const char **rp,
const char **ap)
{
int type;
int count;
-/*@-boundswrite@*/
if (np) {
if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
&& type == RPM_STRING_TYPE && count == 1))
&& type == RPM_STRING_TYPE && count == 1))
*ap = NULL;
}
-/*@=boundswrite@*/
return 0;
}
-/*@-type@*/ /* FIX: cast to HV_t bogus */
+/* FIX: cast to HV_t bogus */
#ifndef H_HDRINLINE
#define H_HDRINLINE
#ifdef __cplusplus
extern "C" {
#endif
-/*@+voidabstract -nullpass -mustmod -compdef -shadow -predboolothers @*/
/** \ingroup header
* Header methods for rpm headers.
*/
-/*@observer@*/ /*@unchecked@*/
extern struct HV_s * hdrVec;
/** \ingroup header
*/
-/*@unused@*/ static inline HV_t h2hv(Header h)
- /*@*/
+static inline HV_t h2hv(Header h)
{
- /*@-abstract -castexpose -refcounttrans@*/
return ((HV_t)h);
- /*@=abstract =castexpose =refcounttrans@*/
}
/** \ingroup header
* Create new (empty) header instance.
* @return header
*/
-/*@unused@*/ static inline
+static inline
Header headerNew(void)
- /*@*/
{
return hdrVec->hdrnew();
}
* @param h header
* @return NULL always
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerFree( /*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+static inline
+Header headerFree( Header h)
{
- /*@-abstract@*/
if (h == NULL) return NULL;
- /*@=abstract@*/
return (h2hv(h)->hdrfree) (h);
}
* @param h header
* @return new header reference
*/
-/*@unused@*/ static inline
+static inline
Header headerLink(Header h)
- /*@modifies h @*/
{
return (h2hv(h)->hdrlink) (h);
}
* @param h header
* @return new header reference
*/
-/*@unused@*/ static inline
-Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+static inline
+Header headerUnlink(Header h)
{
- /*@-abstract@*/
if (h == NULL) return NULL;
- /*@=abstract@*/
return (h2hv(h)->hdrunlink) (h);
}
-/*@-exportlocal@*/
/** \ingroup header
* Sort tags in header.
* @param h header
*/
-/*@unused@*/ static inline
+static inline
void headerSort(Header h)
- /*@modifies h @*/
{
-/*@-noeffectuncon@*/ /* FIX: add rc */
+/* FIX: add rc */
(h2hv(h)->hdrsort) (h);
-/*@=noeffectuncon@*/
return;
}
* Restore tags in header to original ordering.
* @param h header
*/
-/*@unused@*/ static inline
+static inline
void headerUnsort(Header h)
- /*@modifies h @*/
{
-/*@-noeffectuncon@*/ /* FIX: add rc */
+/* FIX: add rc */
(h2hv(h)->hdrunsort) (h);
-/*@=noeffectuncon@*/
return;
}
-/*@=exportlocal@*/
/** \ingroup header
* Return size of on-disk header representation in bytes.
* @param magicp include size of 8 bytes for (magic, 0)?
* @return size of on-disk header
*/
-/*@unused@*/ static inline
-unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
- /*@modifies h @*/
+static inline
+unsigned int headerSizeof(Header h, enum hMagic magicp)
{
- /*@-abstract@*/
if (h == NULL) return 0;
- /*@=abstract@*/
return (h2hv(h)->hdrsizeof) (h, magicp);
}
* @param h header (with pointers)
* @return on-disk header blob (i.e. with offsets)
*/
-/*@unused@*/ static inline
-/*@only@*/ /*@null@*/ void * headerUnload(Header h)
- /*@modifies h @*/
+static inline
+void * headerUnload(Header h)
{
return (h2hv(h)->hdrunload) (h);
}
* @param tag region tag
* @return on-disk header (with offsets)
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerReload(/*@only@*/ Header h, int tag)
- /*@modifies h @*/
+static inline
+Header headerReload(Header h, int tag)
{
- /*@-onlytrans@*/
return (h2hv(h)->hdrreload) (h, tag);
- /*@=onlytrans@*/
}
/** \ingroup header
* @param h header
* @return new header instance
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerCopy(Header h)
- /*@modifies h @*/
+static inline
+Header headerCopy(Header h)
{
return (h2hv(h)->hdrcopy) (h);
}
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerLoad(/*@kept@*/ void * uh)
- /*@modifies uh @*/
+static inline
+Header headerLoad(void * uh)
{
return hdrVec->hdrload(uh);
}
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerCopyLoad(const void * uh)
- /*@*/
+static inline
+Header headerCopyLoad(const void * uh)
{
return hdrVec->hdrcopyload(uh);
}
* @param magicp read (and verify) 8 bytes of (magic, 0)?
* @return header (or NULL on error)
*/
-/*@unused@*/ static inline
-/*@null@*/ Header headerRead(FD_t fd, enum hMagic magicp)
- /*@modifies fd @*/
+static inline
+Header headerRead(FD_t fd, enum hMagic magicp)
{
return hdrVec->hdrread(fd, magicp);
}
* @param magicp prefix write with 8 bytes of (magic, 0)?
* @return 0 on success, 1 on error
*/
-/*@unused@*/ static inline
-int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
- /*@modifies fd, h @*/
+static inline
+int headerWrite(FD_t fd, Header h, enum hMagic magicp)
{
- /*@-abstract@*/
if (h == NULL) return 0;
- /*@=abstract@*/
return (h2hv(h)->hdrwrite) (fd, h, magicp);
}
* @param tag tag
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
-int headerIsEntry(/*@null@*/ Header h, int_32 tag)
- /*@modifies h @*/
+static inline
+int headerIsEntry(Header h, int_32 tag)
{
- /*@-abstract@*/
if (h == NULL) return 0;
- /*@=abstract@*/
return (h2hv(h)->hdrisentry) (h, tag);
}
* @param type type of data (or -1 to force free)
* @return NULL always
*/
-/*@unused@*/ static inline
-/*@null@*/ void * headerFreeTag(Header h,
- /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/
+static inline
+void * headerFreeTag(Header h,
+ const void * data, rpmTagType type)
{
return (h2hv(h)->hdrfreetag) (h, data, type);
}
* @retval *c number of values (or NULL)
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerGetEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void ** p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
+ hTYP_t type,
+ void ** p,
+ hCNT_t c)
{
return (h2hv(h)->hdrget) (h, tag, type, p, c);
}
* @retval *c number of values (or NULL)
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerGetEntryMinMemory(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c)
{
return (h2hv(h)->hdrgetmin) (h, tag, type, p, c);
}
* @param c number of values
* @return 1 on success, 0 on failure
*/
-/*@mayexit@*/
-/*@unused@*/ static inline
+static inline
int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/
{
return (h2hv(h)->hdradd) (h, tag, type, p, c);
}
* @param c number of values
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
return (h2hv(h)->hdrappend) (h, tag, type, p, c);
}
* @param c number of values
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
return (h2hv(h)->hdraddorappend) (h, tag, type, p, c);
}
* @param lang locale
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerAddI18NString(Header h, int_32 tag, const char * string,
const char * lang)
- /*@modifies h @*/
{
return (h2hv(h)->hdraddi18n) (h, tag, string, lang);
}
* @param c number of values
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerModifyEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
return (h2hv(h)->hdrmodify) (h, tag, type, p, c);
}
* @param tag tag
* @return 0 on success, 1 on failure (INCONSISTENT)
*/
-/*@unused@*/ static inline
+static inline
int headerRemoveEntry(Header h, int_32 tag)
- /*@modifies h @*/
{
return (h2hv(h)->hdrremove) (h, tag);
}
* @retval errmsg error message (if any)
* @return formatted output string (malloc'ed)
*/
-/*@unused@*/ static inline
-/*@only@*/ char * headerSprintf(Header h, const char * fmt,
+static inline
+char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry_s * tbltags,
const struct headerSprintfExtension_s * extensions,
- /*@null@*/ /*@out@*/ errmsg_t * errmsg)
- /*@modifies *errmsg @*/
+ errmsg_t * errmsg)
{
return (h2hv(h)->hdrsprintf) (h, fmt, tbltags, extensions, errmsg);
}
* @param headerTo destination header
* @param tagstocopy array of tags that are copied
*/
-/*@unused@*/ static inline
+static inline
void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
- /*@modifies headerFrom, headerTo @*/
{
-/*@-noeffectuncon@*/ /* FIX: add rc */
+/* FIX: add rc */
hdrVec->hdrcopytags(headerFrom, headerTo, tagstocopy);
-/*@=noeffectuncon@*/
return;
}
* @param hi header tag iterator
* @return NULL always
*/
-/*@unused@*/ static inline
-HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi)
- /*@modifies hi @*/
+static inline
+HeaderIterator headerFreeIterator(HeaderIterator hi)
{
return hdrVec->hdrfreeiter(hi);
}
* @param h header
* @return header tag iterator
*/
-/*@unused@*/ static inline
+static inline
HeaderIterator headerInitIterator(Header h)
- /*@modifies h */
{
return hdrVec->hdrinititer(h);
}
* @retval *c number of values
* @return 1 on success, 0 on failure
*/
-/*@unused@*/ static inline
+static inline
int headerNextIterator(HeaderIterator hi,
- /*@null@*/ /*@out@*/ hTAG_t tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies hi, *tag, *type, *p, *c @*/
+ hTAG_t tag,
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c)
{
return hdrVec->hdrnextiter(hi, tag, type, p, c);
}
-/*@=voidabstract =nullpass =mustmod =compdef =shadow =predboolothers @*/
#ifdef __cplusplus
}
#endif
#endif /* H_HDRINLINE */
-/*@=type@*/
#include "debug.h"
-/*@unchecked@*/
int _hdr_debug = 0;
-/*@access entryInfo @*/
-/*@access indexEntry @*/
-/*@access rpmec @*/
-/*@access sprintfTag @*/
-/*@access sprintfToken @*/
-/*@access HV_t @*/
#define PARSER_BEGIN 0
#define PARSER_IN_ARRAY 1
/** \ingroup header
*/
-/*@observer@*/ /*@unchecked@*/
static unsigned char header_magic[8] = {
0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
};
/** \ingroup header
* Alignment needed for header data types.
*/
-/*@observer@*/ /*@unchecked@*/
static int typeAlign[16] = {
1, /*!< RPM_NULL_TYPE */
1, /*!< RPM_CHAR_TYPE */
/** \ingroup header
* Size of header data types.
*/
-/*@observer@*/ /*@unchecked@*/
static int typeSizes[16] = {
0, /*!< RPM_NULL_TYPE */
1, /*!< RPM_CHAR_TYPE */
/** \ingroup header
* Maximum no. of bytes permitted in a header.
*/
-/*@unchecked@*/
static size_t headerMaxbytes = (32*1024*1024);
/**
*/
#define hdrchkRange(_dl, _off) ((_off) < 0 || (_off) > (_dl))
-/*@observer@*/ /*@unchecked@*/
HV_t hdrVec; /* forward reference */
/**
* @param p memory to free
* @return NULL always
*/
-/*@unused@*/ static inline /*@null@*/ void *
-_free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/
+static inline void *
+_free(const void * p)
{
if (p != NULL) free((void *)p);
return NULL;
*/
static
Header headerLink(Header h)
- /*@modifies h @*/
{
-/*@-nullret@*/
if (h == NULL) return NULL;
-/*@=nullret@*/
h->nrefs++;
-/*@-modfilesys@*/
if (_hdr_debug)
fprintf(stderr, "--> h %p ++ %d at %s:%u\n", h, h->nrefs, __FILE__, __LINE__);
-/*@=modfilesys@*/
- /*@-refcounttrans @*/
return h;
- /*@=refcounttrans @*/
}
/** \ingroup header
* @param h header
* @return NULL always
*/
-static /*@null@*/
-Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+static
+Header headerUnlink(Header h)
{
if (h == NULL) return NULL;
-/*@-modfilesys@*/
if (_hdr_debug)
fprintf(stderr, "--> h %p -- %d at %s:%u\n", h, h->nrefs, __FILE__, __LINE__);
-/*@=modfilesys@*/
h->nrefs--;
return NULL;
}
* @param h header
* @return NULL always
*/
-static /*@null@*/
-Header headerFree(/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/
+static
+Header headerFree(Header h)
{
(void) headerUnlink(h);
- /*@-usereleased@*/
if (h == NULL || h->nrefs > 0)
return NULL; /* XXX return previous header? */
h->index = _free(h->index);
}
- /*@-refcounttrans@*/ h = _free(h); /*@=refcounttrans@*/
+ h = _free(h);
return h;
- /*@=usereleased@*/
}
/** \ingroup header
*/
static
Header headerNew(void)
- /*@*/
{
Header h = xcalloc(1, sizeof(*h));
-/*@-boundsread@*/
- /*@-assignexpose@*/
h->hv = *hdrVec; /* structure assignment */
- /*@=assignexpose@*/
-/*@=boundsread@*/
h->blob = NULL;
h->indexAlloced = INDEX_MALLOC_SIZE;
h->indexUsed = 0;
: NULL);
h->nrefs = 0;
- /*@-globstate -observertrans @*/
return headerLink(h);
- /*@=globstate =observertrans @*/
}
/**
*/
static int indexCmp(const void * avp, const void * bvp)
- /*@*/
{
- /*@-castexpose@*/
indexEntry ap = (indexEntry) avp, bp = (indexEntry) bvp;
- /*@=castexpose@*/
return (ap->info.tag - bp->info.tag);
}
*/
static
void headerSort(Header h)
- /*@modifies h @*/
{
if (!(h->flags & HEADERFLAG_SORTED)) {
-/*@-boundsread@*/
qsort(h->index, h->indexUsed, sizeof(*h->index), indexCmp);
-/*@=boundsread@*/
h->flags |= HEADERFLAG_SORTED;
}
}
/**
*/
-static int offsetCmp(const void * avp, const void * bvp) /*@*/
+static int offsetCmp(const void * avp, const void * bvp)
{
- /*@-castexpose@*/
indexEntry ap = (indexEntry) avp, bp = (indexEntry) bvp;
- /*@=castexpose@*/
int rc = (ap->info.offset - bp->info.offset);
if (rc == 0) {
*/
static
void headerUnsort(Header h)
- /*@modifies h @*/
{
-/*@-boundsread@*/
qsort(h->index, h->indexUsed, sizeof(*h->index), offsetCmp);
-/*@=boundsread@*/
}
/** \ingroup header
* @return size of on-disk header
*/
static
-unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
- /*@modifies h @*/
+unsigned int headerSizeof(Header h, enum hMagic magicp)
{
indexEntry entry;
unsigned int size = 0;
break;
}
- /*@-sizeoftype@*/
size += 2 * sizeof(int_32); /* count of index entries */
- /*@=sizeoftype@*/
for (i = 0, entry = h->index; i < h->indexUsed; i++, entry++) {
unsigned diff;
if (ENTRY_IS_REGION(entry)) {
size += entry->length;
/* XXX Legacy regions do not include the region tag and data. */
- /*@-sizeoftype@*/
if (i == 0 && (h->flags & HEADERFLAG_LEGACY))
size += sizeof(struct entryInfo_s) + entry->info.count;
- /*@=sizeoftype@*/
continue;
}
/* Alignment */
type = entry->info.type;
-/*@-boundsread@*/
if (typeSizes[type] > 1) {
diff = typeSizes[type] - (size % typeSizes[type]);
if (diff != typeSizes[type]) {
pad += diff;
}
}
-/*@=boundsread@*/
- /*@-sizeoftype@*/
size += sizeof(struct entryInfo_s) + entry->length;
- /*@=sizeoftype@*/
}
return size;
* @return no. bytes in data, -1 on failure
*/
static int dataLength(int_32 type, hPTR_t p, int_32 count, int onDisk,
- /*@null@*/ hPTR_t pend)
- /*@*/
+ hPTR_t pend)
{
const unsigned char * s = p;
const unsigned char * se = pend;
case RPM_STRING_TYPE:
if (count != 1)
return -1;
-/*@-boundsread@*/
while (*s++) {
if (se && s > se)
return -1;
length++;
}
-/*@=boundsread@*/
length++; /* count nul terminator too. */
break;
if (onDisk) {
while (count--) {
length++; /* count nul terminator too */
-/*@-boundsread@*/
while (*s++) {
if (se && s > se)
return -1;
length++;
}
-/*@=boundsread@*/
}
} else {
const char ** av = (const char **)p;
-/*@-boundsread@*/
while (count--) {
/* add one for null termination */
length += strlen(*av++) + 1;
}
-/*@=boundsread@*/
}
break;
default:
-/*@-boundsread@*/
if (typeSizes[type] == -1)
return -1;
length = typeSizes[(type & 0xf)] * count;
-/*@=boundsread@*/
if (length < 0 || (se && (s + length) > se))
return -1;
break;
* @param regionid region offset
* @return no. bytes of data in region, -1 on error
*/
-static int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
+static int regionSwab(indexEntry entry, int il, int dl,
entryInfo pe,
unsigned char * dataStart,
- /*@null@*/ const unsigned char * dataEnd,
+ const unsigned char * dataEnd,
int regionid)
- /*@modifies *entry, *dataStart @*/
{
unsigned char * tprev = NULL;
unsigned char * t = NULL;
int tl = dl;
struct indexEntry_s ieprev;
-/*@-boundswrite@*/
memset(&ieprev, 0, sizeof(ieprev));
-/*@=boundswrite@*/
for (; il > 0; il--, pe++) {
struct indexEntry_s ie;
int_32 type;
return -1;
if (hdrchkData(ie.info.offset))
return -1;
-/*@-boundsread@*/
if (hdrchkAlign(ie.info.type, ie.info.offset))
return -1;
-/*@=boundsread@*/
ie.data = t = dataStart + ie.info.offset;
if (dataEnd && t >= dataEnd)
if (entry) {
ie.info.offset = regionid;
-/*@-boundswrite@*/
*entry = ie; /* structure assignment */
-/*@=boundswrite@*/
entry++;
}
/* Alignment */
type = ie.info.type;
-/*@-boundsread@*/
if (typeSizes[type] > 1) {
unsigned diff;
diff = typeSizes[type] - (dl % typeSizes[type]);
ieprev.length += diff;
}
}
-/*@=boundsread@*/
tdel = (tprev ? (t - tprev) : 0);
if (ieprev.info.type == RPM_I18NSTRING_TYPE)
tdel = ieprev.length;
} else {
tprev = dataStart;
/* XXX HEADER_IMAGE tags don't include region sub-tag. */
- /*@-sizeoftype@*/
if (ie.info.tag == HEADER_IMAGE)
tprev -= REGION_TAG_COUNT;
- /*@=sizeoftype@*/
}
/* Perform endian conversions */
switch (ntohl(pe->type)) {
-/*@-bounds@*/
case RPM_INT32_TYPE:
{ int_32 * it = (int_32 *)t;
for (; ie.info.count > 0; ie.info.count--, it += 1) {
*it = htonl(*it);
}
t = (unsigned char *) it;
- } /*@switchbreak@*/ break;
+ } break;
case RPM_INT16_TYPE:
{ int_16 * it = (int_16 *) t;
for (; ie.info.count > 0; ie.info.count--, it += 1) {
*it = htons(*it);
}
t = (unsigned char *) it;
- } /*@switchbreak@*/ break;
-/*@=bounds@*/
+ } break;
default:
t += ie.length;
- /*@switchbreak@*/ break;
+ break;
}
dl += ie.length;
* 1) tl is 16b (i.e. REGION_TAG_COUNT) short while doing headerReload().
* 2) the 8/98 rpm bug with inserting i18n tags needs to use tl, not dl.
*/
- /*@-sizeoftype@*/
if (tl+REGION_TAG_COUNT == dl)
tl += REGION_TAG_COUNT;
- /*@=sizeoftype@*/
return dl;
}
* @retval *lengthPtr no. bytes in unloaded header blob
* @return unloaded header blob (NULL on error)
*/
-static /*@only@*/ /*@null@*/ void * doHeaderUnload(Header h,
- /*@out@*/ int * lengthPtr)
- /*@modifies h, *lengthPtr @*/
- /*@requires maxSet(lengthPtr) >= 0 @*/
- /*@ensures maxRead(result) == (*lengthPtr) @*/
+static void * doHeaderUnload(Header h,
+ int * lengthPtr)
{
int_32 * ei = NULL;
entryInfo pe;
/* Skip rest of entries in region, but account for dribbles. */
for (; i < h->indexUsed && entry->info.offset <= rid+1; i++, entry++) {
if (entry->info.offset <= rid)
- /*@innercontinue@*/ continue;
+ continue;
/* Alignment */
type = entry->info.type;
len = sizeof(il) + sizeof(dl) + (il * sizeof(*pe)) + dl;
-/*@-boundswrite@*/
ei = xmalloc(len);
ei[0] = htonl(il);
ei[1] = htonl(dl);
-/*@=boundswrite@*/
pe = (entryInfo) &ei[2];
dataStart = te = (char *) (pe + il);
int_32 stei[4];
legacy = 1;
-/*@-boundswrite@*/
memcpy(pe+1, src, rdl);
memcpy(te, src + rdl, rdlen);
-/*@=boundswrite@*/
te += rdlen;
pe->offset = htonl(te - dataStart);
stei[1] = pe->type;
stei[2] = htonl(-rdl-entry->info.count);
stei[3] = pe->count;
-/*@-boundswrite@*/
memcpy(te, stei, entry->info.count);
-/*@=boundswrite@*/
te += entry->info.count;
ril++;
rdlen += entry->info.count;
} else {
-/*@-boundswrite@*/
memcpy(pe+1, src + sizeof(*pe), ((ril-1) * sizeof(*pe)));
memcpy(te, src + (ril * sizeof(*pe)), rdlen+entry->info.count+drlen);
-/*@=boundswrite@*/
te += rdlen;
- { /*@-castexpose@*/
+ {
entryInfo se = (entryInfo)src;
- /*@=castexpose@*/
int off = ntohl(se->offset);
pe->offset = (off) ? htonl(te - dataStart) : htonl(off);
}
unsigned diff;
diff = typeSizes[type] - ((te - dataStart) % typeSizes[type]);
if (diff != typeSizes[type]) {
-/*@-boundswrite@*/
memset(te, 0, diff);
-/*@=boundswrite@*/
te += diff;
pad += diff;
}
pe->offset = htonl(te - dataStart);
/* copy data w/ endian conversions */
-/*@-boundswrite@*/
switch (entry->info.type) {
case RPM_INT32_TYPE:
count = entry->info.count;
src = entry->data;
while (count--) {
*((int_32 *)te) = htonl(*((int_32 *)src));
- /*@-sizeoftype@*/
te += sizeof(int_32);
src += sizeof(int_32);
- /*@=sizeoftype@*/
}
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
count = entry->info.count;
src = entry->data;
while (count--) {
*((int_16 *)te) = htons(*((int_16 *)src));
- /*@-sizeoftype@*/
te += sizeof(int_16);
src += sizeof(int_16);
- /*@=sizeoftype@*/
}
- /*@switchbreak@*/ break;
+ break;
default:
memcpy(te, entry->data, entry->length);
te += entry->length;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=boundswrite@*/
pe++;
}
return (void *) ei;
errxit:
- /*@-usereleased@*/
ei = _free(ei);
- /*@=usereleased@*/
return (void *) ei;
}
* @param h header (with pointers)
* @return on-disk header blob (i.e. with offsets)
*/
-static /*@only@*/ /*@null@*/
+static
void * headerUnload(Header h)
- /*@modifies h @*/
{
int length;
-/*@-boundswrite@*/
void * uh = doHeaderUnload(h, &length);
-/*@=boundswrite@*/
return uh;
}
* @param type entry type
* @return header entry
*/
-static /*@null@*/
-indexEntry findEntry(/*@null@*/ Header h, int_32 tag, int_32 type)
- /*@modifies h @*/
+static
+indexEntry findEntry(Header h, int_32 tag, int_32 type)
{
indexEntry entry, entry2, last;
struct indexEntry_s key;
key.info.tag = tag;
-/*@-boundswrite@*/
entry2 = entry =
bsearch(&key, h->index, h->indexUsed, sizeof(*h->index), indexCmp);
-/*@=boundswrite@*/
if (entry == NULL)
return NULL;
return entry;
last = h->index + h->indexUsed;
- /*@-usereleased@*/ /* FIX: entry2 = entry. Code looks bogus as well. */
+ /* FIX: entry2 = entry. Code looks bogus as well. */
while (entry2->info.tag == tag && entry2->info.type != type &&
entry2 < last) entry2++;
- /*@=usereleased@*/
if (entry->info.tag == tag && entry->info.type == type)
return entry;
*/
static
int headerRemoveEntry(Header h, int_32 tag)
- /*@modifies h @*/
{
indexEntry last = h->index + h->indexUsed;
indexEntry entry, first;
if (ne > 0) {
h->indexUsed -= ne;
ne = last - first;
-/*@-boundswrite@*/
if (ne > 0)
memmove(entry, first, (ne * sizeof(*entry)));
-/*@=boundswrite@*/
}
return 0;
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
-static /*@null@*/
-Header headerLoad(/*@kept@*/ void * uh)
- /*@modifies uh @*/
+static
+Header headerLoad(void * uh)
{
int_32 * ei = (int_32 *) uh;
int_32 il = ntohl(ei[0]); /* index length */
int_32 dl = ntohl(ei[1]); /* data length */
- /*@-sizeoftype@*/
size_t pvlen = sizeof(il) + sizeof(dl) +
(il * sizeof(struct entryInfo_s)) + dl;
- /*@=sizeoftype@*/
void * pv = uh;
Header h = NULL;
entryInfo pe;
goto errxit;
ei = (int_32 *) pv;
- /*@-castexpose@*/
pe = (entryInfo) &ei[2];
- /*@=castexpose@*/
dataStart = (unsigned char *) (pe + il);
dataEnd = dataStart + dl;
h = xcalloc(1, sizeof(*h));
- /*@-assignexpose@*/
h->hv = *hdrVec; /* structure assignment */
- /*@=assignexpose@*/
- /*@-assignexpose -kepttrans@*/
h->blob = uh;
- /*@=assignexpose =kepttrans@*/
h->indexAlloced = il + 1;
h->indexUsed = il;
h->index = xcalloc(h->indexAlloced, sizeof(*h->index));
h->flags |= HEADERFLAG_LEGACY;
entry->info.type = REGION_TAG_TYPE;
entry->info.tag = HEADER_IMAGE;
- /*@-sizeoftype@*/
entry->info.count = REGION_TAG_COUNT;
- /*@=sizeoftype@*/
entry->info.offset = ((unsigned char *)pe - dataStart); /* negative offset */
- /*@-assignexpose@*/
entry->data = pe;
- /*@=assignexpose@*/
entry->length = pvlen - sizeof(il) - sizeof(dl);
rdlen = regionSwab(entry+1, il, 0, pe, dataStart, dataEnd, entry->info.offset);
#if 0 /* XXX don't check, the 8/98 i18n bug fails here. */
if (hdrchkData(off))
goto errxit;
if (off) {
-/*@-sizeoftype@*/
size_t nb = REGION_TAG_COUNT;
-/*@=sizeoftype@*/
int_32 * stei = memcpy(alloca(nb), dataStart + off, nb);
rdl = -ntohl(stei[2]); /* negative offset */
ril = rdl/sizeof(*pe);
entry->info.tag = htonl(pe->tag);
} else {
ril = il;
- /*@-sizeoftype@*/
rdl = (ril * sizeof(struct entryInfo_s));
- /*@=sizeoftype@*/
entry->info.tag = HEADER_IMAGE;
}
}
entry->info.offset = -rdl; /* negative offset */
- /*@-assignexpose@*/
entry->data = pe;
- /*@=assignexpose@*/
entry->length = pvlen - sizeof(il) - sizeof(dl);
rdlen = regionSwab(entry+1, ril-1, 0, pe+1, dataStart, dataEnd, entry->info.offset);
if (rdlen < 0)
}
/* If any duplicate entries were replaced, move new entries down. */
-/*@-boundswrite@*/
if (h->indexUsed < (save - ne)) {
memmove(h->index + h->indexUsed, firstEntry,
(ne * sizeof(*entry)));
}
-/*@=boundswrite@*/
h->indexUsed += ne;
}
}
h->flags &= ~HEADERFLAG_SORTED;
headerSort(h);
- /*@-globstate -observertrans @*/
return h;
- /*@=globstate =observertrans @*/
errxit:
- /*@-usereleased@*/
if (h) {
h->index = _free(h->index);
- /*@-refcounttrans@*/
h = _free(h);
- /*@=refcounttrans@*/
}
- /*@=usereleased@*/
- /*@-refcounttrans -globstate@*/
return h;
- /*@=refcounttrans =globstate@*/
}
/** \ingroup header
* @param tag region tag
* @return on-disk header (with offsets)
*/
-static /*@null@*/
-Header headerReload(/*@only@*/ Header h, int tag)
- /*@modifies h @*/
+static
+Header headerReload(Header h, int tag)
{
Header nh;
int length;
- /*@-onlytrans@*/
-/*@-boundswrite@*/
void * uh = doHeaderUnload(h, &length);
-/*@=boundswrite@*/
h = headerFree(h);
- /*@=onlytrans@*/
if (uh == NULL)
return NULL;
nh = headerLoad(uh);
uh = _free(uh);
nh->flags |= HEADERFLAG_ALLOCATED;
if (ENTRY_IS_REGION(nh->index)) {
-/*@-boundswrite@*/
if (tag == HEADER_SIGNATURES || tag == HEADER_IMMUTABLE)
nh->index[0].info.tag = tag;
-/*@=boundswrite@*/
}
return nh;
}
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
-static /*@null@*/
+static
Header headerCopyLoad(const void * uh)
- /*@*/
{
int_32 * ei = (int_32 *) uh;
-/*@-boundsread@*/
int_32 il = ntohl(ei[0]); /* index length */
int_32 dl = ntohl(ei[1]); /* data length */
-/*@=boundsread@*/
- /*@-sizeoftype@*/
size_t pvlen = sizeof(il) + sizeof(dl) +
(il * sizeof(struct entryInfo_s)) + dl;
- /*@=sizeoftype@*/
void * nuh = NULL;
Header h = NULL;
/* Sanity checks on header intro. */
- /*@-branchstate@*/
if (!(hdrchkTags(il) || hdrchkData(dl)) && pvlen < headerMaxbytes) {
-/*@-boundsread@*/
nuh = memcpy(xmalloc(pvlen), uh, pvlen);
-/*@=boundsread@*/
if ((h = headerLoad(nuh)) != NULL)
h->flags |= HEADERFLAG_ALLOCATED;
}
- /*@=branchstate@*/
- /*@-branchstate@*/
if (h == NULL)
nuh = _free(nuh);
- /*@=branchstate@*/
return h;
}
* @param magicp read (and verify) 8 bytes of (magic, 0)?
* @return header (or NULL on error)
*/
-static /*@null@*/
+static
Header headerRead(FD_t fd, enum hMagic magicp)
- /*@modifies fd @*/
{
int_32 block[4];
int_32 reserved;
if (magicp == HEADER_MAGIC_YES)
i += 2;
- /*@-type@*/ /* FIX: cast? */
+ /* FIX: cast? */
if (timedRead(fd, (char *)block, i*sizeof(*block)) != (i * sizeof(*block)))
goto exit;
- /*@=type@*/
i = 0;
-/*@-boundsread@*/
if (magicp == HEADER_MAGIC_YES) {
magic = block[i++];
if (memcmp(&magic, header_magic, sizeof(magic)))
il = ntohl(block[i]); i++;
dl = ntohl(block[i]); i++;
-/*@=boundsread@*/
- /*@-sizeoftype@*/
len = sizeof(il) + sizeof(dl) + (il * sizeof(struct entryInfo_s)) + dl;
- /*@=sizeoftype@*/
/* Sanity checks on header intro. */
if (hdrchkTags(il) || hdrchkData(dl) || len > headerMaxbytes)
goto exit;
-/*@-boundswrite@*/
ei = xmalloc(len);
ei[0] = htonl(il);
ei[1] = htonl(dl);
len -= sizeof(il) + sizeof(dl);
-/*@=boundswrite@*/
-/*@-boundsread@*/
- /*@-type@*/ /* FIX: cast? */
+ /* FIX: cast? */
if (timedRead(fd, (char *)&ei[2], len) != len)
goto exit;
- /*@=type@*/
-/*@=boundsread@*/
h = headerLoad(ei);
h->flags |= HEADERFLAG_ALLOCATED;
} else if (ei)
ei = _free(ei);
- /*@-mustmod@*/ /* FIX: timedRead macro obscures annotation */
+ /* FIX: timedRead macro obscures annotation */
return h;
- /*@-mustmod@*/
}
/** \ingroup header
* @return 0 on success, 1 on error
*/
static
-int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
- /*@globals fileSystem @*/
- /*@modifies fd, h, fileSystem @*/
+int headerWrite(FD_t fd, Header h, enum hMagic magicp)
{
ssize_t nb;
int length;
if (h == NULL)
return 1;
-/*@-boundswrite@*/
uh = doHeaderUnload(h, &length);
-/*@=boundswrite@*/
if (uh == NULL)
return 1;
switch (magicp) {
case HEADER_MAGIC_YES:
-/*@-boundsread@*/
- /*@-sizeoftype@*/
nb = Fwrite(header_magic, sizeof(char), sizeof(header_magic), fd);
- /*@=sizeoftype@*/
-/*@=boundsread@*/
if (nb != sizeof(header_magic))
goto exit;
break;
break;
}
- /*@-sizeoftype@*/
nb = Fwrite(uh, sizeof(char), length, fd);
- /*@=sizeoftype@*/
exit:
uh = _free(uh);
* @return 1 on success, 0 on failure
*/
static
-int headerIsEntry(/*@null@*/Header h, int_32 tag)
- /*@*/
+int headerIsEntry(Header h, int_32 tag)
{
- /*@-mods@*/ /*@ FIX: h modified by sort. */
+ /* FIX: h modified by sort. */
return (findEntry(h, tag, RPM_NULL_TYPE) ? 1 : 0);
- /*@=mods@*/
+
}
/** \ingroup header
* @return 1 on success, otherwise error.
*/
static int copyEntry(const indexEntry entry,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c,
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c,
int minMem)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
{
int_32 count = entry->info.count;
int rc = 1; /* XXX 1 on success. */
*/
if (ENTRY_IS_REGION(entry)) {
int_32 * ei = ((int_32 *)entry->data) - 2;
- /*@-castexpose@*/
entryInfo pe = (entryInfo) (ei + 2);
- /*@=castexpose@*/
-/*@-boundsread@*/
unsigned char * dataStart = (unsigned char *) (pe + ntohl(ei[0]));
-/*@=boundsread@*/
int_32 rdl = -entry->info.offset; /* negative offset */
int_32 ril = rdl/sizeof(*pe);
- /*@-sizeoftype@*/
rdl = entry->rdlen;
count = 2 * sizeof(*ei) + (ril * sizeof(*pe)) + rdl;
if (entry->info.tag == HEADER_IMAGE) {
rdl += REGION_TAG_COUNT;
}
-/*@-bounds@*/
*p = xmalloc(count);
ei = (int_32 *) *p;
ei[0] = htonl(ril);
ei[1] = htonl(rdl);
- /*@-castexpose@*/
pe = (entryInfo) memcpy(ei + 2, pe, (ril * sizeof(*pe)));
- /*@=castexpose@*/
dataStart = (unsigned char *) memcpy(pe + ril, dataStart, rdl);
- /*@=sizeoftype@*/
-/*@=bounds@*/
rc = regionSwab(NULL, ril, 0, pe, dataStart, NULL, 0);
/* XXX 1 on success. */
*p = entry->data;
break;
}
- /*@fallthrough@*/
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
{ const char ** ptrEntry;
- /*@-sizeoftype@*/
int tableSize = count * sizeof(char *);
- /*@=sizeoftype@*/
char * t;
int i;
-/*@-bounds@*/
- /*@-mods@*/
if (minMem) {
*p = xmalloc(tableSize);
ptrEntry = (const char **) *p;
t += tableSize;
memcpy(t, entry->data, entry->length);
}
- /*@=mods@*/
-/*@=bounds@*/
for (i = 0; i < count; i++) {
-/*@-boundswrite@*/
*ptrEntry++ = t;
-/*@=boundswrite@*/
t = strchr(t, 0);
t++;
}
* @return 1 on match, 0 on no match
*/
static int headerMatchLocale(const char *td, const char *l, const char *le)
- /*@*/
{
const char *fe;
* @param entry i18n string data
* @return matching i18n string (or 1st string if no match)
*/
-/*@dependent@*/ /*@exposed@*/ static char *
+static char *
headerFindI18NString(Header h, indexEntry entry)
- /*@*/
{
const char *lang, *l, *le;
indexEntry table;
(lang = getenv("LANG")) == NULL)
return entry->data;
- /*@-mods@*/
if ((table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE)) == NULL)
return entry->data;
- /*@=mods@*/
-/*@-boundsread@*/
for (l = lang; *l != '\0'; l = le) {
const char *td;
char *ed;
}
}
-/*@=boundsread@*/
return entry->data;
}
* @return 1 on success, 0 on not found
*/
static int intGetEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTAG_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c,
+ hTAG_t type,
+ hPTR_t * p,
+ hCNT_t c,
int minMem)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
{
indexEntry entry;
int rc;
/* First find the tag */
- /*@-mods@*/ /*@ FIX: h modified by sort. */
+ /* FIX: h modified by sort. */
entry = findEntry(h, tag, RPM_NULL_TYPE);
- /*@mods@*/
if (entry == NULL) {
if (type) type = 0;
if (p) *p = NULL;
rc = 1;
if (type) *type = RPM_STRING_TYPE;
if (c) *c = 1;
- /*@-dependenttrans@*/
if (p) *p = headerFindI18NString(h, entry);
- /*@=dependenttrans@*/
break;
default:
rc = copyEntry(entry, type, p, c, minMem);
* @param type type of data (or -1 to force free)
* @return NULL always
*/
-static /*@null@*/ void * headerFreeTag(/*@unused@*/ Header h,
- /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/
+static void * headerFreeTag(Header h,
+ const void * data, rpmTagType type)
{
if (data) {
- /*@-branchstate@*/
if (type == -1 ||
type == RPM_STRING_ARRAY_TYPE ||
type == RPM_I18NSTRING_TYPE ||
type == RPM_BIN_TYPE)
data = _free(data);
- /*@=branchstate@*/
}
return NULL;
}
*/
static
int headerGetEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void ** p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+ hTYP_t type,
+ void ** p,
+ hCNT_t c)
{
return intGetEntry(h, tag, type, (hPTR_t *)p, c, 0);
}
*/
static
int headerGetEntryMinMemory(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c)
{
return intGetEntry(h, tag, type, p, c, 1);
}
if (p == NULL) return headerIsEntry(h, tag);
/* First find the tag */
- /*@-mods@*/ /*@ FIX: h modified by sort. */
+ /* FIX: h modified by sort. */
entry = findEntry(h, tag, RPM_NULL_TYPE);
- /*@=mods@*/
if (!entry) {
if (p) *p = NULL;
if (c) *c = 0;
/**
*/
-static void copyData(int_32 type, /*@out@*/ void * dstPtr, const void * srcPtr,
+static void copyData(int_32 type, void * dstPtr, const void * srcPtr,
int_32 cnt, int dataLength)
- /*@modifies *dstPtr @*/
{
switch (type) {
case RPM_STRING_ARRAY_TYPE:
{ const char ** av = (const char **) srcPtr;
char * t = dstPtr;
-/*@-bounds@*/
while (cnt-- > 0 && dataLength > 0) {
const char * s;
if ((s = *av++) == NULL)
*t++ = *s++;
} while (s[-1] && --dataLength > 0);
}
-/*@=bounds@*/
} break;
default:
-/*@-boundswrite@*/
memmove(dstPtr, srcPtr, dataLength);
-/*@=boundswrite@*/
break;
}
}
* @retval lengthPtr no. bytes in returned data
* @return (malloc'ed) copy of entry data, NULL on error
*/
-/*@null@*/
static void *
-grabData(int_32 type, hPTR_t p, int_32 c, /*@out@*/ int * lengthPtr)
- /*@modifies *lengthPtr @*/
- /*@requires maxSet(lengthPtr) >= 0 @*/
+grabData(int_32 type, hPTR_t p, int_32 c, int * lengthPtr)
{
void * data = NULL;
int length;
length = dataLength(type, p, c, 0, NULL);
-/*@-branchstate@*/
if (length > 0) {
data = xmalloc(length);
copyData(type, data, p, c, length);
}
-/*@=branchstate@*/
if (lengthPtr)
*lengthPtr = length;
*/
static
int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/
{
indexEntry entry;
void * data;
return 0;
length = 0;
-/*@-boundswrite@*/
data = grabData(type, p, c, &length);
-/*@=boundswrite@*/
if (data == NULL || length <= 0)
return 0;
entry->data = data;
entry->length = length;
-/*@-boundsread@*/
if (h->indexUsed > 0 && tag < h->index[h->indexUsed-1].info.tag)
h->flags &= ~HEADERFLAG_SORTED;
-/*@=boundsread@*/
h->indexUsed++;
return 1;
static
int headerAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
indexEntry entry;
int length;
if (ENTRY_IN_REGION(entry)) {
char * t = xmalloc(entry->length + length);
-/*@-bounds@*/
memcpy(t, entry->data, entry->length);
-/*@=bounds@*/
entry->data = t;
entry->info.offset = 0;
} else
static
int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
return (findEntry(h, tag, type)
? headerAppendEntry(h, tag, type, p, c)
static
int headerAddI18NString(Header h, int_32 tag, const char * string,
const char * lang)
- /*@modifies h @*/
{
indexEntry table, entry;
const char ** strArray;
const char * charArray[2];
int count = 0;
if (!lang || (lang[0] == 'C' && lang[1] == '\0')) {
- /*@-observertrans -readonlytrans@*/
charArray[count++] = "C";
- /*@=observertrans =readonlytrans@*/
} else {
- /*@-observertrans -readonlytrans@*/
charArray[count++] = "C";
- /*@=observertrans =readonlytrans@*/
charArray[count++] = lang;
}
if (!headerAddEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE,
if (!table)
return 0;
- /*@-branchstate@*/
if (!lang) lang = "C";
- /*@=branchstate@*/
{ const char * l = table->data;
for (langNum = 0; langNum < table->info.count; langNum++) {
/* Copy values into new storage */
memcpy(t, b, bn);
t += bn;
-/*@-mayaliasunique@*/
memcpy(t, string, sn);
t += sn;
memcpy(t, e, en);
t += en;
-/*@=mayaliasunique@*/
/* Replace i18N string array */
entry->length -= strlen(be) + 1;
entry->info.offset = 0;
} else
entry->data = _free(entry->data);
- /*@-dependenttrans@*/
entry->data = buf;
- /*@=dependenttrans@*/
}
return 0;
static
int headerModifyEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
- /*@modifies h @*/
{
indexEntry entry;
void * oldData;
entry->data = data;
entry->length = length;
- /*@-branchstate@*/
if (ENTRY_IN_REGION(entry)) {
entry->info.offset = 0;
} else
oldData = _free(oldData);
- /*@=branchstate@*/
return 1;
}
/**
*/
-static char escapedChar(const char ch) /*@*/
+static char escapedChar(const char ch)
{
switch (ch) {
case 'a': return '\a';
* @param num number of elements
* @return NULL always
*/
-static /*@null@*/ sprintfToken
-freeFormat( /*@only@*/ /*@null@*/ sprintfToken format, int num)
- /*@modifies *format @*/
+static sprintfToken
+freeFormat( sprintfToken format, int num)
{
int i;
for (i = 0; i < num; i++) {
switch (format[i].type) {
case PTOK_ARRAY:
-/*@-boundswrite@*/
format[i].u.array.format =
freeFormat(format[i].u.array.format,
format[i].u.array.numTokens);
-/*@=boundswrite@*/
- /*@switchbreak@*/ break;
+ break;
case PTOK_COND:
-/*@-boundswrite@*/
format[i].u.cond.ifFormat =
freeFormat(format[i].u.cond.ifFormat,
format[i].u.cond.numIfTokens);
format[i].u.cond.elseFormat =
freeFormat(format[i].u.cond.elseFormat,
format[i].u.cond.numElseTokens);
-/*@=boundswrite@*/
- /*@switchbreak@*/ break;
+ break;
case PTOK_NONE:
case PTOK_TAG:
case PTOK_STRING:
default:
- /*@switchbreak@*/ break;
+ break;
}
}
format = _free(format);
* Header tag iterator data structure.
*/
struct headerIterator_s {
-/*@unused@*/
Header h; /*!< Header being iterated. */
-/*@unused@*/
int next_index; /*!< Next tag index. */
};
* @param hi header tag iterator
* @return NULL always
*/
-static /*@null@*/
-HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi)
- /*@modifies hi @*/
+static
+HeaderIterator headerFreeIterator(HeaderIterator hi)
{
if (hi != NULL) {
hi->h = headerFree(hi->h);
*/
static
HeaderIterator headerInitIterator(Header h)
- /*@modifies h */
{
HeaderIterator hi = xmalloc(sizeof(*hi));
*/
static
int headerNextIterator(HeaderIterator hi,
- /*@null@*/ /*@out@*/ hTAG_t tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies hi, *tag, *type, *p, *c @*/
- /*@requires maxSet(tag) >= 0 /\ maxSet(type) >= 0
- /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/
+ hTAG_t tag,
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c)
{
Header h = hi->h;
int slot = hi->next_index;
if (entry == NULL || slot >= h->indexUsed)
return 0;
- /*@-noeffect@*/ /* LCL: no clue */
+ /* LCL: no clue */
hi->next_index++;
- /*@=noeffect@*/
if (tag)
*tag = entry->info.tag;
* @param h header
* @return new header instance
*/
-static /*@null@*/
+static
Header headerCopy(Header h)
- /*@modifies h @*/
{
Header nh = headerNew();
HeaderIterator hi;
int_32 tag, type, count;
hPTR_t ptr;
- /*@-branchstate@*/
for (hi = headerInitIterator(h);
headerNextIterator(hi, &tag, &type, &ptr, &count);
ptr = headerFreeData((void *)ptr, type))
if (ptr) (void) headerAddEntry(nh, tag, type, ptr, count);
}
hi = headerFreeIterator(hi);
- /*@=branchstate@*/
return headerReload(nh, HEADER_IMAGE);
}
typedef struct headerSprintfArgs_s {
Header h;
char * fmt;
-/*@temp@*/
headerTagTableEntry tags;
-/*@temp@*/
headerSprintfExtension exts;
-/*@observer@*/ /*@null@*/
const char * errmsg;
rpmec ec;
sprintfToken format;
-/*@relnull@*/
HeaderIterator hi;
-/*@owned@*/
char * val;
size_t vallen;
size_t alloced;
* @param hsa headerSprintf args
* @return headerSprintf args
*/
-static headerSprintfArgs hsaInit(/*@returned@*/ headerSprintfArgs hsa)
- /*@modifies hsa */
+static headerSprintfArgs hsaInit(headerSprintfArgs hsa)
{
sprintfTag tag =
(hsa->format->type == PTOK_TAG
if (tag != NULL && tag->tag == -2)
hsa->hi = headerInitIterator(hsa->h);
}
-/*@-nullret@*/
return hsa;
-/*@=nullret@*/
}
/**
* @param hsa headerSprintf args
* @return next sprintfToken (or NULL)
*/
-/*@null@*/
-static sprintfToken hsaNext(/*@returned@*/ headerSprintfArgs hsa)
- /*@modifies hsa */
+static sprintfToken hsaNext(headerSprintfArgs hsa)
{
sprintfToken fmt = NULL;
sprintfTag tag =
int_32 type;
int_32 count;
-/*@-boundswrite@*/
if (!headerNextIterator(hsa->hi, &tagno, &type, NULL, &count))
fmt = NULL;
tag->tag = tagno;
-/*@=boundswrite@*/
}
}
-/*@-dependenttrans -onlytrans@*/
return fmt;
-/*@=dependenttrans =onlytrans@*/
}
/**
* @param hsa headerSprintf args
* @return headerSprintf args
*/
-static headerSprintfArgs hsaFini(/*@returned@*/ headerSprintfArgs hsa)
- /*@modifies hsa */
+static headerSprintfArgs hsaFini(headerSprintfArgs hsa)
{
if (hsa != NULL) {
hsa->hi = headerFreeIterator(hsa->hi);
hsa->i = 0;
}
-/*@-nullret@*/
return hsa;
-/*@=nullret@*/
}
/**
* @param need no. of bytes to reserve
* @return pointer to reserved space
*/
-/*@dependent@*/ /*@exposed@*/
static char * hsaReserve(headerSprintfArgs hsa, size_t need)
- /*@modifies hsa */
{
if ((hsa->vallen + need) >= hsa->alloced) {
if (hsa->alloced <= need)
* @param val tag value to find
* @return tag name, NULL on not found
*/
-/*@observer@*/ /*@null@*/
static const char * myTagName(headerTagTableEntry tbl, int val)
- /*@*/
{
static char name[128];
const char * s;
* @return tag value, 0 on not found
*/
static int myTagValue(headerTagTableEntry tbl, const char * name)
- /*@*/
{
for (; tbl->name != NULL; tbl++) {
if (!xstrcasecmp(tbl->name, name))
* @return 0 on success, 1 on not found
*/
static int findTag(headerSprintfArgs hsa, sprintfToken token, const char * name)
- /*@modifies token @*/
{
headerSprintfExtension ext;
sprintfTag stag = (token->type == PTOK_COND
goto bingo;
}
-/*@-branchstate@*/
if (strncmp("RPMTAG_", name, sizeof("RPMTAG_")-1)) {
-/*@-boundswrite@*/
char * t = alloca(strlen(name) + sizeof("RPMTAG_"));
(void) stpcpy( stpcpy(t, "RPMTAG_"), name);
name = t;
-/*@=boundswrite@*/
}
-/*@=branchstate@*/
/* Search extensions for specific tag override. */
for (ext = hsa->exts; ext != NULL && ext->type != HEADER_EXT_LAST;
* @return 0 on success
*/
static int parseExpression(headerSprintfArgs hsa, sprintfToken token,
- char * str, /*@out@*/char ** endPtr)
- /*@modifies hsa, str, token, *endPtr @*/
- /*@requires maxSet(endPtr) >= 0 @*/;
+ char * str,char ** endPtr);
/**
* @param hsa headerSprintf args
* @param state
* @return 0 on success
*/
-static int parseFormat(headerSprintfArgs hsa, /*@null@*/ char * str,
- /*@out@*/sprintfToken * formatPtr, /*@out@*/int * numTokensPtr,
- /*@null@*/ /*@out@*/ char ** endPtr, int state)
- /*@modifies hsa, str, *formatPtr, *numTokensPtr, *endPtr @*/
- /*@requires maxSet(formatPtr) >= 0 /\ maxSet(numTokensPtr) >= 0
- /\ maxSet(endPtr) >= 0 @*/
+static int parseFormat(headerSprintfArgs hsa, char * str,
+ sprintfToken * formatPtr,int * numTokensPtr,
+ char ** endPtr, int state)
{
char * chptr, * start, * next, * dst;
sprintfToken format;
format = xcalloc(numTokens, sizeof(*format));
if (endPtr) *endPtr = NULL;
- /*@-infloops@*/ /* LCL: can't detect done termination */
+ /* LCL: can't detect done termination */
dst = start = str;
numTokens = 0;
token = NULL;
if (token == NULL || token->type != PTOK_STRING) {
token = format + numTokens++;
token->type = PTOK_STRING;
- /*@-temptrans -assignexpose@*/
dst = token->u.string.string = start;
- /*@=temptrans =assignexpose@*/
}
start++;
-/*@-boundswrite@*/
*dst++ = *start++;
-/*@=boundswrite@*/
- /*@switchbreak@*/ break;
+ break;
}
token = format + numTokens++;
-/*@-boundswrite@*/
*dst++ = '\0';
-/*@=boundswrite@*/
start++;
if (*start == '|') {
char * newEnd;
start++;
-/*@-boundswrite@*/
if (parseExpression(hsa, token, start, &newEnd))
{
format = freeFormat(format, numTokens);
return 1;
}
-/*@=boundswrite@*/
start = newEnd;
- /*@switchbreak@*/ break;
+ break;
}
- /*@-assignexpose@*/
token->u.tag.format = start;
- /*@=assignexpose@*/
token->u.tag.pad = 0;
token->u.tag.justOne = 0;
token->u.tag.arrayCount = 0;
return 1;
}
-/*@-boundswrite@*/
*chptr++ = '\0';
-/*@=boundswrite@*/
while (start < chptr) {
if (xisdigit(*start)) {
format = freeFormat(format, numTokens);
return 1;
}
-/*@-boundswrite@*/
*next++ = '\0';
-/*@=boundswrite@*/
chptr = start;
while (*chptr && *chptr != ':') chptr++;
if (*chptr != '\0') {
-/*@-boundswrite@*/
*chptr++ = '\0';
-/*@=boundswrite@*/
if (!*chptr) {
hsa->errmsg = _("empty tag format");
format = freeFormat(format, numTokens);
return 1;
}
- /*@-assignexpose@*/
token->u.tag.type = chptr;
- /*@=assignexpose@*/
} else {
token->u.tag.type = NULL;
}
}
start = next;
- /*@switchbreak@*/ break;
+ break;
case '[':
-/*@-boundswrite@*/
*dst++ = '\0';
*start++ = '\0';
-/*@=boundswrite@*/
token = format + numTokens++;
-/*@-boundswrite@*/
if (parseFormat(hsa, start,
&token->u.array.format,
&token->u.array.numTokens,
format = freeFormat(format, numTokens);
return 1;
}
-/*@=boundswrite@*/
if (!start) {
hsa->errmsg = _("] expected at end of array");
token->type = PTOK_ARRAY;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (state != PARSER_IN_ARRAY) {
format = freeFormat(format, numTokens);
return 1;
}
-/*@-boundswrite@*/
*start++ = '\0';
-/*@=boundswrite@*/
if (endPtr) *endPtr = start;
done = 1;
- /*@switchbreak@*/ break;
+ break;
case '}':
if (state != PARSER_IN_EXPR) {
format = freeFormat(format, numTokens);
return 1;
}
-/*@-boundswrite@*/
*start++ = '\0';
-/*@=boundswrite@*/
if (endPtr) *endPtr = start;
done = 1;
- /*@switchbreak@*/ break;
+ break;
default:
if (token == NULL || token->type != PTOK_STRING) {
token = format + numTokens++;
token->type = PTOK_STRING;
- /*@-temptrans -assignexpose@*/
dst = token->u.string.string = start;
- /*@=temptrans =assignexpose@*/
}
-/*@-boundswrite@*/
if (*start == '\\') {
start++;
*dst++ = escapedChar(*start++);
} else {
*dst++ = *start++;
}
-/*@=boundswrite@*/
- /*@switchbreak@*/ break;
+ break;
}
if (done)
break;
}
- /*@=infloops@*/
-/*@-boundswrite@*/
if (dst != NULL)
*dst = '\0';
-/*@=boundswrite@*/
for (i = 0; i < numTokens; i++) {
token = format + i;
return 0;
}
-/*@-boundswrite@*/
static int parseExpression(headerSprintfArgs hsa, sprintfToken token,
- char * str, /*@out@*/ char ** endPtr)
+ char * str, char ** endPtr)
{
char * chptr;
char * end;
return 0;
}
-/*@=boundswrite@*/
/**
* Call a header extension only once, saving results.
* @return 0 on success, 1 on failure
*/
static int getExtension(headerSprintfArgs hsa, headerTagTagFunction fn,
- /*@out@*/ hTYP_t typeptr,
- /*@out@*/ hPTR_t * data,
- /*@out@*/ hCNT_t countptr,
+ hTYP_t typeptr,
+ hPTR_t * data,
+ hCNT_t countptr,
rpmec ec)
- /*@modifies *typeptr, *data, *countptr, ec @*/
- /*@requires maxSet(typeptr) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(countptr) >= 0 @*/
{
if (!ec->avail) {
if (fn(hsa->h, &ec->type, &ec->data, &ec->count, &ec->freeit))
* @param element
* @return end of formatted string (NULL on error)
*/
-/*@observer@*/ /*@null@*/
static char * formatValue(headerSprintfArgs hsa, sprintfTag tag, int element)
- /*@modifies hsa @*/
{
char * val = NULL;
size_t need = 0;
memset(buf, 0, sizeof(buf));
if (tag->ext) {
-/*@-boundswrite -branchstate @*/
if (getExtension(hsa, tag->ext, &type, &data, &count, hsa->ec + tag->extNum))
{
count = 1;
type = RPM_STRING_TYPE;
data = "(none)";
}
-/*@=boundswrite =branchstate @*/
} else {
-/*@-boundswrite -branchstate @*/
if (!headerGetEntry(hsa->h, tag->tag, &type, (void **)&data, &count)) {
count = 1;
type = RPM_STRING_TYPE;
data = "(none)";
}
-/*@=boundswrite =branchstate @*/
/* XXX this test is unnecessary, array sizes are checked */
switch (type) {
default:
if (element >= count) {
- /*@-modobserver -observertrans@*/
data = headerFreeData(data, type);
- /*@=modobserver =observertrans@*/
hsa->errmsg = _("(index out of range)");
return NULL;
}
if (tag->arrayCount) {
- /*@-branchstate -observertrans -modobserver@*/
if (datafree)
data = headerFreeData(data, type);
- /*@=branchstate =observertrans =modobserver@*/
countBuf = count;
data = &countBuf;
type = RPM_INT32_TYPE;
}
-/*@-boundswrite@*/
(void) stpcpy( stpcpy(buf, "%"), tag->format);
-/*@=boundswrite@*/
- /*@-branchstate@*/
if (data)
switch (type) {
case RPM_STRING_ARRAY_TYPE:
need = strlen(strarray[element]) + tag->pad + 20;
val = xmalloc(need+1);
strcat(buf, "s");
- /*@-formatconst@*/
sprintf(val, buf, strarray[element]);
- /*@=formatconst@*/
}
break;
need = strlen(data) + tag->pad + 20;
val = xmalloc(need+1);
strcat(buf, "s");
- /*@-formatconst@*/
sprintf(val, buf, data);
- /*@=formatconst@*/
}
break;
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
intVal = *(((int_8 *) data) + element);
- /*@innerbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
intVal = *(((uint_16 *) data) + element);
- /*@innerbreak@*/ break;
+ break;
default: /* keep -Wall quiet */
case RPM_INT32_TYPE:
intVal = *(((int_32 *) data) + element);
- /*@innerbreak@*/ break;
+ break;
}
if (tag->fmt)
need = 10 + tag->pad + 20;
val = xmalloc(need+1);
strcat(buf, "d");
- /*@-formatconst@*/
sprintf(val, buf, intVal);
- /*@=formatconst@*/
}
break;
val = xstrdup("(unknown type)");
break;
}
- /*@=branchstate@*/
- /*@-branchstate -observertrans -modobserver@*/
if (datafree)
data = headerFreeData(data, type);
- /*@=branchstate =observertrans =modobserver@*/
- /*@-branchstate@*/
if (val && need > 0) {
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, val);
-/*@=boundswrite@*/
hsa->vallen += (te - t);
val = _free(val);
}
- /*@=branchstate@*/
return (hsa->val + hsa->vallen);
}
* @param element
* @return end of formatted string (NULL on error)
*/
-/*@observer@*/
static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
int element)
- /*@modifies hsa @*/
{
char * t, * te;
int i, j;
need = token->u.string.len;
if (need == 0) break;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, token->u.string.string);
-/*@=boundswrite@*/
hsa->vallen += (te - t);
break;
spft->u.tag.justOne) continue;
if (spft->u.tag.ext) {
-/*@-boundswrite@*/
if (getExtension(hsa, spft->u.tag.ext, &type, NULL, &count,
hsa->ec + spft->u.tag.extNum))
continue;
-/*@=boundswrite@*/
} else {
-/*@-boundswrite@*/
if (!headerGetEntry(hsa->h, spft->u.tag.tag, &type, NULL, &count))
continue;
-/*@=boundswrite@*/
}
if (type == RPM_BIN_TYPE)
hsa->errmsg =
_("array iterator used with different sized arrays");
return NULL;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPM_BIN_TYPE:
case RPM_STRING_TYPE:
- /*@switchbreak@*/ break;
+ break;
}
if (count > numElements)
numElements = count;
if (numElements == -1) {
need = sizeof("(none)") - 1;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, "(none)");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
} else {
int isxml;
if (tagN != NULL)
need += strlen(tagN);
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, " <rpmTag name=\"");
if (tagN != NULL)
te = stpcpy(te, tagN);
te = stpcpy(te, "\">\n");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
}
if (isxml) {
need = sizeof(" </rpmTag>\n") - 1;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, " </rpmTag>\n");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
}
* @param exts headerSprintf extensions
* @return new extension cache
*/
-static /*@only@*/ rpmec
+static rpmec
rpmecNew(const headerSprintfExtension exts)
- /*@*/
{
headerSprintfExtension ext;
rpmec ec;
* @param ec extension cache
* @return NULL always
*/
-static /*@null@*/ rpmec
-rpmecFree(const headerSprintfExtension exts, /*@only@*/ rpmec ec)
- /*@modifies ec @*/
+static rpmec
+rpmecFree(const headerSprintfExtension exts, rpmec ec)
{
headerSprintfExtension ext;
int i = 0;
for (ext = exts; ext != NULL && ext->type != HEADER_EXT_LAST;
ext = (ext->type == HEADER_EXT_MORE ? ext->u.more : ext+1))
{
-/*@-boundswrite@*/
if (ec[i].freeit) ec[i].data = _free(ec[i].data);
-/*@=boundswrite@*/
i++;
}
* @retval *errmsg error message (if any)
* @return formatted output string (malloc'ed)
*/
-static /*@only@*/ /*@null@*/
+static
char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry_s * tbltags,
const struct headerSprintfExtension_s * extensions,
- /*@null@*/ /*@out@*/ errmsg_t * errmsg)
- /*@modifies h, *errmsg @*/
- /*@requires maxSet(errmsg) >= 0 @*/
+ errmsg_t * errmsg)
{
headerSprintfArgs hsa = memset(alloca(sizeof(*hsa)), 0, sizeof(*hsa));
sprintfToken nextfmt;
hsa->h = headerLink(h);
hsa->fmt = xstrdup(fmt);
-/*@-castexpose@*/ /* FIX: legacy API shouldn't change. */
hsa->exts = (headerSprintfExtension) extensions;
hsa->tags = (headerTagTableEntry) tbltags;
-/*@=castexpose@*/
hsa->errmsg = NULL;
-/*@-boundswrite@*/
if (parseFormat(hsa, hsa->fmt, &hsa->format, &hsa->numTokens, NULL, PARSER_BEGIN))
goto exit;
-/*@=boundswrite@*/
hsa->ec = rpmecNew(hsa->exts);
hsa->val = xstrdup("");
if (isxml) {
need = sizeof("<rpmHeader>\n") - 1;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, "<rpmHeader>\n");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
}
if (isxml) {
need = sizeof("</rpmHeader>\n") - 1;
t = hsaReserve(hsa, need);
-/*@-boundswrite@*/
te = stpcpy(t, "</rpmHeader>\n");
-/*@=boundswrite@*/
hsa->vallen += (te - t);
}
hsa->format = freeFormat(hsa->format, hsa->numTokens);
exit:
-/*@-dependenttrans -observertrans @*/
if (errmsg)
*errmsg = hsa->errmsg;
-/*@=dependenttrans =observertrans @*/
hsa->h = headerFree(hsa->h);
hsa->fmt = _free(hsa->fmt);
return hsa->val;
* @return formatted string
*/
static char * octalFormat(int_32 type, hPTR_t data,
- char * formatPrefix, int padding, /*@unused@*/int element)
- /*@modifies formatPrefix @*/
+ char * formatPrefix, int padding,int element)
{
char * val;
val = xstrdup(_("(not a number)"));
} else {
val = xmalloc(20 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "o");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(val, formatPrefix, *((int_32 *) data));
- /*@=formatconst@*/
}
return val;
* @return formatted string
*/
static char * hexFormat(int_32 type, hPTR_t data,
- char * formatPrefix, int padding, /*@unused@*/int element)
- /*@modifies formatPrefix @*/
+ char * formatPrefix, int padding,int element)
{
char * val;
val = xstrdup(_("(not a number)"));
} else {
val = xmalloc(20 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "x");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(val, formatPrefix, *((int_32 *) data));
- /*@=formatconst@*/
}
return val;
/**
*/
static char * realDateFormat(int_32 type, hPTR_t data,
- char * formatPrefix, int padding, /*@unused@*/int element,
+ char * formatPrefix, int padding,int element,
const char * strftimeFormat)
- /*@modifies formatPrefix @*/
{
char * val;
char buf[50];
val = xmalloc(50 + padding);
-/*@-boundswrite@*/
strcat(formatPrefix, "s");
-/*@=boundswrite@*/
/* this is important if sizeof(int_32) ! sizeof(time_t) */
{ time_t dateint = *((int_32 *) data);
buf[0] = '\0';
if (tstruct)
(void) strftime(buf, sizeof(buf) - 1, strftimeFormat, tstruct);
- /*@-formatconst@*/
sprintf(val, formatPrefix, buf);
- /*@=formatconst@*/
}
return val;
*/
static char * dateFormat(int_32 type, hPTR_t data,
char * formatPrefix, int padding, int element)
- /*@modifies formatPrefix @*/
{
return realDateFormat(type, data, formatPrefix, padding, element,
_("%c"));
*/
static char * dayFormat(int_32 type, hPTR_t data,
char * formatPrefix, int padding, int element)
- /*@modifies formatPrefix @*/
{
return realDateFormat(type, data, formatPrefix, padding, element,
_("%a %b %d %Y"));
* @return formatted string
*/
static char * shescapeFormat(int_32 type, hPTR_t data,
- char * formatPrefix, int padding, /*@unused@*/int element)
- /*@modifies formatPrefix @*/
+ char * formatPrefix, int padding,int element)
{
char * result, * dst, * src, * buf;
if (type == RPM_INT32_TYPE) {
result = xmalloc(padding + 20);
-/*@-boundswrite@*/
strcat(formatPrefix, "d");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(result, formatPrefix, *((int_32 *) data));
- /*@=formatconst@*/
} else {
buf = alloca(strlen(data) + padding + 2);
-/*@-boundswrite@*/
strcat(formatPrefix, "s");
-/*@=boundswrite@*/
- /*@-formatconst@*/
sprintf(buf, formatPrefix, data);
- /*@=formatconst@*/
-/*@-boundswrite@*/
result = dst = xmalloc(strlen(buf) * 4 + 3);
*dst++ = '\'';
for (src = buf; *src != '\0'; src++) {
}
*dst++ = '\'';
*dst = '\0';
-/*@=boundswrite@*/
}
return result;
}
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
const struct headerSprintfExtension_s headerDefaultFormats[] = {
{ HEADER_EXT_FORMAT, "octal", { octalFormat } },
{ HEADER_EXT_FORMAT, "hex", { hexFormat } },
{ HEADER_EXT_FORMAT, "shescape", { shescapeFormat } },
{ HEADER_EXT_LAST, NULL, { NULL } }
};
-/*@=type@*/
/** \ingroup header
* Duplicate tag values from one header into another.
*/
static
void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
- /*@modifies headerTo @*/
{
int * p;
int_32 count;
if (headerIsEntry(headerTo, *p))
continue;
-/*@-boundswrite@*/
if (!headerGetEntryMinMemory(headerFrom, *p, &type,
(hPTR_t *) &s, &count))
continue;
-/*@=boundswrite@*/
(void) headerAddEntry(headerTo, *p, type, s, count);
s = headerFreeData(s, type);
}
}
-/*@observer@*/ /*@unchecked@*/
static struct HV_s hdrVec1 = {
headerLink,
headerUnlink,
1
};
-/*@-compmempass -redef@*/
-/*@observer@*/ /*@unchecked@*/
HV_t hdrVec = &hdrVec1;
-/*@=compmempass =redef@*/
typedef unsigned short uint_16;
typedef unsigned char uint_8;
-/*@-redef@*/ /* LCL: no clue */
/** \ingroup header
*/
typedef const char * errmsg_t;
/** \ingroup header
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct headerToken_s * Header;
+typedef struct headerToken_s * Header;
/** \ingroup header
*/
-typedef /*@abstract@*/ struct headerIterator_s * HeaderIterator;
+typedef struct headerIterator_s * HeaderIterator;
/** \ingroup header
* Associate tag names with numeric values.
*/
-typedef /*@abstract@*/ struct headerTagTableEntry_s * headerTagTableEntry;
+typedef struct headerTagTableEntry_s * headerTagTableEntry;
struct headerTagTableEntry_s {
-/*@observer@*/ /*@null@*/
const char * name; /*!< Tag name. */
int val; /*!< Tag numeric value. */
int type; /*!< Tag type. */
/**
*/
-typedef /*@abstract@*/ struct headerTagIndices_s * headerTagIndices;
+typedef struct headerTagIndices_s * headerTagIndices;
struct headerTagIndices_s {
int (*loadIndex) (headerTagTableEntry ** ipp, int * np,
- int (*cmp) (const void * avp, const void * bvp))
- /*@ modifies *ipp, *np */; /*!< load sorted tag index. */
-/*@relnull@*/
+ int (*cmp) (const void * avp, const void * bvp));
+ /*!< load sorted tag index. */
headerTagTableEntry * byName; /*!< header tags sorted by name. */
int byNameSize; /*!< no. of entries. */
- int (*byNameCmp) (const void * avp, const void * bvp)
- /*@*/; /*!< compare entries by name. */
- int (*tagValue) (const char * name)
- /*@*/; /* return value from name. */
-/*@relnull@*/
+ int (*byNameCmp) (const void * avp, const void * bvp); /*!< compare entries by name. */
+ int (*tagValue) (const char * name); /* return value from name. */
headerTagTableEntry * byValue; /*!< header tags sorted by value. */
int byValueSize; /*!< no. of entries. */
- int (*byValueCmp) (const void * avp, const void * bvp)
- /*@*/; /*!< compare entries by value. */
- const char * (*tagName) (int value)
- /*@*/; /* Return name from value. */
- int (*tagType) (int value)
- /*@*/; /* Return type from value. */
+ int (*byValueCmp) (const void * avp, const void * bvp); /*!< compare entries by value. */
+ const char * (*tagName) (int value); /* Return name from value. */
+ int (*tagType) (int value); /* Return type from value. */
};
/** \ingroup header
*/
typedef /*only@*/ char * (*headerTagFormatFunction)(int_32 type,
const void * data, char * formatPrefix,
- int padding, int element)
- /*@requires maxSet(data) >= 0 @*/;
+ int padding, int element);
/** \ingroup header
* HEADER_EXT_FORMAT format function prototype.
* @return 0 on success
*/
typedef int (*headerTagTagFunction) (Header h,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * data,
- /*@null@*/ /*@out@*/ hCNT_t count,
- /*@null@*/ /*@out@*/ int * freeData)
- /*@requires maxSet(type) >= 0 /\ maxSet(data) >= 0
- /\ maxSet(count) >= 0 /\ maxSet(freeData) >= 0 @*/;
+ hTYP_t type,
+ hPTR_t * data,
+ hCNT_t count,
+ int * freeData);
/** \ingroup header
* Define header tag output formats.
*/
-typedef /*@abstract@*/ struct headerSprintfExtension_s * headerSprintfExtension;
+typedef struct headerSprintfExtension_s * headerSprintfExtension;
struct headerSprintfExtension_s {
enum headerSprintfExtensionType type; /*!< Type of extension. */
-/*@observer@*/ /*@null@*/
const char * name; /*!< Name of extension. */
union {
-/*@observer@*/ /*@null@*/
void * generic; /*!< Private extension. */
headerTagFormatFunction formatFunction; /*!< HEADER_EXT_TAG extension. */
headerTagTagFunction tagFunction; /*!< HEADER_EXT_FORMAT extension. */
/** \ingroup header
* Supported default header tag output formats.
*/
-/*@-redecl@*/
-/*@observer@*/
extern const struct headerSprintfExtension_s headerDefaultFormats[];
-/*@=redecl@*/
/** \ingroup header
* Include calculation for 8 bytes of (magic, 0)?
* value of the tag a 16 byte image of what should/will be in the header index,
* followed by per-tag private data.
*/
-/*@-enummemuse -typeuse @*/
typedef enum rpmSubTagType_e {
RPM_REGION_TYPE = -10,
RPM_BIN_ARRAY_TYPE = -11,
/*!<@todo Implement, intent is to to carry a (???,tagNum,valNum) cross
reference to retrieve data from other tags. */
} rpmSubTagType;
-/*@=enummemuse =typeuse @*/
/** \ingroup header
* * Identify how to return the header data type.
* */
-/*@-enummemuse -typeuse @*/
typedef enum rpmTagReturnType_e {
RPM_ANY_RETURN_TYPE = 0,
RPM_SCALAR_RETURN_TYPE = 0x00010000,
RPM_MAPPING_RETURN_TYPE = 0x00040000,
RPM_MASK_RETURN_TYPE = 0xffff0000
} rpmTagReturnType;
-/*@=enummemuse =typeuse @*/
/**
* Header private tags.
/**
*/
-/*@-typeuse -fielduse@*/
typedef union hRET_s {
const void * ptr;
const char ** argv;
int_16 * i16p;
int_8 * i8p;
} * hRET_t;
-/*@=typeuse =fielduse@*/
/**
*/
-/*@-typeuse -fielduse@*/
typedef struct HE_s {
int_32 tag;
-/*@null@*/
hTYP_t typ;
union {
-/*@null@*/
hPTR_t * ptr;
-/*@null@*/
hRET_t * ret;
} u;
-/*@null@*/
hCNT_t cnt;
} * HE_t;
-/*@=typeuse =fielduse@*/
/** \ingroup header
* Create new (empty) header instance.
* @return header
*/
typedef
-Header (*HDRnew) (void)
- /*@*/;
+Header (*HDRnew) (void);
/** \ingroup header
* Dereference a header instance.
* @return NULL always
*/
typedef
-/*@null@*/ Header (*HDRfree) (/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/;
+Header (*HDRfree) (Header h);
/** \ingroup header
* Reference a header instance.
* @return referenced header instance
*/
typedef
-Header (*HDRlink) (Header h)
- /*@modifies h @*/;
+Header (*HDRlink) (Header h);
/** \ingroup header
* Dereference a header instance.
* @return NULL always
*/
typedef
-Header (*HDRunlink) (/*@killref@*/ /*@null@*/ Header h)
- /*@modifies h @*/;
+Header (*HDRunlink) (Header h);
/** \ingroup header
* Sort tags in header.
* @param h header
*/
typedef
-void (*HDRsort) (Header h)
- /*@modifies h @*/;
+void (*HDRsort) (Header h);
/** \ingroup header
* Restore tags in header to original ordering.
* @param h header
*/
typedef
-void (*HDRunsort) (Header h)
- /*@modifies h @*/;
+void (*HDRunsort) (Header h);
/** \ingroup header
* Return size of on-disk header representation in bytes.
* @return size of on-disk header
*/
typedef
-unsigned int (*HDRsizeof) (/*@null@*/ Header h, enum hMagic magicp)
- /*@modifies h @*/;
+unsigned int (*HDRsizeof) (Header h, enum hMagic magicp);
/** \ingroup header
* Convert header to on-disk representation.
* @return on-disk header blob (i.e. with offsets)
*/
typedef
-/*@only@*/ /*@null@*/ void * (*HDRunload) (Header h)
- /*@modifies h @*/;
+void * (*HDRunload) (Header h);
/** \ingroup header
* Convert header to on-disk representation, and then reload.
* @return on-disk header (with offsets)
*/
typedef
-/*@null@*/ Header (*HDRreload) (/*@only@*/ Header h, int tag)
- /*@modifies h @*/;
+Header (*HDRreload) (Header h, int tag);
/** \ingroup header
* Duplicate a header.
* @return new header instance
*/
typedef
-Header (*HDRcopy) (Header h)
- /*@modifies h @*/;
+Header (*HDRcopy) (Header h);
/** \ingroup header
* Convert header to in-memory representation.
* @return header
*/
typedef
-/*@null@*/ Header (*HDRload) (/*@kept@*/ void * uh)
- /*@modifies uh @*/;
+Header (*HDRload) (void * uh);
/** \ingroup header
* Make a copy and convert header to in-memory representation.
* @return header
*/
typedef
-/*@null@*/ Header (*HDRcopyload) (const void * uh)
- /*@*/;
+Header (*HDRcopyload) (const void * uh);
/** \ingroup header
* Read (and load) header from file handle.
* @return header (or NULL on error)
*/
typedef
-/*@null@*/ Header (*HDRread) (FD_t fd, enum hMagic magicp)
- /*@modifies fd @*/;
+Header (*HDRread) (FD_t fd, enum hMagic magicp);
/** \ingroup header
* Write (with unload) header to file handle.
* @return 0 on success, 1 on error
*/
typedef
-int (*HDRwrite) (FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
- /*@globals fileSystem @*/
- /*@modifies fd, h, fileSystem @*/;
+int (*HDRwrite) (FD_t fd, Header h, enum hMagic magicp);
/** \ingroup header
* Check if tag is in header.
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRisentry) (/*@null@*/Header h, int_32 tag)
- /*@*/;
+int (*HDRisentry) (Header h, int_32 tag);
/** \ingroup header
* Free data allocated when retrieved from header.
* @return NULL always
*/
typedef
-/*@null@*/ void * (*HDRfreetag) (Header h,
- /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/;
+void * (*HDRfreetag) (Header h,
+ const void * data, rpmTagType type);
/** \ingroup header
* Retrieve tag value.
*/
typedef
int (*HDRget) (Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ void ** p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/;
+ hTYP_t type,
+ void ** p,
+ hCNT_t c);
/** \ingroup header
* Retrieve tag value using header internal array.
*/
typedef
int (*HDRgetmin) (Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/;
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c);
/** \ingroup header
* Add tag to header.
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRadd) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/;
+int (*HDRadd) (Header h, int_32 tag, int_32 type, const void * p, int_32 c);
/** \ingroup header
* Append element to tag array in header.
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/;
+int (*HDRappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c);
/** \ingroup header
* Add or append element to tag array in header.
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRaddorappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/;
+int (*HDRaddorappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c);
/** \ingroup header
* Add locale specific tag to header.
*/
typedef
int (*HDRaddi18n) (Header h, int_32 tag, const char * string,
- const char * lang)
- /*@modifies h @*/;
+ const char * lang);
/** \ingroup header
* Modify tag in header.
* @return 1 on success, 0 on failure
*/
typedef
-int (*HDRmodify) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
- /*@modifies h @*/;
+int (*HDRmodify) (Header h, int_32 tag, int_32 type, const void * p, int_32 c);
/** \ingroup header
* Delete tag in header.
* @return 0 on success, 1 on failure (INCONSISTENT)
*/
typedef
-int (*HDRremove) (Header h, int_32 tag)
- /*@modifies h @*/;
+int (*HDRremove) (Header h, int_32 tag);
/** \ingroup header
* Return formatted output string from header tags.
* @return formatted output string (malloc'ed)
*/
typedef
-/*@only@*/ char * (*HDRsprintf) (Header h, const char * fmt,
+char * (*HDRsprintf) (Header h, const char * fmt,
const struct headerTagTableEntry_s * tags,
const struct headerSprintfExtension_s * extensions,
- /*@null@*/ /*@out@*/ errmsg_t * errmsg)
- /*@modifies *errmsg @*/;
+ errmsg_t * errmsg);
/** \ingroup header
* Duplicate tag values from one header into another.
* @param tagstocopy array of tags that are copied
*/
typedef
-void (*HDRcopytags) (Header headerFrom, Header headerTo, hTAG_t tagstocopy)
- /*@modifies headerFrom, headerTo @*/;
+void (*HDRcopytags) (Header headerFrom, Header headerTo, hTAG_t tagstocopy);
/** \ingroup header
* Destroy header tag iterator.
* @return NULL always
*/
typedef
-HeaderIterator (*HDRfreeiter) (/*@only@*/ HeaderIterator hi)
- /*@modifies hi @*/;
+HeaderIterator (*HDRfreeiter) (HeaderIterator hi);
/** \ingroup header
* Create header tag iterator.
* @return header tag iterator
*/
typedef
-HeaderIterator (*HDRinititer) (Header h)
- /*@modifies h */;
+HeaderIterator (*HDRinititer) (Header h);
/** \ingroup header
* Return next tag from header.
*/
typedef
int (*HDRnextiter) (HeaderIterator hi,
- /*@null@*/ /*@out@*/ hTAG_t tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies hi, *tag, *type, *p, *c @*/;
+ hTAG_t tag,
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c);
/** \ingroup header
* Header method vectors.
*/
-typedef /*@abstract@*/ struct HV_s * HV_t;
+typedef struct HV_s * HV_t;
struct HV_s {
HDRlink hdrlink;
HDRunlink hdrunlink;
HDRfreeiter hdrfreeiter;
HDRinititer hdrinititer;
HDRnextiter hdrnextiter;
-/*@null@*/
void * hdrvecs;
-/*@null@*/
void * hdrdata;
int hdrversion;
};
* @param type type of data (or -1 to force free)
* @return NULL always
*/
-/*@unused@*/ static inline /*@null@*/
-void * headerFreeData( /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
- /*@modifies data @*/
+static inline
+void * headerFreeData( const void * data, rpmTagType type)
{
if (data) {
- /*@-branchstate@*/
if (type == -1 ||
type == RPM_STRING_ARRAY_TYPE ||
type == RPM_I18NSTRING_TYPE ||
type == RPM_BIN_TYPE)
free((void *)data);
- /*@=branchstate@*/
}
return NULL;
}
-/*@-sizeoftype@*/
/** \ingroup header
* \file rpmdb/header_internal.c
*/
#include "debug.h"
-/*@-boundswrite@*/
char ** headerGetLangs(Header h)
{
char **s, *e, **table;
table[i] = e;
table[count] = NULL;
- /*@-nullret@*/ return table; /*@=nullret@*/ /* LCL: double indirection? */
+ return table; /* LCL: double indirection? */
}
-/*@=boundswrite@*/
-/*@-boundsread@*/
-/*@-type@*/ /* FIX: shrug */
+/* FIX: shrug */
void headerDump(Header h, FILE *f, int flags,
const struct headerTagTableEntry_s * tags)
{
switch (p->info.type) {
case RPM_NULL_TYPE:
type = "NULL";
- /*@switchbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
type = "CHAR";
- /*@switchbreak@*/ break;
+ break;
case RPM_BIN_TYPE:
type = "BIN";
- /*@switchbreak@*/ break;
+ break;
case RPM_INT8_TYPE:
type = "INT8";
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
type = "INT16";
- /*@switchbreak@*/ break;
+ break;
case RPM_INT32_TYPE:
type = "INT32";
- /*@switchbreak@*/ break;
+ break;
/*case RPM_INT64_TYPE: type = "INT64"; break;*/
case RPM_STRING_TYPE:
type = "STRING";
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_ARRAY_TYPE:
type = "STRING_ARRAY";
- /*@switchbreak@*/ break;
+ break;
case RPM_I18NSTRING_TYPE:
type = "I18N_STRING";
- /*@switchbreak@*/ break;
+ break;
default:
type = "(unknown)";
- /*@switchbreak@*/ break;
+ break;
}
tage = tags;
(int) *((int_32 *) dp));
dp += sizeof(int_32);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
while (c--) {
(int) *((int_16 *) dp));
dp += sizeof(int_16);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_INT8_TYPE:
while (c--) {
fprintf(f, " Data: %.3d 0x%02x (%d)\n", ct++,
(int) *((int_8 *) dp));
dp += sizeof(int_8);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_BIN_TYPE:
while (c > 0) {
fprintf(f, " Data: %.3d ", ct);
ct++;
dp += sizeof(int_8);
if (! (ct % 8)) {
- /*@loopbreak@*/ break;
+ break;
}
}
fprintf(f, "\n");
}
- /*@switchbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
while (c--) {
char ch = (char) *((char *) dp);
(int) *((char *) dp));
dp += sizeof(char);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
dp = strchr(dp, 0);
dp++;
}
- /*@switchbreak@*/ break;
+ break;
default:
fprintf(stderr, _("Data type %d not supported\n"),
(int) p->info.type);
- /*@switchbreak@*/ break;
+ break;
}
}
p++;
}
}
-/*@=type@*/
-/*@=sizeoftype@*/
-/*@=boundsread@*/
char * bin2hex(const char *data, size_t size)
{
/** \ingroup header
* Description of tag data.
*/
-typedef /*@abstract@*/ struct entryInfo_s * entryInfo;
+typedef struct entryInfo_s * entryInfo;
struct entryInfo_s {
int_32 tag; /*!< Tag identifier. */
int_32 type; /*!< Tag data type. */
/** \ingroup header
* A single tag from a Header.
*/
-typedef /*@abstract@*/ struct indexEntry_s * indexEntry;
+typedef struct indexEntry_s * indexEntry;
struct indexEntry_s {
struct entryInfo_s info; /*!< Description of tag data. */
-/*@owned@*/
void * data; /*!< Location of tag data. */
int length; /*!< No. bytes of data. */
int rdlen; /*!< No. bytes of data in region. */
* The Header data structure.
*/
struct headerToken_s {
-/*@unused@*/
struct HV_s hv; /*!< Header public methods. */
-/*@only@*/ /*@null@*/
void * blob; /*!< Header region blob. */
-/*@owned@*/
indexEntry index; /*!< Array of tags. */
int indexUsed; /*!< Current size of tag array. */
int indexAlloced; /*!< Allocated size of tag array. */
#define HEADERFLAG_ALLOCATED (1 << 1) /*!< Is 1st header region allocated? */
#define HEADERFLAG_LEGACY (1 << 2) /*!< Header came from legacy source? */
#define HEADERFLAG_DEBUG (1 << 3) /*!< Debug this header? */
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
/** \ingroup header
*/
-typedef /*@abstract@*/ struct sprintfTag_s * sprintfTag;
+typedef struct sprintfTag_s * sprintfTag;
struct sprintfTag_s {
-/*@null@*/
headerTagFormatFunction fmt;
-/*@null@*/
headerTagTagFunction ext; /*!< NULL if tag element is invalid */
int extNum;
int_32 tag;
int justOne;
int arrayCount;
-/*@kept@*/
char * format;
-/*@kept@*/ /*@null@*/
char * type;
int pad;
};
/** \ingroup header
* Extension cache.
*/
-typedef /*@abstract@*/ struct rpmec_s * rpmec;
+typedef struct rpmec_s * rpmec;
struct rpmec_s {
int_32 type;
int_32 count;
int avail;
int freeit;
-/*@owned@*/
const void * data;
};
/** \ingroup header
*/
-typedef /*@abstract@*/ struct sprintfToken_s * sprintfToken;
-/*@-fielduse@*/
+typedef struct sprintfToken_s * sprintfToken;
struct sprintfToken_s {
enum {
PTOK_NONE = 0,
union {
struct sprintfTag_s tag; /*!< PTOK_TAG */
struct {
- /*@only@*/
sprintfToken format;
int i;
int numTokens;
} array; /*!< PTOK_ARRAY */
struct {
- /*@dependent@*/
char * string;
int len;
} string; /*!< PTOK_STRING */
struct {
- /*@only@*/ /*@null@*/
sprintfToken ifFormat;
int numIfTokens;
- /*@only@*/ /*@null@*/
sprintfToken elseFormat;
int numElseTokens;
struct sprintfTag_s tag;
} cond; /*!< PTOK_COND */
} u;
};
-/*@=fielduse@*/
#ifdef __cplusplus
extern "C" {
* @param h header
* @return array of locales (or NULL on error)
*/
-/*@unused@*/
-/*@only@*/ /*@null@*/ char ** headerGetLangs(Header h)
- /*@*/;
+char ** headerGetLangs(Header h);
/** \ingroup header
* Retrieve tag value with type match.
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
-/*@-exportlocal@*/
-/*@-incondefs@*/
int headerGetRawEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ hTYP_t type,
- /*@null@*/ /*@out@*/ hPTR_t * p,
- /*@null@*/ /*@out@*/ hCNT_t c)
- /*@modifies *type, *p, *c @*/
- /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/;
-/*@=incondefs@*/
-/*@=exportlocal@*/
+ hTYP_t type,
+ hPTR_t * p,
+ hCNT_t c);
/** \ingroup header
* Return header reference count.
* @param h header
* @return no. of references
*/
-/*@-type@*/ /* FIX: cast? */
-/*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
+/* FIX: cast? */
+static inline int headerUsageCount(Header h) {
return h->nrefs;
}
-/*@=type@*/
/** \ingroup header
* Dump a header in human readable format (for debugging).
* @param flags 0 or HEADER_DUMP_INLINE
* @param tags array of tag name/value pairs
*/
-/*@unused@*/
void headerDump(Header h, FILE *f, int flags,
- const struct headerTagTableEntry_s * tags)
- /*@globals fileSystem @*/
- /*@modifies f, fileSystem @*/;
+ const struct headerTagTableEntry_s * tags);
#define HEADER_DUMP_INLINE 1
/* XXX not perhaps the right place but.. */
* @retval fsizep file size
* @return -1 on error, otherwise, an open file descriptor
*/
-static int open_dso(const char * path, /*@null@*/ pid_t * pidp, /*@null@*/ size_t *fsizep)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *pidp, *fsizep, rpmGlobalMacroContext,
- fileSystem, internalState @*/
+static int open_dso(const char * path, pid_t * pidp, size_t *fsizep)
{
-/*@only@*/
static const char * cmd = NULL;
static int initted = 0;
int fdno;
initted++;
}
-/*@-boundswrite@*/
if (pidp) *pidp = 0;
if (fsizep) {
return -1;
*fsizep = st->st_size;
}
-/*@=boundswrite@*/
fdno = open(path, O_RDONLY);
if (fdno < 0)
return fdno;
-/*@-boundsread@*/
if (!(cmd && *cmd))
return fdno;
-/*@=boundsread@*/
#if HAVE_GELF_H && HAVE_LIBELF
{ Elf *elf = NULL;
(void) elf_version(EV_CURRENT);
-/*@-evalorder@*/
if ((elf = elf_begin (fdno, ELF_C_READ, NULL)) == NULL
|| elf_kind(elf) != ELF_K_ELF
|| gelf_getehdr(elf, &ehdr) == NULL
|| !(ehdr.e_type == ET_DYN || ehdr.e_type == ET_EXEC))
goto exit;
-/*@=evalorder@*/
bingo = 0;
- /*@-branchstate -uniondef @*/
while (!bingo && (scn = elf_nextscn(elf, scn)) != NULL) {
(void) gelf_getshdr(scn, &shdr);
if (shdr.sh_type != SHT_DYNAMIC)
for (ndx = 0; ndx < maxndx; ++ndx) {
(void) gelf_getdyn (data, ndx, &dyn);
if (!(dyn.d_tag == DT_GNU_PRELINKED || dyn.d_tag == DT_GNU_LIBLIST))
- /*@innercontinue@*/ continue;
+ continue;
bingo = 1;
- /*@innerbreak@*/ break;
+ break;
}
}
}
- /*@=branchstate =uniondef @*/
-/*@-boundswrite@*/
if (pidp != NULL && bingo) {
int pipes[2];
pid_t pid;
fdno = pipes[0];
xx = close(pipes[1]);
}
-/*@=boundswrite@*/
exit:
if (elf) (void) elf_end(elf);
int rc = 0;
int fdno;
-/*@-globs -internalglobs -mods @*/
fdno = open_dso(path, &pid, &fsize);
-/*@=globs =internalglobs =mods @*/
if (fdno < 0) {
rc = 1;
goto exit;
xx = munmap(mapped, fsize);
xx = close(fdno);
break;
- } /*@fallthrough@*/
+ }
#endif
case URL_IS_HTTPS:
case URL_IS_HTTP:
}
exit:
-/*@-boundswrite@*/
if (fsizep)
*fsizep = fsize;
if (!rc)
memcpy(digest, md5sum, md5len);
-/*@=boundswrite@*/
md5sum = _free(md5sum);
return rc;
}
-/*@-exportheadervar@*/
-/*@unchecked@*/
int _noDirTokens = 0;
-/*@=exportheadervar@*/
-/*@-boundsread@*/
static int dncmp(const void * a, const void * b)
- /*@*/
{
const char *const * first = a;
const char *const * second = b;
return strcmp(*first, *second);
}
-/*@=boundsread@*/
-/*@-bounds@*/
void compressFilelist(Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
goto exit;
}
- /*@-branchstate@*/
for (i = 0; i < count; i++) {
const char ** needle;
char savechar;
needle = dirNames;
savechar = *baseName;
*baseName = '\0';
-/*@-compdef@*/
if (dirIndex < 0 ||
(needle = bsearch(&fileNames[i], dirNames, dirIndex + 1, sizeof(dirNames[0]), dncmp)) == NULL) {
char *s = alloca(len + 1);
dirNames[dirIndex] = s;
} else
dirIndexes[i] = needle - dirNames;
-/*@=compdef@*/
*baseName = savechar;
baseNames[i] = baseName;
}
- /*@=branchstate@*/
exit:
if (count > 0) {
xx = hre(h, RPMTAG_OLDFILENAMES);
}
-/*@=bounds@*/
void rpmfiBuildFNames(Header h, rpmTag tagN,
- /*@out@*/ const char *** fnp, /*@out@*/ int * fcp)
+ const char *** fnp, int * fcp)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
fileNames = xmalloc(size);
t = ((char *) fileNames) + (sizeof(*fileNames) * count);
- /*@-branchstate@*/
for (i = 0; i < count; i++) {
fileNames[i] = t;
t = stpcpy( stpcpy(t, dirNames[dirIndexes[i]]), baseNames[i]);
*t++ = '\0';
}
- /*@=branchstate@*/
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);
- /*@-branchstate@*/
if (fnp)
*fnp = fileNames;
else
fileNames = _free(fileNames);
- /*@=branchstate@*/
if (fcp) *fcp = count;
}
int count = 0;
int xx;
- /*@-branchstate@*/
if (!headerIsEntry(h, RPMTAG_OLDFILENAMES)) {
rpmfiBuildFNames(h, RPMTAG_BASENAMES, &fileNames, &count);
if (fileNames == NULL || count <= 0)
fileNames, count);
fileNames = _free(fileNames);
}
- /*@=branchstate@*/
xx = hre(h, RPMTAG_DIRNAMES);
xx = hre(h, RPMTAG_BASENAMES);
xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL);
- /*@-nullderef@*/ /* LCL: providesEVR is not NULL */
+ /* LCL: providesEVR is not NULL */
if (provides && providesEVR && provideFlags)
for (i = 0; i < providesCount; i++) {
if (!(provides[i] && providesEVR[i]))
bingo = 0;
break;
}
- /*@=nullderef@*/
exit:
provides = hfd(provides, pnt);
* careful. This fixup makes queries give the new values though,
* which is quite handy.
*/
- /*@=branchstate@*/
if (headerGetEntry(h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &prefix, NULL))
{
const char * nprefix = stripTrailingChar(alloca_strdup(prefix), '/');
(void) headerAddEntry(h, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
&nprefix, 1);
}
- /*@=branchstate@*/
/*
* The file list was moved to a more compressed format which not
/**
*/
-/*@-redecl@*/
-/*@unchecked@*/
extern int _noDirTokens;
-/*@=redecl@*/
#ifdef __cplusplus
extern "C" {
* @retval *fsizep file size pointer (or NULL)
* @return 0 on success, 1 on error
*/
-int domd5(const char * fn, /*@out@*/ unsigned char * digest, int asAscii,
- /*@null@*/ /*@out@*/ size_t *fsizep)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies digest, *fsizep, fileSystem, internalState @*/;
+int domd5(const char * fn, unsigned char * digest, int asAscii,
+ size_t *fsizep);
/**
* Convert absolute path tag to (dirname,basename,dirindex) tags.
* @param h header
*/
-void compressFilelist(Header h)
- /*@modifies h @*/;
+void compressFilelist(Header h);
/**
* Retrieve file names from header.
* @retval *fcp number of files
*/
void rpmfiBuildFNames(Header h, rpmTag tagN,
- /*@out@*/ const char *** fnp, /*@out@*/ int * fcp)
- /*@modifies *fnp, *fcp @*/;
+ const char *** fnp, int * fcp);
/**
* Convert (dirname,basename,dirindex) tags to absolute path tag.
* @param h header
*/
-void expandFilelist(Header h)
- /*@modifies h @*/;
+void expandFilelist(Header h);
/**
* Retrofit a Provides: name = version-release dependency into legacy
* package headers.
* @param h header
*/
-void providePackageNVR(Header h)
- /*@modifies h @*/;
+void providePackageNVR(Header h);
/**
* Do all necessary retorfits for a package header.
* @param h header
* @param lead
*/
-void legacyRetrofit(Header h, const struct rpmlead * lead)
- /*@modifies h@*/;
+void legacyRetrofit(Header h, const struct rpmlead * lead);
#ifdef __cplusplus
}
-/*@-bounds -mustmod -sizeoftype @*/
#ifndef __APPLE__
/*-
* Copyright (c) 1992, 1993
static void
insertionsort(unsigned char *a, size_t n, size_t size,
int (*cmp) (const void *, const void *))
- /*@modifies *a @*/
{
u_char *ai, *s, *t, *u, tmp;
int i;
for (t = ai; t > a; t -= size) {
u = t - size;
if (cmp(u, t) <= 0)
- /*@innerbreak@*/ break;
+ break;
swap(u, t);
}
}
* is defined. Otherwise simple pairwise merging is used.)
*/
static void
-setup(unsigned char *list1, /*@out@*/ unsigned char *list2,
+setup(unsigned char *list1, unsigned char *list2,
size_t n, size_t size, int (*cmp) (const void *, const void *))
- /*@modifies list1, list2 @*/
{
int i, length, size2, tmp, sense;
unsigned char *f1, *f2, *s, *l2, *last, *p2;
/* Find pairs with same sense. */
for (f2 = f1 + size2; f2 < last; f2 += size2) {
if ((cmp(f2, f2+ size) > 0) != sense)
- /*@innerbreak@*/ break;
+ break;
length += 2;
}
if (length < THRESHOLD) { /* Pairwise merge */
register int i, sense;
int big, iflag;
register unsigned char *f1, *f2, *t, *b, *q, *l1, *l2;
- /*@dependent@*/
register unsigned char *tp2;
- /*@owned@*/
unsigned char *list2;
- /*@dependent@*/
unsigned char *list1;
unsigned char *p2, *p, *last, **p1;
setup(list1, list2, nmemb, size, cmp);
last = list2 + nmemb * size;
i = big = 0;
-/*@-branchstate@*/
while (*EVAL(list2) != last) {
l2 = list1;
p1 = EVAL(list1);
goto EXPONENTIAL;
}
} else {
-/*@-shiftimplementation@*/
EXPONENTIAL: for (i = size; ; i <<= 1)
if ((p = (b + i)) >= t) {
if ((p = t - size) > b &&
t = p;
else
b = p;
- /*@innerbreak@*/ break;
+ break;
} else if ((*cmp)(q, p) <= sense) {
t = p;
if (i == size)
goto FASTCASE;
} else
b = p;
- /*@-infloopsuncon@*/
while (t > b+size) {
i = (((t - b) / size) >> 1) * size;
if ((*cmp)(q, p = b + i) <= sense)
t = p;
else
b = p;
- /*@=infloopsuncon@*/
-/*@=shiftimplementation@*/
COPY: b = t;
}
i = size;
}
*p1 = l2;
}
-/*@-dependenttrans@*/
tp2 = list1; /* swap list1, list2 */
list1 = list2;
list2 = tp2;
-/*@=dependenttrans@*/
last = list2 + nmemb*size;
}
-/*@=branchstate@*/
if (base == list2) {
memmove(list2, list1, nmemb*size);
list2 = list1;
}
-/*@-usereleased@*/
free(list2);
-/*@=usereleased@*/
return (0);
}
#else
/* mergesort is implemented in System on Mac OS X */
#endif /* __APPLE__ */
-/*@=bounds =mustmod =sizeoftype @*/
#include <sys/file.h>
#ifndef DYING /* XXX already in "system.h" */
-/*@-noparams@*/
#include <fnmatch.h>
-/*@=noparams@*/
#endif
#include <regex.h>
#include "header_internal.h" /* XXX for HEADERFLAG_ALLOCATED */
#include "debug.h"
-/*@access dbiIndexSet@*/
-/*@access dbiIndexItem@*/
-/*@access rpmts@*/ /* XXX compared with NULL */
-/*@access Header@*/ /* XXX compared with NULL */
-/*@access rpmdbMatchIterator@*/
-/*@access pgpDig@*/
-
-/*@unchecked@*/
int _rpmdb_debug = 0;
-/*@unchecked@*/
static int _rebuildinprogress = 0;
-/*@unchecked@*/
static int _db_filter_dups = 0;
#define _DBI_FLAGS 0
#define _DBI_PERMS 0644
#define _DBI_MAJOR -1
-/*@unchecked@*/
-/*@globstate@*/ /*@null@*/ int * dbiTags = NULL;
-/*@unchecked@*/
+int * dbiTags = NULL;
int dbiTagsMax = 0;
/* We use this to comunicate back to the the rpm transaction
* what their install instance was on a rpmdbAdd().
*/
-/*@unchecked@*/
unsigned int myinstall_instance = 0;
/* Bit mask macros. */
-/*@-exporttype@*/
typedef unsigned int __pbm_bits;
-/*@=exporttype@*/
#define __PBM_NBITS (8 * sizeof (__pbm_bits))
#define __PBM_IX(d) ((d) / __PBM_NBITS)
#define __PBM_MASK(d) ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
-/*@-exporttype@*/
typedef struct {
__pbm_bits bits[1];
} pbm_set;
-/*@=exporttype@*/
#define __PBM_BITS(set) ((set)->bits)
#define PBM_FREE(s) _free(s);
* @retval odp no. of bits in map
* @param nd desired no. of bits
*/
-/*@unused@*/
static inline pbm_set * PBM_REALLOC(pbm_set ** sp, int * odp, int nd)
- /*@modifies *sp, *odp @*/
{
int i, nb;
-/*@-bounds -sizeoftype@*/
if (nd > (*odp)) {
nd *= 2;
nb = __PBM_IX(nd) + 1;
-/*@-unqualifiedtrans@*/
*sp = xrealloc(*sp, nb * sizeof(__pbm_bits));
-/*@=unqualifiedtrans@*/
for (i = __PBM_IX(*odp) + 1; i < nb; i++)
__PBM_BITS(*sp)[i] = 0;
*odp = nd;
}
-/*@=bounds =sizeoftype@*/
-/*@-compdef -retalias -usereleased@*/
return *sp;
-/*@=compdef =retalias =usereleased@*/
}
/**
* @return binary nibble
*/
static inline unsigned char nibble(char c)
- /*@*/
{
if (c >= '0' && c <= '9')
return (c - '0');
* @param len key value length
* @return 1 if only ASCII, 0 otherwise.
*/
-static int printable(const void * ptr, size_t len) /*@*/
+static int printable(const void * ptr, size_t len)
{
const char * s = ptr;
int i;
* @return dbi index, -1 on error
*/
static int dbiTagToDbix(int rpmtag)
- /*@*/
{
int dbix;
if (dbiTags != NULL)
for (dbix = 0; dbix < dbiTagsMax; dbix++) {
-/*@-boundsread@*/
if (rpmtag == dbiTags[dbix])
return dbix;
-/*@=boundsread@*/
}
return -1;
}
* Initialize database (index, tag) tuple from configuration.
*/
static void dbiTagsInit(void)
- /*@globals dbiTags, dbiTagsMax, rpmGlobalMacroContext, h_errno @*/
- /*@modifies dbiTags, dbiTagsMax, rpmGlobalMacroContext @*/
{
-/*@observer@*/
static const char * const _dbiTagStr_default =
"Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Sigmd5:Sha1header:Filemd5s:Depends:Pubkeys";
char * dbiTagStr = NULL;
break;
for (oe = o; oe && *oe; oe++) {
if (xisspace(*oe))
- /*@innerbreak@*/ break;
+ break;
if (oe[0] == ':' && !(oe[1] == '/' && oe[2] == '/'))
- /*@innerbreak@*/ break;
+ break;
}
if (oe && *oe)
*oe++ = '\0';
dbiTagStr = _free(dbiTagStr);
}
-/*@-redecl@*/
#define DB1vec NULL
#define DB2vec NULL
#ifdef HAVE_DB3_DB_H
-/*@-exportheadervar -declundef @*/
-/*@observer@*/ /*@unchecked@*/
extern struct _dbiVec db3vec;
-/*@=exportheadervar =declundef @*/
#define DB3vec &db3vec
-/*@=redecl@*/
#else
#define DB3vec NULL
#endif
#ifdef HAVE_SQLITE3_H
-/*@-exportheadervar -declundef @*/
-/*@observer@*/ /*@unchecked@*/
extern struct _dbiVec sqlitevec;
-/*@=exportheadervar =declundef @*/
#define SQLITEvec &sqlitevec
-/*@=redecl@*/
#else
#define SQLITEvec NULL
#endif
-/*@-nullassign@*/
-/*@observer@*/ /*@unchecked@*/
static struct _dbiVec *mydbvecs[] = {
DB1vec, DB1vec, DB2vec, DB3vec, SQLITEvec, NULL
};
-/*@=nullassign@*/
-dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, /*@unused@*/ unsigned int flags)
+dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag, unsigned int flags)
{
int dbix;
dbiIndex dbi = NULL;
return NULL;
/* Is this index already open ? */
-/*@-compdef@*/ /* FIX: db->_dbi may be NULL */
+/* FIX: db->_dbi may be NULL */
if ((dbi = db->_dbi[dbix]) != NULL)
return dbi;
-/*@=compdef@*/
_dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}");
if (_dbapi_rebuild < 1 || _dbapi_rebuild > 4)
dbi = NULL;
rc = (*mydbvecs[_dbapi]->open) (db, rpmtag, &dbi);
if (rc == 0 && dbi)
- /*@loopbreak@*/ break;
+ break;
}
if (_dbapi <= 0) {
static int _printed[32];
exit:
if (dbi != NULL && rc == 0) {
db->_dbi[dbix] = dbi;
-/*@-sizeoftype@*/
if (rpmtag == RPMDBI_PACKAGES && db->db_bits == NULL) {
db->db_nbits = 1024;
if (!dbiStat(dbi, DB_FAST_STAT)) {
}
db->db_bits = PBM_ALLOC(db->db_nbits);
}
-/*@=sizeoftype@*/
}
#ifdef HAVE_DB3_DB_H
else
dbi = db3Free(dbi);
#endif
-/*@-compdef -nullstate@*/ /* FIX: db->_dbi may be NULL */
+/* FIX: db->_dbi may be NULL */
return dbi;
-/*@=compdef =nullstate@*/
}
/**
* @return new item
*/
static dbiIndexItem dbiIndexNewItem(unsigned int hdrNum, unsigned int tagNum)
- /*@*/
{
dbiIndexItem rec = xcalloc(1, sizeof(*rec));
rec->hdrNum = hdrNum;
};
#define _DBSWAP(_a) \
-/*@-bounds@*/ \
+\
{ unsigned char _b, *_c = (_a).uc; \
_b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \
_b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
-/*@=bounds@*/ \
+\
}
/**
* @retval setp (malloc'ed) index set
* @return 0 on success
*/
-static int dbt2set(dbiIndex dbi, DBT * data, /*@out@*/ dbiIndexSet * setp)
- /*@modifies dbi, *setp @*/
+static int dbt2set(dbiIndex dbi, DBT * data, dbiIndexSet * setp)
{
int _dbbyteswapped = dbiByteSwapped(dbi);
const char * sdbir;
set->count = data->size / dbi->dbi_jlen;
set->recs = xmalloc(set->count * sizeof(*(set->recs)));
-/*@-bounds -sizeoftype @*/
switch (dbi->dbi_jlen) {
default:
case 2*sizeof(int_32):
break;
}
*setp = set;
-/*@=bounds =sizeoftype @*/
-/*@-compdef@*/
return 0;
-/*@=compdef@*/
}
/**
* @return 0 on success
*/
static int set2dbt(dbiIndex dbi, DBT * data, dbiIndexSet set)
- /*@modifies dbi, *data @*/
{
int _dbbyteswapped = dbiByteSwapped(dbi);
char * tdbir;
}
tdbir = data->data = xmalloc(data->size);
-/*@-bounds -sizeoftype@*/
switch (dbi->dbi_jlen) {
default:
case 2*sizeof(int_32):
}
break;
}
-/*@=bounds =sizeoftype@*/
-/*@-compdef@*/
return 0;
-/*@=compdef@*/
}
/* XXX assumes hdrNum is first int in dbiIndexItem */
static int hdrNumCmp(const void * one, const void * two)
- /*@*/
{
const int * a = one, * b = two;
return (*a - *b);
*/
static int dbiAppendSet(dbiIndexSet set, const void * recs,
int nrecs, size_t recsize, int sortset)
- /*@modifies *set @*/
{
const char * rptr = recs;
size_t rlen = (recsize < sizeof(*(set->recs)))
memset(set->recs + set->count, 0, nrecs * sizeof(*(set->recs)));
while (nrecs-- > 0) {
- /*@-mayaliasunique@*/
memcpy(set->recs + set->count, rptr, rlen);
- /*@=mayaliasunique@*/
rptr += recsize;
set->count++;
}
*/
static int dbiPruneSet(dbiIndexSet set, void * recs, int nrecs,
size_t recsize, int sorted)
- /*@modifies set, recs @*/
{
int from;
int to = 0;
typedef struct miRE_s {
rpmTag tag; /*!< header tag */
rpmMireMode mode; /*!< pattern match mode */
-/*@only@*/
const char * pattern; /*!< pattern string */
int notmatch; /*!< like "grep -v" */
-/*@only@*/
regex_t * preg; /*!< regex compiled pattern buffer */
int cflags; /*!< regcomp(3) flags */
int eflags; /*!< regexec(3) flags */
} * miRE;
struct _rpmdbMatchIterator {
-/*@dependent@*/ /*@null@*/
rpmdbMatchIterator mi_next;
-/*@only@*/
const void * mi_keyp;
size_t mi_keylen;
-/*@refcounted@*/
rpmdb mi_db;
rpmTag mi_rpmtag;
dbiIndexSet mi_set;
DBT mi_key;
DBT mi_data;
int mi_setx;
-/*@refcounted@*/ /*@null@*/
Header mi_h;
int mi_sorted;
int mi_cflags;
unsigned int mi_offset; /* header instance (native endian) */
unsigned int mi_filenum; /* tag element (native endian) */
int mi_nre;
-/*@only@*/ /*@null@*/
miRE mi_re;
-/*@null@*/
rpmts mi_ts;
-/*@null@*/
- rpmRC (*mi_hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg)
- /*@modifies ts, *msg @*/;
+ rpmRC (*mi_hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg);
};
-/*@unchecked@*/
static rpmdb rpmdbRock;
-/*@unchecked@*/ /*@exposed@*/ /*@null@*/
static rpmdbMatchIterator rpmmiRock;
int rpmdbCheckTerminate(int terminate)
- /*@globals rpmdbRock, rpmmiRock @*/
- /*@modifies rpmdbRock, rpmmiRock @*/
{
sigset_t newMask, oldMask;
static int terminating = 0;
rpmdb db;
rpmdbMatchIterator mi;
-/*@-branchstate@*/
while ((mi = rpmmiRock) != NULL) {
-/*@i@*/ rpmmiRock = mi->mi_next;
+ rpmmiRock = mi->mi_next;
mi->mi_next = NULL;
-/*@i@*/ mi = rpmdbFreeIterator(mi);
+ mi = rpmdbFreeIterator(mi);
}
-/*@=branchstate@*/
-/*@-newreftrans@*/
while ((db = rpmdbRock) != NULL) {
-/*@i@*/ rpmdbRock = db->db_next;
+ rpmdbRock = db->db_next;
db->db_next = NULL;
(void) rpmdbClose(db);
}
-/*@=newreftrans@*/
}
sigprocmask(SIG_SETMASK, &oldMask, NULL);
return terminating;
int rpmdbCheckSignals(void)
{
if (rpmdbCheckTerminate(0)) {
-/*@-abstract@*/ /* sigset_t is abstract type */
+/* sigset_t is abstract type */
rpmMessage(RPMMESS_DEBUG, "Exiting on signal(0x%lx) ...\n", *((unsigned long *)&rpmsqCaught));
exit(EXIT_FAILURE);
-/*@=abstract@*/
}
return 0;
}
/**
* Block all signals, returning previous signal mask.
*/
-static int blockSignals(/*@unused@*/ rpmdb db, /*@out@*/ sigset_t * oldMask)
- /*@globals fileSystem @*/
- /*@modifies *oldMask, fileSystem @*/
+static int blockSignals(rpmdb db, sigset_t * oldMask)
{
sigset_t newMask;
/**
* Restore signal mask.
*/
-/*@mayexit@*/
-static int unblockSignals(/*@unused@*/ rpmdb db, sigset_t * oldMask)
- /*@globals rpmdbRock, fileSystem, internalState @*/
- /*@modifies rpmdbRock, fileSystem, internalState @*/
+static int unblockSignals(rpmdb db, sigset_t * oldMask)
{
(void) rpmdbCheckSignals();
return sigprocmask(SIG_SETMASK, oldMask, NULL);
#define _DB_MAJOR -1
#define _DB_ERRPFX "rpmdb"
-/*@-fullinitblock@*/
-/*@observer@*/ /*@unchecked@*/
static struct rpmdb_s dbTemplate = {
_DB_ROOT, _DB_HOME, _DB_FLAGS, _DB_MODE, _DB_PERMS,
_DB_MAJOR, _DB_ERRPFX
};
-/*@=fullinitblock@*/
static int isTemporaryDB(int rpmtag)
{
for (dbix = 0; dbix < dbiTagsMax; dbix++) {
if (dbiTags[dbix] != rpmtag)
continue;
-/*@-boundswrite@*/
if (db->_dbi[dbix] != NULL) {
int xx;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection. */
+ /* FIX: double indirection. */
xx = dbiClose(db->_dbi[dbix], 0);
if (xx && rc == 0) rc = xx;
db->_dbi[dbix] = NULL;
- /*@=unqualifiedtrans@*/
}
-/*@=boundswrite@*/
break;
}
return rc;
}
/* XXX query.c, rpminstall.c, verify.c */
-/*@-incondefs@*/
int rpmdbClose(rpmdb db)
- /*@globals rpmdbRock @*/
- /*@modifies rpmdbRock @*/
{
rpmdb * prev, next;
int dbix;
(void) rpmdbUnlink(db, "rpmdbClose");
- /*@-usereleased@*/
if (db->nrefs > 0)
goto exit;
int xx;
if (db->_dbi[dbix] == NULL)
continue;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection. */
xx = dbiClose(db->_dbi[dbix], 0);
if (xx && rc == 0) rc = xx;
db->_dbi[dbix] = NULL;
- /*@=unqualifiedtrans@*/
}
db->db_errpfx = _free(db->db_errpfx);
db->db_root = _free(db->db_root);
db->db_bits = PBM_FREE(db->db_bits);
db->_dbi = _free(db->_dbi);
-/*@-newreftrans@*/
prev = &rpmdbRock;
while ((next = *prev) != NULL && next != db)
prev = &next->db_next;
if (next) {
-/*@i@*/ *prev = next->db_next;
+ *prev = next->db_next;
next->db_next = NULL;
}
-/*@=newreftrans@*/
- /*@-refcounttrans@*/ db = _free(db); /*@=refcounttrans@*/
- /*@=usereleased@*/
+ db = _free(db);
exit:
(void) rpmsqEnable(-SIGHUP, NULL);
(void) rpmsqEnable(-SIGPIPE,NULL);
return rc;
}
-/*@=incondefs@*/
int rpmdbSync(rpmdb db)
{
return rc;
}
-/*@-mods@*/ /* FIX: dbTemplate structure assignment */
-static /*@only@*/ /*@null@*/
-rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root,
- /*@kept@*/ /*@null@*/ const char * home,
+/* FIX: dbTemplate structure assignment */
+static
+rpmdb newRpmdb(const char * root,
+ const char * home,
int mode, int perms, int flags)
- /*@globals _db_filter_dups, rpmGlobalMacroContext, h_errno @*/
- /*@modifies _db_filter_dups, rpmGlobalMacroContext @*/
{
rpmdb db = xcalloc(sizeof(*db), 1);
const char * epfx = _DB_ERRPFX;
_initialized = 1;
}
-/*@-boundswrite@*/
- /*@-assignexpose@*/
*db = dbTemplate; /* structure assignment */
- /*@=assignexpose@*/
-/*@=boundswrite@*/
db->_dbi = NULL;
if (perms >= 0) db->db_perms = perms;
if (flags >= 0) db->db_flags = flags;
-/*@-nullpass@*/
/* HACK: no URL's for root prefixed dbpath yet. */
if (root && *root) {
const char * rootpath = NULL;
} else
db->db_root = rpmGetPath(_DB_ROOT, NULL);
db->db_home = rpmGetPath( (home && *home ? home : _DB_HOME), NULL);
-/*@=nullpass@*/
if (!(db->db_home && db->db_home[0] != '%')) {
rpmError(RPMERR_DBOPEN, _("no dbpath has been set\n"));
db->db_root = _free(db->db_root);
db->db_home = _free(db->db_home);
db = _free(db);
- /*@-globstate@*/ return NULL; /*@=globstate@*/
+ return NULL;
}
db->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL);
db->db_remove_env = 0;
db->db_ndbi = dbiTagsMax;
db->_dbi = xcalloc(db->db_ndbi, sizeof(*db->_dbi));
db->nrefs = 0;
- /*@-globstate@*/
return rpmdbLink(db, "rpmdbCreate");
- /*@=globstate@*/
}
-/*@=mods@*/
-static int openDatabase(/*@null@*/ const char * prefix,
- /*@null@*/ const char * dbpath,
- int _dbapi, /*@null@*/ /*@out@*/ rpmdb *dbp,
+static int openDatabase(const char * prefix,
+ const char * dbpath,
+ int _dbapi, rpmdb *dbp,
int mode, int perms, int flags)
- /*@globals rpmdbRock, rpmGlobalMacroContext, h_errno,
- fileSystem, internalState @*/
- /*@modifies rpmdbRock, *dbp, rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@requires maxSet(dbp) >= 0 @*/
{
rpmdb db;
int rc, xx;
if (db->db_api == 3)
#endif
goto exit;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMTAG_NAME:
if (dbi == NULL) rc |= 1;
if (minimal)
goto exit;
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
}
}
if (rc || justCheck || dbp == NULL)
xx = rpmdbClose(db);
else {
-/*@-assignexpose -newreftrans@*/
-/*@i@*/ db->db_next = rpmdbRock;
+ db->db_next = rpmdbRock;
rpmdbRock = db;
-/*@i@*/ *dbp = db;
-/*@=assignexpose =newreftrans@*/
+ *dbp = db;
}
return rc;
rpmdb XrpmdbUnlink(rpmdb db, const char * msg, const char * fn, unsigned ln)
{
-/*@-modfilesys@*/
if (_rpmdb_debug)
fprintf(stderr, "--> db %p -- %d %s at %s:%u\n", db, db->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
db->nrefs--;
return NULL;
}
rpmdb XrpmdbLink(rpmdb db, const char * msg, const char * fn, unsigned ln)
{
db->nrefs++;
-/*@-modfilesys@*/
if (_rpmdb_debug)
fprintf(stderr, "--> db %p ++ %d %s at %s:%u\n", db, db->nrefs, msg, fn, ln);
-/*@=modfilesys@*/
- /*@-refcounttrans@*/ return db; /*@=refcounttrans@*/
+ return db;
}
/* XXX python/rpmmodule.c */
int rpmdbOpen (const char * prefix, rpmdb *dbp, int mode, int perms)
{
int _dbapi = rpmExpandNumeric("%{_dbapi}");
-/*@-boundswrite@*/
return openDatabase(prefix, NULL, _dbapi, dbp, mode, perms, 0);
-/*@=boundswrite@*/
}
int rpmdbInit (const char * prefix, int perms)
int _dbapi = rpmExpandNumeric("%{_dbapi}");
int rc;
-/*@-boundswrite@*/
rc = openDatabase(prefix, NULL, _dbapi, &db, (O_CREAT | O_RDWR),
perms, RPMDB_FLAG_JUSTCHECK);
-/*@=boundswrite@*/
if (db != NULL) {
int xx;
xx = rpmdbOpenAll(db);
int _dbapi = rpmExpandNumeric("%{_dbapi}");
int rc = 0;
-/*@-boundswrite@*/
rc = openDatabase(prefix, NULL, _dbapi, &db, O_RDONLY, 0644, 0);
-/*@=boundswrite@*/
if (db != NULL) {
int dbix;
for (dbix = db->db_ndbi; --dbix >= 0; ) {
if (db->_dbi[dbix] == NULL)
continue;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection. */
+ /* FIX: double indirection. */
xx = dbiVerify(db->_dbi[dbix], 0);
if (xx && rc == 0) rc = xx;
db->_dbi[dbix] = NULL;
- /*@=unqualifiedtrans@*/
}
- /*@-nullstate@*/ /* FIX: db->_dbi[] may be NULL. */
+ /* FIX: db->_dbi[] may be NULL. */
xx = rpmdbClose(db);
- /*@=nullstate@*/
if (xx && rc == 0) rc = xx;
db = NULL;
}
* @param matches
* @return 0 on success, 1 on not found, -2 on error
*/
-static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec,
- DBT * key, DBT * data, /*@out@*/ dbiIndexSet * matches)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, *key, *data, *matches, rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@requires maxSet(matches) >= 0 @*/
+static int rpmdbFindByFile(rpmdb db, const char * filespec,
+ DBT * key, DBT * data, dbiIndexSet * matches)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
*matches = NULL;
if (filespec == NULL) return -2;
- /*@-branchstate@*/
if ((baseName = strrchr(filespec, '/')) != NULL) {
char * t;
size_t len;
len = baseName - filespec + 1;
-/*@-boundswrite@*/
t = strncpy(alloca(len + 1), filespec, len);
t[len] = '\0';
-/*@=boundswrite@*/
dirName = t;
baseName++;
} else {
dirName = "";
baseName = filespec;
}
- /*@=branchstate@*/
if (baseName == NULL)
return -2;
fp1 = fpLookup(fpc, dirName, baseName, 1);
dbi = dbiOpen(db, RPMTAG_BASENAMES, 0);
-/*@-branchstate@*/
if (dbi != NULL) {
dbcursor = NULL;
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
-/*@-temptrans@*/
key->data = (void *) baseName;
-/*@=temptrans@*/
key->size = strlen(baseName);
if (key->size == 0) key->size++; /* XXX "/" fixup. */
dbcursor = NULL;
} else
rc = -2;
-/*@=branchstate@*/
if (rc) {
allMatches = dbiFreeIndexSet(allMatches);
int num = dbiIndexRecordFileNumber(allMatches, i);
fp2 = fpLookup(fpc, dirNames[dirIndexes[num]], baseNames[num], 1);
- /*@-nullpass@*/
if (FP_EQUAL(fp1, fp2)) {
- /*@=nullpass@*/
rec->hdrNum = dbiIndexRecordOffset(allMatches, i);
rec->tagNum = dbiIndexRecordFileNumber(allMatches, i);
xx = dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
if (dbi == NULL)
return 0;
-/*@-temptrans@*/
key->data = (void *) name;
-/*@=temptrans@*/
key->size = strlen(name);
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
if (rc == 0) { /* success */
dbiIndexSet matches;
- /*@-nullpass@*/ /* FIX: matches might be NULL */
+ /* FIX: matches might be NULL */
matches = NULL;
(void) dbt2set(dbi, data, &matches);
if (matches) {
rc = dbiIndexSetCount(matches);
matches = dbiFreeIndexSet(matches);
}
- /*@=nullpass@*/
} else
if (rc == DB_NOTFOUND) { /* not found */
rc = 0;
static rpmRC dbiFindMatches(dbiIndex dbi, DBC * dbcursor,
DBT * key, DBT * data,
const char * name,
- /*@null@*/ const char * version,
- /*@null@*/ const char * release,
- /*@out@*/ dbiIndexSet * matches)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, *data, *matches,
- rpmGlobalMacroContext, fileSystem, internalState @*/
- /*@requires maxSet(matches) >= 0 @*/
+ const char * version,
+ const char * release,
+ dbiIndexSet * matches)
{
int gotMatches = 0;
int rc;
int i;
-/*@-temptrans@*/
key->data = (void *) name;
-/*@=temptrans@*/
key->size = strlen(name);
rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
}
/* Make sure the version and release match. */
- /*@-branchstate@*/
for (i = 0; i < dbiIndexSetCount(*matches); i++) {
unsigned int recoff = dbiIndexRecordOffset(*matches, i);
rpmdbMatchIterator mi;
}
h = rpmdbNextIterator(mi);
-/*@-boundswrite@*/
if (h)
(*matches)->recs[gotMatches++] = (*matches)->recs[i];
else
(*matches)->recs[i].hdrNum = 0;
-/*@=boundswrite@*/
mi = rpmdbFreeIterator(mi);
}
- /*@=branchstate@*/
if (gotMatches) {
(*matches)->count = gotMatches;
rc = RPMRC_NOTFOUND;
exit:
-/*@-unqualifiedtrans@*/ /* FIX: double indirection */
+/* FIX: double indirection */
if (rc && matches && *matches)
*matches = dbiFreeIndexSet(*matches);
-/*@=unqualifiedtrans@*/
return rc;
}
* @return RPMRC_OK on match, RPMRC_NOMATCH or RPMRC_FAIL
*/
static rpmRC dbiFindByLabel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
- /*@null@*/ const char * arg, /*@out@*/ dbiIndexSet * matches)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, *data, *matches,
- rpmGlobalMacroContext, fileSystem, internalState @*/
- /*@requires maxSet(matches) >= 0 @*/
+ const char * arg, dbiIndexSet * matches)
{
const char * release;
char * localarg;
rc = dbiFindMatches(dbi, dbcursor, key, data, arg, NULL, NULL, matches);
if (rc != RPMRC_NOTFOUND) return rc;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection */
+ /* FIX: double indirection */
*matches = dbiFreeIndexSet(*matches);
- /*@=unqualifiedtrans@*/
/* maybe a name and a release */
localarg = alloca(strlen(arg) + 1);
switch (*s) {
case '[':
brackets = 1;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (c != '[') brackets = 0;
- /*@switchbreak@*/ break;
+ break;
}
c = *s;
if (!brackets && *s == '-')
break;
}
- /*@-nullstate@*/ /* FIX: *matches may be NULL. */
+ /* FIX: *matches may be NULL. */
if (s == localarg) return RPMRC_NOTFOUND;
-/*@-boundswrite@*/
*s = '\0';
-/*@=boundswrite@*/
rc = dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, NULL, matches);
- /*@=nullstate@*/
if (rc != RPMRC_NOTFOUND) return rc;
- /*@-unqualifiedtrans@*/ /* FIX: double indirection */
+ /* FIX: double indirection */
*matches = dbiFreeIndexSet(*matches);
- /*@=unqualifiedtrans@*/
/* how about name-version-release? */
switch (*s) {
case '[':
brackets = 1;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (c != '[') brackets = 0;
- /*@switchbreak@*/ break;
+ break;
}
c = *s;
if (!brackets && *s == '-')
if (s == localarg) return RPMRC_NOTFOUND;
-/*@-boundswrite@*/
*s = '\0';
-/*@=boundswrite@*/
- /*@-nullstate@*/ /* FIX: *matches may be NULL. */
+ /* FIX: *matches may be NULL. */
return dbiFindMatches(dbi, dbcursor, key, data, localarg, s + 1, release, matches);
- /*@=nullstate@*/
}
/**
* @return 0 on success
*/
static int miFreeHeader(rpmdbMatchIterator mi, dbiIndex dbi)
- /*@globals fileSystem, internalState @*/
- /*@modifies mi, dbi, fileSystem, internalState @*/
{
int rc = 0;
rpmRC rpmrc = RPMRC_NOTFOUND;
int xx;
-/*@i@*/ key->data = (void *) &mi->mi_prevoffset;
+ key->data = (void *) &mi->mi_prevoffset;
key->size = sizeof(mi->mi_prevoffset);
data->data = headerUnload(mi->mi_h);
data->size = headerSizeof(mi->mi_h, HEADER_MAGIC_NO);
mi->mi_h = headerFree(mi->mi_h);
-/*@-nullstate@*/
return rc;
-/*@=nullstate@*/
}
rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
- /*@globals rpmmiRock @*/
- /*@modifies rpmmiRock @*/
{
rpmdbMatchIterator * prev, next;
dbiIndex dbi;
while ((next = *prev) != NULL && next != mi)
prev = &next->mi_next;
if (next) {
-/*@i@*/ *prev = next->mi_next;
+ *prev = next->mi_next;
next->mi_next = NULL;
}
mire->pattern = _free(mire->pattern);
if (mire->preg != NULL) {
regfree(mire->preg);
- /*@+voidabstract -usereleased @*/ /* LCL: regfree has bogus only */
+ /* LCL: regfree has bogus only */
mire->preg = _free(mire->preg);
- /*@=voidabstract =usereleased @*/
}
}
mi->mi_re = _free(mi->mi_re);
* @return 0 if pattern matches, >0 on nomatch, <0 on error
*/
static int miregexec(miRE mire, const char * val)
- /*@*/
{
int rc = 0;
break;
case RPMMIRE_DEFAULT:
case RPMMIRE_REGEX:
-/*@-boundswrite@*/
rc = regexec(mire->preg, val, 0, NULL, mire->eflags);
-/*@=boundswrite@*/
if (rc && rc != REG_NOMATCH) {
char msg[256];
(void) regerror(rc, mire->preg, msg, sizeof(msg)-1);
* @param pattern pattern to duplicate
* @return duplicated pattern
*/
-static /*@only@*/ char * mireDup(rpmTag tag, rpmMireMode *modep,
+static char * mireDup(rpmTag tag, rpmMireMode *modep,
const char * pattern)
- /*@modifies *modep @*/
- /*@requires maxSet(modep) >= 0 @*/
{
const char * s;
char * pat;
size_t nb;
int c;
-/*@-boundswrite@*/
switch (*modep) {
default:
case RPMMIRE_DEFAULT:
case '+':
case '*':
if (!brackets) nb++;
- /*@switchbreak@*/ break;
+ break;
case '\\':
s++;
- /*@switchbreak@*/ break;
+ break;
case '[':
brackets = 1;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (c != '[') brackets = 0;
- /*@switchbreak@*/ break;
+ break;
}
c = *s;
}
case '.':
case '+':
if (!brackets) *t++ = '\\';
- /*@switchbreak@*/ break;
+ break;
case '*':
if (!brackets) *t++ = '.';
- /*@switchbreak@*/ break;
+ break;
case '\\':
*t++ = *s++;
- /*@switchbreak@*/ break;
+ break;
case '[':
brackets = 1;
- /*@switchbreak@*/ break;
+ break;
case ']':
if (c != '[') brackets = 0;
- /*@switchbreak@*/ break;
+ break;
}
c = *t = *s;
}
pat = xstrdup(pattern);
break;
}
-/*@-boundswrite@*/
return pat;
}
int fnflags = 0;
int rc = 0;
-/*@-boundsread@*/
if (defmode == (rpmMireMode)-1) {
const char *t = rpmExpand("%{?_query_selector_match}", NULL);
notmatch = 1;
pattern++;
}
-/*@=boundsread@*/
-/*@-boundswrite@*/
allpat = mireDup(tag, &mode, pattern);
-/*@=boundswrite@*/
if (mode == RPMMIRE_DEFAULT)
mode = defmode;
- /*@-branchstate@*/
switch (mode) {
case RPMMIRE_DEFAULT:
case RPMMIRE_STRCMP:
break;
case RPMMIRE_REGEX:
- /*@-type@*/
preg = xcalloc(1, sizeof(*preg));
- /*@=type@*/
cflags = (REG_EXTENDED | REG_NOSUB);
rc = regcomp(preg, allpat, cflags);
if (rc) {
rc = -1;
break;
}
- /*@=branchstate@*/
if (rc) {
- /*@=kepttrans@*/ /* FIX: mire has kept values */
+ /* FIX: mire has kept values */
allpat = _free(allpat);
if (preg) {
regfree(preg);
- /*@+voidabstract -usereleased @*/ /* LCL: regfree has bogus only */
+ /* LCL: regfree has bogus only */
preg = _free(preg);
- /*@=voidabstract =usereleased @*/
}
- /*@=kepttrans@*/
return rc;
}
mire->eflags = eflags;
mire->fnflags = fnflags;
-/*@-boundsread@*/
if (mi->mi_nre > 1)
qsort(mi->mi_re, mi->mi_nre, sizeof(*mi->mi_re), mireCmp);
-/*@=boundsread@*/
return rc;
}
* @return 1 if header should be skipped
*/
static int mireSkip (const rpmdbMatchIterator mi)
- /*@*/
{
HGE_t hge = (HGE_t) headerGetEntryMinMemory;
HFD_t hfd = (HFD_t) headerFreeData;
* Apply tag tests, implicitly "||" for multiple patterns/values of a
* single tag, implicitly "&&" between multiple tag patterns.
*/
-/*@-boundsread@*/
if ((mire = mi->mi_re) != NULL)
for (i = 0; i < mi->mi_nre; i++, mire++) {
int anymatch;
continue;
}
t = RPM_INT32_TYPE;
-/*@-immediatetrans@*/
u.i32p = &zero;
-/*@=immediatetrans@*/
c = 1;
}
rc = miregexec(mire, numbuf);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
anymatch++;
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
sprintf(numbuf, "%d", (int) *u.i16p);
rc = miregexec(mire, numbuf);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
anymatch++;
- /*@switchbreak@*/ break;
+ break;
case RPM_INT32_TYPE:
sprintf(numbuf, "%d", (int) *u.i32p);
rc = miregexec(mire, numbuf);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
anymatch++;
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
rc = miregexec(mire, u.str);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch))
anymatch++;
- /*@switchbreak@*/ break;
+ break;
case RPM_I18NSTRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
for (j = 0; j < c; j++) {
rc = miregexec(mire, u.argv[j]);
if ((!rc && !mire->notmatch) || (rc && mire->notmatch)) {
anymatch++;
- /*@innerbreak@*/ break;
+ break;
}
}
- /*@switchbreak@*/ break;
+ break;
case RPM_BIN_TYPE:
{
const char * str = bin2hex((const char*) u.ptr, c);
anymatch++;
_free(str);
}
- /*@switchbreak@*/ break;
+ break;
case RPM_NULL_TYPE:
default:
- /*@switchbreak@*/ break;
+ break;
}
if ((i+1) < mi->mi_nre && mire[0].tag == mire[1].tag) {
i++;
mire++;
- /*@innercontinue@*/ continue;
+ continue;
}
- /*@innerbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
if ((tagType(mire->tag) & RPM_MASK_RETURN_TYPE) ==
RPM_ARRAY_RETURN_TYPE) {
int rc = 0;
if (mi == NULL)
return 0;
-/*@-assignexpose -newreftrans @*/ /* XXX forward linkage prevents rpmtsLink */
-/*@i@*/ mi->mi_ts = ts;
+/* XXX forward linkage prevents rpmtsLink */
+mi->mi_ts = ts;
mi->mi_hdrchk = hdrchk;
-/*@=assignexpose =newreftrans @*/
return rc;
}
-/*@-nullstate@*/ /* FIX: mi->mi_key.data may be NULL */
+/* FIX: mi->mi_key.data may be NULL */
Header rpmdbNextIterator(rpmdbMatchIterator mi)
{
dbiIndex dbi;
if (mi->mi_dbc == NULL)
xx = dbiCopen(dbi, dbi->dbi_txnid, &mi->mi_dbc, mi->mi_cflags);
-/*@-boundswrite@*/
key = &mi->mi_key;
memset(key, 0, sizeof(*key));
data = &mi->mi_data;
memset(data, 0, sizeof(*data));
-/*@=boundswrite@*/
top:
uh = NULL;
do {
union _dbswap mi_offset;
- /*@-branchstate -compmempass @*/
if (mi->mi_set) {
if (!(mi->mi_setx < mi->mi_set->count))
return NULL;
* largest header instance in the database, and should be
* skipped.
*/
-/*@-boundswrite@*/
if (keyp && mi->mi_setx && rc == 0) {
memcpy(&mi_offset, keyp, sizeof(mi_offset.ui));
if (dbiByteSwapped(dbi) == 1)
_DBSWAP(mi_offset);
mi->mi_offset = mi_offset.ui;
}
-/*@=boundswrite@*/
/* Terminate on error or end of keys */
if (rc || (mi->mi_setx && mi->mi_offset == 0))
return NULL;
}
- /*@=branchstate =compmempass @*/
mi->mi_setx++;
} while (mi->mi_offset == 0);
/* If next header is identical, return it now. */
-/*@-compdef -refcounttrans -retalias -retexpose -usereleased @*/
if (mi->mi_prevoffset && mi->mi_offset == mi->mi_prevoffset)
return mi->mi_h;
-/*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/
/* Retrieve next header blob for index iterator. */
- /*@-branchstate -compmempass -immediatetrans @*/
if (uh == NULL) {
key->data = keyp;
key->size = keylen;
if (rc)
return NULL;
}
- /*@=branchstate =compmempass =immediatetrans @*/
/* Rewrite current header (if necessary) and unlink. */
xx = miFreeHeader(mi, dbi);
return NULL;
/* Check header digest/signature once (if requested). */
-/*@-boundsread -branchstate -sizeoftype @*/
if (mi->mi_hdrchk && mi->mi_ts) {
rpmRC rpmrc = RPMRC_NOTFOUND;
goto top;
}
}
-/*@=boundsread =branchstate =sizeoftype @*/
/* Did the header blob load correctly? */
#if !defined(_USE_COPY_LOAD)
-/*@-onlytrans@*/
mi->mi_h = headerLoad(uh);
-/*@=onlytrans@*/
if (mi->mi_h)
mi->mi_h->flags |= HEADERFLAG_ALLOCATED;
#else
mi->mi_prevoffset = mi->mi_offset;
mi->mi_modified = 0;
-/*@-compdef -retalias -retexpose -usereleased @*/
return mi->mi_h;
-/*@=compdef =retalias =retexpose =usereleased @*/
}
-/*@=nullstate@*/
-static void rpmdbSortIterator(/*@null@*/ rpmdbMatchIterator mi)
- /*@modifies mi @*/
+static void rpmdbSortIterator(rpmdbMatchIterator mi)
{
if (mi && mi->mi_set && mi->mi_set->recs && mi->mi_set->count > 0) {
/*
* than pure quicksort, but glibc uses msort_with_tmp() on stack.
*/
#if defined(__GLIBC__)
-/*@-boundsread@*/
qsort(mi->mi_set->recs, mi->mi_set->count,
sizeof(*mi->mi_set->recs), hdrNumCmp);
-/*@=boundsread@*/
#else
mergesort(mi->mi_set->recs, mi->mi_set->count,
sizeof(*mi->mi_set->recs), hdrNumCmp);
}
}
-/*@-bounds@*/ /* LCL: segfault */
-static int rpmdbGrowIterator(/*@null@*/ rpmdbMatchIterator mi, int fpNum)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/
+/* LCL: segfault */
+static int rpmdbGrowIterator(rpmdbMatchIterator mi, int fpNum)
{
DBC * dbcursor;
DBT * key;
dbcursor = NULL;
#endif
-/*@-branchstate@*/
if (mi->mi_set == NULL) {
mi->mi_set = set;
} else {
mi->mi_set->count += set->count;
set = dbiFreeIndexSet(set);
}
-/*@=branchstate@*/
return rc;
}
-/*@=bounds@*/
int rpmdbPruneIterator(rpmdbMatchIterator mi, int * hdrNums,
int nHdrNums, int sorted)
rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag,
const void * keyp, size_t keylen)
- /*@globals rpmmiRock @*/
- /*@modifies rpmmiRock @*/
{
rpmdbMatchIterator mi;
DBT * key;
* Handle label and file name special cases.
* Otherwise, retrieve join keys for secondary lookup.
*/
-/*@-branchstate@*/
if (rpmtag != RPMDBI_PACKAGES && keyp) {
DBC * dbcursor = NULL;
int rc;
} else {
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
-/*@-temptrans@*/
key->data = (void *) keyp;
-/*@=temptrans@*/
key->size = keylen;
if (key->data && key->size == 0) key->size = strlen((char *)key->data);
if (key->data && key->size == 0) key->size++; /* XXX "/" fixup. */
-/*@-nullstate@*/
rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
-/*@=nullstate@*/
if (rc > 0) {
rpmError(RPMERR_DBGETINDEX,
_("error(%d) getting \"%s\" records from %s index\n"),
return NULL;
}
}
-/*@=branchstate@*/
/* Copy the retrieval key, byte swapping header instance if necessary. */
if (keyp) {
if (keylen == 0)
keylen = strlen(keyp);
k = xmalloc(keylen + 1);
-/*@-boundsread@*/
memcpy(k, keyp, keylen);
-/*@=boundsread@*/
k[keylen] = '\0'; /* XXX assumes strings */
mi_keyp = k;
} break;
mi->mi_ts = NULL;
mi->mi_hdrchk = NULL;
-/*@i@*/ return mi;
+return mi;
}
/* XXX psm.c */
-int rpmdbRemove(rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
- /*@unused@*/ rpmts ts,
- /*@unused@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
+int rpmdbRemove(rpmdb db, int rid, unsigned int hdrNum,
+ rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
{
DBC * dbcursor = NULL;
DBT * key = alloca(sizeof(*key));
(void) blockSignals(db, &signalMask);
- /*@-nullpass -nullptrarith -nullderef @*/ /* FIX: rpmvals heartburn */
+ /* FIX: rpmvals heartburn */
{ int dbix;
dbiIndexItem rec = dbiIndexNewItem(hdrNum, 0);
int i, j;
dbi = NULL;
-/*@-boundsread@*/
rpmtag = dbiTags[dbix];
-/*@=boundsread@*/
- /*@-branchstate@*/
/* Filter out temporary databases */
if (isTemporaryDB(rpmtag))
continue;
if (dbi == NULL) /* XXX shouldn't happen */
continue;
-/*@-immediatetrans@*/
mi_offset.ui = hdrNum;
if (dbiByteSwapped(dbi) == 1)
_DBSWAP(mi_offset);
key->data = &mi_offset;
-/*@=immediatetrans@*/
key->size = sizeof(mi_offset.ui);
rc = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR);
if (!dbi->dbi_no_dbsync)
xx = dbiSync(dbi, 0);
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
}
- /*@=branchstate@*/
if (!hge(h, rpmtag, &rpmtype, (void **) &rpmvals, &rpmcnt))
continue;
printed = 0;
xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, DB_WRITECURSOR);
-/*@-branchstate@*/
for (i = 0; i < rpmcnt; i++) {
dbiIndexSet set;
int stringvalued;
case RPMTAG_FILEMD5S:
/* Filter out empty MD5 strings. */
if (!(rpmvals[i] && *rpmvals[i] != '\0'))
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
/* Identify value pointer and length. */
stringvalued = 0;
switch (rpmtype) {
-/*@-sizeoftype@*/
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
key->size = sizeof(RPM_CHAR_TYPE);
key->data = rpmvals + i;
- /*@switchbreak@*/ break;
+ break;
case RPM_INT16_TYPE:
key->size = sizeof(int_16);
key->data = rpmvals + i;
- /*@switchbreak@*/ break;
+ break;
case RPM_INT32_TYPE:
key->size = sizeof(int_32);
key->data = rpmvals + i;
- /*@switchbreak@*/ break;
-/*@=sizeoftype@*/
+ break;
case RPM_BIN_TYPE:
key->size = rpmcnt;
key->data = rpmvals;
rpmcnt = 1; /* XXX break out of loop. */
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_I18NSTRING_TYPE:
rpmcnt = 1; /* XXX break out of loop. */
- /*@fallthrough@*/
case RPM_STRING_ARRAY_TYPE:
/* Convert from hex to binary. */
-/*@-boundsread@*/
if (dbi->dbi_rpmtag == RPMTAG_FILEMD5S) {
const char * s;
byte * t;
*t = (nibble(s[0]) << 4) | nibble(s[1]);
key->data = bin;
key->size = 16;
- /*@switchbreak@*/ break;
+ break;
}
/* Extract the pubkey id from the base64 blob. */
if (dbi->dbi_rpmtag == RPMTAG_PUBKEYS) {
size_t pktlen;
if (b64decode(rpmvals[i], (void **)&pkt, &pktlen))
- /*@innercontinue@*/ continue;
+ continue;
(void) pgpPrtPkts(pkt, pktlen, dig, 0);
memcpy(bin, dig->pubkey.signid, 8);
pkt = _free(pkt);
dig = _free(dig);
key->data = bin;
key->size = 8;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
- /*@fallthrough@*/
default:
-/*@i@*/ key->data = (void *) rpmvals[i];
+ key->data = (void *) rpmvals[i];
key->size = strlen(rpmvals[i]);
stringvalued = 1;
- /*@switchbreak@*/ break;
+ break;
}
if (!printed) {
if (key->size == 0) key->size = strlen((char *)key->data);
if (key->size == 0) key->size++; /* XXX "/" fixup. */
-/*@-compmempass@*/
rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
if (rc == 0) { /* success */
(void) dbt2set(dbi, data, &set);
} else if (rc == DB_NOTFOUND) { /* not found */
- /*@innercontinue@*/ continue;
+ continue;
} else { /* error */
rpmError(RPMERR_DBGETINDEX,
_("error(%d) setting \"%s\" records from %s index\n"),
rc, key->data, tagName(dbi->dbi_rpmtag));
ret += 1;
- /*@innercontinue@*/ continue;
+ continue;
}
-/*@=compmempass@*/
rc = dbiPruneSet(set, rec, 1, sizeof(*rec), 1);
/* If nothing was pruned, then don't bother updating. */
if (rc) {
set = dbiFreeIndexSet(set);
- /*@innercontinue@*/ continue;
+ continue;
}
-/*@-compmempass@*/
if (set->count > 0) {
(void) set2dbt(dbi, data, set);
rc = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
ret += 1;
}
}
-/*@=compmempass@*/
set = dbiFreeIndexSet(set);
}
-/*@=branchstate@*/
xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR);
dbcursor = NULL;
rec = _free(rec);
}
- /*@=nullpass =nullptrarith =nullderef @*/
(void) unblockSignals(db, &signalMask);
/* XXX install.c */
int rpmdbAdd(rpmdb db, int iid, Header h,
- /*@unused@*/ rpmts ts,
- /*@unused@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
+ rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
{
DBC * dbcursor = NULL;
DBT * key = alloca(sizeof(*key));
* we won't have bogus information (i.e. the last succesful
* add).
*/
-/*@-mods@*/
myinstall_instance = 0;
-/*@=mods@*/
if (db == NULL)
return 0;
size_t datalen = 0;
dbi = dbiOpen(db, RPMDBI_PACKAGES, 0);
- /*@-branchstate@*/
if (dbi != NULL) {
/* XXX db0: hack to pass sizeof header to fadAlloc */
/* Retrieve join key for next header instance. */
-/*@-compmempass@*/
key->data = keyp;
key->size = keylen;
-/*@i@*/ data->data = datap;
+ data->data = datap;
data->size = datalen;
ret = dbiGet(dbi, dbcursor, key, data, DB_SET);
keyp = key->data;
keylen = key->size;
datap = data->data;
datalen = data->size;
-/*@=compmempass@*/
-/*@-bounds@*/
hdrNum = 0;
if (ret == 0 && datap) {
memcpy(&mi_offset, datap, sizeof(mi_offset.ui));
datap = &mi_offset;
datalen = sizeof(mi_offset.ui);
}
-/*@=bounds@*/
key->data = keyp;
key->size = keylen;
-/*@-kepttrans@*/
data->data = datap;
-/*@=kepttrans@*/
data->size = datalen;
-/*@-compmempass@*/
ret = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
-/*@=compmempass@*/
xx = dbiSync(dbi, 0);
xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR);
dbcursor = NULL;
}
- /*@=branchstate@*/
}
dbiIndexItem rec = dbiIndexNewItem(hdrNum, 0);
/* Save the header number for the current transaction. */
-/*@-mods@*/
myinstall_instance = hdrNum;
-/*@=mods@*/
if (dbiTags != NULL)
for (dbix = 0; dbix < dbiTagsMax; dbix++) {
rpmrc = RPMRC_NOTFOUND;
dbi = NULL;
requireFlags = NULL;
-/*@-boundsread@*/
rpmtag = dbiTags[dbix];
-/*@=boundsread@*/
/* Filter out temporary databases */
if (isTemporaryDB(rpmtag))
mi_offset.ui = hdrNum;
if (dbiByteSwapped(dbi) == 1)
_DBSWAP(mi_offset);
-/*@-immediatetrans@*/
key->data = (void *) &mi_offset;
-/*@=immediatetrans@*/
key->size = sizeof(mi_offset.ui);
data->data = headerUnload(h);
data->size = headerSizeof(h, HEADER_MAGIC_NO);
}
if (data->data != NULL && rpmrc != RPMRC_FAIL) {
-/*@-compmempass@*/
xx = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
-/*@=compmempass@*/
xx = dbiSync(dbi, 0);
}
data->data = _free(data->data);
if (!dbi->dbi_no_dbsync)
xx = dbiSync(dbi, 0);
continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
+ break;
case RPMTAG_BASENAMES: /* XXX preserve legacy behavior */
rpmtype = bnt;
rpmvals = baseNames;
rpmcnt = count;
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_REQUIRENAME:
xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
- /*@switchbreak@*/ break;
+ break;
default:
xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
- /*@switchbreak@*/ break;
+ break;
}
- /*@-branchstate@*/
if (rpmcnt <= 0) {
if (rpmtag != RPMTAG_GROUP)
continue;
rpmvals = (const char **) "Unknown";
rpmcnt = 1;
}
- /*@=branchstate@*/
dbi = dbiOpen(db, rpmtag, 0);
if (dbi != NULL) {
if (rpmtype == RPM_STRING_TYPE) {
/* XXX force uniform headerGetEntry return */
- /*@-observertrans@*/
av[0] = (const char *) rpmvals;
- /*@=observertrans@*/
rpmvals = av;
rpmcnt = 1;
}
rec->tagNum = i;
switch (dbi->dbi_rpmtag) {
case RPMTAG_PUBKEYS:
- /*@switchbreak@*/ break;
+ break;
case RPMTAG_FILEMD5S:
/* Filter out empty MD5 strings. */
if (!(rpmvals[i] && *rpmvals[i] != '\0'))
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
case RPMTAG_REQUIRENAME:
/* Filter out install prerequisites. */
if (requireFlags && isInstallPreReq(requireFlags[i]))
- /*@innercontinue@*/ continue;
- /*@switchbreak@*/ break;
+ continue;
+ break;
case RPMTAG_TRIGGERNAME:
if (i) { /* don't add duplicates */
-/*@-boundsread@*/
for (j = 0; j < i; j++) {
if (!strcmp(rpmvals[i], rpmvals[j]))
- /*@innerbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
if (j < i)
- /*@innercontinue@*/ continue;
+ continue;
}
- /*@switchbreak@*/ break;
+ break;
default:
- /*@switchbreak@*/ break;
+ break;
}
/* Identify value pointer and length. */
stringvalued = 0;
-/*@-branchstate@*/
switch (rpmtype) {
-/*@-sizeoftype@*/
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
key->size = sizeof(int_8);
-/*@i@*/ key->data = rpmvals + i;
- /*@switchbreak@*/ break;
+ key->data = rpmvals + i;
+ break;
case RPM_INT16_TYPE:
key->size = sizeof(int_16);
-/*@i@*/ key->data = rpmvals + i;
- /*@switchbreak@*/ break;
+ key->data = rpmvals + i;
+ break;
case RPM_INT32_TYPE:
key->size = sizeof(int_32);
-/*@i@*/ key->data = rpmvals + i;
- /*@switchbreak@*/ break;
-/*@=sizeoftype@*/
+ key->data = rpmvals + i;
+ break;
case RPM_BIN_TYPE:
key->size = rpmcnt;
-/*@i@*/ key->data = rpmvals;
+ key->data = rpmvals;
rpmcnt = 1; /* XXX break out of loop. */
- /*@switchbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_I18NSTRING_TYPE:
rpmcnt = 1; /* XXX break out of loop. */
- /*@fallthrough@*/
case RPM_STRING_ARRAY_TYPE:
/* Convert from hex to binary. */
-/*@-boundsread@*/
if (dbi->dbi_rpmtag == RPMTAG_FILEMD5S) {
const char * s;
*t = (nibble(s[0]) << 4) | nibble(s[1]);
key->data = bin;
key->size = 16;
- /*@switchbreak@*/ break;
+ break;
}
/* Extract the pubkey id from the base64 blob. */
if (dbi->dbi_rpmtag == RPMTAG_PUBKEYS) {
size_t pktlen;
if (b64decode(rpmvals[i], (void **)&pkt, &pktlen))
- /*@innercontinue@*/ continue;
+ continue;
(void) pgpPrtPkts(pkt, pktlen, dig, 0);
memcpy(bin, dig->pubkey.signid, 8);
pkt = _free(pkt);
dig = _free(dig);
key->data = bin;
key->size = 8;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
- /*@fallthrough@*/
default:
-/*@i@*/ key->data = (void *) rpmvals[i];
+ key->data = (void *) rpmvals[i];
key->size = strlen(rpmvals[i]);
stringvalued = 1;
- /*@switchbreak@*/ break;
+ break;
}
-/*@=branchstate@*/
if (!printed) {
if (rpmcnt == 1 && stringvalued) {
if (key->size == 0) key->size = strlen((char *)key->data);
if (key->size == 0) key->size++; /* XXX "/" fixup. */
-/*@-compmempass@*/
rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
if (rc == 0) { /* success */
/* With duplicates, cursor is positioned, discard the record. */
_("error(%d) getting \"%s\" records from %s index\n"),
rc, key->data, tagName(dbi->dbi_rpmtag));
ret += 1;
- /*@innercontinue@*/ continue;
+ continue;
}
-/*@=compmempass@*/
if (set == NULL) /* not found or duplicate */
set = xcalloc(1, sizeof(*set));
(void) dbiAppendSet(set, rec, 1, sizeof(*rec), 0);
-/*@-compmempass@*/
(void) set2dbt(dbi, data, set);
rc = dbiPut(dbi, dbcursor, key, data, DB_KEYLAST);
-/*@=compmempass@*/
if (rc) {
rpmError(RPMERR_DBPUTINDEX,
rc, key->data, tagName(dbi->dbi_rpmtag));
ret += 1;
}
-/*@-unqualifiedtrans@*/
data->data = _free(data->data);
-/*@=unqualifiedtrans@*/
data->size = 0;
set = dbiFreeIndexSet(set);
}
xx = dbiSync(dbi, 0);
}
- /*@-observertrans@*/
if (rpmtype != RPM_BIN_TYPE) /* XXX WTFO? HACK ALERT */
rpmvals = hfd(rpmvals, rpmtype);
- /*@=observertrans@*/
rpmtype = 0;
rpmcnt = 0;
}
- /*@=nullpass =nullptrarith =nullderef @*/
rec = _free(rec);
}
#define _skip(_dn) { sizeof(_dn)-1, (_dn) }
-/*@unchecked@*/ /*@observer@*/
static struct skipDir_s {
int dnlen;
-/*@observer@*/ /*@null@*/
const char * dn;
} skipDirs[] = {
{ 0, NULL }
};
static int skipDir(const char * dn)
- /*@*/
{
struct skipDir_s * sd = skipDirs;
int dnlen;
}
/* XXX transaction.c */
-/*@-compmempass@*/
int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
int numItems)
{
/* Gather all installed headers with matching basename's. */
for (i = 0; i < numItems; i++) {
-/*@-boundswrite@*/
matchList[i] = xcalloc(1, sizeof(*(matchList[i])));
-/*@=boundswrite@*/
-/*@-boundsread -dependenttrans@*/
key->data = (void *) fpList[i].baseName;
-/*@=boundsread =dependenttrans@*/
key->size = strlen((char *)key->data);
if (key->size == 0) key->size++; /* XXX "/" fixup. */
im = mi->mi_set->recs + start;
/* Find the end of the set of matched basename's in this package. */
-/*@-boundsread@*/
for (end = start + 1; end < mi->mi_set->count; end++) {
if (im->hdrNum != mi->mi_set->recs[end].hdrNum)
- /*@innerbreak@*/ break;
+ break;
}
-/*@=boundsread@*/
num = end - start;
/* Compute fingerprints for this installed header's matches */
baseNames = xcalloc(num, sizeof(*baseNames));
dirIndexes = xcalloc(num, sizeof(*dirIndexes));
-/*@-bounds@*/
for (i = 0; i < num; i++) {
baseNames[i] = fullBaseNames[im[i].tagNum];
dirIndexes[i] = fullDirIndexes[im[i].tagNum];
}
-/*@=bounds@*/
fps = xcalloc(num, sizeof(*fps));
fpLookupList(fpc, dirNames, baseNames, dirIndexes, num, fps);
/* Add db (recnum,filenum) to list for fingerprint matches. */
-/*@-boundsread@*/
for (i = 0; i < num; i++, im++) {
- /*@-nullpass@*/ /* FIX: fpList[].subDir may be NULL */
+ /* FIX: fpList[].subDir may be NULL */
if (!FP_EQUAL(fps[i], fpList[im->fpNum]))
- /*@innercontinue@*/ continue;
- /*@=nullpass@*/
+ continue;
xx = dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
}
-/*@=boundsread@*/
fps = _free(fps);
dirNames = hfd(dirNames, dnt);
return 0;
}
-/*@=compmempass@*/
/**
* Check if file esists using stat(2).
* @return 1 if file exists, 0 if not
*/
static int rpmioFileExists(const char * urlfn)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/
{
const char *fn;
int urltype = urlPath(urlfn, &fn);
struct stat buf;
- /*@-branchstate@*/
if (*fn == '\0') fn = "/";
- /*@=branchstate@*/
switch (urltype) {
case URL_IS_HTTPS: /* XXX WRONG WRONG WRONG */
case URL_IS_HTTP: /* XXX WRONG WRONG WRONG */
case URL_IS_DASH:
default:
return 0;
- /*@notreached@*/ break;
+ break;
}
return 1;
static int rpmdbRemoveDatabase(const char * prefix,
const char * dbpath, int _dbapi)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/
{
int i;
char * filename;
int xx;
i = strlen(dbpath);
- /*@-bounds -branchstate@*/
if (dbpath[i - 1] != '/') {
filename = alloca(i);
strcpy(filename, dbpath);
filename[i + 1] = '\0';
dbpath = filename;
}
- /*@=bounds =branchstate@*/
filename = alloca(strlen(prefix) + strlen(dbpath) + 40);
switch (_dbapi) {
case 4:
- /*@fallthrough@*/
case 3:
if (dbiTags != NULL)
for (i = 0; i < dbiTagsMax; i++) {
-/*@-boundsread@*/
const char * base = tagName(dbiTags[i]);
-/*@=boundsread@*/
sprintf(filename, "%s/%s/%s", prefix, dbpath, base);
(void)rpmCleanPath(filename);
if (!rpmioFileExists(filename))
static int rpmdbMoveDatabase(const char * prefix,
const char * olddbpath, int _olddbapi,
- const char * newdbpath, /*@unused@*/ int _newdbapi)
- /*@globals h_errno, fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/
+ const char * newdbpath, int _newdbapi)
{
int i;
char * ofilename, * nfilename;
int xx;
i = strlen(olddbpath);
- /*@-branchstate@*/
if (olddbpath[i - 1] != '/') {
ofilename = alloca(i + 2);
strcpy(ofilename, olddbpath);
ofilename[i + 1] = '\0';
olddbpath = ofilename;
}
- /*@=branchstate@*/
i = strlen(newdbpath);
- /*@-branchstate@*/
if (newdbpath[i - 1] != '/') {
nfilename = alloca(i + 2);
strcpy(nfilename, newdbpath);
nfilename[i + 1] = '\0';
newdbpath = nfilename;
}
- /*@=branchstate@*/
ofilename = alloca(strlen(prefix) + strlen(olddbpath) + 40);
nfilename = alloca(strlen(prefix) + strlen(newdbpath) + 40);
int rpmdbRebuild(const char * prefix, rpmts ts,
rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
- /*@globals _rebuildinprogress @*/
- /*@modifies _rebuildinprogress @*/
{
rpmdb olddb;
const char * dbpath = NULL;
int _dbapi;
int _dbapi_rebuild;
- /*@-branchstate@*/
if (prefix == NULL) prefix = "/";
- /*@=branchstate@*/
_dbapi = rpmExpandNumeric("%{_dbapi}");
_dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}");
- /*@-nullpass@*/
tfn = rpmGetPath("%{?_dbpath}", NULL);
- /*@=nullpass@*/
-/*@-boundsread@*/
if (!(tfn && tfn[0] != '\0'))
-/*@=boundsread@*/
{
rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
rc = 1;
dbpath += strlen(prefix) - 1;
tfn = _free(tfn);
- /*@-nullpass@*/
tfn = rpmGetPath("%{?_dbpath_rebuild}", NULL);
- /*@=nullpass@*/
-/*@-boundsread@*/
if (!(tfn && tfn[0] != '\0' && strcmp(tfn, dbpath)))
-/*@=boundsread@*/
{
char pidbuf[20];
char *t;
sprintf(pidbuf, "rebuilddb.%d", (int) getpid());
t = xmalloc(strlen(dbpath) + strlen(pidbuf) + 1);
-/*@-boundswrite@*/
(void)stpcpy(stpcpy(t, dbpath), pidbuf);
-/*@=boundswrite@*/
tfn = _free(tfn);
tfn = t;
nocleanup = 0;
rpmMessage(RPMMESS_DEBUG, _("opening old database with dbapi %d\n"),
_dbapi);
-/*@-boundswrite@*/
if (openDatabase(prefix, dbpath, _dbapi, &olddb, O_RDONLY, 0644,
RPMDB_FLAG_MINIMAL)) {
rc = 1;
goto exit;
}
-/*@=boundswrite@*/
_dbapi = olddb->db_api;
_rebuildinprogress = 1;
rpmMessage(RPMMESS_DEBUG, _("opening new database with dbapi %d\n"),
_dbapi_rebuild);
(void) rpmDefineMacro(NULL, "_rpmdb_rebuild %{nil}", -1);
-/*@-boundswrite@*/
if (openDatabase(prefix, newdbpath, _dbapi_rebuild, &newdb, O_RDWR | O_CREAT, 0644, 0)) {
rc = 1;
goto exit;
}
-/*@=boundswrite@*/
_rebuildinprogress = 0;
(void) headerNVR(h, &name, &version, &release);
- /*@-shadow@*/
{ rpmdbMatchIterator mi;
mi = rpmdbInitIterator(newdb, RPMTAG_NAME, name, 0);
(void) rpmdbSetIteratorRE(mi, RPMTAG_VERSION,
RPMMIRE_DEFAULT, release);
while (rpmdbNextIterator(mi)) {
skip = 1;
- /*@innerbreak@*/ break;
+ break;
}
mi = rpmdbFreeIterator(mi);
}
- /*@=shadow@*/
if (skip)
continue;
#ifndef H_RPMDB
#define H_RPMDB
-/*@-bounds@*/
/** \ingroup rpmdb dbi db1 db3
* \file rpmdb/rpmdb.h
#include "rpmsw.h"
#include "db.h"
-/*@-exportlocal@*/
-/*@unchecked@*/
extern int _rpmdb_debug;
-/*@=exportlocal@*/
#ifdef NOTYET
/** \ingroup rpmdb
* Database of headers and tag value indices.
*/
-typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb;
+typedef struct rpmdb_s * rpmdb;
/** \ingroup rpmdb
* Database iterator.
*/
-typedef /*@abstract@*/ struct _rpmdbMatchIterator * rpmdbMatchIterator;
+typedef struct _rpmdbMatchIterator * rpmdbMatchIterator;
#endif
/**
/**
*/
-typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
+typedef struct _dbiIndexItem * dbiIndexItem;
/** \ingroup rpmdb
* A single element (i.e. inverted list from tag values) of a database.
*/
-typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet;
+typedef struct _dbiIndexSet * dbiIndexSet;
/**
*/
-typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
+typedef struct _dbiIndex * dbiIndex;
/* this will break if sizeof(int) != 4 */
/** \ingroup dbi
* Items retrieved from the index database.
*/
struct _dbiIndexSet {
-/*@owned@*/ struct _dbiIndexItem * recs; /*!< array of records */
+struct _dbiIndexItem * recs; /*!< array of records */
int count; /*!< number of records */
};
* @param rpmtag rpm tag
* @return 0 on success
*/
- int (*open) (rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip)
- /*@globals fileSystem @*/
- /*@modifies *dbip, fileSystem @*/;
+ int (*open) (rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip);
/** \ingroup dbi
* Close index database, and destroy database handle.
* @param flags (unused)
* @return 0 on success
*/
- int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/;
+ int (*close) (dbiIndex dbi, unsigned int flags);
/** \ingroup dbi
* Flush pending operations to disk.
* @param flags (unused)
* @return 0 on success
*/
- int (*sync) (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ int (*sync) (dbiIndex dbi, unsigned int flags);
/** \ingroup dbi
* Associate secondary database with primary.
*/
int (*associate) (dbiIndex dbi, dbiIndex dbisecondary,
int (*callback) (DB *, const DBT *, const DBT *, DBT *),
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/;
+ unsigned int flags);
/** \ingroup dbi
* Return join cursor for list of cursors.
* @param flags DB_JOIN_NOSORT or 0
* @return 0 on success
*/
- int (*join) (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/;
+ int (*join) (dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
+ unsigned int flags);
/** \ingroup dbi
* Open database cursor.
* @param dbiflags DB_WRITECURSOR or 0
* @return 0 on success
*/
- int (*copen) (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
- /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *txnid, *dbcp, fileSystem @*/;
+ int (*copen) (dbiIndex dbi, DB_TXN * txnid,
+ DBC ** dbcp, unsigned int dbiflags);
/** \ingroup dbi
* Close database cursor.
* @param flags (unused)
* @return 0 on success
*/
- int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcursor, fileSystem @*/;
+ int (*cclose) (dbiIndex dbi, DBC * dbcursor, unsigned int flags);
/** \ingroup dbi
* Duplicate a database cursor.
* @param flags DB_POSITION for same position, 0 for uninitialized
* @return 0 on success
*/
- int (*cdup) (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/;
+ int (*cdup) (dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
+ unsigned int flags);
/** \ingroup dbi
* Delete (key,data) pair(s) using db->del or dbcursor->c_del.
* @param flags (unused)
* @return 0 on success
*/
- int (*cdel) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/;
+ int (*cdel) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
+ unsigned int flags);
/** \ingroup dbi
* Retrieve (key,data) pair using db->get or dbcursor->c_get.
* @param flags (unused)
* @return 0 on success
*/
- int (*cget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *data, fileSystem @*/;
+ int (*cget) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
+ unsigned int flags);
/** \ingroup dbi
* Retrieve (key,data) pair using dbcursor->c_pget.
* @param flags DB_NEXT, DB_SET, or 0
* @return 0 on success
*/
- int (*cpget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
- DBT * key, DBT * pkey, DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/;
+ int (*cpget) (dbiIndex dbi, DBC * dbcursor,
+ DBT * key, DBT * pkey, DBT * data, unsigned int flags);
/** \ingroup dbi
* Store (key,data) pair using db->put or dbcursor->c_put.
* @param flags (unused)
* @return 0 on success
*/
- int (*cput) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/;
+ int (*cput) (dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
+ unsigned int flags);
/** \ingroup dbi
* Retrieve count of (possible) duplicate items using dbcursor->c_count.
* @return 0 on success
*/
int (*ccount) (dbiIndex dbi, DBC * dbcursor,
- /*@out@*/ unsigned int * countp,
- unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/;
+ unsigned int * countp,
+ unsigned int flags);
/** \ingroup dbi
* Is database byte swapped?
* @param dbi index database handle
* @return 0 no
*/
- int (*byteswapped) (dbiIndex dbi)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ int (*byteswapped) (dbiIndex dbi);
/** \ingroup dbi
* Save statistics in database handle.
* @param flags retrieve statistics that don't require traversal?
* @return 0 on success
*/
- int (*stat) (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/;
+ int (*stat) (dbiIndex dbi, unsigned int flags);
};
/** \ingroup dbi
* Describes an index database (implemented on Berkeley db3 functionality).
*/
struct _dbiIndex {
-/*@null@*/
const char * dbi_root; /*!< chroot(2) component of path */
-/*@null@*/
const char * dbi_home; /*!< directory component of path */
-/*@relnull@*/
const char * dbi_file; /*!< file component of path */
-/*@relnull@*/
const char * dbi_subfile;
-/*@null@*/
const char * dbi_tmpdir; /*!< temporary directory */
int dbi_ecflags; /*!< db_env_create flags */
int dbi_debug;
int dbi_byteswapped;
-/*@null@*/
char * dbi_host;
unsigned long dbi_cl_timeout;
unsigned long dbi_sv_timeout;
/* dbenv parameters */
int dbi_lorder;
-/*@unused@*/
/* XXX db-4.3.14 adds dbenv as 1st arg. */
- void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
-/*@unused@*/ /*@shared@*/
+ void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer);
FILE * dbi_errfile;
const char * dbi_errpfx;
int dbi_verbose;
/* lock sub-system parameters */
unsigned int dbi_lk_max;
unsigned int dbi_lk_detect;
-/*@unused@*/ int dbi_lk_nmodes;
-/*@unused@*/ unsigned char * dbi_lk_conflicts;
+int dbi_lk_nmodes;
+unsigned char * dbi_lk_conflicts;
/* log sub-system parameters */
unsigned int dbi_lg_max;
unsigned int dbi_lg_bsize;
unsigned int dbi_tx_max;
#if 0
int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec,
- DB_LSN *lsnp, int redo, void *info)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ DB_LSN *lsnp, int redo, void *info);
#endif
/* dbinfo parameters */
int dbi_pagesize; /*!< (fs blksize) */
-/*@unused@*/ /*@null@*/
- void * (*dbi_malloc) (size_t nbytes)
- /*@*/;
+ void * (*dbi_malloc) (size_t nbytes);
/* hash access parameters */
unsigned int dbi_h_ffactor; /*!< */
unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes,
- unsigned int length)
- /*@*/;
+ unsigned int length);
unsigned int dbi_h_nelem; /*!< */
unsigned int dbi_h_flags; /*!< DB_DUP, DB_DUPSORT */
- int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *)
- /*@*/;
+ int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *);
/* btree access parameters */
int dbi_bt_flags;
int dbi_bt_minkey;
- int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *)
- /*@*/;
- int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *)
- /*@*/;
- size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *)
- /*@*/;
+ int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *);
+ int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *);
+ size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *);
/* recno access parameters */
int dbi_re_flags;
int dbi_re_delim;
/* queue access parameters */
unsigned int dbi_q_extentsize;
-/*@refcounted@*/
rpmdb dbi_rpmdb; /*!< the parent rpm database */
rpmTag dbi_rpmtag; /*!< rpm tag used for index */
int dbi_jlen; /*!< size of join key */
-/*@only@*//*@null@*/
DB * dbi_db; /*!< Berkeley DB * handle */
-/*@only@*//*@null@*/
DB_TXN * dbi_txnid; /*!< Bekerley DB_TXN * transaction id */
-/*@only@*//*@null@*/
void * dbi_stats; /*!< Berkeley db statistics */
-/*@observer@*/
const struct _dbiVec * dbi_vec; /*!< private methods */
};
* Describes the collection of index databases used by rpm.
*/
struct rpmdb_s {
-/*@owned@*/
const char * db_root;/*!< path prefix */
-/*@owned@*/
const char * db_home;/*!< directory path */
int db_flags;
int db_mode; /*!< open mode */
int db_perms; /*!< open permissions */
int db_api; /*!< Berkeley API type */
-/*@owned@*/
const char * db_errpfx;
int db_remove_env;
int db_filter_dups;
int db_chrootDone; /*!< If chroot(2) done, ignore db_root. */
- void (*db_errcall) (const char *db_errpfx, char *buffer)
- /*@*/;
-/*@shared@*/
+ void (*db_errcall) (const char *db_errpfx, char *buffer);
FILE * db_errfile;
-/*@only@*/
- void * (*db_malloc) (size_t nbytes)
- /*@*/;
-/*@only@*/
- void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr,
- size_t nbytes)
- /*@*/;
- void (*db_free) (/*@only@*/ void * ptr)
- /*@modifies *ptr @*/;
-/*@only@*/ /*@null@*/
+ void * (*db_malloc) (size_t nbytes);
+ void * (*db_realloc) (void * ptr,
+ size_t nbytes);
+ void (*db_free) (void * ptr);
unsigned char * db_bits; /*!< package instance bit mask. */
int db_nbits; /*!< no. of bits in mask. */
rpmdb db_next;
int db_opens;
-/*@only@*/ /*@null@*/
void * db_dbenv; /*!< Berkeley DB_ENV handle. */
int db_ndbi; /*!< No. of tag indices. */
dbiIndex * _dbi; /*!< Tag indices. */
struct rpmop_s db_putops;
struct rpmop_s db_delops;
-/*@refs@*/
int nrefs; /*!< Reference count. */
};
enum rpmdbFlags {
RPMDB_FLAG_JUSTCHECK = (1 << 0),
RPMDB_FLAG_MINIMAL = (1 << 1),
-/*@-enummemuse@*/
RPMDB_FLAG_CHROOT = (1 << 2)
-/*@=enummemuse@*/
};
#ifdef __cplusplus
extern "C" {
#endif
-/*@-exportlocal@*/
/** \ingroup db3
* Return new configured index database handle instance.
* @param rpmdb rpm database
* @param rpmtag rpm tag
* @return index database handle
*/
-/*@unused@*/ /*@only@*/ /*@null@*/
-dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies rpmGlobalMacroContext @*/;
+dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag);
/** \ingroup db3
* Destroy index database handle instance.
* @param dbi index database handle
* @return NULL always
*/
-/*@null@*/
-dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
- /*@*/;
+dbiIndex db3Free( dbiIndex dbi);
/** \ingroup db3
* Format db3 open flags for debugging print.
* @param print_dbenv_flags format db env flags instead?
* @return formatted flags (static buffer)
*/
-/*@-redecl@*/
-/*@exposed@*/
-extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
- /*@*/;
-/*@=redecl@*/
+extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags);
/** \ingroup dbi
* Return handle for an index database.
* @param flags (unused)
* @return index database handle
*/
-/*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag rpmtag,
- unsigned int flags)
- /*@globals rpmGlobalMacroContext, errno, h_errno @*/
- /*@modifies db, rpmGlobalMacroContext, errno @*/;
+dbiIndex dbiOpen(rpmdb db, rpmTag rpmtag,
+ unsigned int flags);
-/*@-globuse -mustmod @*/ /* FIX: vector annotations */
+/* FIX: vector annotations */
/** \ingroup dbi
* Open a database cursor.
* @param dbi index database handle
* @param flags DB_WRITECURSOR if writing, or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
- /*@out@*/ DBC ** dbcp, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
+static inline
+int dbiCopen(dbiIndex dbi, DB_TXN * txnid,
+ DBC ** dbcp, unsigned int flags)
{
return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags);
}
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcursor, fileSystem @*/
+static inline
+int dbiCclose(dbiIndex dbi, DBC * dbcursor, unsigned int flags)
{
return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags);
}
* @param flags DB_POSITION for same position, 0 for uninitialized
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
+static inline
+int dbiCdup(dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
unsigned int flags)
- /*@modifies dbi, *dbcp @*/
{
return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags);
}
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
+static inline
+int dbiDel(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, fileSystem, internalState @*/
{
int rc;
assert(key->data != NULL && key->size > 0);
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
+static inline
+int dbiGet(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, *data, fileSystem, internalState @*/
{
int rc;
assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
* @param flags DB_NEXT, DB_SET, or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor,
+static inline
+int dbiPget(dbiIndex dbi, DBC * dbcursor,
DBT * key, DBT * pkey, DBT * data, unsigned int flags)
- /*@globals fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, *pkey, *data, fileSystem, internalState @*/
{
int rc;
assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data,
+static inline
+int dbiPut(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * data,
unsigned int flags)
- /*@globals fileSystem, internalState @*/
- /*@modifies dbi, *dbcursor, *key, fileSystem, internalState @*/
{
int rc;
assert(key->data != NULL && key->size > 0 && data->data != NULL && data->size > 0);
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
+static inline
+int dbiCount(dbiIndex dbi, DBC * dbcursor, unsigned int * countp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
{
return (*dbi->dbi_vec->ccount) (dbi, dbcursor, countp, flags);
}
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+static inline
+int dbiVerify(dbiIndex dbi, unsigned int flags)
{
dbi->dbi_verify_on_close = 1;
return (*dbi->dbi_vec->close) (dbi, flags);
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+static inline
+int dbiClose(dbiIndex dbi, unsigned int flags)
{
return (*dbi->dbi_vec->close) (dbi, flags);
}
* @param flags (unused)
* @return 0 on success
*/
-/*@unused@*/ static inline
+static inline
int dbiSync (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
return (*dbi->dbi_vec->sync) (dbi, flags);
}
* @param flags DB_CREATE or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
+static inline
int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary,
int (*callback) (DB *, const DBT *, const DBT *, DBT *),
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags);
}
* @param flags DB_JOIN_NOSORT or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
-int dbiJoin(dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
+static inline
+int dbiJoin(dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
{
return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags);
}
* @param dbi index database handle
* @return 0 same order, 1 swapped order
*/
-/*@unused@*/ static inline
+static inline
int dbiByteSwapped(dbiIndex dbi)
- /*@modifies dbi @*/
{
if (dbi->dbi_byteswapped == -1)
dbi->dbi_byteswapped = (*dbi->dbi_vec->byteswapped) (dbi);
* @param flags DB_FAST_STAT or 0
* @return 0 on success
*/
-/*@unused@*/ static inline
+static inline
int dbiStat(dbiIndex dbi, unsigned int flags)
- /*@modifies dbi @*/
{
return (*dbi->dbi_vec->stat) (dbi, flags);
}
-/*@=globuse =mustmod @*/
-/*@=exportlocal@*/
/** \ingroup rpmdb
*/
-unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi)
- /*@*/;
+unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi);
/** \ingroup dbi
* Destroy set of index database items.
* @param set set of index database items
* @return NULL always
*/
-/*@null@*/ dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set)
- /*@modifies set @*/;
+dbiIndexSet dbiFreeIndexSet(dbiIndexSet set);
/** \ingroup dbi
* Count items in index database set.
* @param set set of index database items
* @return number of items
*/
-unsigned int dbiIndexSetCount(dbiIndexSet set)
- /*@*/;
+unsigned int dbiIndexSetCount(dbiIndexSet set);
/** \ingroup dbi
* Return record offset of header from element in index database set.
* @param recno index of item in set
* @return record offset of header
*/
-unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
- /*@*/;
+unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno);
/** \ingroup dbi
* Return file index from element in index database set.
* @param recno index of item in set
* @return file index
*/
-unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno)
- /*@*/;
+unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno);
/** \ingroup rpmdb
* Tags for which rpmdb indices will be built.
*/
-/*@-exportlocal@*/
-/*@unchecked@*/
-/*@only@*/ /*@null@*/ extern int * dbiTags;
-/*@unchecked@*/
+extern int * dbiTags;
extern int dbiTagsMax;
-/*@=exportlocal@*/
/** \ingroup rpmdb
* Unreference a database instance.
* @param msg
* @return NULL always
*/
-/*@unused@*/ /*@null@*/
-rpmdb rpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg)
- /*@modifies db @*/;
+rpmdb rpmdbUnlink (rpmdb db, const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
-/*@null@*/
-rpmdb XrpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg,
- const char * fn, unsigned ln)
- /*@modifies db @*/;
-/*@=exportlocal@*/
+rpmdb XrpmdbUnlink (rpmdb db, const char * msg,
+ const char * fn, unsigned ln);
#define rpmdbUnlink(_db, _msg) XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)
/** \ingroup rpmdb
* @param msg
* @return new rpm database reference
*/
-/*@unused@*/
-rpmdb rpmdbLink (rpmdb db, const char * msg)
- /*@modifies db @*/;
+rpmdb rpmdbLink (rpmdb db, const char * msg);
/** @todo Remove debugging entry from the ABI. */
-/*@-exportlocal@*/
rpmdb XrpmdbLink (rpmdb db, const char * msg,
- const char * fn, unsigned ln)
- /*@modifies db @*/;
-/*@=exportlocal@*/
+ const char * fn, unsigned ln);
#define rpmdbLink(_db, _msg) XrpmdbLink(_db, _msg, __FILE__, __LINE__)
/** \ingroup rpmdb
* @param perms database permissions
* @return 0 on success
*/
-int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
- int mode, int perms)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbOpen (const char * prefix, rpmdb * dbp,
+ int mode, int perms);
/** \ingroup rpmdb
* Initialize database.
* @param perms database permissions
* @return 0 on success
*/
-int rpmdbInit(/*@null@*/ const char * prefix, int perms)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbInit(const char * prefix, int perms);
/** \ingroup rpmdb
* Verify database components.
* @param prefix path to top of install tree
* @return 0 on success
*/
-int rpmdbVerify(/*@null@*/ const char * prefix)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbVerify(const char * prefix);
/**
* Close a single database index.
* @param rpmtag rpm tag
* @return 0 on success
*/
-int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag)
- /*@globals fileSystem @*/
- /*@modifies db, fileSystem @*/;
+int rpmdbCloseDBI(rpmdb db, int rpmtag);
/** \ingroup rpmdb
* Close all database indices and free rpmdb.
* @param db rpm database
* @return 0 on success
*/
-int rpmdbClose (/*@killref@*/ /*@only@*/ /*@null@*/ rpmdb db)
- /*@globals fileSystem @*/
- /*@modifies db, fileSystem @*/;
+int rpmdbClose (rpmdb db);
/** \ingroup rpmdb
* Sync all database indices.
* @param db rpm database
* @return 0 on success
*/
-int rpmdbSync (/*@null@*/ rpmdb db)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+int rpmdbSync (rpmdb db);
/** \ingroup rpmdb
* Open all database indices.
* @param db rpm database
* @return 0 on success
*/
-/*@-exportlocal@*/
-int rpmdbOpenAll (/*@null@*/ rpmdb db)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies db, rpmGlobalMacroContext @*/;
-/*@=exportlocal@*/
+int rpmdbOpenAll (rpmdb db);
/** \ingroup rpmdb
* Return number of instances of package in rpm database.
* @param name rpm package name
* @return number of instances
*/
-int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbCountPackages(rpmdb db, const char * name);
/** \ingroup rpmdb
* Return header join key for current position of rpm database iterator.
* @param mi rpm database iterator
* @return current header join key
*/
-unsigned int rpmdbGetIteratorOffset(/*@null@*/ rpmdbMatchIterator mi)
- /*@*/;
+unsigned int rpmdbGetIteratorOffset(rpmdbMatchIterator mi);
/** \ingroup rpmdb
* Return number of elements in rpm database iterator.
* @param mi rpm database iterator
* @return number of elements
*/
-int rpmdbGetIteratorCount(/*@null@*/ rpmdbMatchIterator mi)
- /*@*/;
+int rpmdbGetIteratorCount(rpmdbMatchIterator mi);
/** \ingroup rpmdb
* Append items to set of package instances to iterate.
* @param nHdrNums number of elements in array
* @return 0 on success, 1 on failure (bad args)
*/
-int rpmdbAppendIterator(/*@null@*/ rpmdbMatchIterator mi,
- /*@null@*/ const int * hdrNums, int nHdrNums)
- /*@modifies mi @*/;
+int rpmdbAppendIterator(rpmdbMatchIterator mi,
+ const int * hdrNums, int nHdrNums);
/** \ingroup rpmdb
* Remove items from set of package instances to iterate.
* @param sorted is the array sorted? (array will be sorted on return)
* @return 0 on success, 1 on failure (bad args)
*/
-int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi,
- /*@null@*/ int * hdrNums, int nHdrNums, int sorted)
- /*@modifies mi, hdrNums @*/;
+int rpmdbPruneIterator(rpmdbMatchIterator mi,
+ int * hdrNums, int nHdrNums, int sorted);
/** \ingroup rpmdb
* Add pattern to iterator selector.
* @param pattern pattern to match
* @return 0 on success
*/
-int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag,
- rpmMireMode mode, /*@null@*/ const char * pattern)
- /*@globals rpmGlobalMacroContext, h_errno @*/
- /*@modifies mi, mode, rpmGlobalMacroContext @*/;
+int rpmdbSetIteratorRE(rpmdbMatchIterator mi, rpmTag tag,
+ rpmMireMode mode, const char * pattern);
/** \ingroup rpmdb
* Prepare iterator for lazy writes.
* @param rewrite new value of rewrite
* @return previous value
*/
-int rpmdbSetIteratorRewrite(/*@null@*/ rpmdbMatchIterator mi, int rewrite)
- /*@modifies mi @*/;
+int rpmdbSetIteratorRewrite(rpmdbMatchIterator mi, int rewrite);
/** \ingroup rpmdb
* Modify iterator to mark header for lazy write on release.
* @param modified new value of modified
* @return previous value
*/
-int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified)
- /*@modifies mi @*/;
+int rpmdbSetIteratorModified(rpmdbMatchIterator mi, int modified);
/** \ingroup rpmdb
* Modify iterator to verify retrieved header blobs.
* @param (*hdrchk) headerCheck() vector
* @return 0 always
*/
-int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts,
- /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg))
- /*@modifies mi @*/;
+int rpmdbSetHdrChk(rpmdbMatchIterator mi, rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void * uh, size_t uc, const char ** msg));
/** \ingroup rpmdb
* Return database iterator.
* @param keylen key data length (0 will use strlen(keyp))
* @return NULL on failure
*/
-/*@only@*/ /*@null@*/
-rpmdbMatchIterator rpmdbInitIterator(/*@null@*/ rpmdb db, rpmTag rpmtag,
- /*@null@*/ const void * keyp, size_t keylen)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
+rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag,
+ const void * keyp, size_t keylen);
/** \ingroup rpmdb
* Return next package header from iteration.
* @param mi rpm database iterator
* @return NULL on end of iteration.
*/
-/*@null@*/
-Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
+Header rpmdbNextIterator(rpmdbMatchIterator mi);
/** \ingroup rpmdb
* Check for and exit on termination signals.
*/
-/*@mayexit@*/
-int rpmdbCheckSignals(void)
- /*@globals fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/;
+int rpmdbCheckSignals(void);
/** \ingroup rpmdb
* Check rpmdb signal handler for trapped signal and/or requested exit,
* @param mi rpm database iterator
* @return NULL always
*/
-/*@null@*/
-rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterator mi)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
+rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
/** \ingroup rpmdb
* Add package header to rpm database and indices.
* @param (*hdrchk) (unused) headerCheck() vector (or NULL)
* @return 0 on success
*/
-int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts,
- /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbAdd(rpmdb db, int iid, Header h, rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg));
/** \ingroup rpmdb
* Remove package header from rpm database and indices.
* @param (*hdrchk) (unused) headerCheck() vector (or NULL)
* @return 0 on success
*/
-int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdrNum,
- /*@null@*/ rpmts ts,
- /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbRemove(rpmdb db, int rid, unsigned int hdrNum,
+ rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg));
/** \ingroup rpmdb
* Rebuild database indices from package headers.
* @param (*hdrchk) headerCheck() vector (or NULL)
* @return 0 on success
*/
-int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts,
- /*@null@*/ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
+int rpmdbRebuild(const char * prefix, rpmts ts,
+ rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg));
#ifndef __APPLE__
/**
* Mergesort, same arguments as qsort(2).
*/
-/*@unused@*/
int mergesort(void *base, size_t nmemb, size_t size,
- int (*cmp) (const void *, const void *))
- /*@globals errno @*/
- /*@modifies base, errno @*/;
+ int (*cmp) (const void *, const void *));
#else
/* mergesort is defined in stdlib.h on Mac OS X */
#endif /* __APPLE__ */
}
#endif
-/*@=bounds@*/
#endif /* H_RPMDB */
#include "rpmhash.h"
#include "debug.h"
-typedef /*@owned@*/ const void * voidptr;
+typedef const void * voidptr;
typedef struct hashBucket_s * hashBucket;
/**
*/
struct hashBucket_s {
- voidptr key; /*!< hash key */
-/*@owned@*/ voidptr * data; /*!< pointer to hashed data */
- int dataCount; /*!< length of data (0 if unknown) */
-/*@dependent@*/hashBucket next; /*!< pointer to next item in bucket */
+ voidptr key; /*!< hash key */
+voidptr * data; /*!< pointer to hashed data */
+ int dataCount; /*!< length of data (0 if unknown) */
+ hashBucket next; /*!< pointer to next item in bucket */
};
/**
* @param key pointer to key value
* @return pointer to hash bucket of key (or NULL)
*/
-static /*@shared@*/ /*@null@*/
+static
hashBucket findEntry(hashTable ht, const void * key)
- /*@*/
{
unsigned int hash;
hashBucket b;
- /*@-modunconnomods@*/
hash = ht->fn(key) % ht->numBuckets;
-/*@-boundsread@*/
b = ht->buckets[hash];
-/*@=boundsread@*/
while (b && b->key && ht->eq(b->key, key))
b = b->next;
- /*@=modunconnomods@*/
return b;
}
const char * chp = string;
len = strlen(string);
-/*@-boundsread@*/
for (i = 0; i < len; i++, chp++) {
xorValue ^= *chp;
sum += *chp;
}
-/*@=boundsread@*/
return ((((unsigned)len) << 16) + (((unsigned)sum) << 8) + xorValue);
}
ht->buckets = xcalloc(numBuckets, sizeof(*ht->buckets));
ht->keySize = keySize;
ht->freeData = freeData;
- /*@-assignexpose@*/
ht->fn = fn;
ht->eq = eq;
- /*@=assignexpose@*/
return ht;
}
-/*@-boundswrite@*/
void htAddEntry(hashTable ht, const void * key, const void * data)
{
unsigned int hash;
while (b && b->key && ht->eq(b->key, key))
b = b->next;
- /*@-branchstate@*/
if (b == NULL) {
b = xmalloc(sizeof(*b));
if (ht->keySize) {
b->data = NULL;
ht->buckets[hash] = b;
}
- /*@=branchstate@*/
b->data = xrealloc(b->data, sizeof(*b->data) * (b->dataCount + 1));
b->data[b->dataCount++] = data;
}
-/*@=boundswrite@*/
hashTable htFree(hashTable ht)
{
int i;
for (i = 0; i < ht->numBuckets; i++) {
-/*@-boundsread@*/
b = ht->buckets[i];
-/*@=boundsread@*/
if (b == NULL)
continue;
-/*@-boundswrite@*/
ht->buckets[i] = NULL;
-/*@=boundswrite@*/
if (ht->keySize > 0)
b->key = _free(b->key);
do {
n = b->next;
- /*@-branchstate@*/
if (b->data) {
-/*@-boundswrite@*/
if (ht->freeData)
*b->data = _free(*b->data);
-/*@=boundswrite@*/
b->data = _free(b->data);
}
- /*@=branchstate@*/
b = _free(b);
} while ((b = n) != NULL);
}
if ((b = findEntry(ht, key)) == NULL)
return 1;
-/*@-boundswrite@*/
if (data)
*data = (const void **) b->data;
if (dataCount)
*dataCount = b->dataCount;
if (tableKey)
*tableKey = b->key;
-/*@=boundswrite@*/
return 0;
}
/**
*/
-typedef /*@abstract@*/ struct hashTable_s * hashTable;
+typedef struct hashTable_s * hashTable;
#ifdef __cplusplus
extern "C" {
/**
*/
-typedef unsigned int (*hashFunctionType) (const void * string)
- /*@*/;
+typedef unsigned int (*hashFunctionType) (const void * string);
/**
*/
-typedef int (*hashEqualityType) (const void * key1, const void * key2)
- /*@*/;
+typedef int (*hashEqualityType) (const void * key1, const void * key2);
/**
* Return hash value of a string
* @param string string on which to calculate hash value
* @return hash value
*/
-unsigned int hashFunctionString(const void * string)
- /*@*/;
+unsigned int hashFunctionString(const void * string);
/**
* Compare two hash table entries for equality.
* @param key2 entry 2
* @return 0 if entries are equal
*/
-int hashEqualityString(const void * key1, const void * key2)
- /*@*/;
+int hashEqualityString(const void * key1, const void * key2);
/**
* Create hash table.
* @return pointer to initialized hash table
*/
hashTable htCreate(int numBuckets, int keySize, int freeData,
- hashFunctionType fn, hashEqualityType eq)
- /*@*/;
+ hashFunctionType fn, hashEqualityType eq);
/**
* Destroy hash table.
* @param ht pointer to hash table
* @return NULL always
*/
-/*@null@*/
-hashTable htFree( /*@only@*/ hashTable ht)
- /*@modifies ht @*/;
+hashTable htFree( hashTable ht);
/**
* Add item to hash table.
* @param key pointer to key
* @param data pointer to data value
*/
-void htAddEntry(hashTable ht, /*@owned@*/ const void * key,
- /*@owned@*/ const void * data)
- /*@modifies ht */;
+void htAddEntry(hashTable ht, const void * key,
+ const void * data);
/**
* Retrieve item from hash table.
* @return 0 on success, 1 if the item is not found.
*/
int htGetEntry(hashTable ht, const void * key,
- /*@null@*/ /*@out@*/ const void *** data,
- /*@null@*/ /*@out@*/ int * dataCount,
- /*@null@*/ /*@out@*/ const void ** tableKey)
- /*@modifies *data, *dataCount, *tableKey @*/;
+ const void *** data,
+ int * dataCount,
+ const void ** tableKey);
/**
* Check for key in hash table.
* @param key pointer to key value
* @return 1 if the key is present, 0 otherwise
*/
-/*@unused@*/
-int htHasEntry(hashTable ht, const void * key)
- /*@*/;
+int htHasEntry(hashTable ht, const void * key);
#ifdef __cplusplus
}
-/*@-bounds@*/
-/*@-mustmod@*/
-/*@-paramuse@*/
-/*@-globuse@*/
-/*@-moduncon@*/
-/*@-noeffectuncon@*/
-/*@-compdef@*/
-/*@-compmempass@*/
-/*@-branchstate@*/
-/*@-modfilesystem@*/
-/*@-evalorderuncon@*/
/*
* sqlite.c
#include "debug.h"
-/*@access rpmdb @*/
-/*@access dbiIndex @*/
-/*@unchecked@*/
static int _debug = 0;
/* Define the things normally in a header... */
struct _sql_dbcursor_s {
DB *dbp;
-/*@only@*/ /*@relnull@*/
char * cmd; /* SQL command string */
-/*@only@*/ /*@relnull@*/
sqlite3_stmt *pStmt; /* SQL byte code */
const char * pzErrmsg; /* SQL error msg */
/* Table -- result of query */
-/*@only@*/ /*@null@*/
char ** av; /* item ptrs */
-/*@only@*/ /*@null@*/
int * avlen; /* item sizes */
int nalloc;
int ac; /* no. of items */
_b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
}
-/*@unchecked@*/
static unsigned int endian = 0x11223344;
static char * sqlCwd = NULL;
}
static void dbg_scp(void *ptr)
- /*@*/
{
SCP_t scp = ptr;
}
-static void dbg_keyval(const char * msg, dbiIndex dbi, /*@null@*/ DBC * dbcursor,
+static void dbg_keyval(const char * msg, dbiIndex dbi, DBC * dbcursor,
DBT * key, DBT * data, unsigned int flags)
- /*@*/
{
if (!_debug) return;
dbg_scp(dbcursor);
}
-/*@only@*/
-static SCP_t scpResetKeys(/*@only@*/ SCP_t scp)
- /*@modifies scp @*/
+
+static SCP_t scpResetKeys(SCP_t scp)
{
int ix;
return scp;
}
-/*@only@*/
-static SCP_t scpResetAv(/*@only@*/ SCP_t scp)
- /*@modifies scp @*/
+
+static SCP_t scpResetAv(SCP_t scp)
{
int xx;
return scp;
}
-/*@only@*/
-static SCP_t scpReset(/*@only@*/ SCP_t scp)
- /*@modifies scp @*/
+
+static SCP_t scpReset(SCP_t scp)
{
int xx;
return scp;
}
-/*@null@*/
-static SCP_t scpFree(/*@only@*/ SCP_t scp)
- /*@modifies scp @*/
+static SCP_t scpFree(SCP_t scp)
{
scp = scpReset(scp);
scp = scpResetKeys(scp);
}
static SCP_t scpNew(DB * dbp)
- /*@*/
{
SCP_t scp = xcalloc(1, sizeof(*scp));
scp->dbp = dbp;
}
static int sql_step(dbiIndex dbi, SCP_t scp)
- /*@modifies scp @*/
{
const char * cname;
const char * vtype;
}
}
-/*@-infloopsuncon@*/
loop = 1;
while (loop) {
rc = sqlite3_step(scp->pStmt);
if (_debug)
fprintf(stderr, "sqlite3_step: DONE scp %p [%d:%d] av %p avlen %p\n", scp, scp->ac, scp->nalloc, scp->av, scp->avlen);
loop = 0;
- /*@switchbreak@*/ break;
+ break;
case SQLITE_ROW:
if (scp->av != NULL)
for (i = 0; i < scp->nc; i++) {
assert(scp->ac <= scp->nalloc);
}
scp->nr++;
- /*@switchbreak@*/ break;
+ break;
case SQLITE_BUSY:
fprintf(stderr, "sqlite3_step: BUSY %d\n", rc);
- /*@switchbreak@*/ break;
+ break;
case SQLITE_ERROR:
fprintf(stderr, "sqlite3_step: ERROR %d -- %s\n", rc, scp->cmd);
fprintf(stderr, " %s (%d)\n",
sqlite3_errmsg(((SQL_DB*)dbi->dbi_db)->db), sqlite3_errcode(((SQL_DB*)dbi->dbi_db)->db));
fprintf(stderr, " cwd '%s'\n", getcwd(NULL,0));
loop = 0;
- /*@switchbreak@*/ break;
+ break;
case SQLITE_MISUSE:
fprintf(stderr, "sqlite3_step: MISUSE %d\n", rc);
loop = 0;
- /*@switchbreak@*/ break;
+ break;
default:
fprintf(stderr, "sqlite3_step: rc %d\n", rc);
loop = 0;
- /*@switchbreak@*/ break;
+ break;
}
}
-/*@=infloopsuncon@*/
if (rc == SQLITE_DONE)
rc = SQLITE_OK;
}
static int sql_bind_key(dbiIndex dbi, SCP_t scp, int pos, DBT * key)
- /*@modifies scp @*/
{
int rc = 0;
memcpy(&hnum, &dbswap.ui, sizeof(dbswap.ui));
}
rc = sqlite3_bind_int(scp->pStmt, pos, hnum);
- } /*@innerbreak@*/ break;
+ } break;
default:
switch (tagType(dbi->dbi_rpmtag)) {
case RPM_NULL_TYPE:
case RPM_BIN_TYPE:
rc = sqlite3_bind_blob(scp->pStmt, pos, key->data, key->size, SQLITE_STATIC);
- /*@innerbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
{ unsigned char i;
assert(dbiByteSwapped(dbi) == 0); /* Byte swap?! */
memcpy(&i, key->data, sizeof(i));
rc = sqlite3_bind_int(scp->pStmt, pos, i);
- } /*@innerbreak@*/ break;
+ } break;
case RPM_INT16_TYPE:
{ unsigned short i;
assert(key->size == sizeof(int_16));
assert(dbiByteSwapped(dbi) == 0); /* Byte swap?! */
memcpy(&i, key->data, sizeof(i));
rc = sqlite3_bind_int(scp->pStmt, pos, i);
- } /*@innerbreak@*/ break;
+ } break;
case RPM_INT32_TYPE:
/* case RPM_INT64_TYPE: */
default:
memcpy(&i, &dbswap.ui, sizeof(dbswap.ui));
}
rc = sqlite3_bind_int(scp->pStmt, pos, i);
- } /*@innerbreak@*/ break;
+ } break;
case RPM_STRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
rc = sqlite3_bind_text(scp->pStmt, pos, key->data, key->size, SQLITE_STATIC);
- /*@innerbreak@*/ break;
+ break;
}
}
}
static int sql_bind_data(dbiIndex dbi, SCP_t scp, int pos, DBT * data)
- /*@modifies scp @*/
{
int rc;
*/
static int sql_startTransaction(dbiIndex dbi)
- /*@*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
int rc = 0;
}
static int sql_endTransaction(dbiIndex dbi)
- /*@*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
int rc=0;
}
static int sql_commitTransaction(dbiIndex dbi, int flag)
- /*@*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
int rc = 0;
}
static int sql_busy_handler(void * dbi_void, int time)
- /*@*/
{
-/*@-castexpose@*/
dbiIndex dbi = (dbiIndex) dbi_void;
-/*@=castexpose@*/
rpmMessage(RPMMESS_WARNING, _("Unable to get lock on db %s, retrying... (%d)\n"),
dbi->dbi_file, time);
* Create the table.. create the db_info
*/
static int sql_initDB(dbiIndex dbi)
- /*@*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
sprintf(cmd,
"SELECT name FROM 'sqlite_master' WHERE type='table' and name='%s';",
dbi->dbi_subfile);
-/*@-nullstate@*/
rc = sqlite3_get_table(sqldb->db, cmd,
&scp->av, &scp->nr, &scp->nc, (char **)&scp->pzErrmsg);
-/*@=nullstate@*/
if (rc)
goto exit;
case RPM_BIN_TYPE:
default:
keytype = "blob UNIQUE";
- /*@innerbreak@*/ break;
+ break;
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
case RPM_INT16_TYPE:
case RPM_INT32_TYPE:
/* case RPM_INT64_TYPE: */
keytype = "int UNIQUE";
- /*@innerbreak@*/ break;
+ break;
case RPM_STRING_TYPE:
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
keytype = "text UNIQUE";
- /*@innerbreak@*/ break;
+ break;
}
}
if (_debug)
* @param flags (unused)
* @return 0 on success
*/
-static int sql_cclose (dbiIndex dbi, /*@only@*/ DBC * dbcursor,
+static int sql_cclose (dbiIndex dbi, DBC * dbcursor,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcursor, fileSystem @*/
{
SCP_t scp = (SCP_t)dbcursor;
int rc;
else
rc = sql_endTransaction(dbi);
-/*@-kepttrans@*/
scp = scpFree(scp);
-/*@=kepttrans@*/
leaveChroot(dbi);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_close(/*@only@*/ dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
+static int sql_close(dbiIndex dbi, unsigned int flags)
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
int rc = 0;
* @param rpmtag rpm tag
* @return 0 on success
*/
-static int sql_open(rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies *dbip, rpmGlobalMacroContext, fileSystem, internalState @*/
+static int sql_open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
{
-/*@-nestedextern -shadow @*/
extern struct _dbiVec sqlitevec;
-/*@=nestedextern -shadow @*/
const char * urlfn = NULL;
const char * root;
/*
* Parse db configuration parameters.
*/
- /*@-mods@*/
if ((dbi = db3New(rpmdb, rpmtag)) == NULL)
- /*@-nullstate@*/
return 1;
- /*@=nullstate@*/
- /*@=mods@*/
/*
* Get the prefix/root component and directory path
t = xcalloc(len + 1, sizeof(*t));
(void) stpcpy( t, dbfile );
dbi->dbi_file = t;
-/*@-kepttrans@*/ /* WRONG */
+/* WRONG */
dbi->dbi_subfile = t;
-/*@=kepttrans@*/
}
dbi->dbi_mode=O_RDWR;
* Either the root or directory components may be a URL. Concatenate,
* convert the URL to a path, and add the name of the file.
*/
- /*@-mods@*/
urlfn = rpmGenPath(NULL, home, NULL);
- /*@=mods@*/
(void) urlPath(urlfn, &dbhome);
/*
* @return 0 on success
*/
static int sql_sync (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
int rc = 0;
* @param dbiflags DB_WRITECURSOR or 0
* @return 0 on success
*/
-static int sql_copen (dbiIndex dbi, /*@null@*/ DB_TXN * txnid,
- /*@out@*/ DBC ** dbcp, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *txnid, *dbcp, fileSystem @*/
+static int sql_copen (dbiIndex dbi, DB_TXN * txnid,
+ DBC ** dbcp, unsigned int flags)
{
SCP_t scp = scpNew(dbi->dbi_db);
DBC * dbcursor = (DBC *)scp;
rc = sql_startTransaction(dbi);
if (dbcp)
- /*@-onlytrans@*/ *dbcp = dbcursor; /*@=onlytrans@*/
+ *dbcp = dbcursor;
else
- /*@-kepttrans -nullstate @*/ (void) sql_cclose(dbi, dbcursor, 0); /*@=kepttrans =nullstate @*/
+ (void) sql_cclose(dbi, dbcursor, 0);
leaveChroot(dbi);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_cdel (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key,
+static int sql_cdel (dbiIndex dbi, DBC * dbcursor, DBT * key,
DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
{
-/*@i@*/ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
+ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
int rc = 0;
* @param flags (unused)
* @return 0 on success
*/
-static int sql_cget (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key,
+static int sql_cget (dbiIndex dbi, DBC * dbcursor, DBT * key,
DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, dbcursor, *key, *data, fileSystem @*/
{
-/*@i@*/ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
+ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = (SCP_t)dbcursor;
int rc = 0;
int ix;
case RPMDBI_PACKAGES:
scp->cmd = sqlite3_mprintf("SELECT key FROM '%q' ORDER BY key;",
dbi->dbi_subfile);
- /*@innerbreak@*/ break;
+ break;
default:
scp->cmd = sqlite3_mprintf("SELECT key FROM '%q';",
dbi->dbi_subfile);
- /*@innerbreak@*/ break;
+ break;
}
rc = sqlite3_prepare(sqldb->db, scp->cmd, strlen(scp->cmd), &scp->pStmt, &scp->pzErrmsg);
if (rc) rpmMessage(RPMMESS_WARNING, "cget(%s) sequential prepare %s (%d)\n", dbi->dbi_subfile, sqlite3_errmsg(sqldb->db), rc);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_cput (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key,
+static int sql_cput (dbiIndex dbi, DBC * dbcursor, DBT * key,
DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
{
-/*@i@*/ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
+ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
int rc = 0;
* @return 0 no
*/
static int sql_byteswapped (dbiIndex dbi)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
{
SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
enterChroot(dbi);
-/*@-nullstate@*/
sql_rc = sqlite3_get_table(sqldb->db, "SELECT endian FROM 'db_info';",
&scp->av, &scp->nr, &scp->nc, (char **)&scp->pzErrmsg);
-/*@=nullstate@*/
if (sql_rc == 0 && scp->nr > 0) {
assert(scp->av != NULL);
static int sql_associate (dbiIndex dbi, dbiIndex dbisecondary,
int (*callback) (DB *, const DBT *, const DBT *, DBT *),
unsigned int flags)
- /*@*/
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @param flags DB_JOIN_NOSORT or 0
* @return 0 on success
*/
-static int sql_join (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp,
+static int sql_join (dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @param flags DB_POSITION for same position, 0 for uninitialized
* @return 0 on success
*/
-static int sql_cdup (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp,
+static int sql_cdup (dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, *dbcp, fileSystem @*/
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @param flags DB_NEXT, DB_SET, or 0
* @return 0 on success
*/
-static int sql_cpget (dbiIndex dbi, /*@null@*/ DBC * dbcursor,
+static int sql_cpget (dbiIndex dbi, DBC * dbcursor,
DBT * key, DBT * pkey, DBT * data, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @param flags (unused)
* @return 0 on success
*/
-static int sql_ccount (dbiIndex dbi, /*@unused@*/ DBC * dbcursor,
- /*@unused@*/ /*@out@*/ unsigned int * countp,
- /*@unused@*/ unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies *dbcursor, fileSystem @*/
+static int sql_ccount (dbiIndex dbi, DBC * dbcursor,
+ unsigned int * countp,
+ unsigned int flags)
{
if (_debug)
fprintf(stderr, "*** %s:\n", __FUNCTION__);
* @return 0 on success
*/
static int sql_stat (dbiIndex dbi, unsigned int flags)
- /*@globals fileSystem @*/
- /*@modifies dbi, fileSystem @*/
{
-/*@i@*/ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
+ SQL_DB * sqldb = (SQL_DB *) dbi->dbi_db;
SCP_t scp = scpNew(dbi->dbi_db);
int rc = 0;
long nkeys = -1;
dbi->dbi_stats = _free(dbi->dbi_stats);
-/*@-sizeoftype@*/
dbi->dbi_stats = xcalloc(1, sizeof(DB_HASH_STAT));
-/*@=sizeoftype@*/
scp->cmd = sqlite3_mprintf("SELECT COUNT('key') FROM '%q';", dbi->dbi_subfile);
-/*@-nullstate@*/
rc = sqlite3_get_table(sqldb->db, scp->cmd,
&scp->av, &scp->nr, &scp->nc, (char **)&scp->pzErrmsg);
-/*@=nullstate@*/
if ( rc == 0 && scp->nr > 0) {
assert(scp->av != NULL);
/* cursor_open, cursor_close, cursor_dup, cursor_delete, cursor_get, */
/* cursor_pget?, cursor_put, cursor_count */
/* db_bytewapped, stat */
-/*@observer@*/ /*@unchecked@*/
struct _dbiVec sqlitevec = {
0, 0, 0,
sql_open,
sql_stat
};
-/*@=evalorderuncon@*/
-/*@=modfilesystem@*/
-/*@=branchstate@*/
-/*@=compmempass@*/
-/*@=compdef@*/
-/*@=moduncon@*/
-/*@=noeffectuncon@*/
-/*@=globuse@*/
-/*@=paramuse@*/
-/*@=mustmod@*/
-/*@=bounds@*/
#include <rpmio.h>
#include "debug.h"
-/*@access headerTagTableEntry @*/
-/*@access headerTagIndices @*/
/**
* Compare tag table entries by name.
* @return comparison
*/
static int tagCmpName(const void * avp, const void * bvp)
- /*@*/
{
headerTagTableEntry a = *(headerTagTableEntry *) avp;
headerTagTableEntry b = *(headerTagTableEntry *) bvp;
* @return comparison
*/
static int tagCmpValue(const void * avp, const void * bvp)
- /*@*/
{
headerTagTableEntry a = *(headerTagTableEntry *) avp;
headerTagTableEntry b = *(headerTagTableEntry *) bvp;
*/
static int tagLoadIndex(headerTagTableEntry ** ipp, int * np,
int (*cmp) (const void * avp, const void * bvp))
- /*@modifies *ipp, *np @*/
{
headerTagTableEntry tte, *ip;
int n = 0;
ip = xcalloc(rpmTagTableSize, sizeof(*ip));
n = 0;
-/*@-dependenttrans@*/ /*@-observertrans@*/ /*@-castexpose@*/ /*@-mods@*/ /*@-modobserver@*/
for (tte = (headerTagTableEntry)rpmTagTable; tte->name != NULL; tte++) {
ip[n] = tte;
n++;
}
assert(n == rpmTagTableSize);
-/*@=dependenttrans@*/ /*@=observertrans@*/ /*@=castexpose@*/ /*@=mods@*/ /*@=modobserver@*/
if (n > 1)
qsort(ip, n, sizeof(*ip), cmp);
/* forward refs */
-static const char * _tagName(int tag)
- /*@*/;
-static int _tagType(int tag)
- /*@*/;
-static int _tagValue(const char * tagstr)
- /*@*/;
+static const char * _tagName(int tag);
+static int _tagType(int tag);
+static int _tagValue(const char * tagstr);
-/*@unchecked@*/
static struct headerTagIndices_s _rpmTags = {
tagLoadIndex,
NULL, 0, tagCmpName, _tagValue,
NULL, 0, tagCmpValue, _tagName, _tagType,
};
-/*@-compmempass@*/
-/*@unchecked@*/
headerTagIndices rpmTags = &_rpmTags;
-/*@=compmempass@*/
static const char * _tagName(int tag)
{
strcpy(nameBuf, "(unknown)");
if (_rpmTags.byValue == NULL)
break;
-/*@-boundswrite@*/
l = 0;
u = _rpmTags.byValueSize;
while (l < u) {
strcpy(nameBuf, t->name + (sizeof("RPMTAG_")-1));
for (s = nameBuf+1; *s != '\0'; s++)
*s = xtolower(*s);
- /*@loopbreak@*/ break;
+ break;
}
}
break;
}
-/*@-statictrans@*/
return nameBuf;
-/*@=statictrans@*/
}
static int _tagType(int tag)
default:
if (_rpmTags.byValue == NULL)
break;
-/*@-boundswrite@*/
l = 0;
u = _rpmTags.byValueSize;
while (l < u) {