RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: rpm Date: 10-Dec-2009 18:08:43 Branch: HEAD Handle: 2009121017084200 Modified files: rpm/rpmdb .splintrc Makefile.am db3.c header.c legacy.c poptDB.c rpmdb.c rpmdb.h rpmevr.c rpmlio.c rpmlio.h rpmns.c rpmtag.h rpmtxn.c rpmtxn.h Log: - rpmdb: rescusitate splint. Summary: Revision Changes Path 1.17 +36 -0 rpm/rpmdb/.splintrc 1.121 +8 -2 rpm/rpmdb/Makefile.am 1.132 +55 -11 rpm/rpmdb/db3.c 1.195 +4 -2 rpm/rpmdb/header.c 1.44 +1 -1 rpm/rpmdb/legacy.c 1.16 +1 -0 rpm/rpmdb/poptDB.c 1.357 +55 -36 rpm/rpmdb/rpmdb.c 1.130 +4 -2 rpm/rpmdb/rpmdb.h 1.35 +2 -0 rpm/rpmdb/rpmevr.c 1.3 +8 -3 rpm/rpmdb/rpmlio.c 1.2 +1 -0 rpm/rpmdb/rpmlio.h 1.12 +1 -0 rpm/rpmdb/rpmns.c 1.69 +2 -2 rpm/rpmdb/rpmtag.h 1.6 +11 -8 rpm/rpmdb/rpmtxn.c 1.5 +1 -1 rpm/rpmdb/rpmtxn.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmdb/.splintrc ============================================================================ $ cvs diff -u -r1.16 -r1.17 .splintrc --- rpm/rpmdb/.splintrc 27 Mar 2009 17:42:00 -0000 1.16 +++ rpm/rpmdb/.splintrc 10 Dec 2009 17:08:42 -0000 1.17 @@ -16,6 +16,42 @@ -bounds -bufferoverflowhigh # 26 ++voidabstract ++longunsignedintegral +-abstract +-assignexpose +-castfcnptr +-compdef +-compmempass +-fullinitblock +-immediatetrans +-matchfields +-modfilesys +-noeffect +-paramuse +-retalias +-retexpose +-shiftnegative + +-castexpose +-globs +-globuse +-internalglobs +-modobserver +-mods +-moduncon +-nestedextern +-nullderef +-nullret +-kepttrans +-readonlytrans +-shadow +-temptrans +-type +-unrecog + +-exportheader # 1 logio_dispatch + -evalorder # 17 -nullpass # 90 -nullstate # 56 indirections hard to annotate @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/Makefile.am ============================================================================ $ cvs diff -u -r1.120 -r1.121 Makefile.am --- rpm/rpmdb/Makefile.am 6 Dec 2009 17:04:13 -0000 1.120 +++ rpm/rpmdb/Makefile.am 10 Dec 2009 17:08:42 -0000 1.121 @@ -129,16 +129,22 @@ clean-local: rm -f *.o tagtbl.c +splint_librpmdb_la_SOURCES = \ + dbconfig.c fprint.c \ + hdrfmt.c hdrNVR.c header.c header_internal.c legacy.c merge.c \ + pkgio.c poptDB.c rpmdb.c rpmdpkg.c rpmevr.c rpmlio.c rpmns.c rpmtd.c \ + rpmtxn.c rpmwf.c signature.c tagname.c tagtbl.c + rpmdb.lcd: Makefile.am ${librpmdb_la_SOURCES} ${pkginc_HEADERS} ${noinst_HEADERS} -splint ${DEFS} ${INCLUDES} ${librpmdb_la_SOURCES} -dump $@ 2>/dev/null .PHONY: sources sources: - @echo $(librpmdb_la_SOURCES:%=rpmdb/%) + @echo $(splint_librpmdb_la_SOURCES:%=rpmdb/%) .PHONY: lint lint: - $(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES) $(DBLIBSRCS) + $(LINT) $(DEFS) $(INCLUDES) $(splint_librpmdb_la_SOURCES) $(DBLIBSRCS) .PHONY: mccabe mccabe: @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/db3.c ============================================================================ $ cvs diff -u -r1.131 -r1.132 db3.c --- rpm/rpmdb/db3.c 8 Dec 2009 18:49:25 -0000 1.131 +++ rpm/rpmdb/db3.c 10 Dec 2009 17:08:42 -0000 1.132 @@ -43,12 +43,15 @@ /*...@access dbiIndex @*/ /*...@access dbiIndexSet @*/ +/*...@-redef@*/ union _dbswap { uint64_t ul; uint32_t ui; uint16_t us; uint8_t uc[8]; }; +/*...@=redef@*/ +/*...@unchecked@*/ static union _dbswap _endian = { .ui = 0x11223344 }; static inline uint64_t _ntoh_ul(uint64_t ul) @@ -177,12 +180,17 @@ "\20\1WRONLY\2RDWR\7CREAT\10EXCL\11NOCTTY\12TRUNC\13APPEND\14NONBLOCK\15SYNC\16ASYNC\17DIRECT\20LARGEFILE\21DIRECTORY\22NOFOLLOW"; #endif /* NOTNOW */ +/*...@-redef@*/ typedef struct key_s { uint32_t v; +/*...@observer@*/ const char *n; } KEY; +/*...@=redef@*/ +/*...@observer@*/ static const char * tblName(uint32_t v, KEY * tbl, size_t ntbl) + /*...@*/ { const char * n = NULL; static char buf[32]; @@ -195,19 +203,20 @@ break; } if (n == NULL) { - snprintf(buf, sizeof(buf), "0x%x", v); + (void) snprintf(buf, sizeof(buf), "0x%x", (unsigned)v); n = buf; } return n; } static const char * fmtBits(uint32_t flags, KEY tbl[], size_t ntbl, char *t) + /*...@modifies t @*/ { char pre = '<'; char * te = t; int i; - sprintf(t, "0x%x", flags); + sprintf(t, "0x%x", (unsigned)flags); te = t; te += strlen(te); for (i = 0; i < 32; i++) { @@ -229,6 +238,7 @@ #define _ENTRY(_v) { DB_##_v, #_v, } +/*...@unchecked@*/ /*...@observer@*/ static KEY DBeflags[] = { _ENTRY(INIT_CDB), _ENTRY(INIT_LOCK), @@ -248,8 +258,11 @@ _ENTRY(SYSTEM_MEM), _ENTRY(THREAD), }; +/*...@unchecked@*/ static size_t nDBeflags = sizeof(DBeflags) / sizeof(DBeflags[0]); +/*...@observer@*/ static const char * fmtDBeflags(uint32_t flags) + /*...@*/ { static char buf[BUFSIZ]; char * te = buf; @@ -259,6 +272,7 @@ } #define _EFLAGS(_eflags) fmtDBeflags(_eflags) +/*...@unchecked@*/ /*...@observer@*/ static KEY DBoflags[] = { _ENTRY(AUTO_COMMIT), _ENTRY(CREATE), @@ -270,8 +284,11 @@ _ENTRY(THREAD), _ENTRY(TRUNCATE), }; +/*...@unchecked@*/ static size_t nDBoflags = sizeof(DBoflags) / sizeof(DBoflags[0]); +/*...@observer@*/ static const char * fmtDBoflags(uint32_t flags) + /*...@*/ { static char buf[BUFSIZ]; char * te = buf; @@ -281,12 +298,16 @@ } #define _OFLAGS(_oflags) fmtDBoflags(_oflags) +/*...@unchecked@*/ /*...@observer@*/ static KEY DBaflags[] = { _ENTRY(CREATE), _ENTRY(IMMUTABLE_KEY), }; +/*...@unchecked@*/ static size_t nDBaflags = sizeof(DBaflags) / sizeof(DBaflags[0]); +/*...@observer@*/ static const char * fmtDBaflags(uint32_t flags) + /*...@*/ { static char buf[BUFSIZ]; char * te = buf; @@ -296,13 +317,17 @@ } #define _AFLAGS(_aflags) fmtDBaflags(_aflags) +/*...@unchecked@*/ /*...@observer@*/ static KEY DBafflags[] = { _ENTRY(FOREIGN_ABORT), _ENTRY(FOREIGN_CASCADE), _ENTRY(FOREIGN_NULLIFY), }; +/*...@unchecked@*/ static size_t nDBafflags = sizeof(DBafflags) / sizeof(DBafflags[0]); +/*...@observer@*/ static const char * fmtDBafflags(uint32_t flags) + /*...@*/ { static char buf[BUFSIZ]; char * te = buf; @@ -312,6 +337,7 @@ } #define _AFFLAGS(_afflags) fmtDBafflags(_afflags) +/*...@unchecked@*/ /*...@observer@*/ static KEY DBCflags[] = { _ENTRY(AFTER), /* Dbc.put */ _ENTRY(APPEND), /* Db.put */ @@ -353,8 +379,11 @@ _ENTRY(MULTIPLE_KEY), _ENTRY(RMW), }; +/*...@unchecked@*/ static size_t nDBCflags = sizeof(DBCflags) / sizeof(DBCflags[0]); +/*...@observer@*/ static const char * fmtDBCflags(uint32_t flags) + /*...@*/ { static char buf[BUFSIZ]; char * te = buf; @@ -374,6 +403,7 @@ #define _DBCFLAGS(_flags) fmtDBCflags(_flags) #define _DBT_ENTRY(_v) { DB_DBT_##_v, #_v, } +/*...@unchecked@*/ /*...@observer@*/ static KEY DBTflags[] = { _DBT_ENTRY(MALLOC), _DBT_ENTRY(REALLOC), @@ -382,8 +412,11 @@ _DBT_ENTRY(APPMALLOC), _DBT_ENTRY(MULTIPLE), }; +/*...@unchecked@*/ static size_t nDBTflags = sizeof(DBTflags) / sizeof(DBTflags[0]); +/*...@observer@*/ static char * fmtDBT(const DBT * K, char * te) + /*...@modifies te @*/ { static size_t keymax = 35; int unprintable; @@ -419,7 +452,7 @@ } else { switch (_nu) { default: break; - case 4: sprintf(te, "\t0x%08x", *(uint32_t *)_u); break; + case 4: sprintf(te, "\t0x%08x", (unsigned)*(uint32_t *)_u); break; } } @@ -428,7 +461,9 @@ } return te; } +/*...@observer@*/ static const char * fmtKDR(const DBT * K, const DBT * D, const DBT * R) + /*...@*/ { static char buf[BUFSIZ]; char * te = buf; @@ -1286,7 +1321,7 @@ if (dbi->dbi_debug || dbisecondary->dbi_debug) { const char * tag2 = xstrdup(tagName(dbisecondary->dbi_rpmtag)); -fprintf(stderr, "<-- %s(%p(%s),%p(%s),%p,0x%x) rc %d %s\n", __FUNCTION__, dbi, tagName(dbi->dbi_rpmtag), dbisecondary, tag2, callback, flags, rc, _AFLAGS(flags)); +fprintf(stderr, "<-- %s(%p(%s),%p(%s),%p,0x%x) rc %d %s\n", __FUNCTION__, dbi, tagName(dbi->dbi_rpmtag), dbisecondary, tag2, (void *)callback, flags, rc, _AFLAGS(flags)); tag2 = _free(tag2); } @@ -1516,6 +1551,7 @@ } static int loadDBT(DBT * _r, rpmTag tag, const void * _s, size_t ns) + /*...@modifies *_r @*/ { const char * s = _s; void * data = NULL; @@ -1533,7 +1569,7 @@ data = t = xmalloc(ns); for (i = 0; i < ns; i++, t++, s += 2) { if (!(isxdigit(s[0]) && isxdigit(s[1]))) - break; + /*...@loopbreak@*/ break; *t = (uint8_t) (nibble(s[0]) << 4) | nibble(s[1]); } if (i == ns) @@ -1561,6 +1597,7 @@ } static int uint32Cmp(const void * _a, const void * _b) + /*...@*/ { const uint32_t * a = _a; const uint32_t * b = _b; @@ -1569,6 +1606,7 @@ } static int uint64Cmp(const void * _a, const void * _b) + /*...@*/ { const uint64_t * a = _a; const uint64_t * b = _b; @@ -1578,6 +1616,8 @@ static int db3Acallback(DB * db, const DBT * key, const DBT * data, DBT * _r) + /*...@globals internalState @*/ + /*...@modifies *_r, internalState @*/ { HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he)); HE_t Fhe = memset(alloca(sizeof(*Fhe)), 0, sizeof(*Fhe)); @@ -1637,7 +1677,7 @@ switch (he->t) { default: assert(0); - break; + /*...@notreached@*/ break; case RPM_UINT8_TYPE: /* XXX coerce to uint32_t */ { uint8_t * _u = he->p.ui8p; he->p.ui32p = xmalloc(he->c * sizeof(*he->p.ui32p)); @@ -1645,7 +1685,7 @@ he->p.ui32p[i] = _u[i]; _u = _free(_u); goto _ifill; - } break; + } /*...@notreached@*/ break; case RPM_UINT16_TYPE: /* XXX coerce to uint32_t */ { uint16_t * _u = he->p.ui16p; he->p.ui32p = xmalloc(he->c * sizeof(*he->p.ui32p)); @@ -1653,7 +1693,7 @@ he->p.ui32p[i] = _u[i]; _u = _free(_u); goto _ifill; - } break; + } /*...@notreached@*/ break; case RPM_UINT32_TYPE: _ifill: { uint32_t * _u = he->p.ui32p; @@ -1664,9 +1704,9 @@ case RPMTAG_INSTALLTID: case RPMTAG_REMOVETID: he->c = 1; - break; + /*...@innerbreak@*/ break; default: - break; + /*...@innerbreak@*/ break; } if (he->c == 1) { /* XXX is it worth avoiding the realloc here? */ @@ -1763,7 +1803,7 @@ /* Don't add identical (key,val) item to secondary. */ if (rpmbfChk(bf, s, ns)) continue; - rpmbfAdd(bf, s, ns); + (void) rpmbfAdd(bf, s, ns); if (!loadDBT(A, he->tag, s, ns)) continue; @@ -1796,6 +1836,7 @@ static int seqid_init(dbiIndex dbi, const char * keyp, size_t keylen, DB_SEQUENCE ** seqp) + /*...@modifies *seqp @*/ { DB * db = dbi->dbi_db; DBT k = {0}; @@ -1812,9 +1853,12 @@ assert(db != NULL); if (seqp) *seqp = NULL; +/*...@-moduncon@*/ rc = db_sequence_create(&seq, db, 0); +/*...@=moduncon@*/ rc = cvtdberr(dbi, "db_sequence_create", rc, _debug); if (rc) goto exit; +assert(seq != NULL); if (dbi->dbi_seq_cachesize) { _cachesize = dbi->dbi_seq_cachesize; @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/header.c ============================================================================ $ cvs diff -u -r1.194 -r1.195 header.c --- rpm/rpmdb/header.c 6 Dec 2009 20:22:01 -0000 1.194 +++ rpm/rpmdb/header.c 10 Dec 2009 17:08:42 -0000 1.195 @@ -457,7 +457,9 @@ if (tagSwab(ptr, he, nb) != NULL) he->p.ptr = ptr; else { +/*...@-dependenttrans@*/ ptr = _free(ptr); +/*...@=dependenttrans@*/ rc = 0; } } @@ -1237,12 +1239,12 @@ return NULL; } -rpmuint32_t headerGetInstance(Header h) +uint32_t headerGetInstance(Header h) { return (h != NULL ? h->instance : 0); } -rpmuint32_t headerSetInstance(Header h, rpmuint32_t instance) +uint32_t headerSetInstance(Header h, uint32_t instance) { uint32_t oinstance = 0; if (h != NULL) { @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/legacy.c ============================================================================ $ cvs diff -u -r1.43 -r1.44 legacy.c --- rpm/rpmdb/legacy.c 29 Aug 2009 17:33:59 -0000 1.43 +++ rpm/rpmdb/legacy.c 10 Dec 2009 17:08:42 -0000 1.44 @@ -212,7 +212,7 @@ ctx = rpmDigestInit(dalgo, RPMDIGEST_NONE); if (doHmac) - rpmHmacInit(ctx, hmackey, 0); + xx = rpmHmacInit(ctx, hmackey, 0); if (fsize) xx = rpmDigestUpdate(ctx, mapped, fsize); xx = rpmDigestFinal(ctx, &dsum, &dlen, asAscii); @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/poptDB.c ============================================================================ $ cvs diff -u -r1.15 -r1.16 poptDB.c --- rpm/rpmdb/poptDB.c 1 Dec 2009 16:48:33 -0000 1.15 +++ rpm/rpmdb/poptDB.c 10 Dec 2009 17:08:42 -0000 1.16 @@ -20,6 +20,7 @@ /*...@unchecked@*/ extern int _dbi_debug; +/*...@unchecked@*/ struct rpmQVKArguments_s rpmDBArgs; /** @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmdb.c ============================================================================ $ cvs diff -u -r1.356 -r1.357 rpmdb.c --- rpm/rpmdb/rpmdb.c 10 Dec 2009 09:53:44 -0000 1.356 +++ rpm/rpmdb/rpmdb.c 10 Dec 2009 17:08:42 -0000 1.357 @@ -70,6 +70,7 @@ /*...@unchecked@*/ static int _rebuildinprogress = 0; +/*...@unchecked@*/ static int _rebuild_inplace = 1; #define _DBI_FLAGS 0 @@ -323,12 +324,16 @@ return rec; } +/*...@-redef@*/ union _dbswap { uint64_t ul; uint32_t ui; uint16_t us; uint8_t uc[8]; }; +/*...@=redef@*/ + +/*...@unchecked@*/ static union _dbswap _endian = { .ui = 0x11223344 }; static inline uint64_t _ntoh_ul(uint64_t ul) @@ -400,11 +405,11 @@ * @return 0 on success */ static int dbt2set(dbiIndex dbi, DBT * data, /*...@out@*/ dbiIndexSet * setp) - /*...@modifies dbi, *setp @*/ + /*...@modifies *setp @*/ { int _dbbyteswapped; dbiIndexSet set; - const char * s; + const uint8_t * s; setSwap T; int i; @@ -533,13 +538,13 @@ } /* XXX transaction.c */ -uint32_t dbiIndexRecordOffset(dbiIndexSet set, int recno) { - return (unsigned) set->recs[recno].hdrNum; +uint32_t dbiIndexRecordOffset(dbiIndexSet set, unsigned int recno) { + return set->recs[recno].hdrNum; } /* XXX transaction.c */ uint32_t dbiIndexRecordFileNumber(dbiIndexSet set, int recno) { - return (unsigned) set->recs[recno].tagNum; + return set->recs[recno].tagNum; } /* XXX transaction.c */ @@ -579,8 +584,10 @@ int mi_nre; /*...@only@*/ /*...@null@*/ miRE mi_re; +#if defined(SUPPORT_HEADER_CHECKS) /*...@null@*/ rpmts mi_ts; +#endif }; @@ -1243,7 +1250,7 @@ { int c; - while ((c = *s)) { + while ((c = (int)*s)) { switch (c) { case '.': case '^': @@ -1276,7 +1283,6 @@ /*...@null@*/ const char *_post) /*...@*/ { - static const char _REchars[] = "^.*(|)[]+?{}$"; size_t nt = 0; const char * se; @@ -1296,7 +1302,9 @@ te = stpcpy(te, _post); *te = '\0'; +/*...@-dependenttrans@*/ return t; +/*...@=dependenttrans@*/ } /** @@ -1313,7 +1321,8 @@ /*...@null@*/ const char * pat, /*...@null@*/ dbiIndexSet * matches, /*...@null@*/ const char *** argvp) - /*...@modifies *matches, *argvp @*/ + /*...@globals internalState @*/ + /*...@modifies *matches, *argvp, internalState @*/ { DBC * dbcursor = NULL; DBT k = DBT_INIT; @@ -1352,12 +1361,14 @@ case RPMMIRE_REGEX: case RPMMIRE_PCRE: if (*pat == '^') pat++; - nb = stemEnd(pat) - pat; + /* If partial match on stem won't help, just iterate. */ + nb = stemEnd(pat) - pat; if (nb == 0) { k.doff = 0; goto doit; } + /* Remove the escapes in the stem. */ { char *be; b = be = xmalloc(nb + 1); @@ -1368,6 +1379,7 @@ *be = '\0'; } nb = strlen(b); + /* Set stem length for partial match retrieve. */ k.flags = DB_DBT_PARTIAL; k.dlen = nb; @@ -1485,10 +1497,7 @@ */ static rpmRC dbiFindMatches(dbiIndex dbi, const char * NVR, /*...@out@*/ dbiIndexSet * matches) - /*...@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ - /*...@modifies dbi, *dbcursor, *matches, - rpmGlobalMacroContext, fileSystem, internalState @*/ - /*...@requires maxSet(matches) >= 0 @*/ + /*...@*/ { const char * s = NVR; size_t ns = (s ? strlen(s) : 0); @@ -1596,7 +1605,8 @@ lvl = (rpmrc == RPMRC_FAIL ? RPMLOG_ERR : RPMLOG_DEBUG); rpmlog(lvl, "%s h#%8u %s", (rpmrc == RPMRC_FAIL ? _("miFreeHeader: skipping") : "write"), - mi->mi_prevoffset, (msg ? msg : "\n")); + (unsigned)_ntoh_ui(mi->mi_prevoffset), + (msg ? msg : "\n")); msg = _free(msg); } #endif @@ -1607,8 +1617,9 @@ rc = dbiPut(dbi, mi->mi_dbc, &k, &v, DB_KEYLAST); if (rc) { rpmlog(RPMLOG_ERR, - _("error(%d) storing record #%d into %s\n"), - rc, mi->mi_prevoffset, tagName(dbi->dbi_rpmtag)); + _("error(%d) storing record h#%u into %s\n"), + rc, (unsigned)_ntoh_ui(mi->mi_prevoffset), + tagName(dbi->dbi_rpmtag)); } xx = dbiSync(dbi, 0); (void) unblockSignals(dbi->dbi_rpmdb, &signalMask); @@ -2123,18 +2134,23 @@ int rpmmiSetHdrChk(rpmmi mi, rpmts ts) { int rc = 0; +#if defined(SUPPORT_HEADER_CHECKS) if (mi == NULL) return 0; /*...@-assignexpose -newreftrans @*/ /* XXX forward linkage prevents rpmtsLink */ /*...@i@*/ mi->mi_ts = ts; /*...@=assignexpose =newreftrans @*/ +#endif return rc; } +/*...@unchecked@*/ static int _rpmmi_usermem = 1; static int rpmmiGet(dbiIndex dbi, DBC * dbcursor, DBT * kp, DBT * pk, DBT * vp, unsigned int flags) + /*...@globals internalState @*/ + /*...@modifies dbi, dbcursor, *kp, *pk, *vp, internalState @*/ { int map; int rc; @@ -2199,7 +2215,7 @@ int chkhdr = (pgpDigVSFlags & _RPMVSF_NOHEADER) ^ _RPMVSF_NOHEADER; #endif rpmTag tag; -uint32_t _flags; +unsigned int _flags; int map; int rc; int xx; @@ -2270,7 +2286,7 @@ /*...@notreached@*/ break; case 0: mi->mi_setx++; -assert(p.size == sizeof(mi->mi_offset)); +assert((size_t)p.size == sizeof(mi->mi_offset)); memcpy(&mi->mi_offset, p.data, sizeof(mi->mi_offset)); /* If next header is identical, return it now. */ if (mi->mi_offset == mi->mi_prevoffset && mi->mi_h != NULL) @@ -2289,7 +2305,7 @@ do { rc = rpmmiGet(dbi, mi->mi_dbc, &k, NULL, &v, DB_NEXT); if (rc == 0) { -assert(k.size == sizeof(mi->mi_offset)); +assert((size_t)k.size == sizeof(mi->mi_offset)); memcpy(&mi->mi_offset, k.data, sizeof(mi->mi_offset)); } } while (rc == 0 && mi->mi_offset == 0); @@ -2332,7 +2348,7 @@ lvl = (rpmrc == RPMRC_FAIL ? RPMLOG_ERR : RPMLOG_DEBUG); rpmlog(lvl, "%s h#%8u %s\n", (rpmrc == RPMRC_FAIL ? _("rpmdb: skipping") : _("rpmdb: read")), - _ntoh_ui(mi->mi_offset), (msg ? msg : "")); + (unsigned)_ntoh_ui(mi->mi_offset), (msg ? msg : "")); msg = _free(msg); /* Mark header checked. */ @@ -2360,7 +2376,7 @@ if (mi->mi_h == NULL) { rpmlog(RPMLOG_ERR, _("rpmdb: damaged header #%u cannot be loaded -- skipping.\n"), - _ntoh_ui(mi->mi_offset)); + (unsigned)_ntoh_ui(mi->mi_offset)); /* damaged header should not be reused */ if (mi->mi_h) { (void)headerFree(mi->mi_h); @@ -2377,7 +2393,7 @@ /* Mark header with its instance number. */ { char origin[32]; uint32_t hdrNum = _ntoh_ui(mi->mi_offset); - sprintf(origin, "rpmdb (h#%u)", hdrNum); + sprintf(origin, "rpmdb (h#%u)", (unsigned)hdrNum); (void) headerSetOrigin(mi->mi_h, origin); (void) headerSetInstance(mi->mi_h, hdrNum); } @@ -2410,7 +2426,7 @@ } static int rpmdbGrowIterator(/*...@null@*/ rpmmi mi, int fpNum, - unsigned int exclude, unsigned int tag) + unsigned int exclude, /*...@unused@*/ unsigned int tag) /*...@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ /*...@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/ { @@ -2512,7 +2528,7 @@ mi->mi_bf = rpmbfNew(_m, _k, 0); } for (i = 0; i < nHdrNums; i++) - rpmbfAdd(mi->mi_bf, &hdrNums[i], sizeof(*hdrNums)); + (void) rpmbfAdd(mi->mi_bf, &hdrNums[i], sizeof(*hdrNums)); } if (_rpmmi_debug) @@ -2551,7 +2567,6 @@ /* XXX HACK to remove rpmdbFindByLabel/findMatches from the API */ case RPMDBI_LABEL: tag = RPMTAG_NVRA; - /*...@fallthrough@*/ isLabel = 1; break; /* XXX HACK to remove the existing complexity of RPMTAG_BASENAMES */ @@ -2596,7 +2611,9 @@ } else if (isLabel) { /* XXX Special case #4: gather primary keys for a NVR label. */ - rpmRC rc = dbiFindMatches(dbi, keyp, &set); + rpmRC rc; + + rc = dbiFindMatches(dbi, keyp, &set); if ((rc && rc != RPMRC_NOTFOUND) || set == NULL || set->count < 1) { /* error or empty set */ set = dbiFreeIndexSet(set); @@ -2641,7 +2658,9 @@ mi->mi_nre = 0; mi->mi_re = NULL; +#if defined(SUPPORT_HEADER_CHECKS) mi->mi_ts = NULL; +#endif /*...@i@*/ return mi; } @@ -2669,13 +2688,13 @@ if (db->db_h == NULL) { rpmlog(RPMLOG_ERR, _("%s: cannot read header at 0x%x\n"), - "rpmdbRemove", hdrNum); + "rpmdbRemove", (unsigned)hdrNum); return 1; } he->tag = RPMTAG_NVRA; xx = headerGet(db->db_h, he, 0); - rpmlog(RPMLOG_DEBUG, " --- h#%8u %s\n", hdrNum, he->p.str); + rpmlog(RPMLOG_DEBUG, " --- h#%8u %s\n", (unsigned)hdrNum, he->p.str); he->p.ptr = _free(he->p.ptr); (void) blockSignals(db, &signalMask); @@ -2742,8 +2761,8 @@ const char * dbiBN = (dbiTag->str != NULL ? dbiTag->str : tagName(dbiTag->tag)); rpmlog(RPMLOG_ERR, - _("error(%d) setting header #%d record for %s removal\n"), - rc, hdrNum, dbiBN); + _("error(%d) setting header #%u record for %s removal\n"), + rc, (unsigned)hdrNum, dbiBN); } else rc = dbiDel(dbi, dbcursor, &k, &v, 0); xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR); @@ -2815,7 +2834,7 @@ dbi = dbiOpen(db, RPMDBI_SEQNO, 0); if ((ret = dbiSeqno(dbi, &seqno, 0)) == 0) { hdrNum = seqno; - headerSetInstance(h, hdrNum); + (void) headerSetInstance(h, hdrNum); } } @@ -3126,9 +3145,9 @@ case RPMDBI_QUEUE: case RPMDBI_RECNO: continue; - /*...@notreached@*/ break; + /*...@notreached@*/ /*...@switchbreak@*/ break; default: - break; + /*...@switchbreak@*/ break; } fn = rpmGetPath(prefix, dbpath, "/", dbiBN, NULL); if (rpmioFileExists(fn)) @@ -3435,10 +3454,10 @@ { Header nh = (headerIsEntry(h, RPMTAG_HEADERIMAGE) ? headerCopy(h) : NULL); if (nh) -headerSetInstance(nh, hdrNum); +(void) headerSetInstance(nh, hdrNum); #ifdef RESET_PRIMARY_KEYS else -headerSetInstance(h, hdrNum); +(void) headerSetInstance(h, hdrNum); #endif rc = rpmdbAdd(newdb, -1, (nh ? nh : h), ts); (void)headerFree(nh); @@ -3468,7 +3487,7 @@ assert(dbi != NULL); /* XXX sanity */ /* XXX calling dbiSeqno does seqno++ always. */ while (!dbiSeqno(dbi, &seqno, 0) && seqno < (int64_t)maxHdrNum) - ; +/*...@i@*/ ; /* XXX grrr no %ull in rpmlog(). */ rpmlog(RPMLOG_DEBUG, D_("max. instance %u seqno %u\n"), (unsigned)maxHdrNum, (unsigned)seqno); @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmdb.h ============================================================================ $ cvs diff -u -r1.129 -r1.130 rpmdb.h --- rpm/rpmdb/rpmdb.h 6 Dec 2009 20:22:01 -0000 1.129 +++ rpm/rpmdb/rpmdb.h 10 Dec 2009 17:08:42 -0000 1.130 @@ -870,6 +870,7 @@ #include <rpmlio.h> /* XXX add to psm.c/fsm.c */ +#if !defined(__LCLINT__) /*...@unused@*/ static inline int rpmlkId(rpmdb rpmdb, uint32_t *_idp) { @@ -888,7 +889,7 @@ int rc = (rpmdb->_dbi[0]->dbi_eflags & 0x080) ? dbenv->lock_id_free(dbenv, _id) : ENOTSUP; if (_rpmdb_debug) -fprintf(stderr, "<-- %s(%p,%u) rc %d\n", "dbenv->lock_id_free", dbenv, _id, rc); +fprintf(stderr, "<-- %s(%p,%u) rc %d\n", "dbenv->lock_id_free", dbenv, (unsigned)_id, rc); return rc; } @@ -1086,6 +1087,7 @@ fprintf(stderr, "<-- %s(%p) rc %d\n", "mpf->close", mpf, rc); return rc; } +#endif /* __LCLINT__ */ #endif /* _RPMDB_INTERNAL */ /*...@=globuse =mustmod @*/ @@ -1116,7 +1118,7 @@ * @param recno index of item in set * @return record offset of header */ -uint32_t dbiIndexRecordOffset(dbiIndexSet set, int recno) +uint32_t dbiIndexRecordOffset(dbiIndexSet set, unsigned int recno) /*...@*/; /** \ingroup dbi @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmevr.c ============================================================================ $ cvs diff -u -r1.34 -r1.35 rpmevr.c --- rpm/rpmdb/rpmevr.c 22 Oct 2009 16:37:11 -0000 1.34 +++ rpm/rpmdb/rpmevr.c 10 Dec 2009 17:08:42 -0000 1.35 @@ -213,10 +213,12 @@ } /* XXX HACK: postpone committing to single "missing" value for now. */ +/*...@-observertrans -readonlytr...@*/ if (evr->F[RPMEVR_E] == NULL) evr->F[RPMEVR_E] = "0"; if (evr->F[RPMEVR_V] == NULL) evr->F[RPMEVR_V] = ""; if (evr->F[RPMEVR_R] == NULL) evr->F[RPMEVR_R] = ""; if (evr->F[RPMEVR_D] == NULL) evr->F[RPMEVR_D] = ""; +/*...@=observertrans =readonlytr...@*/ evr->Elong = strtoul(evr->F[RPMEVR_E], NULL, 10); @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmlio.c ============================================================================ $ cvs diff -u -r1.2 -r1.3 rpmlio.c --- rpm/rpmdb/rpmlio.c 1 Dec 2009 17:05:09 -0000 1.2 +++ rpm/rpmdb/rpmlio.c 10 Dec 2009 17:08:42 -0000 1.3 @@ -15,9 +15,12 @@ #include "debug.h" +/*...@unchecked@*/ int _rpmlio_debug = 0; +/*...@unchecked@*/ static int _enable_syscall_logging = 0; +/*...@unchecked@*/ static int _enable_scriptlet_logging = 0; int rpmlioCreat(rpmdb rpmdb, const char * fn, mode_t mode, @@ -42,7 +45,7 @@ Ddbt.size = dlen; rc = logio_Creat_log(dbenv, _txn, &_lsn, DB_FLUSH, &FNdbt, mode, &Bdbt, &Ddbt, dalgo); if (_rpmlio_debug) -fprintf(stderr, "<== %s(%s, 0%o, %p[%u], %p[%u], %u) rc %d\n", __FUNCTION__, fn, mode, b, (unsigned)blen, d, (unsigned)dlen, dalgo, rc); +fprintf(stderr, "<== %s(%s, 0%o, %p[%u], %p[%u], %u) rc %d\n", __FUNCTION__, fn, mode, b, (unsigned)blen, d, (unsigned)dlen, (unsigned)dalgo, rc); return rc; } @@ -68,7 +71,7 @@ Ddbt.size = dlen; rc = logio_Unlink_log(dbenv, _txn, &_lsn, DB_FLUSH, &FNdbt, mode, &Bdbt, &Ddbt, dalgo); if (_rpmlio_debug) -fprintf(stderr, "<== %s(%s, 0%o, %p[%u], %p[%u], %u) rc %d\n", __FUNCTION__, fn, mode, b, (unsigned)blen, d, (unsigned)dlen, dalgo, rc); +fprintf(stderr, "<== %s(%s, 0%o, %p[%u], %p[%u], %u) rc %d\n", __FUNCTION__, fn, mode, b, (unsigned)blen, d, (unsigned)dlen, (unsigned)dalgo, rc); return rc; } @@ -98,7 +101,7 @@ Ddbt.size = dlen; rc = logio_Rename_log(dbenv, _txn, &_lsn, DB_FLUSH, &ONdbt, &NNdbt, mode, &Bdbt, &Ddbt, dalgo); if (_rpmlio_debug) -fprintf(stderr, "<== %s(%s, %s, 0%o, %p[%u], %p[%u], %u) rc %d\n", __FUNCTION__, oldname, newname, mode, b, (unsigned)blen, d, (unsigned)dlen, dalgo, rc); +fprintf(stderr, "<== %s(%s, %s, 0%o, %p[%u], %p[%u], %u) rc %d\n", __FUNCTION__, oldname, newname, mode, b, (unsigned)blen, d, (unsigned)dlen, (unsigned)dalgo, rc); return rc; } @@ -152,7 +155,9 @@ FNdbt.data = (void *)fn; FNdbt.size = strlen(fn) + 1; /* trailing NUL too */ if (context == NULL) context = ""; /* XXX prevent segfaults */ +/*...@-observertrans@*/ CONTEXTdbt.data = (void *)context; +/*...@=observertrans@*/ CONTEXTdbt.size = strlen(context) + 1; /* trailing NUL too */ rc = logio_Lsetfilecon_log(dbenv, _txn, &_lsn, DB_FLUSH, &FNdbt, &CONTEXTdbt); if (_rpmlio_debug) @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmlio.h ============================================================================ $ cvs diff -u -r1.1 -r1.2 rpmlio.h --- rpm/rpmdb/rpmlio.h 1 Dec 2009 16:48:33 -0000 1.1 +++ rpm/rpmdb/rpmlio.h 10 Dec 2009 17:08:42 -0000 1.2 @@ -1,6 +1,7 @@ #ifndef H_RPMLIO #define H_RPMLIO +/*...@unchecked@*/ extern int _rpmlio_debug; int rpmlioCreat(rpmdb rpmdb, const char * fn, mode_t mode, @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmns.c ============================================================================ $ cvs diff -u -r1.11 -r1.12 rpmns.c --- rpm/rpmdb/rpmns.c 17 Jan 2009 23:02:43 -0000 1.11 +++ rpm/rpmdb/rpmns.c 10 Dec 2009 17:08:42 -0000 1.12 @@ -28,6 +28,7 @@ /*...@access rpmts @*/ /*...@access pgpDigParams @*/ +/*...@access rpmiob @*/ /*...@unchecked@*/ int _rpmns_debug = 0; @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmtag.h ============================================================================ $ cvs diff -u -r1.68 -r1.69 rpmtag.h --- rpm/rpmdb/rpmtag.h 5 Oct 2009 15:21:30 -0000 1.68 +++ rpm/rpmdb/rpmtag.h 10 Dec 2009 17:08:42 -0000 1.69 @@ -1111,7 +1111,7 @@ * @param h header * @return header instance */ -rpmuint32_t headerGetInstance(/*...@null@*/ Header h) +uint32_t headerGetInstance(/*...@null@*/ Header h) /*...@*/; /** \ingroup header @@ -1120,7 +1120,7 @@ * @param instance new header instance * @return 0 always */ -rpmuint32_t headerSetInstance(/*...@null@*/ Header h, rpmuint32_t instance) +uint32_t headerSetInstance(/*...@null@*/ Header h, uint32_t instance) /*...@modifies h @*/; /** \ingroup header @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmtxn.c ============================================================================ $ cvs diff -u -r1.5 -r1.6 rpmtxn.c --- rpm/rpmdb/rpmtxn.c 7 Dec 2009 17:51:47 -0000 1.5 +++ rpm/rpmdb/rpmtxn.c 10 Dec 2009 17:08:42 -0000 1.6 @@ -14,6 +14,9 @@ #include "debug.h" +/*...@access rpmdb @*/ +/*...@access dbiIndex @*/ + int _rpmtxn_debug = 0; uint32_t rpmtxnId(rpmtxn txn) @@ -55,7 +58,7 @@ DB_ENV * dbenv = (rpmdb ? rpmdb->db_dbenv : NULL); DB_TXN * _parent = parent; DB_TXN * _txn = NULL; - uint32_t _flags = 0; + u_int32_t _flags = 0; int rc = (dbenv && rpmdb->_dbi[0]->dbi_eflags & 0x800) ? dbenv->txn_begin(dbenv, _parent, &_txn, _flags) : ENOTSUP; if (!rc) { @@ -65,30 +68,30 @@ rpmdb->db_txn = _txn; } if (_rpmtxn_debug) -fprintf(stderr, "<-- %s(%p,%p,%p,0x%x) txn %p rc %d\n", "dbenv->txn_begin", dbenv, _parent, &_txn, _flags, _txn, rc); +fprintf(stderr, "<-- %s(%p,%p,%p,0x%x) txn %p rc %d\n", "dbenv->txn_begin", dbenv, _parent, &_txn, (unsigned)_flags, _txn, rc); return rc; } int rpmtxnCommit(rpmtxn txn) { DB_TXN * _txn = txn; - uint32_t _flags = 0; + u_int32_t _flags = 0; int rc = (_txn ? _txn->commit(_txn, _flags) : ENOTSUP); if (_rpmtxn_debug) -fprintf(stderr, "<-- %s(%p,0x%x) rc %d\n", "txn->commit", _txn, _flags, rc); +fprintf(stderr, "<-- %s(%p,0x%x) rc %d\n", "txn->commit", _txn, (unsigned)_flags, rc); return rc; } int rpmtxnCheckpoint(rpmdb rpmdb) { DB_ENV * dbenv = (rpmdb ? rpmdb->db_dbenv : NULL); - uint32_t _kbytes = 0; - uint32_t _minutes = 0; - uint32_t _flags = 0; + u_int32_t _kbytes = 0; + u_int32_t _minutes = 0; + u_int32_t _flags = 0; int rc = (dbenv && rpmdb->_dbi[0]->dbi_eflags & 0x800) ? dbenv->txn_checkpoint(dbenv, _kbytes, _minutes, _flags) : ENOTSUP; if (_rpmtxn_debug) -fprintf(stderr, "<-- %s(%p,%u,%u,0x%x) rc %d\n", "dbenv->txn_checkpoint", dbenv, _kbytes, _minutes, _flags, rc); +fprintf(stderr, "<-- %s(%p,%u,%u,0x%x) rc %d\n", "dbenv->txn_checkpoint", dbenv, (unsigned)_kbytes, (unsigned)_minutes, (unsigned)_flags, rc); return rc; } @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmtxn.h ============================================================================ $ cvs diff -u -r1.4 -r1.5 rpmtxn.h --- rpm/rpmdb/rpmtxn.h 4 Dec 2009 13:56:58 -0000 1.4 +++ rpm/rpmdb/rpmtxn.h 10 Dec 2009 17:08:42 -0000 1.5 @@ -31,7 +31,7 @@ /*...@*/; int rpmtxnBegin(rpmdb rpmdb, /*...@null@*/ rpmtxn parent, /*...@null@*/ rpmtxn * txnp) - /*...@*/; + /*...@modifies *txnp @*/; int rpmtxnCommit(/*...@only@*/ rpmtxn txn) /*...@*/; @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
