summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-10-16 14:58:57 +0000
committerjbj <devnull@localhost>2001-10-16 14:58:57 +0000
commit9f45bcd3ecf3f3548ed7a8490b882a6ca9ffeb94 (patch)
tree65c941cf8e72c29c2d63822cd98aec4db0967afc /rpmdb
parentcafccc00586497bdc9c5a4c12b19709fbd417976 (diff)
downloadlibrpm-tizen-9f45bcd3ecf3f3548ed7a8490b882a6ca9ffeb94.tar.gz
librpm-tizen-9f45bcd3ecf3f3548ed7a8490b882a6ca9ffeb94.tar.bz2
librpm-tizen-9f45bcd3ecf3f3548ed7a8490b882a6ca9ffeb94.zip
More lclint annotations.
CVS patchset: 5116 CVS date: 2001/10/16 14:58:57
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/db3.c43
-rw-r--r--rpmdb/dbconfig.c13
-rw-r--r--rpmdb/falloc.c8
-rw-r--r--rpmdb/fprint.c5
-rw-r--r--rpmdb/rpmdb.c43
5 files changed, 74 insertions, 38 deletions
diff --git a/rpmdb/db3.c b/rpmdb/db3.c
index 602836077..671ff2683 100644
--- a/rpmdb/db3.c
+++ b/rpmdb/db3.c
@@ -11,6 +11,15 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#include <sys/ipc.h>
#endif
+#if defined(__LCLINT__)
+typedef unsigned int u_int32_t;
+typedef unsigned short u_int16_t;
+typedef unsigned char u_int8_t;
+/*@-incondefs@*/ /* LCLint 3.0.0.15 */
+typedef int int32_t;
+/*@=incondefs@*/
+#endif
+
#include <db3/db.h>
#include <rpmlib.h>
@@ -83,7 +92,7 @@ static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit)
rc = error;
if (printit && rc) {
- /*@-moduncon@*/
+ /*@-moduncon@*/ /* 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));
@@ -122,7 +131,7 @@ static int db_fini(dbiIndex dbi, const char * dbhome,
if (rpmdb->db_remove_env || dbi->dbi_tear_down) {
int xx;
- /*@-moduncon@*/
+ /*@-moduncon@*/ /* FIX: annotate db3 methods */
xx = db_env_create(&dbenv, 0);
/*@=moduncon@*/
xx = cvtdberr(dbi, "db_env_create", rc, _debug);
@@ -148,7 +157,7 @@ static int db3_fsync_disable(/*@unused@*/ int fd)
return 0;
}
-/*@-moduncon@*/
+/*@-moduncon@*/ /* FIX: annotate db3 methods */
static int db_init(dbiIndex dbi, const char * dbhome,
/*@null@*/ const char * dbfile,
/*@unused@*/ /*@null@*/ const char * dbsubfile,
@@ -200,17 +209,19 @@ static int db_init(dbiIndex dbi, const char * dbhome,
return 1;
{ int xx;
+ /*@-noeffectuncon@*/ /* FIX: annotate db3 methods */
dbenv->set_errcall(dbenv, rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile);
dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
+ /*@=noeffectuncon@*/
/* dbenv->set_paniccall(???) */
- (void) dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
+ xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT));
- (void) dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK,
+ xx = dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK,
(dbi->dbi_verbose & DB_VERB_DEADLOCK));
- (void) dbenv->set_verbose(dbenv, DB_VERB_RECOVERY,
+ xx = dbenv->set_verbose(dbenv, DB_VERB_RECOVERY,
(dbi->dbi_verbose & DB_VERB_RECOVERY));
- (void) dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
+ xx = dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
(dbi->dbi_verbose & DB_VERB_WAITSFOR));
/* dbenv->set_lg_max(???) */
/* dbenv->set_lk_conflicts(???) */
@@ -636,7 +647,7 @@ static int db3stat(dbiIndex dbi, unsigned int flags)
return rc;
}
-/*@-moduncon@*/
+/*@-moduncon@*/ /* FIX: annotate db3 methods */
static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
/*@globals rpmGlobalMacroContext,
fileSystem @*/
@@ -705,23 +716,25 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
if (dbi->dbi_verify_on_close && !dbi->dbi_temporary) {
DB_ENV * dbenv = NULL;
- /*@-moduncon@*/
+ /*@-moduncon@*/ /* 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 */
dbenv->set_errcall(dbenv, rpmdb->db_errcall);
dbenv->set_errfile(dbenv, rpmdb->db_errfile);
dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
/* dbenv->set_paniccall(???) */
- (void) dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
+ /*@=noeffectuncon@*/
+ xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
(dbi->dbi_verbose & DB_VERB_CHKPOINT));
- (void) dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK,
+ xx = dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK,
(dbi->dbi_verbose & DB_VERB_DEADLOCK));
- (void) dbenv->set_verbose(dbenv, DB_VERB_RECOVERY,
+ xx = dbenv->set_verbose(dbenv, DB_VERB_RECOVERY,
(dbi->dbi_verbose & DB_VERB_RECOVERY));
- (void) dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
+ xx = dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
(dbi->dbi_verbose & DB_VERB_WAITSFOR));
if (dbi->dbi_tmpdir) {
@@ -737,7 +750,7 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
rc = cvtdberr(dbi, "dbenv->open", rc, _debug);
if (rc) goto exit;
- /*@-moduncon@*/
+ /*@-moduncon@*/ /* FIX: annotate db3 methods */
rc = db_create(&db, dbenv, 0);
/*@=moduncon@*/
rc = cvtdberr(dbi, "db_create", rc, _debug);
@@ -960,7 +973,7 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
if (rc == 0) {
static int _lockdbfd = 0;
- /*@-moduncon@*/
+ /*@-moduncon@*/ /* FIX: annotate db3 methods */
rc = db_create(&db, dbenv, dbi->dbi_cflags);
/*@=moduncon@*/
rc = cvtdberr(dbi, "db_create", rc, _debug);
diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c
index 704bc8490..44f3ff21e 100644
--- a/rpmdb/dbconfig.c
+++ b/rpmdb/dbconfig.c
@@ -4,6 +4,17 @@
#include "system.h"
+#if defined(__LCLINT__)
+/*@-redef@*/
+typedef unsigned int u_int32_t;
+typedef unsigned short u_int16_t;
+typedef unsigned char u_int8_t;
+/*@-incondefs@*/ /* LCLint 3.0.0.15 */
+typedef int int32_t;
+/*@=incondefs@*/
+/*@=redef@*/
+#endif
+
#include <db3/db.h>
#include <rpmlib.h>
@@ -478,6 +489,7 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
/*
* Inverted lists have join length of 2, primary data has join length of 1.
*/
+ /*@-sizeoftype@*/
switch (rpmtag) {
case RPMDBI_PACKAGES:
case RPMDBI_DEPENDS:
@@ -487,6 +499,7 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
dbi->dbi_jlen = 2 * sizeof(int_32);
break;
}
+ /*@=sizeoftype@*/
dbi->dbi_use_cursors = 1; /* db3 cursors are always used now. */
diff --git a/rpmdb/falloc.c b/rpmdb/falloc.c
index 4785107ca..117d19500 100644
--- a/rpmdb/falloc.c
+++ b/rpmdb/falloc.c
@@ -78,10 +78,12 @@ FD_t fadOpen(const char * path, int flags, mode_t perms)
if (fadGetFileSize(fd) == 0) {
newHdr.magic = FA_MAGIC;
newHdr.firstFree = 0;
+ /*@-sizeoftype@*/
if (Fwrite(&newHdr, sizeof(char), sizeof(newHdr), fd) != sizeof(newHdr)) {
(void) Fclose(fd);
return NULL;
}
+ /*@=sizeoftype@*/
fadSetFirstFree(fd, 0);
fadSetFileSize(fd, sizeof(newHdr));
} else {
@@ -127,7 +129,9 @@ unsigned int fadAlloc(FD_t fd, unsigned int size)
memset(&header, 0, sizeof(header));
/* our internal idea of size includes overhead */
+ /*@-sizeoftype@*/
size += sizeof(struct faHeader) + sizeof(struct faFooter);
+ /*@=sizeoftype@*/
/* Make sure they are allocing multiples of 64 bytes. It'll keep
things less fragmented that way */
@@ -387,6 +391,7 @@ static int fadSanity(FD_t fd, int offset, const struct faHeader * fh, int printi
{
int rc = 0;
+ /*@-sizeoftype@*/
/* Check size range and alignment. */
if (!(fh->size > 0 && fh->size <= 0x00200000 && (fh->size & 0x3f) == 0))
rc |= 0x1;
@@ -404,6 +409,7 @@ static int fadSanity(FD_t fd, int offset, const struct faHeader * fh, int printi
fh->freePrev < fadGetFileSize(fd) &&
(fh->freePrev & 0x3f) == sizeof(struct faFileHeader)) )
rc |= 0x4;
+ /*@=sizeoftype@*/
/* Check that only the isFree bit is (possibly) set. */
if (fh->isFree & ~1)
@@ -431,9 +437,11 @@ int fadNextOffset(FD_t fd, unsigned int lastoff)
struct faHeader header;
int offset;
+ /*@-sizeoftype@*/
offset = (lastoff)
? (lastoff - sizeof(header))
: sizeof(struct faFileHeader);
+ /*@=sizeoftype@*/
if (offset >= fadGetFileSize(fd))
return 0;
diff --git a/rpmdb/fprint.c b/rpmdb/fprint.c
index 7563585cd..3a049db6e 100644
--- a/rpmdb/fprint.c
+++ b/rpmdb/fprint.c
@@ -249,12 +249,13 @@ void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
rpmTagType bnt, dnt;
int_32 * dirIndexes;
int fileCount;
+ int xx;
if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount))
return;
- (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
- (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
+ xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList);
dirNames = hfd(dirNames, dnt);
baseNames = hfd(baseNames, bnt);
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c
index 1703f22d0..0eab91a40 100644
--- a/rpmdb/rpmdb.c
+++ b/rpmdb/rpmdb.c
@@ -1,3 +1,4 @@
+/*@-sizeoftype@*/
/** \ingroup rpmdb dbi
* \file rpmdb/rpmdb.c
*/
@@ -907,7 +908,7 @@ static int openDatabase(/*@null@*/ const char * prefix,
/*@modifies *dbp, fileSystem @*/
{
rpmdb db;
- int rc;
+ int rc, xx;
unsigned int gflags = 0; /* dbiGet() flags */
static int _initialized = 0;
int justCheck = flags & RPMDB_FLAG_JUSTCHECK;
@@ -934,7 +935,7 @@ static int openDatabase(/*@null@*/ const char * prefix,
sprintf(filename, "%s/%s/__db.%03d",
(prefix ? prefix : ""), (dbpath ? dbpath : ""), i);
(void) rpmCleanPath(filename);
- (void) unlink(filename);
+ xx = unlink(filename);
}
}
#endif
@@ -1001,7 +1002,6 @@ static int openDatabase(/*@null@*/ const char * prefix,
case RPMTAG_BASENAMES:
{ void * keyp = NULL;
DBC * dbcursor;
- int xx;
/* We used to store the fileindexes as complete paths, rather then
plain basenames. Let's see which version we are... */
@@ -1033,7 +1033,7 @@ static int openDatabase(/*@null@*/ const char * prefix,
exit:
if (rc || justCheck || dbp == NULL)
- (void) rpmdbClose(db);
+ xx = rpmdbClose(db);
else
*dbp = db;
@@ -1184,9 +1184,9 @@ static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec,
continue;
}
- (void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
- (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
- (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
+ xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
+ xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
do {
fingerPrint fp2;
@@ -1198,7 +1198,7 @@ static int rpmdbFindByFile(rpmdb db, /*@null@*/ const char * filespec,
/*@=nullpass@*/
rec->hdrNum = dbiIndexRecordOffset(allMatches, i);
rec->tagNum = dbiIndexRecordFileNumber(allMatches, i);
- (void) dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
+ xx = dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
}
prevoff = offset;
@@ -2565,9 +2565,9 @@ int rpmdbAdd(rpmdb db, int iid, Header h)
if (iid != 0 && iid != -1) {
int_32 tid = iid;
- (void) headerRemoveEntry(h, RPMTAG_REMOVETID);
+ xx = headerRemoveEntry(h, RPMTAG_REMOVETID);
if (!headerIsEntry(h, RPMTAG_INSTALLTID))
- (void) headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1);
+ xx = headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1);
}
/*
@@ -2576,7 +2576,7 @@ int rpmdbAdd(rpmdb db, int iid, Header h)
* being written to the package header database.
*/
- (void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count);
+ xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count);
if (_noDirTokens)
expandFilelist(h);
@@ -2672,7 +2672,7 @@ int rpmdbAdd(rpmdb db, int iid, Header h)
if (!dbi->dbi_no_dbsync)
xx = dbiSync(dbi, 0);
{ const char *n, *v, *r;
- (void) headerNVR(h, &n, &v, &r);
+ xx = headerNVR(h, &n, &v, &r);
rpmMessage(RPMMESS_DEBUG, " +++ %10u %s-%s-%s\n", hdrNum, n, v, r);
}
}
@@ -2685,11 +2685,11 @@ int rpmdbAdd(rpmdb db, int iid, Header h)
rpmcnt = count;
/*@switchbreak@*/ break;
case RPMTAG_REQUIRENAME:
- (void) hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
- (void) hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
+ xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
+ xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
/*@switchbreak@*/ break;
default:
- (void) hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
+ xx = hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
/*@switchbreak@*/ break;
}
@@ -2822,7 +2822,7 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
rpmdbMatchIterator mi;
fingerPrintCache fpc;
Header h;
- int i;
+ int i, xx;
if (db == NULL) return 0;
@@ -2830,7 +2830,7 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
/* Gather all matches from the database */
for (i = 0; i < numItems; i++) {
- (void) rpmdbGrowIterator(mi, fpList[i].baseName, 0, i);
+ xx = rpmdbGrowIterator(mi, fpList[i].baseName, 0, i);
matchList[i] = xcalloc(1, sizeof(*(matchList[i])));
}
@@ -2869,9 +2869,9 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
num = end - start;
/* Compute fingerprints for this header's matches */
- (void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL);
- (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
- (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL);
+ xx = hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL);
+ xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
+ xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL);
baseNames = xcalloc(num, sizeof(*baseNames));
dirIndexes = xcalloc(num, sizeof(*dirIndexes));
@@ -2889,7 +2889,7 @@ int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList,
if (FP_EQUAL(fps[i], fpList[im->fpNum])) {
/*@=nullpass@*/
/*@-usedef@*/
- (void) dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
+ xx = dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
/*@=usedef@*/
}
}
@@ -3327,3 +3327,4 @@ exit:
return rc;
}
/*@=globs@*/
+/*@=sizeoftype@*/