lclint fiddles.

CVS patchset: 4833
CVS date: 2001/06/04 13:55:58
This commit is contained in:
jbj 2001-06-04 13:55:58 +00:00
parent 9e1929c9bb
commit 750d54d8a3
72 changed files with 1126 additions and 525 deletions

View File

@ -7,24 +7,97 @@
+unixlib +unixlib
# XXX ignore doxygen markings -unrecogcomments # XXX ignore doxygen markings
-unrecogcomments
#+mustmod # segfault in psm.c:597
#+proto-param-match #+proto-param-match
#-cpp-names #-deepbreak # shortcut 485 cases
#-declundef # db3 is noisy
#-deepbreak # 485 cases # --- not-yet at strict level
#-export-local #+ptrarith
#-export-header #+bitwisesigned
#-export-header-var #+strictops
#+sizeoftype
#+mod-uncon # shortcut alloca is painful
#+mod-nomods
#+modglobsnomods
#+modstrictglobsnomods
#+mod-uncon-nomods
#+mod-internal-strict
#+mod-file-sys
#+globnoglobs
#+internalglobs
#+internalglobnoglobs
#+modglobsunchecked
#+warnmissingglobs
#+warnmissingglobsnomods
#+impcheckedstrictglobs
#+impcheckedstrictstatics
#+strictusereleas
#+strictbranchstate
#+strictdestroy
#+modobserveruncon
#+macroempty
#+ansi-reserved-internal
#+evalorderuncon
#+elseifcomplete
#+loopswitchbreak
#+switchswitchbreak
#+looploopcontinue
#+whileblock
#+forempty
#+forblock
#+ifblock
#+noeffectuncon
+topuse
#+unusedspecial
#+export-local
#+oldstyle
#+sys-dir-errors
#controlnestdepth 15
#stringliterallen 509
#numstructfields 127
#numenummembers 127
# --- not-yet at checks level
#+predboolptr
-ptrnegate
#-enumint
-relaxquals
#+mustmod # segfault in psm.c:597
#+allglobs
#+impcheckmodinternals
#+uncheckedglobalias
#+deparrays
#+onlyunqglobaltrans
#+staticinittrans
#+unqualifiedinittrans
#+retalias
#+assignexpose
#+castexpose
#+retexpose
#+readonlytrans
#+sefuncon
#+ansi-reserved
+cpp-names # check for c++ names
#+infloopsuncon
#+looploopbreak
#+switchloopbreak
#+whileempty
+declundef
+export-header
+export-header-var
+redecl
+noparams
#includenest 8
# don't-bother-me-yet parameters # don't-bother-me-yet parameters
-branchstate # painful -branchstate # painful
-mustfree # alloca is painful -mustfree # alloca is painful
# not-yet normal parameters # --- not-yet at standard level
-boolops # w->n -boolops # w->n
-predboolint # w->n -predboolint # w->n
-type # -type #

View File

@ -32,15 +32,17 @@ extern "C" {
* @param csa * @param csa
* @return 0 on success * @return 0 on success
*/ */
int readRPM(/*@null@*/ const char * fileName, /*@out@*/ Spec * specp, /*@unused@*/ int readRPM(/*@null@*/ const char * fileName,
/*@out@*/ struct rpmlead * lead, /*@out@*/ Header * sigs, /*@out@*/ Spec * specp,
/*@out@*/ struct rpmlead * lead,
/*@out@*/ Header * sigs,
CSA_t csa) CSA_t csa)
/*@modifies *specp, *sigs, csa, csa->cpioFdIn @*/; /*@modifies *specp, *lead, *sigs, csa, csa->cpioFdIn @*/;
/** /**
* Write rpm package to file. * Write rpm package to file.
* *
* @warning The first header argument is now passed by reference in order to * @warning The first argument (header) is now passed by reference in order to
* return a reloaded contiguous header to the caller. * return a reloaded contiguous header to the caller.
* *
* @retval hdrp header to write (final header is returned). * @retval hdrp header to write (final header is returned).
@ -51,8 +53,11 @@ int readRPM(/*@null@*/ const char * fileName, /*@out@*/ Spec * specp,
* @retval cookie generated cookie (i.e build host/time) * @retval cookie generated cookie (i.e build host/time)
* @return 0 on success * @return 0 on success
*/ */
int writeRPM(Header * hdrp, const char * fileName, int type, int writeRPM(Header * hdrp,
CSA_t csa, /*@null@*/ char * passPhrase, const char * fileName,
int type,
CSA_t csa,
/*@null@*/ char * passPhrase,
/*@out@*/ const char ** cookie) /*@out@*/ const char ** cookie)
/*@modifies *hdrp, *cookie, csa, csa->cpioArchiveSize @*/; /*@modifies *hdrp, *cookie, csa, csa->cpioArchiveSize @*/;

View File

@ -31,7 +31,9 @@
#define MAXDOCDIR 1024 #define MAXDOCDIR 1024
/*@-redecl@*/
extern int _noDirTokens; extern int _noDirTokens;
/*@=redecl@*/
/** /**
*/ */
@ -272,7 +274,7 @@ typedef struct VFA {
/** /**
*/ */
/*@-exportlocal@*/ /*@-exportlocal -exportheadervar@*/
VFA_t verifyAttrs[] = { VFA_t verifyAttrs[] = {
{ "md5", RPMVERIFY_MD5 }, { "md5", RPMVERIFY_MD5 },
{ "size", RPMVERIFY_FILESIZE }, { "size", RPMVERIFY_FILESIZE },
@ -284,7 +286,7 @@ VFA_t verifyAttrs[] = {
{ "rdev", RPMVERIFY_RDEV }, { "rdev", RPMVERIFY_RDEV },
{ NULL, 0 } { NULL, 0 }
}; };
/*@=exportlocal@*/ /*@=exportlocal =exportheadervar@*/
/** /**
* @param fl package file tree walk data * @param fl package file tree walk data
@ -297,7 +299,7 @@ static int parseForVerify(char * buf, FileList fl)
char *p, *pe, *q; char *p, *pe, *q;
const char *name; const char *name;
int *resultVerify; int *resultVerify;
int not; int negated;
int verifyFlags; int verifyFlags;
specdFlags * specdFlags; specdFlags * specdFlags;
@ -339,7 +341,7 @@ static int parseForVerify(char * buf, FileList fl)
while (p <= pe) while (p <= pe)
*p++ = ' '; *p++ = ' ';
not = 0; negated = 0;
verifyFlags = RPMVERIFY_NONE; verifyFlags = RPMVERIFY_NONE;
for (p = q; *p != '\0'; p = pe) { for (p = q; *p != '\0'; p = pe) {
@ -363,7 +365,7 @@ static int parseForVerify(char * buf, FileList fl)
} }
if (!strcmp(p, "not")) { if (!strcmp(p, "not")) {
not ^= 1; negated ^= 1;
} else { } else {
rpmError(RPMERR_BADSPEC, _("Invalid %s token: %s\n"), name, p); rpmError(RPMERR_BADSPEC, _("Invalid %s token: %s\n"), name, p);
fl->processingFailed = 1; fl->processingFailed = 1;
@ -371,7 +373,7 @@ static int parseForVerify(char * buf, FileList fl)
} }
} }
*resultVerify = not ? ~(verifyFlags) : verifyFlags; *resultVerify = negated ? ~(verifyFlags) : verifyFlags;
*specdFlags |= SPECD_VERIFY; *specdFlags |= SPECD_VERIFY;
return 0; return 0;
@ -740,7 +742,7 @@ static int parseForRegexMultiLib(const char *fileName) /*@*/
/** /**
*/ */
/*@-exportlocal@*/ /*@-exportlocal -exportheadervar@*/
VFA_t virtualFileAttributes[] = { VFA_t virtualFileAttributes[] = {
{ "%dir", 0 }, /* XXX why not RPMFILE_DIR? */ { "%dir", 0 }, /* XXX why not RPMFILE_DIR? */
{ "%doc", RPMFILE_DOC }, { "%doc", RPMFILE_DOC },
@ -760,7 +762,7 @@ VFA_t virtualFileAttributes[] = {
{ NULL, 0 } { NULL, 0 }
}; };
/*@=exportlocal@*/ /*@=exportlocal =exportheadervar@*/
/** /**
* @param fl package file tree walk data * @param fl package file tree walk data
@ -1547,7 +1549,7 @@ exit:
static int processPackageFiles(Spec spec, Package pkg, static int processPackageFiles(Spec spec, Package pkg,
int installSpecialDoc, int test) int installSpecialDoc, int test)
/*@modifies spec->macros, /*@modifies spec->macros,
pkg->cpioList, pkg->specialDoc, pkg->header */ pkg->cpioList, pkg->fileList, pkg->specialDoc, pkg->header */
{ {
HGE_t hge = (HGE_t)headerGetEntryMinMemory; HGE_t hge = (HGE_t)headerGetEntryMinMemory;
struct FileList_s fl; struct FileList_s fl;
@ -2126,7 +2128,7 @@ typedef struct {
/** /**
*/ */
/*@-exportlocal@*/ /*@-exportlocal -exportheadervar@*/
DepMsg_t depMsgs[] = { DepMsg_t depMsgs[] = {
{ "Provides", { "%{__find_provides}", NULL, NULL, NULL }, { "Provides", { "%{__find_provides}", NULL, NULL, NULL },
RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS,
@ -2166,7 +2168,7 @@ DepMsg_t depMsgs[] = {
0, -1 }, 0, -1 },
{ NULL, { NULL, NULL, NULL, NULL }, 0, 0, 0, 0, 0 } { NULL, { NULL, NULL, NULL, NULL }, 0, 0, 0, 0, 0 }
}; };
/*@=exportlocal@*/ /*@=exportlocal =exportheadervar@*/
/** /**
*/ */

View File

@ -14,7 +14,9 @@
#include "rpmlead.h" #include "rpmlead.h"
#include "debug.h" #include "debug.h"
/*@-redecl@*/
extern int _noDirTokens; extern int _noDirTokens;
/*@=redecl@*/
/*@access StringBuf @*/ /* compared with NULL */ /*@access StringBuf @*/ /* compared with NULL */
/*@access TFI_t @*/ /* compared with NULL */ /*@access TFI_t @*/ /* compared with NULL */
@ -45,7 +47,7 @@ static inline int genSourceRpmName(Spec spec)
*/ */
static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t csa, static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t csa,
const char * fmodeMacro) const char * fmodeMacro)
/*@modifies csa, fileSystem @*/ /*@modifies fdo, csa, fileSystem @*/
{ {
const char * rootDir = "/"; const char * rootDir = "/";
rpmdb rpmdb = NULL; rpmdb rpmdb = NULL;
@ -86,7 +88,7 @@ static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t csa,
/** /**
*/ */
static int cpio_copy(FD_t fdo, CSA_t csa) static int cpio_copy(FD_t fdo, CSA_t csa)
/*@modifies csa, fileSystem @*/ /*@modifies fdo, csa, fileSystem @*/
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
size_t nb; size_t nb;

View File

@ -8,7 +8,9 @@
#include "rpmbuild.h" #include "rpmbuild.h"
#include "debug.h" #include "debug.h"
extern int noLang; /* XXX FIXME: pass as arg */ /*@-exportheadervar@*/
extern int noLang;
/*@=exportheadervar@*/
/* These have to be global scope to make up for *stupid* compilers */ /* These have to be global scope to make up for *stupid* compilers */
/*@observer@*/ /*@null@*/ static const char *name = NULL; /*@observer@*/ /*@null@*/ static const char *name = NULL;

View File

@ -408,7 +408,9 @@ if (multiToken) { \
return RPMERR_BADSPEC; \ return RPMERR_BADSPEC; \
} }
extern int noLang; /* XXX FIXME: pass as arg */ /*@-redecl@*/
extern int noLang;
/*@=redecl@*/
/** /**
*/ */

View File

@ -13,9 +13,10 @@
/** /**
*/ */
static int addTriggerIndex(Package pkg, const char *file, const char *script, const char *prog) static int addTriggerIndex(Package pkg, const char *file,
const char *script, const char *prog)
{ {
struct TriggerFileEntry *new; struct TriggerFileEntry *tfe;
struct TriggerFileEntry *list = pkg->triggerFiles; struct TriggerFileEntry *list = pkg->triggerFiles;
struct TriggerFileEntry *last = NULL; struct TriggerFileEntry *last = NULL;
int index = 0; int index = 0;
@ -29,18 +30,18 @@ static int addTriggerIndex(Package pkg, const char *file, const char *script, co
index = last->index + 1; index = last->index + 1;
} }
new = xmalloc(sizeof(*new)); tfe = xmalloc(sizeof(*tfe));
new->fileName = (file) ? xstrdup(file) : NULL; tfe->fileName = (file) ? xstrdup(file) : NULL;
new->script = (script && *script != '\0') ? xstrdup(script) : NULL; tfe->script = (script && *script != '\0') ? xstrdup(script) : NULL;
new->prog = xstrdup(prog); tfe->prog = xstrdup(prog);
new->index = index; tfe->index = index;
new->next = NULL; tfe->next = NULL;
if (last) { if (last) {
last->next = new; last->next = tfe;
} else { } else {
pkg->triggerFiles = new; pkg->triggerFiles = tfe;
} }
return index; return index;

View File

@ -352,7 +352,9 @@ void closeSpec(Spec spec)
} }
} }
/*@-redecl@*/
extern int noLang; /* XXX FIXME: pass as arg */ extern int noLang; /* XXX FIXME: pass as arg */
/*@=redecl@*/
/*@todo Skip parse recursion if os is not compatible. @*/ /*@todo Skip parse recursion if os is not compatible. @*/
int parseSpec(Spec *specp, const char *specFile, const char *rootURL, int parseSpec(Spec *specp, const char *specFile, const char *rootURL,

View File

@ -18,8 +18,11 @@
/** \ingroup rpmbuild /** \ingroup rpmbuild
* Bit(s) to control buildSpec() operation. * Bit(s) to control buildSpec() operation.
*/ */
/*@-typeuse@*/
typedef enum rpmBuildFlags_e { typedef enum rpmBuildFlags_e {
/*@-enummemuse@*/
RPMBUILD_NONE = 0, RPMBUILD_NONE = 0,
/*@=enummemuse@*/
RPMBUILD_PREP = (1 << 0), /*!< Execute %%prep. */ RPMBUILD_PREP = (1 << 0), /*!< Execute %%prep. */
RPMBUILD_BUILD = (1 << 1), /*!< Execute %%build. */ RPMBUILD_BUILD = (1 << 1), /*!< Execute %%build. */
RPMBUILD_INSTALL = (1 << 2), /*!< Execute %%install. */ RPMBUILD_INSTALL = (1 << 2), /*!< Execute %%install. */
@ -32,6 +35,7 @@ typedef enum rpmBuildFlags_e {
RPMBUILD_STRINGBUF = (1 << 9), /*!< only for doScript() */ RPMBUILD_STRINGBUF = (1 << 9), /*!< only for doScript() */
RPMBUILD_RMSPEC = (1 << 10) /*!< Remove spec file. */ RPMBUILD_RMSPEC = (1 << 10) /*!< Remove spec file. */
} rpmBuildFlags; } rpmBuildFlags;
/*@=typeuse@*/
#include <ctype.h> #include <ctype.h>
@ -262,17 +266,6 @@ int parseScript(Spec spec, int parsePart)
spec->fileStack, spec->readStack, spec->line, spec->lineNum, spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->sl @*/; spec->sl @*/;
/** \ingroup rpmbuild
* Parse %%trigger et al scriptlets from a spec file.
* @param spec spec file control structure
* @param pkg package control structure
* @param field
* @param tag
* @return
*/
int parseTrigger(Spec spec, Package pkg, char * field, int tag)
/*@modifies nothing @*/;
/** \ingroup rpmbuild /** \ingroup rpmbuild
* Evaluate boolean expression. * Evaluate boolean expression.
* @param spec spec file control structure * @param spec spec file control structure
@ -287,6 +280,7 @@ int parseExpressionBoolean(Spec spec, const char * expr) /*@*/;
* @param expr expression to parse * @param expr expression to parse
* @return * @return
*/ */
/*@unused@*/
char * parseExpressionString(Spec spec, const char * expr) char * parseExpressionString(Spec spec, const char * expr)
/*@modifies nothing @*/; /*@modifies nothing @*/;
@ -372,9 +366,9 @@ int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
* @return 0 on success * @return 0 on success
*/ */
int processBinaryFiles(Spec spec, int installSpecialDoc, int test) int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
/*@modifies spec->packages->cpioList, spec->packages->specialDoc, /*@modifies spec->macros,
spec->macros, spec->packages->cpioList, spec->packages->fileList,
spec->packages->header @*/; spec->packages->specialDoc, spec->packages->header @*/;
/** \ingroup rpmbuild /** \ingroup rpmbuild
* Create and initialize header for source package. * Create and initialize header for source package.
@ -431,6 +425,7 @@ int parseSpec(/*@out@*/ Spec * specp, const char * specFile,
* @param force * @param force
* @return * @return
*/ */
/*@-declundef@*/
extern int (*parseSpecVec) (Spec * specp, const char * specFile, extern int (*parseSpecVec) (Spec * specp, const char * specFile,
const char * rootdir, const char * rootdir,
/*@null@*/ const char * buildRoot, /*@null@*/ const char * buildRoot,
@ -439,6 +434,7 @@ extern int (*parseSpecVec) (Spec * specp, const char * specFile,
/*@null@*/ char * cookie, /*@null@*/ char * cookie,
int anyarch, int force) int anyarch, int force)
/*@modifies *specp @*/; /*@modifies *specp @*/;
/*@=declundef@*/
/** \ingroup rpmbuild /** \ingroup rpmbuild
* Build stages state machine driver. * Build stages state machine driver.
@ -452,8 +448,8 @@ int buildSpec(Spec spec, int what, int test)
spec->sourceRpmName, spec->macros, spec->sourceRpmName, spec->macros,
spec->BASpecs, spec->BASpecs,
spec->buildRestrictions, spec->BANames, spec->buildRestrictions, spec->BANames,
spec->packages->cpioList, spec->packages->specialDoc, spec->packages->cpioList, spec->packages->fileList,
spec->packages->header @*/; spec->packages->specialDoc, spec->packages->header @*/;
/** \ingroup rpmbuild /** \ingroup rpmbuild
* Generate binary package(s). * Generate binary package(s).

View File

@ -41,10 +41,12 @@ struct Source {
/** \ingroup rpmbuild /** \ingroup rpmbuild
*/ */
/*@-typeuse@*/
typedef struct ReadLevelEntry { typedef struct ReadLevelEntry {
int reading; int reading;
/*@dependent@*/ struct ReadLevelEntry * next; /*@dependent@*/ struct ReadLevelEntry * next;
} RLE_t; } RLE_t;
/*@=typeuse@*/
/** \ingroup rpmbuild /** \ingroup rpmbuild
*/ */
@ -192,8 +194,10 @@ extern "C" {
* @param spec spec file control structure * @param spec spec file control structure
* @return NULL always * @return NULL always
*/ */
/*@-declundef@*/
extern /*@null@*/ Spec (*freeSpecVec) (Spec spec) /* XXX FIXME */ extern /*@null@*/ Spec (*freeSpecVec) (Spec spec) /* XXX FIXME */
/*@modifies spec @*/; /*@modifies spec @*/;
/*@=declundef@*/
/** \ingroup rpmbuild /** \ingroup rpmbuild
*/ */

View File

@ -9,8 +9,12 @@
#include "buildio.h" #include "buildio.h"
#include "debug.h" #include "debug.h"
/*@-redecl@*/
extern int specedit; extern int specedit;
/*@=redecl@*/
/*@-exportheadervar@*/
extern struct MacroContext_s rpmGlobalMacroContext; extern struct MacroContext_s rpmGlobalMacroContext;
/*@=exportheadervar@*/
#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;} #define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;} #define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}

View File

@ -728,6 +728,7 @@ AC_ARG_WITH(glob, [ --with-glob use the internal GNU glob ],
if test $rpm_cv_glob = no ; then if test $rpm_cv_glob = no ; then
AC_MSG_CHECKING(for GNU extensions to glob) AC_MSG_CHECKING(for GNU extensions to glob)
rm -f t
mkdir t mkdir t
mkdir t/p mkdir t/p
touch t/p/foo.8 touch t/p/foo.8

View File

@ -5,6 +5,7 @@ Makefile.in
.libs .libs
*.la *.la
*.lo *.lo
db3lobjs
config.cache config.cache
config.log config.log
db_config.h db_config.h

10
db3/configure vendored
View File

@ -26,10 +26,14 @@ db3_install: all install_setip \\' > Makefile
mv db.h db.h.orig mv db.h db.h.orig
cat db.h.orig | sed \ cat db.h.orig | sed \
-e '/^struct __db;/i\ -e '/^typedef u_int32_t db_pgno_t;/i\
/*@-incondefs@*/' \ /*@-incondefs -fielduse -enummemuse -typeuse @*/' \
-e '/^struct __key_range;/a\ -e '/^struct __key_range;/a\
/*@=incondefs@*/' > db.h /*@=incondefs@*/' \
-e '/^#define db_create/i\
/*@-declundef -noparams -fcnuse@*/' \
-e '/^#define db_xa_switch/a\
/*@=declundef =noparams =fcnuse =fielduse =enummemuse =typeuse @*/' > db.h
# Generate manifest for rpmdb. # Generate manifest for rpmdb.
make -s listobjs > db3lobjs make -s listobjs > db3lobjs

View File

@ -58,7 +58,7 @@ getdate.c: getdate.y
@echo expect 10 shift/reduce conflicts @echo expect 10 shift/reduce conflicts
$(YACC) $(srcdir)/getdate.y $(YACC) $(srcdir)/getdate.y
-@if test -f y.tab.c; then \ -@if test -f y.tab.c; then \
{ echo "/*@-globstate -statictrans -unqualifiedtrans @*/";\ { echo "/*@-globstate -statictrans -unqualifiedtrans -noparams @*/";\
echo "/*@-retvalint -usedef -varuse -nullderef -nullassign @*/";\ echo "/*@-retvalint -usedef -varuse -nullderef -nullassign @*/";\
sed -e 's,y.tab.c,getdate.c,' y.tab.c \ sed -e 's,y.tab.c,getdate.c,' y.tab.c \
-e 's,^YYSTYPE ,static &,' \ -e 's,^YYSTYPE ,static &,' \
@ -67,7 +67,7 @@ getdate.c: getdate.y
-e 's,^int yydebug,/*@unused@*/ static &,' \ -e 's,^int yydebug,/*@unused@*/ static &,' \
-e 's,^int ,static &,' ;\ -e 's,^int ,static &,' ;\
echo "/*@=retvalint =usedef =varuse =nullderef =nullassign @*/";\ echo "/*@=retvalint =usedef =varuse =nullderef =nullassign @*/";\
echo "/*@=globstate =statictrans =unqualifiedtrans @*/";\ echo "/*@=globstate =statictrans =unqualifiedtrans =noparams @*/";\
} > getdate.c ;\ } > getdate.c ;\
rm -f y.tab.c; \ rm -f y.tab.c; \
else \ else \

View File

@ -16,7 +16,9 @@
/*@access FSM_t @*/ /*@access FSM_t @*/
/*@-exportheadervar@*/
extern int _fsm_debug; extern int _fsm_debug;
/*@=exportheadervar@*/
/** /**
* Convert string to unsigned integer (with buffer size check). * Convert string to unsigned integer (with buffer size check).

View File

@ -102,14 +102,16 @@ extern "C" {
* @retval fsm file path and stat info * @retval fsm file path and stat info
* @return 0 on success * @return 0 on success
*/ */
int cpioTrailerWrite(FSM_t fsm); int cpioTrailerWrite(FSM_t fsm)
/*@modifies fsm, fileSystem @*/;
/** /**
* Write cpio header. * Write cpio header.
* @retval fsm file path and stat info * @retval fsm file path and stat info
* @return 0 on success * @return 0 on success
*/ */
int cpioHeaderWrite(FSM_t fsm, struct stat * st); int cpioHeaderWrite(FSM_t fsm, struct stat * st)
/*@modifies fsm, fileSystem @*/;
/** /**
* Read cpio header. * Read cpio header.

View File

@ -2,7 +2,9 @@
* \file lib/depends.c * \file lib/depends.c
*/ */
int _depends_debug = 0; /*@-exportheadervar@*/
/*@unused@*/ int _depends_debug = 0;
/*@=exportheadervar@*/
#include "system.h" #include "system.h"
@ -592,7 +594,9 @@ exit:
return result; return result;
} }
/*@-typeuse@*/
typedef int (*dbrecMatch_t) (Header h, const char *reqName, const char * reqEVR, int reqFlags); typedef int (*dbrecMatch_t) (Header h, const char *reqName, const char * reqEVR, int reqFlags);
/*@=typeuse@*/
static int rangeMatchesDepFlags (Header h, static int rangeMatchesDepFlags (Header h,
const char * reqName, const char * reqEVR, int reqFlags) const char * reqName, const char * reqEVR, int reqFlags)
@ -1165,7 +1169,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
const char * keyType, const char * keyDepend, const char * keyType, const char * keyDepend,
const char * keyName, const char * keyEVR, int keyFlags, const char * keyName, const char * keyEVR, int keyFlags,
/*@null@*/ /*@out@*/ struct availablePackage *** suggestion) /*@null@*/ /*@out@*/ struct availablePackage *** suggestion)
/*@modifies *suggestion @*/ /*@modifies ts, *suggestion @*/
{ {
static int _cacheDependsRC = 1; static int _cacheDependsRC = 1;
rpmdbMatchIterator mi; rpmdbMatchIterator mi;
@ -1189,7 +1193,9 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
size_t datalen = 0; size_t datalen = 0;
int xx; int xx;
xx = dbiCopen(dbi, &dbcursor, 0); xx = dbiCopen(dbi, &dbcursor, 0);
/*@-mods@*/ /* FIX: keyDepends mod undocumented. */
xx = dbiGet(dbi, dbcursor, (void **)&keyDepend, &keylen, &datap, &datalen, 0); xx = dbiGet(dbi, dbcursor, (void **)&keyDepend, &keylen, &datap, &datalen, 0);
/*@=mods@*/
if (xx == 0 && datap && datalen == 4) { if (xx == 0 && datap && datalen == 4) {
memcpy(&rc, datap, datalen); memcpy(&rc, datap, datalen);
rpmMessage(RPMMESS_DEBUG, _("%s: %-45s %-s (cached)\n"), rpmMessage(RPMMESS_DEBUG, _("%s: %-45s %-s (cached)\n"),
@ -1345,7 +1351,7 @@ exit:
*/ */
static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
Header h, const char * keyName, uint_32 multiLib) Header h, const char * keyName, uint_32 multiLib)
/*@modifies h, psp */ /*@modifies ts, h, psp */
{ {
HGE_t hge = (HGE_t)headerGetEntryMinMemory; HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData; HFD_t hfd = headerFreeData;
@ -1533,7 +1539,7 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
*/ */
static int checkPackageSet(rpmTransactionSet ts, problemsSet psp, static int checkPackageSet(rpmTransactionSet ts, problemsSet psp,
const char * key, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi) const char * key, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi)
/*@modifies mi, psp @*/ /*@modifies ts, mi, psp @*/
{ {
Header h; Header h;
int rc = 0; int rc = 0;
@ -1560,7 +1566,7 @@ static int checkPackageSet(rpmTransactionSet ts, problemsSet psp,
*/ */
static int checkDependentPackages(rpmTransactionSet ts, static int checkDependentPackages(rpmTransactionSet ts,
problemsSet psp, const char * key) problemsSet psp, const char * key)
/*@modifies psp @*/ /*@modifies ts, psp @*/
{ {
rpmdbMatchIterator mi; rpmdbMatchIterator mi;
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_REQUIRENAME, key, 0); mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_REQUIRENAME, key, 0);
@ -1576,7 +1582,7 @@ static int checkDependentPackages(rpmTransactionSet ts,
*/ */
static int checkDependentConflicts(rpmTransactionSet ts, static int checkDependentConflicts(rpmTransactionSet ts,
problemsSet psp, const char * key) problemsSet psp, const char * key)
/*@modifies psp @*/ /*@modifies ts, psp @*/
{ {
int rc = 0; int rc = 0;

View File

@ -113,8 +113,8 @@ struct transactionElement {
TR_REMOVED /*!< Package will be removed. */ TR_REMOVED /*!< Package will be removed. */
} type; /*!< Package disposition (installed/removed). */ } type; /*!< Package disposition (installed/removed). */
union { union {
int addedIndex; /*@unused@*/ int addedIndex;
struct { /*@unused@*/ struct {
int dboffset; int dboffset;
int dependsOnIndex; int dependsOnIndex;
} removed; } removed;

View File

@ -399,9 +399,9 @@ static int filenamesTag(Header h, /*@out@*/ int_32 * type,
/* I18N look aside diversions */ /* I18N look aside diversions */
/*@-exportlocal@*/ /*@-exportlocal -exportheadervar@*/
int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */ int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */
/*@=exportlocal@*/ /*@=exportlocal =exportheadervar@*/
static const char * language = "LANGUAGE"; static const char * language = "LANGUAGE";
static char * _macro_i18ndomains = "%{?_i18ndomains:%{_i18ndomains}}"; static char * _macro_i18ndomains = "%{?_i18ndomains:%{_i18ndomains}}";

View File

@ -20,9 +20,9 @@
int _fsm_debug = 0; int _fsm_debug = 0;
/* XXX Failure to remove is not (yet) cause for failure. */ /* XXX Failure to remove is not (yet) cause for failure. */
/*@-exportlocal@*/ /*@-exportlocal -exportheadervar@*/
int strict_erasures = 0; int strict_erasures = 0;
/*@=exportlocal@*/ /*@=exportlocal =exportheadervar@*/
rpmTransactionSet fsmGetTs(const FSM_t fsm) { rpmTransactionSet fsmGetTs(const FSM_t fsm) {
const FSMI_t iter = fsm->iter; const FSMI_t iter = fsm->iter;
@ -78,25 +78,25 @@ const char * fsmFsPath(/*@special@*/ /*@null@*/ const FSM_t fsm,
/** \ingroup payload /** \ingroup payload
* Destroy file info iterator. * Destroy file info iterator.
* @param this file info iterator * @param p file info iterator
* @retval NULL always * @retval NULL always
*/ */
static /*@null@*/ void * mapFreeIterator(/*@only@*//*@null@*/const void * this) static /*@null@*/ void * mapFreeIterator(/*@only@*//*@null@*/const void * p)
{ {
return _free((void *)this); return _free((void *)p);
} }
/** \ingroup payload /** \ingroup payload
* Create file info iterator. * Create file info iterator.
* @param this transaction set * @param a transaction set
* @param that transaction element file info * @param b transaction element file info
* @return file info iterator * @return file info iterator
*/ */
static void * static void *
mapInitIterator(/*@kept@*/ const void * this, /*@kept@*/ const void * that) mapInitIterator(/*@kept@*/ const void * a, /*@kept@*/ const void * b)
{ {
rpmTransactionSet ts = (void *)this; rpmTransactionSet ts = (void *)a;
TFI_t fi = (void *)that; TFI_t fi = (void *)b;
FSMI_t iter = NULL; FSMI_t iter = NULL;
iter = xcalloc(1, sizeof(*iter)); iter = xcalloc(1, sizeof(*iter));
@ -110,11 +110,11 @@ mapInitIterator(/*@kept@*/ const void * this, /*@kept@*/ const void * that)
/** \ingroup payload /** \ingroup payload
* Return next index into file info. * Return next index into file info.
* @param this file info iterator * @param a file info iterator
* @return next index, -1 on termination * @return next index, -1 on termination
*/ */
static int mapNextIterator(void * this) { static int mapNextIterator(void * a) {
FSMI_t iter = this; FSMI_t iter = a;
const TFI_t fi = iter->fi; const TFI_t fi = iter->fi;
int i = -1; int i = -1;
@ -148,14 +148,14 @@ static int cpioStrCmp(const void * a, const void * b)
/** \ingroup payload /** \ingroup payload
* Locate archive path in file info. * Locate archive path in file info.
* @param this file info iterator * @param a file info iterator
* @param fsmPath archive path * @param fsmPath archive path
* @return index into file info, -1 if archive path was not found * @return index into file info, -1 if archive path was not found
*/ */
static int mapFind(void * this, const char * fsmPath) static int mapFind(void * a, const char * fsmPath)
/*@*/ /*@*/
{ {
FSMI_t iter = this; FSMI_t iter = a;
const TFI_t fi = iter->fi; const TFI_t fi = iter->fi;
int ix = -1; int ix = -1;
@ -188,16 +188,16 @@ typedef struct dnli_s {
/** \ingroup payload /** \ingroup payload
* Destroy directory name iterator. * Destroy directory name iterator.
* @param this file info iterator * @param a directory name iterator
* @retval NULL always * @retval NULL always
*/ */
static /*@null@*/ void * dnlFreeIterator(/*@only@*//*@null@*/ const void * this) static /*@null@*/ void * dnlFreeIterator(/*@only@*//*@null@*/ const void * a)
{ {
if (this) { if (a) {
DNLI_t dnli = (void *)this; DNLI_t dnli = (void *)a;
if (dnli->active) free(dnli->active); if (dnli->active) free(dnli->active);
} }
return _free(this); return _free(a);
} }
/** \ingroup payload /** \ingroup payload

View File

@ -135,7 +135,7 @@ struct fsm_s {
/*@kept@*/ /*@null@*/ unsigned int * archiveSize; /*!< Pointer to archive size. */ /*@kept@*/ /*@null@*/ unsigned int * archiveSize; /*!< Pointer to archive size. */
/*@kept@*/ /*@null@*/ const char ** failedFile; /*!< First file name that failed. */ /*@kept@*/ /*@null@*/ const char ** failedFile; /*!< First file name that failed. */
/*@shared@*/ const char * subdir; /*!< Current file sub-directory. */ /*@shared@*/ const char * subdir; /*!< Current file sub-directory. */
char subbuf[64]; /* XXX eliminate */ /*@unused@*/ char subbuf[64]; /* XXX eliminate */
/*@observer@*/ const char * osuffix; /*!< Old, preserved, file suffix. */ /*@observer@*/ const char * osuffix; /*!< Old, preserved, file suffix. */
/*@observer@*/ const char * nsuffix; /*!< New, created, file suffix. */ /*@observer@*/ const char * nsuffix; /*!< New, created, file suffix. */
/*@shared@*/ const char * suffix; /*!< Current file suffix. */ /*@shared@*/ const char * suffix; /*!< Current file suffix. */

View File

@ -22,8 +22,9 @@
#include "debug.h" #include "debug.h"
/* XXX avoid rpmlib.h, need for debugging. */ /*@-redecl@*/ /* FIX: avoid rpmlib.h, need for debugging. */
/*@observer@*/ const char *const tagName(int tag) /*@*/; /*@observer@*/ const char *const tagName(int tag) /*@*/;
/*@=redecl@*/
/* /*
* Teach header.c about legacy tags. * Teach header.c about legacy tags.
@ -151,10 +152,12 @@ struct sprintfToken {
/** /**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param this memory to free * @param p memory to free
* @return NULL always * @return NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * p) { /*@unused@*/ static inline /*@null@*/ void *
_free(/*@only@*/ /*@null@*/ const void * p) /*@modifies *p @*/
{
if (p != NULL) free((void *)p); if (p != NULL) free((void *)p);
return NULL; return NULL;
} }
@ -250,6 +253,7 @@ static int dataLength(int_32 type, const void * p, int_32 count, int onDisk)
*/ */
static int regionSwab(/*@null@*/ struct indexEntry * entry, int il, int dl, static int regionSwab(/*@null@*/ struct indexEntry * entry, int il, int dl,
const struct entryInfo * pe, char * dataStart, int regionid) const struct entryInfo * pe, char * dataStart, int regionid)
/*@modifies *entry, *dataStart @*/
{ {
char * tprev = NULL; char * tprev = NULL;
char * t = NULL; char * t = NULL;
@ -1185,6 +1189,7 @@ void headerDump(Header h, FILE *f, int flags,
*/ */
static /*@null@*/ static /*@null@*/
struct indexEntry * findEntry(/*@null@*/ Header h, int_32 tag, int_32 type) struct indexEntry * findEntry(/*@null@*/ Header h, int_32 tag, int_32 type)
/*@modifies h @*/
{ {
struct indexEntry * entry, * entry2, * last; struct indexEntry * entry, * entry2, * last;
struct indexEntry key; struct indexEntry key;
@ -1221,7 +1226,9 @@ struct indexEntry * findEntry(/*@null@*/ Header h, int_32 tag, int_32 type)
int headerIsEntry(Header h, int_32 tag) int headerIsEntry(Header h, int_32 tag)
{ {
/*@-mods@*/ /*@ FIX: h modified by sort. */
return (findEntry(h, tag, RPM_NULL_TYPE) ? 1 : 0); return (findEntry(h, tag, RPM_NULL_TYPE) ? 1 : 0);
/*@=mods@*/
} }
int headerGetRawEntry(Header h, int_32 tag, int_32 * type, const void ** p, int headerGetRawEntry(Header h, int_32 tag, int_32 * type, const void ** p,
@ -1233,7 +1240,9 @@ int headerGetRawEntry(Header h, int_32 tag, int_32 * type, const void ** p,
if (p == NULL) return headerIsEntry(h, tag); if (p == NULL) return headerIsEntry(h, tag);
/* First find the tag */ /* First find the tag */
/*@-mods@*/ /*@ FIX: h modified by sort. */
entry = findEntry(h, tag, RPM_NULL_TYPE); entry = findEntry(h, tag, RPM_NULL_TYPE);
/*@=mods@*/
if (!entry) { if (!entry) {
if (p) *p = NULL; if (p) *p = NULL;
if (c) *c = 0; if (c) *c = 0;
@ -1398,7 +1407,9 @@ static int intGetEntry(Header h, int_32 tag, /*@null@*/ /*@out@*/ int_32 * type,
int rc; int rc;
/* First find the tag */ /* First find the tag */
/*@-mods@*/ /*@ FIX: h modified by sort. */
entry = findEntry(h, tag, RPM_NULL_TYPE); entry = findEntry(h, tag, RPM_NULL_TYPE);
/*@mods@*/
if (entry == NULL) { if (entry == NULL) {
if (type) type = 0; if (type) type = 0;
if (p) *p = NULL; if (p) *p = NULL;
@ -1917,6 +1928,7 @@ static char escapedChar(const char ch) /*@*/
*/ */
static /*@null@*/ struct sprintfToken * static /*@null@*/ struct sprintfToken *
freeFormat( /*@only@*/ /*@null@*/ struct sprintfToken * format, int num) freeFormat( /*@only@*/ /*@null@*/ struct sprintfToken * format, int num)
/*@modifies *format @*/
{ {
int i; int i;

View File

@ -155,7 +155,7 @@ struct headerSprintfExtension {
enum headerSprintfExtenstionType type; /*!< Type of extension. */ enum headerSprintfExtenstionType type; /*!< Type of extension. */
char * name; /*!< Name of extension. */ char * name; /*!< Name of extension. */
union { union {
void * generic; /*!< Private extension. */ /*@unused@*/ void * generic; /*!< Private extension. */
headerTagFormatFunction formatFunction; /*!< HEADER_EXT_TAG extension. */ headerTagFormatFunction formatFunction; /*!< HEADER_EXT_TAG extension. */
headerTagTagFunction tagFunction; /*!< HEADER_EXT_FORMAT extension. */ headerTagTagFunction tagFunction; /*!< HEADER_EXT_FORMAT extension. */
struct headerSprintfExtension * more; /*!< Chained table extension. */ struct headerSprintfExtension * more; /*!< Chained table extension. */
@ -165,7 +165,9 @@ struct headerSprintfExtension {
/** \ingroup header /** \ingroup header
* Supported default header tag output formats. * Supported default header tag output formats.
*/ */
/*@-redecl@*/
extern const struct headerSprintfExtension headerDefaultFormats[]; extern const struct headerSprintfExtension headerDefaultFormats[];
/*@=redecl@*/
/** \ingroup header /** \ingroup header
* Include calculation for 8 bytes of (magic, 0)? * Include calculation for 8 bytes of (magic, 0)?
@ -209,7 +211,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @return header * @return header
*/ */
/*@-exportlocal@*/ /*@-exportlocal@*/
/*@null@*/ Header headerLoad(/*@kept@*/ void * uh) /*@*/; /*@null@*/ Header headerLoad(/*@kept@*/ void * uh)
/*@modifies uh @*/;
/*@=exportlocal@*/ /*@=exportlocal@*/
/** \ingroup header /** \ingroup header
@ -217,7 +220,8 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
* @param uh on-disk header blob (i.e. with offsets) * @param uh on-disk header blob (i.e. with offsets)
* @return header * @return header
*/ */
/*@null@*/ Header headerCopyLoad(void * uh) /*@*/; /*@null@*/ Header headerCopyLoad(void * uh)
/*@modifies uh @*/;
/** \ingroup header /** \ingroup header
* Convert header to on-disk representation. * Convert header to on-disk representation.
@ -256,13 +260,15 @@ Header headerLink(Header h)
* @param h header * @param h header
* @return NULL always * @return NULL always
*/ */
/*@null@*/ Header headerFree( /*@null@*/ /*@killref@*/ Header h); /*@null@*/ Header headerFree( /*@null@*/ /*@killref@*/ Header h)
/*@modifies h @*/;
/** \ingroup header /** \ingroup header
* Return header reference count. * Return header reference count.
* @param h header * @param h header
* @return no. of references * @return no. of references
*/ */
/*@unused@*/
int headerUsageCount(Header h) /*@*/; int headerUsageCount(Header h) /*@*/;
/** \ingroup header /** \ingroup header
@ -271,6 +277,7 @@ int headerUsageCount(Header h) /*@*/;
* @param flags 0 or HEADER_DUMP_LINLINE * @param flags 0 or HEADER_DUMP_LINLINE
* @param tags array of tag name/value pairs * @param tags array of tag name/value pairs
*/ */
/*@unused@*/
void headerDump(Header h, FILE *f, int flags, void headerDump(Header h, FILE *f, int flags,
const struct headerTagTableEntry * tags); const struct headerTagTableEntry * tags);
#define HEADER_DUMP_INLINE 1 #define HEADER_DUMP_INLINE 1
@ -333,6 +340,7 @@ int headerModifyEntry(Header h, int_32 tag, int_32 type, void *p, int_32 c)
* @param h header * @param h header
* @return array of locales (or NULL on error) * @return array of locales (or NULL on error)
*/ */
/*@unused@*/
/*@only@*/ /*@null@*/ char ** headerGetLangs(Header h) /*@*/; /*@only@*/ /*@null@*/ char ** headerGetLangs(Header h) /*@*/;
/** \ingroup header /** \ingroup header
@ -397,13 +405,15 @@ int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type, void * p, int_32 c
* *
* @param h header * @param h header
* @param tag tag * @param tag tag
* @retval type address of tag value data type * @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) * @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values * @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure * @return 1 on success, 0 on failure
*/ */
int headerGetEntry(Header h, int_32 tag, /*@null@*/ /*@out@*/ int_32 *type, int headerGetEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ void **p, /*@null@*/ /*@out@*/int_32 *c) /*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ void ** p,
/*@null@*/ /*@out@*/int_32 *c)
/*@modifies *type, *p, *c @*/; /*@modifies *type, *p, *c @*/;
/** \ingroup header /** \ingroup header
@ -413,13 +423,15 @@ int headerGetEntry(Header h, int_32 tag, /*@null@*/ /*@out@*/ int_32 *type,
* *
* @param h header * @param h header
* @param tag tag * @param tag tag
* @retval type address of tag value data type * @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) * @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values * @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure * @return 1 on success, 0 on failure
*/ */
int headerGetEntryMinMemory(Header h, int_32 tag, /*@out@*/ int_32 *type, int headerGetEntryMinMemory(Header h, int_32 tag,
/*@out@*/ const void **p, /*@out@*/ int_32 *c) /*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ const void ** p,
/*@null@*/ /*@out@*/ int_32 * c)
/*@modifies *type, *p, *c @*/; /*@modifies *type, *p, *c @*/;
/** \ingroup header /** \ingroup header
@ -429,14 +441,16 @@ int headerGetEntryMinMemory(Header h, int_32 tag, /*@out@*/ int_32 *type,
* *
* @param h header * @param h header
* @param tag tag * @param tag tag
* @retval type address of tag value data type * @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) * @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values * @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure * @return 1 on success, 0 on failure
*/ */
/*@-exportlocal@*/ /*@-exportlocal@*/
int headerGetRawEntry(Header h, int_32 tag, /*@out@*/ int_32 *type, int headerGetRawEntry(Header h, int_32 tag,
/*@out@*/ const void **p, /*@out@*/ int_32 *c) /*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ const void ** p,
/*@null@*/ /*@out@*/ int_32 * c)
/*@modifies *type, *p, *c @*/; /*@modifies *type, *p, *c @*/;
/*@=exportlocal@*/ /*@=exportlocal@*/
@ -542,16 +556,17 @@ typedef enum rpmTagType_e {
/** \ingroup header /** \ingroup header
* Free data allocated when retrieved from header. * Free data allocated when retrieved from header.
* @param data address of data * @param data address of data (or NULL)
* @param type type of data * @param type type of data (or -1 to force free)
* @return NULL always * @return NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ /*@unused@*/ static inline /*@null@*/
void * headerFreeData( /*@only@*/ /*@null@*/ const void * data, rpmTagType type) void * headerFreeData( /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
/*@modifies data @*/
{ {
if (data) { if (data) {
/*@-branchstate@*/ /*@-branchstate@*/
if (type < 0 || if (type == -1 ||
type == RPM_STRING_ARRAY_TYPE || type == RPM_STRING_ARRAY_TYPE ||
type == RPM_I18NSTRING_TYPE || type == RPM_I18NSTRING_TYPE ||
type == RPM_BIN_TYPE) type == RPM_BIN_TYPE)
@ -569,6 +584,7 @@ void * headerFreeData( /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
* value of the tag a 16 byte image of what should/will be in the header index, * value of the tag a 16 byte image of what should/will be in the header index,
* followed by per-tag private data. * followed by per-tag private data.
*/ */
/*@-enummemuse -typeuse @*/
typedef enum rpmSubTagType_e { typedef enum rpmSubTagType_e {
RPM_REGION_TYPE = -10, RPM_REGION_TYPE = -10,
RPM_BIN_ARRAY_TYPE = -11, RPM_BIN_ARRAY_TYPE = -11,
@ -578,6 +594,7 @@ typedef enum rpmSubTagType_e {
/*!<@todo Implement, intent is to to carry a (???,tagNum,valNum) cross /*!<@todo Implement, intent is to to carry a (???,tagNum,valNum) cross
reference to retrieve data from other tags. */ reference to retrieve data from other tags. */
} rpmSubTagType; } rpmSubTagType;
/*@=enummemuse =typeuse @*/
/** /**
* Header private tags. * Header private tags.

View File

@ -15,7 +15,8 @@ extern "C" {
* @param mode file mode * @param mode file mode
* @return (malloc'd) formatted mode string * @return (malloc'd) formatted mode string
*/ */
char * rpmPermsString(int mode); char * rpmPermsString(int mode)
/*@*/;
/** /**
* Read manifest, glob items, and append to existing args. * Read manifest, glob items, and append to existing args.
@ -23,7 +24,8 @@ char * rpmPermsString(int mode);
* @retval argcPtr no. of args * @retval argcPtr no. of args
* @retval argvPtr args themselves * @retval argvPtr args themselves
*/ */
int rpmReadPackageManifest(FD_t fd, int * argcPtr, const char *** argvPtr); int rpmReadPackageManifest(FD_t fd, int * argcPtr, const char *** argvPtr)
/*@modifies fd, *argcPtr, *argvPtr @*/;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -23,18 +23,18 @@
#include "debug.h" #include "debug.h"
static int _ie = 0x44332211; static int _ie = 0x44332211;
static union _mendian { int i; char b[4]; } *_endian = (union _mendian *)&_ie; static union _mendian {
/*@unused@*/ int i;
char b[4];
} *_endian = (union _mendian *)&_ie;
#define IS_BIG_ENDIAN() (_endian->b[0] == '\x44') #define IS_BIG_ENDIAN() (_endian->b[0] == '\x44')
#define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11') #define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11')
/*@-exportlocal@*/
void byteReverse(unsigned char *buf, unsigned longs);
/*@=exportlocal@*/
/* /*
* Note: this code is harmless on little-endian machines. * Note: this code is harmless on little-endian machines.
*/ */
void byteReverse(unsigned char *buf, unsigned longs) static void byteReverse(unsigned char *buf, unsigned longs)
/*@modifies *buf @*/
{ {
uint32 t; uint32 t;
do { do {

View File

@ -16,7 +16,9 @@ static int _debug = 0;
/*@access Header@*/ /* XXX compared with NULL */ /*@access Header@*/ /* XXX compared with NULL */
/*@access FD_t@*/ /* XXX compared with NULL */ /*@access FD_t@*/ /* XXX compared with NULL */
char * RPMVERSION = VERSION; /* just to put a marker in librpm.a */ /*@-exportheadervar@*/
/*@unused@*/ char * RPMVERSION = VERSION; /* just to put a marker in librpm.a */
/*@=exportheadervar@*/
char ** splitString(const char * str, int length, char sep) char ** splitString(const char * str, int length, char sep)
{ {

View File

@ -18,11 +18,13 @@ extern "C" {
/** /**
*/ */
/*@only@*/ char ** splitString(const char * str, int length, char sep); /*@only@*/ char ** splitString(const char * str, int length, char sep)
/*@*/;
/** /**
*/ */
void freeSplitString( /*@only@*/ char ** list); void freeSplitString( /*@only@*/ char ** list)
/*@modifies list @*/;
/** /**
* Remove occurences of trailing character from string. * Remove occurences of trailing character from string.
@ -42,11 +44,13 @@ void freeSplitString( /*@only@*/ char ** list);
/** /**
*/ */
int rpmfileexists(const char * urlfn) /*@*/; int rpmfileexists(const char * urlfn)
/*@modifies fileSystem @*/;
/** /**
*/ */
int rpmvercmp(const char * a, const char * b); int rpmvercmp(const char * a, const char * b)
/*@*/;
/* /*
* These are like the libc functions, but they malloc() the space which * These are like the libc functions, but they malloc() the space which
@ -55,34 +59,42 @@ int rpmvercmp(const char * a, const char * b);
/** /**
*/ */
int dosetenv(const char * name, const char * value, int overwrite); int dosetenv(const char * name, const char * value, int overwrite)
/*@modifies fileSystem @*/;
/** /**
*/ */
int doputenv(const char * str); int doputenv(const char * str)
/*@modifies fileSystem @*/;
/** /**
*/ */
int makeTempFile(const char * prefix, /*@out@*/ const char ** fnptr, int makeTempFile(const char * prefix,
/*@out@*/ FD_t * fdptr); /*@null@*/ /*@out@*/ const char ** fnptr,
/*@out@*/ FD_t * fdptr)
/*@modifies *fnptr, *fdptr, fileSystem @*/;
/** /**
* @return cureent working directory (malloc'ed) * @return cureent working directory (malloc'ed)
*/ */
/*@only@*/ char * currentDirectory(void); /*@only@*/ char * currentDirectory(void)
/*@modifies fileSystem @*/;
/** /**
*/ */
void compressFilelist(Header h); void compressFilelist(Header h)
/*@modifies h @*/;
/** /**
*/ */
void expandFilelist(Header h); void expandFilelist(Header h)
/*@modifies h @*/;
/** /**
*/ */
void buildOrigFileList(Header h, /*@out@*/ const char *** fileListPtr, void buildOrigFileList(Header h, /*@out@*/ const char *** fileListPtr,
/*@out@*/ int * fileCountPtr); /*@out@*/ int * fileCountPtr)
/*@modifies *fileListPtr, *fileCountPtr @*/;
/** /**
*/ */
@ -96,7 +108,8 @@ int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr,
/** /**
*/ */
void providePackageNVR(Header h); void providePackageNVR(Header h)
/*@modifies h @*/;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -101,7 +101,6 @@ static rpmRC readPackageHeaders(FD_t fd,
struct rpmlead * lead; struct rpmlead * lead;
char * defaultPrefix; char * defaultPrefix;
struct stat sb; struct stat sb;
int_32 true = 1;
rpmRC rc; rpmRC rc;
hdr = hdrPtr ? hdrPtr : &hdrBlock; hdr = hdrPtr ? hdrPtr : &hdrBlock;
@ -175,9 +174,10 @@ static rpmRC readPackageHeaders(FD_t fd,
/* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */ /* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */
if (lead->type == RPMLEAD_SOURCE) { if (lead->type == RPMLEAD_SOURCE) {
int_32 one = 1;
if (!headerIsEntry(*hdr, RPMTAG_SOURCEPACKAGE)) if (!headerIsEntry(*hdr, RPMTAG_SOURCEPACKAGE))
(void)headerAddEntry(*hdr, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE, (void)headerAddEntry(*hdr, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE,
&true, 1); &one, 1);
} else if (lead->major < 4) { } else if (lead->major < 4) {
/* Retrofit "Provide: name = EVR" for binary packages. */ /* Retrofit "Provide: name = EVR" for binary packages. */
providePackageNVR(*hdr); providePackageNVR(*hdr);

View File

@ -43,8 +43,10 @@ struct rpmBuildArguments_s rpmBTArgs;
#define POPT_TP 0x7470 #define POPT_TP 0x7470
#define POPT_TS 0x7473 #define POPT_TS 0x7473
/*@-redecl@*/
extern int _noDirTokens; extern int _noDirTokens;
extern int _fsm_debug; extern int _fsm_debug;
/*@=redecl@*/
static int force = 0; static int force = 0;
int noLang = 0; int noLang = 0;
static int noBuild = 0; static int noBuild = 0;

View File

@ -23,7 +23,9 @@
/*@access PSM_t @*/ /* compared with NULL */ /*@access PSM_t @*/ /* compared with NULL */
/*@access FD_t @*/ /* compared with NULL */ /*@access FD_t @*/ /* compared with NULL */
/*@-redecl@*/
extern int _fsm_debug; extern int _fsm_debug;
/*@=redecl@*/
int rpmVersionCompare(Header first, Header second) int rpmVersionCompare(Header first, Header second)
{ {

View File

@ -10,14 +10,6 @@
#include "depends.h" #include "depends.h"
#include "fsm.h" #include "fsm.h"
/**
*/
struct sharedFile {
int mainFileNumber;
int secRecOffset;
int secFileNumber;
} ;
/** /**
*/ */
struct sharedFileInfo { struct sharedFileInfo {
@ -51,7 +43,7 @@ struct transactionFileInfo_s {
int_32 * dil; /*!< Directory indice(s) (from header) */ int_32 * dil; /*!< Directory indice(s) (from header) */
/*@owned@*/ const char ** obnl; /*!< Original base name(s) (from header) */ /*@owned@*/ const char ** obnl; /*!< Original base name(s) (from header) */
/*@owned@*/ const char ** odnl; /*!< Original directory name(s) (from header) */ /*@owned@*/ const char ** odnl; /*!< Original directory name(s) (from header) */
int_32 * odil; /*!< Original directory indice(s) (from header) */ /*@unused@*/ int_32 * odil; /*!< Original directory indice(s) (from header) */
/*@owned@*/ const char ** fmd5s;/*!< File MD5 sum(s) (from header) */ /*@owned@*/ const char ** fmd5s;/*!< File MD5 sum(s) (from header) */
/*@owned@*/ const char ** flinks; /*!< File link(s) (from header) */ /*@owned@*/ const char ** flinks; /*!< File link(s) (from header) */
/* XXX setuid/setgid bits are turned off if fuser/fgroup doesn't map. */ /* XXX setuid/setgid bits are turned off if fuser/fgroup doesn't map. */
@ -161,7 +153,7 @@ struct psm_s {
unsigned long total; /*!< Callback total. */ unsigned long total; /*!< Callback total. */
rpmRC rc; rpmRC rc;
pkgStage goal; pkgStage goal;
pkgStage stage; /*@unused@*/ pkgStage stage;
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -154,6 +154,7 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
const char ** fileOwnerList = NULL; const char ** fileOwnerList = NULL;
const char ** fileGroupList = NULL; const char ** fileGroupList = NULL;
const char ** fileLinktoList = NULL; const char ** fileLinktoList = NULL;
int m5t, fot, fgt, ltt;
const char * fileStatesList; const char * fileStatesList;
int_32 * fileFlagsList, * fileMTimeList, * fileSizeList; int_32 * fileFlagsList, * fileMTimeList, * fileSizeList;
int_32 * fileUIDList = NULL; int_32 * fileUIDList = NULL;
@ -203,33 +204,36 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
te = stpcpy(te, _("(contains no files)")); te = stpcpy(te, _("(contains no files)"));
goto exit; goto exit;
} }
if (!hge(h, RPMTAG_FILESTATES, &type, (void **) &fileStatesList, &count)) { if (!hge(h, RPMTAG_FILESTATES, &type, (void **) &fileStatesList, &count))
fileStatesList = NULL; fileStatesList = NULL;
} if (!hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL))
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); dirNames = NULL;
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); if (!hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL))
(void) hge(h, RPMTAG_FILEFLAGS, &type, (void **)&fileFlagsList, &count); dirIndexes = NULL;
(void) hge(h, RPMTAG_FILESIZES, &type, (void **) &fileSizeList, &count); if (!hge(h, RPMTAG_FILEFLAGS, &type, (void **) &fileFlagsList, &count))
(void) hge(h, RPMTAG_FILEMODES, &type, (void **) &fileModeList, &count); fileFlagsList = NULL;
(void) hge(h, RPMTAG_FILEMTIMES, &type, (void **)&fileMTimeList,&count); if (!hge(h, RPMTAG_FILESIZES, &type, (void **) &fileSizeList, &count))
(void) hge(h, RPMTAG_FILERDEVS, &type, (void **) &fileRdevList, &count); fileSizeList = NULL;
(void) hge(h, RPMTAG_FILEINODES, &type, (void **)&fileInodeList,&count); if (!hge(h, RPMTAG_FILEMODES, &type, (void **) &fileModeList, &count))
(void) hge(h, RPMTAG_FILELINKTOS,&type,(void **)&fileLinktoList,&count); fileModeList = NULL;
(void) hge(h, RPMTAG_FILEMD5S, &type, (void **) &fileMD5List, &count); if (!hge(h, RPMTAG_FILEMTIMES, &type, (void **) &fileMTimeList, &count))
fileMTimeList = NULL;
if (!hge(h, RPMTAG_FILEUIDS, &type, (void **) &fileUIDList, &count)) { if (!hge(h, RPMTAG_FILERDEVS, &type, (void **) &fileRdevList, &count))
fileRdevList = NULL;
if (!hge(h, RPMTAG_FILEINODES, &type, (void **) &fileInodeList, &count))
fileInodeList = NULL;
if (!hge(h, RPMTAG_FILELINKTOS, &ltt, (void **) &fileLinktoList, NULL))
fileLinktoList = NULL;
if (!hge(h, RPMTAG_FILEMD5S, &m5t, (void **) &fileMD5List, NULL))
fileMD5List = NULL;
if (!hge(h, RPMTAG_FILEUIDS, &type, (void **) &fileUIDList, &count))
fileUIDList = NULL; fileUIDList = NULL;
} else if (!hge(h, RPMTAG_FILEGIDS, &type, if (!hge(h, RPMTAG_FILEGIDS, &type, (void **) &fileGIDList, &count))
(void **) &fileGIDList, &count)) {
fileGIDList = NULL; fileGIDList = NULL;
} if (!hge(h, RPMTAG_FILEUSERNAME, &fot, (void **) &fileOwnerList, NULL))
if (!hge(h, RPMTAG_FILEUSERNAME, &type, (void **) &fileOwnerList, &count)) {
fileOwnerList = NULL; fileOwnerList = NULL;
} else if (!hge(h, RPMTAG_FILEGROUPNAME, &fgt, (void **) &fileGroupList, NULL))
if (!hge(h, RPMTAG_FILEGROUPNAME, &type, (void **) &fileGroupList, &count)) {
fileGroupList = NULL; fileGroupList = NULL;
}
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
/* If querying only docs, skip non-doc files. */ /* If querying only docs, skip non-doc files. */
@ -269,7 +273,7 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
sprintf(te, "%s%s %d %d %s 0%o ", sprintf(te, "%s%s %d %d %s 0%o ",
dirNames[dirIndexes[i]], baseNames[i], dirNames[dirIndexes[i]], baseNames[i],
fileSizeList[i], fileMTimeList[i], fileSizeList[i], fileMTimeList[i],
fileMD5List[i], fileModeList[i]); fileMD5List[i], (unsigned) fileModeList[i]);
te += strlen(te); te += strlen(te);
if (fileOwnerList && fileGroupList) { if (fileOwnerList && fileGroupList) {
@ -286,7 +290,7 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
sprintf(te, " %s %s %u ", sprintf(te, " %s %s %u ",
fileFlagsList[i] & RPMFILE_CONFIG ? "1" : "0", fileFlagsList[i] & RPMFILE_CONFIG ? "1" : "0",
fileFlagsList[i] & RPMFILE_DOC ? "1" : "0", fileFlagsList[i] & RPMFILE_DOC ? "1" : "0",
(unsigned)fileRdevList[i]); (unsigned) fileRdevList[i]);
te += strlen(te); te += strlen(te);
if (strlen(fileLinktoList[i])) if (strlen(fileLinktoList[i]))
@ -352,10 +356,10 @@ exit:
t = _free(t); t = _free(t);
dirNames = hfd(dirNames, dnt); dirNames = hfd(dirNames, dnt);
baseNames = hfd(baseNames, bnt); baseNames = hfd(baseNames, bnt);
fileLinktoList = hfd(fileLinktoList, -1); fileLinktoList = hfd(fileLinktoList, ltt);
fileMD5List = hfd(fileMD5List, -1); fileMD5List = hfd(fileMD5List, m5t);
fileOwnerList = hfd(fileOwnerList, -1); fileOwnerList = hfd(fileOwnerList, fot);
fileGroupList = hfd(fileGroupList, -1); fileGroupList = hfd(fileGroupList, fgt);
return rc; return rc;
} }
@ -469,6 +473,7 @@ int showMatches(QVA_t qva, rpmdbMatchIterator mi, QVF_t showPackage)
return ec; return ec;
} }
/*@-redecl@*/
/** /**
* @todo Eliminate linkage loop into librpmbuild.a * @todo Eliminate linkage loop into librpmbuild.a
*/ */
@ -479,6 +484,7 @@ int (*parseSpecVec) (Spec *specp, const char *specFile, const char *rootdir,
* @todo Eliminate linkage loop into librpmbuild.a * @todo Eliminate linkage loop into librpmbuild.a
*/ */
/*@null@*/ Spec (*freeSpecVec) (Spec spec) = NULL; /*@null@*/ Spec (*freeSpecVec) (Spec spec) = NULL;
/*@=redecl@*/
int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg, int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg,
rpmdb rpmdb, QVF_t showPackage) rpmdb rpmdb, QVF_t showPackage)

View File

@ -139,8 +139,8 @@ void * showProgress(/*@null@*/ const void * arg, const rpmCallbackType what,
case RPMCALLBACK_TRANS_PROGRESS: case RPMCALLBACK_TRANS_PROGRESS:
case RPMCALLBACK_INST_PROGRESS: case RPMCALLBACK_INST_PROGRESS:
if (flags & INSTALL_PERCENT) if (flags & INSTALL_PERCENT)
fprintf(stdout, "%%%% %f\n", (total fprintf(stdout, "%%%% %f\n", (double) (total
? ((float) ((((float) amount) / total) * 100)) ? ((((float) amount) / total) * 100)
: 100.0)); : 100.0));
else if (flags & INSTALL_HASH) else if (flags & INSTALL_HASH)
printHash(amount, total); printHash(amount, total);

View File

@ -33,10 +33,12 @@ extern "C" {
/** /**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param this memory to free * @param p memory to free
* @return NULL always * @return NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * p) { /*@unused@*/ static inline /*@null@*/ void *
_free(/*@only@*/ /*@null@*/ const void * p) /*@modifies p@*/
{
if (p != NULL) free((void *)p); if (p != NULL) free((void *)p);
return NULL; return NULL;
} }
@ -146,10 +148,12 @@ int rpmHeaderGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type,
* @retval c address of number of values * @retval c address of number of values
* @return 0 on success, 1 on bad magic, 2 on error * @return 0 on success, 1 on bad magic, 2 on error
*/ */
/*@unused@*/
int rpmPackageGetEntry(void *leadp, Header sigs, Header h, int rpmPackageGetEntry(void *leadp, Header sigs, Header h,
int_32 tag, int_32 *type, void **p, int_32 *c) int_32 tag, int_32 *type, void **p, int_32 *c)
/*@modifies *type, *p, *c @*/; /*@modifies *type, *p, *c @*/;
/*@-redecl@*/
/** /**
* Automatically generated table of tag name/value pairs. * Automatically generated table of tag name/value pairs.
*/ */
@ -165,6 +169,7 @@ extern const int rpmTagTableSize;
* @note Chains to headerDefaultFormats[]. * @note Chains to headerDefaultFormats[].
*/ */
extern const struct headerSprintfExtension rpmHeaderFormats[]; extern const struct headerSprintfExtension rpmHeaderFormats[];
/*@=redecl@*/
/** /**
* Pseudo-tags used by the rpmdb iterator API. * Pseudo-tags used by the rpmdb iterator API.
@ -180,6 +185,7 @@ extern const struct headerSprintfExtension rpmHeaderFormats[];
* Tags identify data in package headers. * Tags identify data in package headers.
* @note tags should not have value 0! * @note tags should not have value 0!
*/ */
/*@-enummemuse -typeuse@*/
typedef enum rpmTag_e { typedef enum rpmTag_e {
RPMTAG_HEADERIMAGE = HEADER_IMAGE, /*!< Current image. */ RPMTAG_HEADERIMAGE = HEADER_IMAGE, /*!< Current image. */
@ -328,26 +334,32 @@ typedef enum rpmTag_e {
RPMTAG_REMOVETID = 1129, RPMTAG_REMOVETID = 1129,
RPMTAG_FIRSTFREE_TAG /*!< internal */ RPMTAG_FIRSTFREE_TAG /*!< internal */
} rpmTag; } rpmTag;
/*@=enummemuse =typeuse@*/
#define RPMTAG_EXTERNAL_TAG 1000000 #define RPMTAG_EXTERNAL_TAG 1000000
/** /**
* File States (when installed). * File States (when installed).
*/ */
/*@-typeuse@*/
typedef enum rpmfileStates_e { typedef enum rpmfileStates_e {
RPMFILE_STATE_NORMAL = 0, RPMFILE_STATE_NORMAL = 0,
RPMFILE_STATE_REPLACED = 1, RPMFILE_STATE_REPLACED = 1,
RPMFILE_STATE_NOTINSTALLED = 2, RPMFILE_STATE_NOTINSTALLED = 2,
RPMFILE_STATE_NETSHARED = 3 RPMFILE_STATE_NETSHARED = 3
} rpmfileStates; } rpmfileStates;
/*@=typeuse@*/
/** /**
* File Attributes. * File Attributes.
*/ */
/*@-typeuse@*/
typedef enum rpmfileAttrs_e { typedef enum rpmfileAttrs_e {
RPMFILE_CONFIG = (1 << 0), /*!< from %%config */ RPMFILE_CONFIG = (1 << 0), /*!< from %%config */
RPMFILE_DOC = (1 << 1), /*!< from %%doc */ RPMFILE_DOC = (1 << 1), /*!< from %%doc */
/*@-enummemuse@*/
RPMFILE_DONOTUSE = (1 << 2), /*!< @todo (unimplemented) from %donotuse. */ RPMFILE_DONOTUSE = (1 << 2), /*!< @todo (unimplemented) from %donotuse. */
/*@=enummemuse@*/
RPMFILE_MISSINGOK = (1 << 3), /*!< from %%config(missingok) */ RPMFILE_MISSINGOK = (1 << 3), /*!< from %%config(missingok) */
RPMFILE_NOREPLACE = (1 << 4), /*!< from %%config(noreplace) */ RPMFILE_NOREPLACE = (1 << 4), /*!< from %%config(noreplace) */
RPMFILE_SPECFILE = (1 << 5), /*!< @todo (unnecessary) marks 1st file in srpm. */ RPMFILE_SPECFILE = (1 << 5), /*!< @todo (unnecessary) marks 1st file in srpm. */
@ -356,6 +368,7 @@ typedef enum rpmfileAttrs_e {
RPMFILE_README = (1 << 8), /*!< from %%readme */ RPMFILE_README = (1 << 8), /*!< from %%readme */
RPMFILE_EXCLUDE = (1 << 9) /*!< from %%exclude */ RPMFILE_EXCLUDE = (1 << 9) /*!< from %%exclude */
} rpmfileAttrs; } rpmfileAttrs;
/*@=typeuse@*/
#define RPMFILE_MULTILIB_SHIFT 9 #define RPMFILE_MULTILIB_SHIFT 9
#define RPMFILE_MULTILIB(N) ((N) << RPMFILE_MULTILIB_SHIFT) #define RPMFILE_MULTILIB(N) ((N) << RPMFILE_MULTILIB_SHIFT)
#define RPMFILE_MULTILIB_MASK RPMFILE_MULTILIB(7) #define RPMFILE_MULTILIB_MASK RPMFILE_MULTILIB(7)
@ -368,7 +381,9 @@ typedef enum rpmfileAttrs_e {
*/ */
typedef enum rpmsenseFlags_e { typedef enum rpmsenseFlags_e {
RPMSENSE_ANY = 0, RPMSENSE_ANY = 0,
/*@-enummemuse@*/
RPMSENSE_SERIAL = (1 << 0), /*!< @todo Legacy. */ RPMSENSE_SERIAL = (1 << 0), /*!< @todo Legacy. */
/*@=enummemuse@*/
RPMSENSE_LESS = (1 << 1), RPMSENSE_LESS = (1 << 1),
RPMSENSE_GREATER = (1 << 2), RPMSENSE_GREATER = (1 << 2),
RPMSENSE_EQUAL = (1 << 3), RPMSENSE_EQUAL = (1 << 3),
@ -394,7 +409,9 @@ typedef enum rpmsenseFlags_e {
RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */ RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */
RPMSENSE_SCRIPT_CLEAN = (1 << 23), /*!< %clean build dependency. */ RPMSENSE_SCRIPT_CLEAN = (1 << 23), /*!< %clean build dependency. */
RPMSENSE_RPMLIB = ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature) dependency. */ RPMSENSE_RPMLIB = ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature) dependency. */
/*@-enummemuse@*/
RPMSENSE_TRIGGERPREIN = (1 << 25) /*!< @todo Implement %triggerprein. */ RPMSENSE_TRIGGERPREIN = (1 << 25) /*!< @todo Implement %triggerprein. */
/*@=enummemuse@*/
} rpmsenseFlags; } rpmsenseFlags;
@ -447,7 +464,9 @@ typedef enum rpmsenseFlags_e {
* @deprecated Use rpmExpand() with appropriate macro expression. * @deprecated Use rpmExpand() with appropriate macro expression.
* @todo Eliminate from API. * @todo Eliminate from API.
*/ */
/*@-redecl@*/
/*@observer@*/ /*@null@*/ extern const char * rpmGetVar(int var) /*@*/; /*@observer@*/ /*@null@*/ extern const char * rpmGetVar(int var) /*@*/;
/*@=redecl@*/
/** \ingroup rpmrc /** \ingroup rpmrc
* Set value of an rpmrc variable. * Set value of an rpmrc variable.
@ -461,7 +480,9 @@ void rpmSetVar(int var, const char *val);
* This is a colon separated list of files. URI's are permitted as well, * This is a colon separated list of files. URI's are permitted as well,
* identified by the token '://', so file paths must not begin with '//'. * identified by the token '://', so file paths must not begin with '//'.
*/ */
/*@-redecl@*/
extern const char * macrofiles; extern const char * macrofiles;
/*@=redecl@*/
/** \ingroup rpmrc /** \ingroup rpmrc
* Build and install arch/os table identifiers. * Build and install arch/os table identifiers.
@ -561,6 +582,7 @@ void rpmSetMachine(/*@null@*/ const char * arch, /*@null@*/ const char * os);
* @retval arch address of arch name (or NULL) * @retval arch address of arch name (or NULL)
* @retval os address of os name (or NULL) * @retval os address of os name (or NULL)
*/ */
/*@unused@*/
void rpmGetMachine( /*@null@*/ /*@out@*/ const char **arch, void rpmGetMachine( /*@null@*/ /*@out@*/ const char **arch,
/*@null@*/ /*@out@*/ const char **os) /*@null@*/ /*@out@*/ const char **os)
/*@modifies *arch, *os @*/; /*@modifies *arch, *os @*/;
@ -630,11 +652,11 @@ int rpmdbSync (/*@null@*/ rpmdb rpmdb)
/** \ingroup rpmdb /** \ingroup rpmdb
* Open all database indices. * Open all database indices.
* @param rpmdb rpm database * @param db rpm database
* @return 0 on success * @return 0 on success
*/ */
int rpmdbOpenAll (/*@null@*/ rpmdb rpmdb) int rpmdbOpenAll (/*@null@*/ rpmdb db)
/*@modifies fileSystem @*/; /*@modifies db, fileSystem @*/;
/** \ingroup rpmdb /** \ingroup rpmdb
* Return number of instances of package in rpm database. * Return number of instances of package in rpm database.
@ -643,7 +665,7 @@ int rpmdbOpenAll (/*@null@*/ rpmdb rpmdb)
* @return number of instances * @return number of instances
*/ */
int rpmdbCountPackages(rpmdb db, const char * name) int rpmdbCountPackages(rpmdb db, const char * name)
/*@*/; /*@modifies db @*/;
/** \ingroup rpmdb /** \ingroup rpmdb
*/ */
@ -758,36 +780,36 @@ int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified)
/** \ingroup rpmdb /** \ingroup rpmdb
* Return database iterator. * Return database iterator.
* @param rpmdb rpm database * @param db rpm database
* @param rpmtag rpm tag * @param rpmtag rpm tag
* @param keyp key data (NULL for sequential access) * @param keyp key data (NULL for sequential access)
* @param keylen key data length (0 will use strlen(keyp)) * @param keylen key data length (0 will use strlen(keyp))
* @return NULL on failure * @return NULL on failure
*/ */
/*@only@*/ /*@null@*/ rpmdbMatchIterator rpmdbInitIterator( /*@only@*/ /*@null@*/ rpmdbMatchIterator rpmdbInitIterator(
/*@kept@*/ /*@null@*/ rpmdb rpmdb, int rpmtag, /*@kept@*/ /*@null@*/ rpmdb db, int rpmtag,
/*@null@*/ const void * key, size_t keylen) /*@null@*/ const void * key, size_t keylen)
/*@modifies fileSystem @*/; /*@modifies db, fileSystem @*/;
/** \ingroup rpmdb /** \ingroup rpmdb
* Add package header to rpm database and indices. * Add package header to rpm database and indices.
* @param rpmdb rpm database * @param db rpm database
* @param iid install transaction id (or -1 to skip) * @param iid install transaction id (or -1 to skip)
* @param h header * @param h header
* @return 0 on success * @return 0 on success
*/ */
int rpmdbAdd(rpmdb rpmdb, int iid, Header h) int rpmdbAdd(rpmdb db, int iid, Header h)
/*@modifies h, fileSystem @*/; /*@modifies db, h, fileSystem @*/;
/** \ingroup rpmdb /** \ingroup rpmdb
* Remove package header from rpm database and indices. * Remove package header from rpm database and indices.
* @param rpmdb rpm database * @param db rpm database
* @param rid remove transaction id (or -1 to skip) * @param rid remove transaction id (or -1 to skip)
* @param offset location in Packages dbi * @param offset location in Packages dbi
* @return 0 on success * @return 0 on success
*/ */
int rpmdbRemove(rpmdb rpmdb, int rid, unsigned int offset) int rpmdbRemove(rpmdb db, int rid, unsigned int offset)
/*@modifies fileSystem @*/; /*@modifies db, fileSystem @*/;
/** \ingroup rpmdb /** \ingroup rpmdb
* Rebuild database indices from package headers. * Rebuild database indices from package headers.
@ -882,7 +904,9 @@ void printDepProblems(FILE * fp, const rpmDependencyConflict conflicts,
* @param prob rpm problem * @param prob rpm problem
* @return formatted string * @return formatted string
*/ */
/*@-redecl@*/
/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob) /*@*/; /*@only@*/ extern const char * rpmProblemString(const rpmProblem prob) /*@*/;
/*@=redecl@*/
/** /**
* Output formatted string representation of problem to file handle. * Output formatted string representation of problem to file handle.
@ -914,14 +938,16 @@ void rpmProblemSetFree( /*@only@*/ rpmProblemSet probs);
* Prototype for headerFreeData() vector. * Prototype for headerFreeData() vector.
*/ */
typedef /*@null@*/ typedef /*@null@*/
void * (*HFD_t) (/*@only@*/ /*@null@*/ const void * data, rpmTagType type); void * (*HFD_t) (/*@only@*/ /*@null@*/ const void * data, rpmTagType type)
/*@modifies data @*/;
/** /**
* Prototype for headerGetEntry() vector. * Prototype for headerGetEntry() vector.
*/ */
typedef int (*HGE_t) (Header h, int_32 tag, /*@null@*/ /*@out@*/ int_32 * type, typedef int (*HGE_t) (Header h, int_32 tag,
/*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ void ** p, /*@null@*/ /*@out@*/ void ** p,
/*@null@*/ /*@out@*/int_32 * c) /*@null@*/ /*@out@*/ int_32 * c)
/*@modifies *type, *p, *c @*/; /*@modifies *type, *p, *c @*/;
/** /**
@ -1062,6 +1088,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, /*@null@*/ FD_t fd,
* @param h header * @param h header
* @param key package private data * @param key package private data
*/ */
/*@unused@*/
void rpmtransAvailablePackage(rpmTransactionSet ts, Header h, void rpmtransAvailablePackage(rpmTransactionSet ts, Header h,
/*@null@*/ /*@owned@*/ const void * key) /*@null@*/ /*@owned@*/ const void * key)
/*@modifies h, ts @*/; /*@modifies h, ts @*/;
@ -1086,6 +1113,7 @@ void rpmtransFree( /*@only@*/ rpmTransactionSet ts)
* @param ts transaction set * @param ts transaction set
* @param fd file handle * @param fd file handle
*/ */
/*@unused@*/
void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd) void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd)
/*@modifies ts, fd @*/; /*@modifies ts, fd @*/;
@ -1097,6 +1125,7 @@ void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd)
* @retval nep address of no. of returned elements (or NULL) * @retval nep address of no. of returned elements (or NULL)
* @return 0 always * @return 0 always
*/ */
/*@unused@*/
int rpmtransGetKeys(const rpmTransactionSet ts, int rpmtransGetKeys(const rpmTransactionSet ts,
/*@null@*/ /*@out@*/ const void *** ep, /*@null@*/ /*@out@*/ int * nep) /*@null@*/ /*@out@*/ const void *** ep, /*@null@*/ /*@out@*/ int * nep)
/*@modifies ep, nep @*/; /*@modifies ep, nep @*/;
@ -1157,15 +1186,21 @@ typedef enum rpmtransFlags_e {
RPMTRANS_FLAG_NOTRIGGERS = (1 << 4), /*!< from --notriggers */ RPMTRANS_FLAG_NOTRIGGERS = (1 << 4), /*!< from --notriggers */
RPMTRANS_FLAG_NODOCS = (1 << 5), /*!< from --excludedocs */ RPMTRANS_FLAG_NODOCS = (1 << 5), /*!< from --excludedocs */
RPMTRANS_FLAG_ALLFILES = (1 << 6), /*!< from --allfiles */ RPMTRANS_FLAG_ALLFILES = (1 << 6), /*!< from --allfiles */
/*@-enummemuse@*/
RPMTRANS_FLAG_KEEPOBSOLETE = (1 << 7), /*!< @todo Document. */ RPMTRANS_FLAG_KEEPOBSOLETE = (1 << 7), /*!< @todo Document. */
/*@=enummemuse@*/
RPMTRANS_FLAG_MULTILIB = (1 << 8), /*!< @todo Document. */ RPMTRANS_FLAG_MULTILIB = (1 << 8), /*!< @todo Document. */
RPMTRANS_FLAG_DIRSTASH = (1 << 9), /*!< from --dirstash */ RPMTRANS_FLAG_DIRSTASH = (1 << 9), /*!< from --dirstash */
RPMTRANS_FLAG_REPACKAGE = (1 << 10), /*!< from --repackage */ RPMTRANS_FLAG_REPACKAGE = (1 << 10), /*!< from --repackage */
RPMTRANS_FLAG_PKGCOMMIT = (1 << 11), RPMTRANS_FLAG_PKGCOMMIT = (1 << 11),
/*@-enummemuse@*/
RPMTRANS_FLAG_PKGUNDO = (1 << 12), RPMTRANS_FLAG_PKGUNDO = (1 << 12),
/*@=enummemuse@*/
RPMTRANS_FLAG_COMMIT = (1 << 13), RPMTRANS_FLAG_COMMIT = (1 << 13),
/*@-enummemuse@*/
RPMTRANS_FLAG_UNDO = (1 << 14), RPMTRANS_FLAG_UNDO = (1 << 14),
/*@=enummemuse@*/
RPMTRANS_FLAG_REVERSE = (1 << 15), RPMTRANS_FLAG_REVERSE = (1 << 15),
RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16), RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16),
@ -1176,7 +1211,9 @@ typedef enum rpmtransFlags_e {
RPMTRANS_FLAG_NOPREUN = (1 << 21), RPMTRANS_FLAG_NOPREUN = (1 << 21),
RPMTRANS_FLAG_NOPOSTUN = (1 << 22), RPMTRANS_FLAG_NOPOSTUN = (1 << 22),
RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23), RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23),
/*@-enummemuse@*/
RPMTRANS_FLAG_NOPAYLOAD = (1 << 24), RPMTRANS_FLAG_NOPAYLOAD = (1 << 24),
/*@=enummemuse@*/
RPMTRANS_FLAG_APPLYONLY = (1 << 25), RPMTRANS_FLAG_APPLYONLY = (1 << 25),
RPMTRANS_FLAG_CHAINSAW = (1 << 26), RPMTRANS_FLAG_CHAINSAW = (1 << 26),
@ -1203,6 +1240,7 @@ typedef enum rpmtransFlags_e {
* @retval address of array of rpmlib internal provide versions * @retval address of array of rpmlib internal provide versions
* @return no. of entries * @return no. of entries
*/ */
/*@unused@*/
int rpmGetRpmlibProvides(/*@out@*/ const char *** provNames, int rpmGetRpmlibProvides(/*@out@*/ const char *** provNames,
/*@out@*/ int ** provFlags, /*@out@*/ const char *** provVersions) /*@out@*/ int ** provFlags, /*@out@*/ const char *** provVersions)
/*@ modifies *provNames, *provFlags, *provVersions @*/; /*@ modifies *provNames, *provFlags, *provVersions @*/;
@ -1280,7 +1318,9 @@ int rpmRunTransactions(rpmTransactionSet ts,
* @param tag tag value * @param tag tag value
* @return name of tag * @return name of tag
*/ */
/*@-redecl@*/
/*@observer@*/ extern const char *const tagName(int tag) /*@*/; /*@observer@*/ extern const char *const tagName(int tag) /*@*/;
/*@=redecl@*/
/** /**
* Return value of tag from name. * Return value of tag from name.
@ -1313,7 +1353,7 @@ struct rpmlead {
char name[66]; char name[66];
short osnum; short osnum;
short signature_type; /*!< Signature header type (RPMSIG_HEADERSIG) */ short signature_type; /*!< Signature header type (RPMSIG_HEADERSIG) */
char reserved[16]; /*!< Pad to 96 bytes -- 8 byte aligned! */ /*@unused@*/ char reserved[16]; /*!< Pad to 96 bytes -- 8 byte aligned! */
} ; } ;
/** /**
@ -1445,6 +1485,7 @@ typedef enum rpmQVSources_e {
/** \ingroup rpmcli /** \ingroup rpmcli
* Bit(s) to control rpmQuery() operation, stored in qva_flags. * Bit(s) to control rpmQuery() operation, stored in qva_flags.
*/ */
/*@-typeuse@*/
typedef enum rpmQueryFlags_e { typedef enum rpmQueryFlags_e {
QUERY_FOR_LIST = (1 << 1), /*!< from --list */ QUERY_FOR_LIST = (1 << 1), /*!< from --list */
QUERY_FOR_STATE = (1 << 2), /*!< from --state */ QUERY_FOR_STATE = (1 << 2), /*!< from --state */
@ -1452,16 +1493,19 @@ typedef enum rpmQueryFlags_e {
QUERY_FOR_CONFIG = (1 << 4), /*!< from --configfiles */ QUERY_FOR_CONFIG = (1 << 4), /*!< from --configfiles */
QUERY_FOR_DUMPFILES = (1 << 8) /*!< from --dump */ QUERY_FOR_DUMPFILES = (1 << 8) /*!< from --dump */
} rpmQueryFlags; } rpmQueryFlags;
/*@=typeuse@*/
/** \ingroup rpmcli /** \ingroup rpmcli
* Bit(s) to control rpmVerify() operation, stored in qva_flags. * Bit(s) to control rpmVerify() operation, stored in qva_flags.
*/ */
/*@-typeuse@*/
typedef enum rpmVerifyFlags_e { typedef enum rpmVerifyFlags_e {
VERIFY_FILES = (1 << 9), /*!< from --nofiles */ VERIFY_FILES = (1 << 9), /*!< from --nofiles */
VERIFY_DEPS = (1 << 10), /*!< from --nodeps */ VERIFY_DEPS = (1 << 10), /*!< from --nodeps */
VERIFY_SCRIPT = (1 << 11), /*!< from --noscripts */ VERIFY_SCRIPT = (1 << 11), /*!< from --noscripts */
VERIFY_MD5 = (1 << 12) /*!< from --nomd5 */ VERIFY_MD5 = (1 << 12) /*!< from --nomd5 */
} rpmVerifyFlags; } rpmVerifyFlags;
/*@=typeuse@*/
/** \ingroup rpmcli /** \ingroup rpmcli
* Describe query/verify command line request. * Describe query/verify command line request.
@ -1470,7 +1514,7 @@ typedef struct rpmQVArguments_s {
rpmQVSources qva_source; /*!< Identify CLI arg type. */ rpmQVSources qva_source; /*!< Identify CLI arg type. */
int qva_sourceCount;/*!< Exclusive check (>1 is error). */ int qva_sourceCount;/*!< Exclusive check (>1 is error). */
int qva_flags; /*!< Bit(s) to control operation. */ int qva_flags; /*!< Bit(s) to control operation. */
int qva_verbose; /*!< (unused) */ /*@unused@*/ int qva_verbose; /*!< (unused) */
/*@only@*/ /*@null@*/ const char * qva_queryFormat; /*!< Format for headerSprintf(). */ /*@only@*/ /*@null@*/ const char * qva_queryFormat; /*!< Format for headerSprintf(). */
/*@dependent@*/ /*@null@*/ const char * qva_prefix; /*!< Path to top of install tree. */ /*@dependent@*/ /*@null@*/ const char * qva_prefix; /*!< Path to top of install tree. */
char qva_mode; /*!< 'q' is query, 'v' is verify mode. */ char qva_mode; /*!< 'q' is query, 'v' is verify mode. */
@ -1490,7 +1534,8 @@ extern struct poptOption rpmQVSourcePoptTable[];
* @param db rpm database * @param db rpm database
* @param h header to use for query/verify * @param h header to use for query/verify
*/ */
typedef int (*QVF_t) (QVA_t qva, rpmdb db, Header h); typedef int (*QVF_t) (QVA_t qva, rpmdb db, Header h)
/*@modifies db @*/;
/** \ingroup rpmcli /** \ingroup rpmcli
* Display query/verify information for each header in iterator. * Display query/verify information for each header in iterator.
@ -1500,7 +1545,8 @@ typedef int (*QVF_t) (QVA_t qva, rpmdb db, Header h);
* @return result of last non-zero showPackage() return * @return result of last non-zero showPackage() return
*/ */
int showMatches(QVA_t qva, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi, int showMatches(QVA_t qva, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi,
QVF_t showPackage); QVF_t showPackage)
/*@modifies mi @*/;
/** \ingroup rpmcli /** \ingroup rpmcli
*/ */
@ -1514,30 +1560,31 @@ extern struct poptOption rpmQueryPoptTable[];
* Display list of tags that can be used in --queryformat. * Display list of tags that can be used in --queryformat.
* @param f file handle to use for display * @param f file handle to use for display
*/ */
void rpmDisplayQueryTags(FILE * f) /*@modifies f@*/; void rpmDisplayQueryTags(FILE * f) /*@modifies f @*/;
/** \ingroup rpmcli /** \ingroup rpmcli
* Common query/verify source interface, called once for each CLI arg. * Common query/verify source interface, called once for each CLI arg.
* @param qva parsed query/verify options * @param qva parsed query/verify options
* @param source type of source to query/verify * @param source type of source to query/verify
* @param arg name of source to query/verify * @param arg name of source to query/verify
* @param rpmdb rpm database * @param db rpm database
* @param showPackage query/verify specific display routine * @param showPackage query/verify specific display routine
* @return showPackage() result, 1 if rpmdbInitIterator() is NULL * @return showPackage() result, 1 if rpmdbInitIterator() is NULL
*/ */
int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg, int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg,
rpmdb rpmdb, QVF_t showPackage) rpmdb db, QVF_t showPackage)
/*@modifies fileSystem@*/; /*@modifies db, fileSystem@*/;
/** \ingroup rpmcli /** \ingroup rpmcli
* Display results of package query. * Display results of package query.
* @todo Devise a meaningful return code. * @todo Devise a meaningful return code.
* @param qva parsed query/verify options * @param qva parsed query/verify options
* @param rpmdb rpm database (unused for queries) * @param db rpm database (unused for queries)
* @param h header to use for query * @param h header to use for query
* @return 0 always * @return 0 always
*/ */
int showQueryPackage(QVA_t qva, rpmdb rpmdb, Header h); int showQueryPackage(QVA_t qva, rpmdb db, Header h)
/*@modifies db, fileSystem @*/;
/** \ingroup rpmcli /** \ingroup rpmcli
* Display package information. * Display package information.
@ -1556,12 +1603,12 @@ extern struct poptOption rpmVerifyPoptTable[];
/** \ingroup rpmcli /** \ingroup rpmcli
* Display results of package verify. * Display results of package verify.
* @param qva parsed query/verify options * @param qva parsed query/verify options
* @param rpmdb rpm database * @param db rpm database
* @param h header to use for verify * @param h header to use for verify
* @return result of last non-zero verify return * @return result of last non-zero verify return
*/ */
int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb rpmdb, Header h) int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb db, Header h)
/*@modifies fileSystem@*/; /*@modifies db, fileSystem@*/;
/** \ingroup rpmcli /** \ingroup rpmcli
* Verify package install. * Verify package install.
@ -1653,6 +1700,7 @@ int rpmErase(/*@null@*/ const char * rootdir, /*@null@*/ const char ** argv,
/** \ingroup signature /** \ingroup signature
* Tags found in signature header from package. * Tags found in signature header from package.
*/ */
/*@-enummemuse@*/
enum rpmtagSignature { enum rpmtagSignature {
RPMSIGTAG_SIZE = 1000, /*!< Size in bytes. */ RPMSIGTAG_SIZE = 1000, /*!< Size in bytes. */
/* the md5 sum was broken *twice* on big endian machines */ /* the md5 sum was broken *twice* on big endian machines */
@ -1684,6 +1732,7 @@ enum rpmtagSignature {
RPMTAG_HASH_TIGER192= RPMTAG_HASH_BASE+6, /*!< (unused) */ RPMTAG_HASH_TIGER192= RPMTAG_HASH_BASE+6, /*!< (unused) */
RPMTAG_HASH_HAVAL_5_160= RPMTAG_HASH_BASE+7 /*!< (unused) */ RPMTAG_HASH_HAVAL_5_160= RPMTAG_HASH_BASE+7 /*!< (unused) */
}; };
/*@=enummemuse@*/
/** /**
* Return codes from verifySignature(). * Return codes from verifySignature().

View File

@ -54,8 +54,11 @@ struct rpmvarValue {
struct rpmOption { struct rpmOption {
const char * name; const char * name;
int var; int var;
int archSpecific, required, macroize, localize; int archSpecific;
struct rpmOptionValue * value; /*@unused@*/ int required;
int macroize;
int localize;
/*@unused@*/ struct rpmOptionValue * value;
}; };
typedef struct defaultEntry_s { typedef struct defaultEntry_s {
@ -1530,12 +1533,12 @@ void rpmFreeRpmrc(void)
} }
for (i = 0; i < RPMVAR_NUM; i++) { for (i = 0; i < RPMVAR_NUM; i++) {
struct rpmvarValue *this; struct rpmvarValue * vp;
while ((this = values[i].next) != NULL) { while ((vp = values[i].next) != NULL) {
values[i].next = this->next; values[i].next = vp->next;
this->value = _free(this->value); vp->value = _free(vp->value);
this->arch = _free(this->arch); vp->arch = _free(vp->arch);
this = _free(this); vp = _free(vp);
} }
values[i].value = _free(values[i].value); values[i].value = _free(values[i].value);
values[i].arch = _free(values[i].arch); values[i].arch = _free(values[i].arch);

View File

@ -14,7 +14,9 @@
typedef enum sigType_e { typedef enum sigType_e {
RPMSIGTYPE_NONE = 0, /*!< unused, legacy. */ RPMSIGTYPE_NONE = 0, /*!< unused, legacy. */
RPMSIGTYPE_PGP262_1024 = 1, /*!< unused, legacy. */ RPMSIGTYPE_PGP262_1024 = 1, /*!< unused, legacy. */
/*@-enummemuse@*/
RPMSIGTYPE_BAD = 2, /*!< Unknown signature type. */ RPMSIGTYPE_BAD = 2, /*!< Unknown signature type. */
/*@=enummemuse@*/
RPMSIGTYPE_MD5 = 3, /*!< unused, legacy. */ RPMSIGTYPE_MD5 = 3, /*!< unused, legacy. */
RPMSIGTYPE_MD5_PGP = 4, /*!< unused, legacy. */ RPMSIGTYPE_MD5_PGP = 4, /*!< unused, legacy. */
RPMSIGTYPE_HEADERSIG= 5, /*!< Header style signature */ RPMSIGTYPE_HEADERSIG= 5, /*!< Header style signature */
@ -92,9 +94,11 @@ int rpmLookupSignatureType(int action)
/** \ingroup signature /** \ingroup signature
* Return path to pgp executable of given type, or NULL when not found. * Return path to pgp executable of given type, or NULL when not found.
*/ */
/*@-redecl@*/
/*@null@*/ const char * rpmDetectPGPVersion( /*@null@*/ const char * rpmDetectPGPVersion(
/*@null@*/ /*@out@*/ pgpVersion * pgpVer) /*@null@*/ /*@out@*/ pgpVersion * pgpVer)
/*@modifies *pgpVer, fileSystem @*/; /*@modifies *pgpVer, fileSystem @*/;
/*@=redecl@*/
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -25,10 +25,12 @@ struct StringBufRec {
/** /**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param this memory to free * @param p memory to free
* @return NULL always * @return NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * p) { /*@unused@*/ static inline /*@null@*/ void *
_free(/*@only@*/ /*@null@*/ const void * p) /*@modifies *p @*/
{
if (p != NULL) free((void *)p); if (p != NULL) free((void *)p);
return NULL; return NULL;
} }

View File

@ -15,23 +15,29 @@ extern "C" {
/** /**
*/ */
/*@only@*/ StringBuf newStringBuf(void); /*@only@*/ StringBuf newStringBuf(void)
/*@*/;
/** /**
*/ */
/*@null@*/ StringBuf freeStringBuf( /*@only@*/ /*@null@*/ StringBuf sb); /*@null@*/ StringBuf freeStringBuf( /*@only@*/ /*@null@*/ StringBuf sb)
/*@modifies sb @*/;
/** /**
*/ */
void truncStringBuf(StringBuf sb); /*@unused@*/
void truncStringBuf(StringBuf sb)
/*@modifies sb @*/;
/** /**
*/ */
/*@observer@*/ char *getStringBuf(StringBuf sb); /*@observer@*/ char * getStringBuf(StringBuf sb)
/*@*/;
/** /**
*/ */
void stripTrailingBlanksStringBuf(StringBuf sb); void stripTrailingBlanksStringBuf(StringBuf sb)
/*@modifies sb @*/;
/** /**
*/ */
@ -43,7 +49,8 @@ void stripTrailingBlanksStringBuf(StringBuf sb);
/** /**
*/ */
void appendStringBufAux(StringBuf sb, const char *s, int nl); void appendStringBufAux(StringBuf sb, const char * s, int nl)
/*@modifies sb @*/;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1388,17 +1388,23 @@ struct tsIterator_s {
}; };
/** /**
* Return transaction element order count.
* @param a transaction element iterator
* @return element order count
*/ */
static int tsGetOc(void * this) { static int tsGetOc(void * a) {
struct tsIterator_s * iter = this; struct tsIterator_s * iter = a;
int oc = iter->ocsave; int oc = iter->ocsave;
return oc; return oc;
} }
/** /**
* Return transaction element available package pointer.
* @param a transaction element iterator
* @return available package pointer
*/ */
static /*@dependent@*/ struct availablePackage * tsGetAlp(void * this) { static /*@dependent@*/ struct availablePackage * tsGetAlp(void * a) {
struct tsIterator_s * iter = this; struct tsIterator_s * iter = a;
struct availablePackage * alp = NULL; struct availablePackage * alp = NULL;
int oc = iter->ocsave; int oc = iter->ocsave;
@ -1413,22 +1419,22 @@ static /*@dependent@*/ struct availablePackage * tsGetAlp(void * this) {
/** /**
* Destroy transaction element iterator. * Destroy transaction element iterator.
* @param this transaction element iterator * @param a transaction element iterator
* @return NULL always * @return NULL always
*/ */
static /*@null@*/ void * tsFreeIterator(/*@only@*//*@null@*/ const void * this) static /*@null@*/ void * tsFreeIterator(/*@only@*//*@null@*/ const void * a)
{ {
return _free(this); return _free(a);
} }
/** /**
* Create transaction element iterator. * Create transaction element iterator.
* @param this transaction set * @param a transaction set
* @return transaction element iterator * @return transaction element iterator
*/ */
static void * tsInitIterator(/*@kept@*/ const void * this) static void * tsInitIterator(/*@kept@*/ const void * a)
{ {
rpmTransactionSet ts = (void *)this; rpmTransactionSet ts = (void *)a;
struct tsIterator_s * iter = NULL; struct tsIterator_s * iter = NULL;
iter = xcalloc(1, sizeof(*iter)); iter = xcalloc(1, sizeof(*iter));
@ -1441,11 +1447,11 @@ static void * tsInitIterator(/*@kept@*/ const void * this)
/** /**
* Return next transaction element's file info. * Return next transaction element's file info.
* @param this file info iterator * @param a file info iterator
* @return next index, -1 on termination * @return next index, -1 on termination
*/ */
static /*@dependent@*/ TFI_t tsNextIterator(void * this) { static /*@dependent@*/ TFI_t tsNextIterator(void * a) {
struct tsIterator_s * iter = this; struct tsIterator_s * iter = a;
rpmTransactionSet ts = iter->ts; rpmTransactionSet ts = iter->ts;
TFI_t fi = NULL; TFI_t fi = NULL;
int oc = -1; int oc = -1;
@ -1526,7 +1532,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
#else #else
struct statfs sfb; struct statfs sfb;
# if STAT_STATFS4 # if STAT_STATFS4
/* this platform has the 4-argument version of the statfs call. The last two /* This platform has the 4-argument version of the statfs call. The last two
* should be the size of struct statfs and 0, respectively. The 0 is the * should be the size of struct statfs and 0, respectively. The 0 is the
* filesystem type, and is always 0 when statfs is called on a mounted * filesystem type, and is always 0 when statfs is called on a mounted
* filesystem, as we're doing. * filesystem, as we're doing.

View File

@ -19,7 +19,10 @@
/*@access rpmdb*/ /* XXX compared with NULL */ /*@access rpmdb*/ /* XXX compared with NULL */
static int _ie = 0x44332211; static int _ie = 0x44332211;
static union _vendian { int i; char b[4]; } *_endian = (union _vendian *)&_ie; static union _vendian {
/*@unused@*/ int i;
char b[4];
} *_endian = (union _vendian *)&_ie;
#define IS_BIG_ENDIAN() (_endian->b[0] == '\x44') #define IS_BIG_ENDIAN() (_endian->b[0] == '\x44')
#define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11') #define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11')

View File

@ -477,7 +477,7 @@ findOption(const struct poptOption * opt, /*@null@*/ const char * longName,
} }
static const char * findNextArg(/*@special@*/ poptContext con, static const char * findNextArg(/*@special@*/ poptContext con,
unsigned argx, int delete) unsigned argx, int delete_arg)
/*@uses con->optionStack, con->os, /*@uses con->optionStack, con->os,
con->os->next, con->os->argb, con->os->argc, con->os->argv @*/ con->os->next, con->os->argb, con->os->argc, con->os->argv @*/
{ {
@ -495,7 +495,7 @@ static const char * findNextArg(/*@special@*/ poptContext con,
if (*os->argv[i] == '-') continue; if (*os->argv[i] == '-') continue;
if (--argx > 0) continue; if (--argx > 0) continue;
arg = os->argv[i]; arg = os->argv[i];
if (delete) { if (delete_arg) {
if (os->argb == NULL) os->argb = PBM_ALLOC(os->argc); if (os->argb == NULL) os->argb = PBM_ALLOC(os->argc);
if (os->argb != NULL) /* XXX can't happen */ if (os->argb != NULL) /* XXX can't happen */
PBM_SET(i, os->argb); PBM_SET(i, os->argb);

View File

@ -142,7 +142,9 @@ typedef /*@abstract@*/ struct poptContext_s * poptContext;
/** \ingroup popt /** \ingroup popt
*/ */
#ifndef __cplusplus #ifndef __cplusplus
/*@-typeuse@*/
typedef struct poptOption * poptOption; typedef struct poptOption * poptOption;
/*@=typeuse@*/
#endif #endif
enum poptCallbackReason { POPT_CALLBACK_REASON_PRE, enum poptCallbackReason { POPT_CALLBACK_REASON_PRE,
@ -161,7 +163,8 @@ typedef void (*poptCallbackType) (poptContext con,
enum poptCallbackReason reason, enum poptCallbackReason reason,
/*@null@*/ const struct poptOption * opt, /*@null@*/ const struct poptOption * opt,
/*@null@*/ const char * arg, /*@null@*/ const char * arg,
/*@null@*/ const void * data); /*@null@*/ const void * data)
/*@*/;
/** \ingroup popt /** \ingroup popt
* Initialize popt context. * Initialize popt context.
@ -176,61 +179,73 @@ typedef void (*poptCallbackType) (poptContext con,
/*@dependent@*/ /*@keep@*/ const char * name, /*@dependent@*/ /*@keep@*/ const char * name,
int argc, /*@dependent@*/ /*@keep@*/ const char ** argv, int argc, /*@dependent@*/ /*@keep@*/ const char ** argv,
/*@dependent@*/ /*@keep@*/ const struct poptOption * options, /*@dependent@*/ /*@keep@*/ const struct poptOption * options,
int flags); int flags)
/*@*/;
/** \ingroup popt /** \ingroup popt
* Reinitialize popt context. * Reinitialize popt context.
* @param con context * @param con context
*/ */
void poptResetContext(/*@null@*/poptContext con); void poptResetContext(/*@null@*/poptContext con)
/*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Return value of next option found. * Return value of next option found.
* @param con context * @param con context
* @return next option val, -1 on last item, POPT_ERROR_* on error * @return next option val, -1 on last item, POPT_ERROR_* on error
*/ */
int poptGetNextOpt(/*@null@*/poptContext con); int poptGetNextOpt(/*@null@*/poptContext con)
/* returns NULL if no argument is available */ /*@modifies con @*/;
/*@-redecl@*/
/** \ingroup popt /** \ingroup popt
* Return next option argument (if any).
* @param con context * @param con context
* @return option argument, NULL if no more options are available
*/ */
/*@observer@*/ /*@null@*/ const char * poptGetOptArg(/*@null@*/poptContext con); /*@observer@*/ /*@null@*/ const char * poptGetOptArg(/*@null@*/poptContext con)
/*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Return current option's argument. * Return current option's argument.
* @param con context * @param con context
* @return option argument, NULL if no more options are available * @return option argument, NULL if no more options are available
*/ */
/*@observer@*/ /*@null@*/ const char * poptGetArg(/*@null@*/poptContext con); /*@observer@*/ /*@null@*/ const char * poptGetArg(/*@null@*/poptContext con)
/*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Peek at current option's argument. * Peek at current option's argument.
* @param con context * @param con context
* @return option argument * @return option argument
*/ */
/*@observer@*/ /*@null@*/ const char * poptPeekArg(/*@null@*/poptContext con); /*@observer@*/ /*@null@*/ const char * poptPeekArg(/*@null@*/poptContext con)
/*@*/;
/** \ingroup popt /** \ingroup popt
* Return remaining arguments. * Return remaining arguments.
* @param con context * @param con context
* @return argument array, terminated with NULL * @return argument array, terminated with NULL
*/ */
/*@observer@*/ /*@null@*/ const char ** poptGetArgs(/*@null@*/poptContext con); /*@observer@*/ /*@null@*/ const char ** poptGetArgs(/*@null@*/poptContext con)
/*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Return the option which caused the most recent error. * Return the option which caused the most recent error.
* @param con context * @param con context
* @return offending option * @return offending option
*/ */
/*@observer@*/ const char * poptBadOption(/*@null@*/poptContext con, int flags); /*@observer@*/ const char * poptBadOption(/*@null@*/poptContext con, int flags)
/*@*/;
/*@=redecl@*/
/** \ingroup popt /** \ingroup popt
* Destroy context. * Destroy context.
* @param con context * @param con context
* @return NULL * @return NULL always
*/ */
/*@null@*/ poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext con); /*@null@*/ poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext con)
/*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Add arguments to context. * Add arguments to context.
@ -238,7 +253,8 @@ int poptGetNextOpt(/*@null@*/poptContext con);
* @param argv argument array, NULL terminated * @param argv argument array, NULL terminated
* @return 0 on success, POPT_ERROR_OPTSTOODEEP on failure * @return 0 on success, POPT_ERROR_OPTSTOODEEP on failure
*/ */
int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv); int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv)
/*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Add alias to context. * Add alias to context.
@ -248,7 +264,8 @@ int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv);
* @param flags (unused) * @param flags (unused)
* @return 0 always * @return 0 always
*/ */
int poptAddAlias(poptContext con, struct poptAlias alias, int flags); int poptAddAlias(poptContext con, struct poptAlias alias, int flags)
/*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Read configuration file. * Read configuration file.
@ -306,8 +323,10 @@ int poptParseArgvString(const char * s,
* @param error popt error * @param error popt error
* @return error string * @return error string
*/ */
/*@-redecl@*/
/*@observer@*/ const char *const poptStrerror(const int error) /*@observer@*/ const char *const poptStrerror(const int error)
/*@*/; /*@*/;
/*@=redecl@*/
/** \ingroup popt /** \ingroup popt
* Limit search for executables. * Limit search for executables.
@ -315,7 +334,8 @@ int poptParseArgvString(const char * s,
* @param path single path to search for executables * @param path single path to search for executables
* @param allowAbsolute absolute paths only? * @param allowAbsolute absolute paths only?
*/ */
void poptSetExecPath(poptContext con, const char * path, int allowAbsolute); void poptSetExecPath(poptContext con, const char * path, int allowAbsolute)
/*@modifies con @*/;
/** \ingroup popt /** \ingroup popt
* Print detailed description of options. * Print detailed description of options.
@ -323,7 +343,8 @@ void poptSetExecPath(poptContext con, const char * path, int allowAbsolute);
* @param f ouput file handle * @param f ouput file handle
* @param flags (unused) * @param flags (unused)
*/ */
void poptPrintHelp(poptContext con, FILE * f, /*@unused@*/ int flags); void poptPrintHelp(poptContext con, FILE * f, /*@unused@*/ int flags)
/*@modifies *f @*/;
/** \ingroup popt /** \ingroup popt
* Print terse description of options. * Print terse description of options.
@ -331,27 +352,40 @@ void poptPrintHelp(poptContext con, FILE * f, /*@unused@*/ int flags);
* @param f ouput file handle * @param f ouput file handle
* @param flags (unused) * @param flags (unused)
*/ */
void poptPrintUsage(poptContext con, FILE * f, /*@unused@*/ int flags); void poptPrintUsage(poptContext con, FILE * f, /*@unused@*/ int flags)
/*@modifies *f @*/;
/** \ingroup popt /** \ingroup popt
* Provide text to replace default "[OPTION...]" in help/usage output. * Provide text to replace default "[OPTION...]" in help/usage output.
* @param con context * @param con context
* @param text replacement text * @param text replacement text
*/ */
void poptSetOtherOptionHelp(poptContext con, const char * text); /*@-fcnuse@*/
void poptSetOtherOptionHelp(poptContext con, const char * text)
/*@modifies con @*/;
/*@=fcnuse@*/
/** \ingroup popt /** \ingroup popt
* Return argv[0] from context. * Return argv[0] from context.
* @param con context * @param con context
* @return argv[0]
*/ */
/*@observer@*/ const char * poptGetInvocationName(poptContext con); /*@-redecl -fcnuse@*/
/*@observer@*/ const char * poptGetInvocationName(poptContext con)
/*@*/;
/*@=redecl =fcnuse@*/
/** \ingroup popt /** \ingroup popt
* Shuffle argv pointers to remove stripped args, returns new argc. * Shuffle argv pointers to remove stripped args, returns new argc.
* @param con context * @param con context
* @param argc no. of args
* @param argv arg vector
* @return new argc * @return new argc
*/ */
int poptStrippedArgv(poptContext con, int argc, char ** argv); /*@-fcnuse@*/
int poptStrippedArgv(poptContext con, int argc, char ** argv)
/*@modifies *argv @*/;
/*@=fcnuse@*/
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -180,30 +180,30 @@ static int maxArgWidth(const struct poptOption * opt,
/*@null@*/ const char * translation_domain) /*@null@*/ const char * translation_domain)
{ {
int max = 0; int max = 0;
int this = 0; int len = 0;
const char * s; const char * s;
if (opt != NULL) if (opt != NULL)
while (opt->longName || opt->shortName || opt->arg) { while (opt->longName || opt->shortName || opt->arg) {
if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) { if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
if (opt->arg) /* XXX program error */ if (opt->arg) /* XXX program error */
this = maxArgWidth(opt->arg, translation_domain); len = maxArgWidth(opt->arg, translation_domain);
if (this > max) max = this; if (len > max) max = len;
} else if (!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) { } else if (!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
this = sizeof(" ")-1; len = sizeof(" ")-1;
if (opt->shortName != '\0') this += sizeof("-X")-1; if (opt->shortName != '\0') len += sizeof("-X")-1;
if (opt->shortName != '\0' && opt->longName) this += sizeof(", ")-1; if (opt->shortName != '\0' && opt->longName) len += sizeof(", ")-1;
if (opt->longName) { if (opt->longName) {
this += ((opt->argInfo & POPT_ARGFLAG_ONEDASH) len += ((opt->argInfo & POPT_ARGFLAG_ONEDASH)
? sizeof("-")-1 : sizeof("--")-1); ? sizeof("-")-1 : sizeof("--")-1);
this += strlen(opt->longName); len += strlen(opt->longName);
} }
s = getArgDescrip(opt, translation_domain); s = getArgDescrip(opt, translation_domain);
if (s) if (s)
this += sizeof("=")-1 + strlen(s); len += sizeof("=")-1 + strlen(s);
if (opt->argInfo & POPT_ARGFLAG_OPTIONAL) this += sizeof("[]")-1; if (opt->argInfo & POPT_ARGFLAG_OPTIONAL) len += sizeof("[]")-1;
if (this > max) max = this; if (len > max) max = len;
} }
opt++; opt++;

View File

@ -11,11 +11,11 @@
/** /**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param this memory to free * @param p memory to free
* @retval NULL always * @retval NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) { /*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * p) {
if (this != NULL) free((void *)this); if (p != NULL) free((void *)p);
return NULL; return NULL;
} }

View File

@ -42,9 +42,9 @@ char *alloca ();
#define alloca __builtin_alloca #define alloca __builtin_alloca
#endif #endif
#if !defined(__LCLINT__)
/*@only@*/ char * xstrdup (const char *str); /*@only@*/ char * xstrdup (const char *str);
#if !defined(__LCLINT__)
#if HAVE_MCHECK_H && defined(__GNUC__) #if HAVE_MCHECK_H && defined(__GNUC__)
#define vmefail() (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL) #define vmefail() (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
#define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str))) #define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))

View File

@ -7,17 +7,100 @@
+unixlib +unixlib
# XXX ignore doxygen markings -unrecogcomments # XXX ignore doxygen markings
-unrecogcomments
#+proto-param-match
#-deepbreak # shortcut 485 cases
# --- not-yet at strict level
#+ptrarith
#+bitwisesigned
#+strictops
#+sizeoftype
#+mod-uncon # shortcut alloca is painful
#+mod-nomods
#+modglobsnomods
#+modstrictglobsnomods
#+mod-uncon-nomods
#+mod-internal-strict
#+mod-file-sys
#+globnoglobs
#+internalglobs
#+internalglobnoglobs
#+modglobsunchecked
#+warnmissingglobs
#+warnmissingglobsnomods
#+impcheckedstrictglobs
#+impcheckedstrictstatics
#+strictusereleas
#+strictbranchstate
#+strictdestroy
#+modobserveruncon
#+macroempty
#+ansi-reserved-internal
#+evalorderuncon
#+elseifcomplete
#+loopswitchbreak
#+switchswitchbreak
#+looploopcontinue
#+whileblock
#+forempty
#+forblock
#+ifblock
#+noeffectuncon
+topuse
#+unusedspecial
#+export-local
#+oldstyle
#+sys-dir-errors
#controlnestdepth 15
#stringliterallen 509
#numstructfields 127
#numenummembers 127
# --- not-yet at checks level
#+predboolptr
-ptrnegate
#-enumint
-relaxquals
#+mustmod # segfault in psm.c:597
#+allglobs
#+impcheckmodinternals
#+uncheckedglobalias
#+deparrays
#+onlyunqglobaltrans
#+staticinittrans
#+unqualifiedinittrans
#+retalias
#+assignexpose
#+castexpose
#+retexpose
#+readonlytrans
#+sefuncon
#+ansi-reserved
+cpp-names # check for c++ names
#+infloopsuncon
#+looploopbreak
#+switchloopbreak
#+whileempty
+declundef
+export-header
+export-header-var
+redecl
+noparams
#includenest 8
# don't-bother-me-yet parameters # don't-bother-me-yet parameters
-branchstate # ~140 painful -branchstate # painful
-mustfree # ~588 alloca is painful -mustfree # alloca is painful
# not-yet normal parameters # --- not-yet at standard level
-boolops # ~831 w->n -boolops # w->n
-predboolint # ~574 w->n -predboolint # w->n
-type # ~872 -type #
# -weak paramaters # -weak paramaters
#+boolint #+boolint

View File

@ -481,7 +481,8 @@ static int db1close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
return rc; return rc;
} }
static int db1open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip) static int db1open(/*@keep@*/ rpmdb rpmdb, int rpmtag,
/*@out@*/ dbiIndex * dbip)
{ {
/*@-nestedextern@*/ /*@-nestedextern@*/
extern struct _dbiVec db1vec; extern struct _dbiVec db1vec;
@ -571,8 +572,10 @@ exit:
/** \ingroup db1 /** \ingroup db1
*/ */
/*@-exportheadervar@*/
struct _dbiVec db1vec = { struct _dbiVec db1vec = {
DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH, DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
db1open, db1close, db1sync, db1copen, db1cclose, db1cdel, db1cget, db1cput, db1open, db1close, db1sync, db1copen, db1cclose, db1cdel, db1cget, db1cput,
db1ccount, db1byteswapped, db1stat db1ccount, db1byteswapped, db1stat
}; };
/*@=exportheadervar@*/

View File

@ -17,6 +17,7 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#include <rpmurl.h> /* XXX urlPath proto */ #include <rpmurl.h> /* XXX urlPath proto */
#include "rpmdb.h" #include "rpmdb.h"
#include "debug.h" #include "debug.h"
/*@access rpmdb@*/ /*@access rpmdb@*/
@ -26,6 +27,7 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
/** \ingroup dbi /** \ingroup dbi
* Hash database statistics. * Hash database statistics.
*/ */
/*@-fielduse@*/
struct dbiHStats_s { struct dbiHStats_s {
unsigned int hash_magic; /*!< hash database magic number. */ unsigned int hash_magic; /*!< hash database magic number. */
unsigned int hash_version; /*!< version of the hash database. */ unsigned int hash_version; /*!< version of the hash database. */
@ -68,6 +70,7 @@ struct dbiBStats_s {
unsigned int bt_dup_pgfree; /*!< no. of bytes free in duplicate pages. */ unsigned int bt_dup_pgfree; /*!< no. of bytes free in duplicate pages. */
unsigned int bt_over_pgfree;/*!< no. of bytes free in overflow pages. */ unsigned int bt_over_pgfree;/*!< no. of bytes free in overflow pages. */
}; };
/*@=fielduse@*/
#if DB_VERSION_MAJOR == 3 #if DB_VERSION_MAJOR == 3
#define __USE_DB3 1 #define __USE_DB3 1
@ -1172,10 +1175,12 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
/** \ingroup db3 /** \ingroup db3
*/ */
/*@-exportheadervar@*/
struct _dbiVec db3vec = { struct _dbiVec db3vec = {
DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH, DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
db3open, db3close, db3sync, db3copen, db3cclose, db3cdel, db3cget, db3cput, db3open, db3close, db3sync, db3copen, db3cclose, db3cdel, db3cget, db3cput,
db3ccount, db3byteswapped, db3stat db3ccount, db3byteswapped, db3stat
}; };
/*@=exportheadervar@*/
#endif /* DB_VERSION_MAJOR == 3 */ #endif /* DB_VERSION_MAJOR == 3 */

View File

@ -19,9 +19,9 @@
#if DB_VERSION_MAJOR == 3 #if DB_VERSION_MAJOR == 3
#define __USE_DB3 1 #define __USE_DB3 1
/*@-exportlocal@*/ /*@-exportlocal -exportheadervar@*/
struct _dbiIndex db3dbi; struct _dbiIndex db3dbi;
/*@=exportlocal@*/ /*@=exportlocal =exportheadervar@*/
/** \ingroup db3 /** \ingroup db3
* Analogue to struct poptOption * Analogue to struct poptOption
@ -39,7 +39,7 @@ struct dbOption {
#define _POPT_SET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_OR) #define _POPT_SET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_OR)
#define _POPT_UNSET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_NAND) #define _POPT_UNSET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_NAND)
/*@-immediatetrans -exportlocal@*/ /*@-immediatetrans -exportlocal -exportheadervar@*/
/** \ingroup db3 /** \ingroup db3
*/ */
struct dbOption rdbOptions[] = { struct dbOption rdbOptions[] = {
@ -247,7 +247,7 @@ struct dbOption rdbOptions[] = {
{ NULL, 0,0, NULL, 0, NULL, NULL } { NULL, 0,0, NULL, 0, NULL, NULL }
}; };
/*@=immediatetrans =exportlocal@*/ /*@=immediatetrans =exportlocal =exportheadervar@*/
static int dbSaveLong(const struct dbOption * opt, int argInfo, long aLong) { static int dbSaveLong(const struct dbOption * opt, int argInfo, long aLong) {
if (argInfo & POPT_ARGFLAG_NOT) if (argInfo & POPT_ARGFLAG_NOT)
@ -314,6 +314,7 @@ dbiIndex db3Free(dbiIndex dbi) {
return dbi; return dbi;
} }
/** @todo Set a reasonable "last gasp" default db config. */
static const char *db3_config_default = static const char *db3_config_default =
"db3:hash:mpool:cdb:usecursors:verbose:mp_mmapsize=8Mb:mp_size=512Kb:pagesize=512:perms=0644"; "db3:hash:mpool:cdb:usecursors:verbose:mp_mmapsize=8Mb:mp_size=512Kb:pagesize=512:perms=0644";

View File

@ -42,10 +42,12 @@ struct faFooter {
} ; } ;
/* =============================================================== */ /* =============================================================== */
/*@-nullassign@*/
static struct FDIO_s fadio_s = { static struct FDIO_s fadio_s = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
fadOpen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL fadOpen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
}; };
/*@=nullassign@*/
FDIO_t fadio = /*@-compmempass@*/ &fadio_s /*@=compmempass@*/ ; FDIO_t fadio = /*@-compmempass@*/ &fadio_s /*@=compmempass@*/ ;
/* =============================================================== */ /* =============================================================== */

View File

@ -126,6 +126,7 @@ void fpLookupList(fingerPrintCache cache, const char ** dirNames,
* @param h package header * @param h package header
* @retval fpList pointer to array of finger prints * @retval fpList pointer to array of finger prints
*/ */
/*@unused@*/
void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList) void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
/*@modifies h, cache, *fpList @*/; /*@modifies h, cache, *fpList @*/;

View File

@ -24,13 +24,15 @@ static int _debug = 0;
/*@access Header@*/ /* XXX compared with NULL */ /*@access Header@*/ /* XXX compared with NULL */
/*@access rpmdbMatchIterator@*/ /*@access rpmdbMatchIterator@*/
/*@-redecl@*/
extern int _noDirTokens; extern int _noDirTokens;
/*@=redecl@*/
static int _rebuildinprogress = 0; static int _rebuildinprogress = 0;
static int _db_filter_dups = 1; static int _db_filter_dups = 1;
/*@-exportlocal@*/ /*@-exportlocal -exportheadervar@*/
int _filterDbDups = 0; /* Filter duplicate entries ? (bug in pre rpm-3.0.4) */ int _filterDbDups = 0; /* Filter duplicate entries ? (bug in pre rpm-3.0.4) */
/*@=exportlocal@*/ /*@=exportlocal =exportheadervar@*/
#define _DBI_FLAGS 0 #define _DBI_FLAGS 0
#define _DBI_PERMS 0644 #define _DBI_PERMS 0644
@ -114,6 +116,7 @@ static void dbiTagsInit(void)
dbiTagStr = _free(dbiTagStr); dbiTagStr = _free(dbiTagStr);
} }
/*@-redecl@*/
#if USE_DB1 #if USE_DB1
extern struct _dbiVec db1vec; extern struct _dbiVec db1vec;
#define DB1vec &db1vec #define DB1vec &db1vec
@ -134,6 +137,7 @@ extern struct _dbiVec db3vec;
#else #else
#define DB3vec NULL #define DB3vec NULL
#endif #endif
/*@=redecl@*/
/*@-nullassign@*/ /*@-nullassign@*/
static struct _dbiVec *mydbvecs[] = { static struct _dbiVec *mydbvecs[] = {
@ -998,7 +1002,9 @@ int rpmdbVerify(const char * prefix)
/*@=unqualifiedtrans@*/ /*@=unqualifiedtrans@*/
} }
/*@-nullstate@*/ /* FIX: rpmdb->_dbi[] may be NULL. */
xx = rpmdbClose(rpmdb); xx = rpmdbClose(rpmdb);
/*@=nullstate@*/
if (xx && rc == 0) rc = xx; if (xx && rc == 0) rc = xx;
rpmdb = NULL; rpmdb = NULL;
} }
@ -1742,6 +1748,7 @@ fprintf(stderr, "*** RMW %s %p\n", tagName(rpmtag), dbi->dbi_rmw);
mi->mi_dbc = NULL; mi->mi_dbc = NULL;
mi->mi_set = set; mi->mi_set = set;
mi->mi_setx = 0; mi->mi_setx = 0;
mi->mi_ndups = 0;
mi->mi_h = NULL; mi->mi_h = NULL;
mi->mi_sorted = 0; mi->mi_sorted = 0;
mi->mi_cflags = 0; mi->mi_cflags = 0;

View File

@ -10,13 +10,6 @@
#include "fprint.h" #include "fprint.h"
#ifdef __LCLINT__
typedef unsigned int u_int32_t;
typedef unsigned short u_int16_t;
typedef unsigned char u_int8_t;
typedef int int32_t;
#endif
typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem; typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
typedef /*@abstract@*/ struct _dbiIndex * dbiIndex; typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
@ -37,10 +30,12 @@ struct _dbiIndexItem {
* A single item in an index database (i.e. the "data saved"). * A single item in an index database (i.e. the "data saved").
*/ */
struct _dbiIR { struct _dbiIR {
unsigned int recOffset; /*!< byte offset of header in db */ /*@unused@*/ unsigned int recOffset; /*!< byte offset of header in db */
unsigned int fileNumber; /*!< file array index */ /*@unused@*/ unsigned int fileNumber; /*!< file array index */
}; };
/*@-typeuse@*/
typedef struct _dbiIR * DBIR_t; typedef struct _dbiIR * DBIR_t;
/*@=typeuse@*/
/** \ingroup dbi /** \ingroup dbi
* Items retrieved from the index database. * Items retrieved from the index database.
@ -72,7 +67,8 @@ struct _dbiVec {
* @param rpmtag rpm tag * @param rpmtag rpm tag
* @return 0 on success * @return 0 on success
*/ */
int (*open) (rpmdb rpmdb, int rpmtag, /*@out@*/ dbiIndex * dbip); int (*open) (rpmdb rpmdb, int rpmtag, /*@out@*/ dbiIndex * dbip)
/*@modifies *dbip @*/;
/** \ingroup dbi /** \ingroup dbi
* Close index database, and destroy database handle. * Close index database, and destroy database handle.
@ -80,7 +76,8 @@ struct _dbiVec {
* @param flags (unused) * @param flags (unused)
* @return 0 on success * @return 0 on success
*/ */
int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags); int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags)
/*@modifies dbi, fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Flush pending operations to disk. * Flush pending operations to disk.
@ -88,7 +85,8 @@ struct _dbiVec {
* @param flags (unused) * @param flags (unused)
* @return 0 on success * @return 0 on success
*/ */
int (*sync) (dbiIndex dbi, unsigned int flags); int (*sync) (dbiIndex dbi, unsigned int flags)
/*@modifies fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Open database cursor. * Open database cursor.
@ -96,7 +94,8 @@ struct _dbiVec {
* @param dbcp address of database cursor * @param dbcp address of database cursor
* @param flags (unused) * @param flags (unused)
*/ */
int (*copen) (dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int flags); int (*copen) (dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int flags)
/*@modifies dbi, *dbcp @*/;
/** \ingroup dbi /** \ingroup dbi
* Close database cursor. * Close database cursor.
@ -104,7 +103,8 @@ struct _dbiVec {
* @param dbcursor database cursor * @param dbcursor database cursor
* @param flags (unused) * @param flags (unused)
*/ */
int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags); int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
/*@modifies dbi, *dbcursor @*/;
/** \ingroup dbi /** \ingroup dbi
* Delete (key,data) pair(s) using db->del or dbcursor->c_del. * Delete (key,data) pair(s) using db->del or dbcursor->c_del.
@ -115,7 +115,9 @@ struct _dbiVec {
* @param flags (unused) * @param flags (unused)
* @return 0 on success * @return 0 on success
*/ */
int (*cdel) (dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen, unsigned int flags); int (*cdel) (dbiIndex dbi, DBC * dbcursor,
const void * keyp, size_t keylen, unsigned int flags)
/*@modifies *dbcursor, fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Retrieve (key,data) pair using db->get or dbcursor->c_get. * Retrieve (key,data) pair using db->get or dbcursor->c_get.
@ -131,7 +133,9 @@ struct _dbiVec {
int (*cget) (dbiIndex dbi, DBC * dbcursor, int (*cget) (dbiIndex dbi, DBC * dbcursor,
/*@out@*/ void ** keypp, /*@out@*/ size_t * keylenp, /*@out@*/ void ** keypp, /*@out@*/ size_t * keylenp,
/*@out@*/ void ** datapp, /*@out@*/ size_t * datalenp, /*@out@*/ void ** datapp, /*@out@*/ size_t * datalenp,
unsigned int flags); unsigned int flags)
/*@modifies *dbcursor, *keypp, *keylenp, *datapp, *datalenp,
fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Store (key,data) pair using db->put or dbcursor->c_put. * Store (key,data) pair using db->put or dbcursor->c_put.
@ -147,7 +151,8 @@ struct _dbiVec {
int (*cput) (dbiIndex dbi, DBC * dbcursor, int (*cput) (dbiIndex dbi, DBC * dbcursor,
const void * keyp, size_t keylen, const void * keyp, size_t keylen,
const void * datap, size_t datalen, const void * datap, size_t datalen,
unsigned int flags); unsigned int flags)
/*@modifies *dbcursor, fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Retrieve count of (possible) duplicate items using dbcursor->c_count. * Retrieve count of (possible) duplicate items using dbcursor->c_count.
@ -159,14 +164,16 @@ struct _dbiVec {
*/ */
int (*ccount) (dbiIndex dbi, DBC * dbcursor, int (*ccount) (dbiIndex dbi, DBC * dbcursor,
/*@out@*/ unsigned int * countp, /*@out@*/ unsigned int * countp,
unsigned int flags); unsigned int flags)
/*@modifies *dbcursor @*/;
/** \ingroup dbi /** \ingroup dbi
* Is database byte swapped? * Is database byte swapped?
* @param dbi index database handle * @param dbi index database handle
* @return 0 no * @return 0 no
*/ */
int (*byteswapped) (dbiIndex dbi); int (*byteswapped) (dbiIndex dbi)
/*@*/;
/** \ingroup dbi /** \ingroup dbi
* Save statistics in database handle. * Save statistics in database handle.
@ -174,7 +181,8 @@ struct _dbiVec {
* @param flags retrieve statistics that don't require traversal? * @param flags retrieve statistics that don't require traversal?
* @return 0 on success * @return 0 on success
*/ */
int (*stat) (dbiIndex dbi, unsigned int flags); int (*stat) (dbiIndex dbi, unsigned int flags)
/*@modifies dbi @*/;
}; };
@ -217,8 +225,9 @@ struct _dbiIndex {
/* dbenv parameters */ /* dbenv parameters */
int dbi_lorder; int dbi_lorder;
/*@null@*/ void (*db_errcall) (const char *db_errpfx, char *buffer); /*@unused@*/ /*@null@*/ void (*db_errcall) (const char *db_errpfx, char *buffer)
/*@shared@*/ FILE * dbi_errfile; /*@modifies fileSystem @*/;
/*@unused@*/ /*@shared@*/ FILE * dbi_errfile;
const char * dbi_errpfx; const char * dbi_errpfx;
int dbi_verbose; int dbi_verbose;
int dbi_region_init; int dbi_region_init;
@ -229,32 +238,40 @@ struct _dbiIndex {
/* lock sub-system parameters */ /* lock sub-system parameters */
unsigned int dbi_lk_max; unsigned int dbi_lk_max;
unsigned int dbi_lk_detect; unsigned int dbi_lk_detect;
int dbi_lk_nmodes; /*@unused@*/ int dbi_lk_nmodes;
unsigned char *dbi_lk_conflicts; /*@unused@*/ unsigned char * dbi_lk_conflicts;
/* log sub-system parameters */ /* log sub-system parameters */
unsigned int dbi_lg_max; unsigned int dbi_lg_max;
unsigned int dbi_lg_bsize; unsigned int dbi_lg_bsize;
/* transaction sub-system parameters */ /* transaction sub-system parameters */
unsigned int dbi_tx_max; unsigned int dbi_tx_max;
#if 0 #if 0
int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec, DB_LSN *lsnp, int redo, void *info); int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec,
DB_LSN *lsnp, int redo, void *info)
/*@modifies fileSystem @*/;
#endif #endif
/* dbinfo parameters */ /* dbinfo parameters */
int dbi_cachesize; /*!< */ int dbi_cachesize; /*!< */
int dbi_pagesize; /*!< (fs blksize) */ int dbi_pagesize; /*!< (fs blksize) */
/*@null@*/ void * (*dbi_malloc) (size_t nbytes); /*@unused@*/ /*@null@*/ void * (*dbi_malloc) (size_t nbytes)
/*@*/;
/* hash access parameters */ /* hash access parameters */
unsigned int dbi_h_ffactor; /*!< */ unsigned int dbi_h_ffactor; /*!< */
/*@null@*/ unsigned int (*dbi_h_hash_fcn) (const void *bytes, unsigned int length); /*@unused@*/ /*@null@*/ unsigned int (*dbi_h_hash_fcn) (const void *bytes, unsigned int length)
/*@modifies internalState @*/;
unsigned int dbi_h_nelem; /*!< */ unsigned int dbi_h_nelem; /*!< */
unsigned int dbi_h_flags; /*!< DB_DUP, DB_DUPSORT */ unsigned int dbi_h_flags; /*!< DB_DUP, DB_DUPSORT */
/*@null@*/ int (*dbi_h_dup_compare_fcn) (const DBT *, const DBT *); /*@unused@*/ /*@null@*/ int (*dbi_h_dup_compare_fcn) (const DBT *, const DBT *)
/*@modifies internalState @*/;
/* btree access parameters */ /* btree access parameters */
int dbi_bt_flags; int dbi_bt_flags;
int dbi_bt_minkey; /*@unused@*/ int dbi_bt_minkey;
/*@null@*/ int (*dbi_bt_compare_fcn) (const DBT *, const DBT *); /*@unused@*/ /*@null@*/ int (*dbi_bt_compare_fcn) (const DBT *, const DBT *)
/*@null@*/ int (*dbi_bt_dup_compare_fcn) (const DBT *, const DBT *); /*@modifies internalState @*/;
/*@null@*/ size_t (*dbi_bt_prefix_fcn) (const DBT *, const DBT *); /*@unused@*/ /*@null@*/ int (*dbi_bt_dup_compare_fcn) (const DBT *, const DBT *)
/*@modifies internalState @*/;
/*@unused@*/ /*@null@*/ size_t (*dbi_bt_prefix_fcn) (const DBT *, const DBT *)
/*@modifies internalState @*/;
/* recno access parameters */ /* recno access parameters */
int dbi_re_flags; int dbi_re_flags;
int dbi_re_delim; int dbi_re_delim;
@ -293,12 +310,16 @@ struct rpmdb_s {
int db_remove_env; int db_remove_env;
int db_filter_dups; int db_filter_dups;
/*@owned@*/ const char *db_errpfx; /*@owned@*/ const char *db_errpfx;
void (*db_errcall) (const char *db_errpfx, char *buffer); void (*db_errcall) (const char *db_errpfx, char *buffer)
/*@*/;
/*@shared@*/ FILE * db_errfile; /*@shared@*/ FILE * db_errfile;
/*@only@*/ void * (*db_malloc) (size_t nbytes); /*@only@*/ void * (*db_malloc) (size_t nbytes)
/*@*/;
/*@only@*/ void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr, /*@only@*/ void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr,
size_t nbytes); size_t nbytes)
void (*db_free) (/*@only@*/ void * ptr); /*@*/;
void (*db_free) (/*@only@*/ void * ptr)
/*@modifies *ptr @*/;
int db_ndbi; int db_ndbi;
dbiIndex *_dbi; dbiIndex *_dbi;
}; };
@ -310,7 +331,9 @@ struct rpmdb_s {
enum rpmdbFlags { enum rpmdbFlags {
RPMDB_FLAG_JUSTCHECK = (1 << 0), RPMDB_FLAG_JUSTCHECK = (1 << 0),
RPMDB_FLAG_MINIMAL = (1 << 1), RPMDB_FLAG_MINIMAL = (1 << 1),
/*@-enummemuse@*/
RPMDB_FLAG_CHROOT = (1 << 2) RPMDB_FLAG_CHROOT = (1 << 2)
/*@=enummemuse@*/
}; };
#ifdef __cplusplus #ifdef __cplusplus
@ -322,14 +345,16 @@ extern "C" {
* Return new configured index database handle instance. * Return new configured index database handle instance.
* @param rpmdb rpm database * @param rpmdb rpm database
*/ */
/*@only@*/ /*@null@*/ dbiIndex db3New(/*@keep@*/ rpmdb rpmdb, int rpmtag); /*@only@*/ /*@null@*/ dbiIndex db3New(/*@keep@*/ rpmdb rpmdb, int rpmtag)
/*@*/;
/** \ingroup db3 /** \ingroup db3
* Destroy index database handle instance. * Destroy index database handle instance.
* @param dbi index database handle * @param dbi index database handle
* @return NULL always * @return NULL always
*/ */
/*@null@*/ dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi); /*@null@*/ dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi)
/*@*/;
/** \ingroup db3 /** \ingroup db3
* Format db3 open flags for debugging print. * Format db3 open flags for debugging print.
@ -337,25 +362,32 @@ extern "C" {
* @param print_dbenv_flags format db env flags instead? * @param print_dbenv_flags format db env flags instead?
* @return formatted flags (static buffer) * @return formatted flags (static buffer)
*/ */
/*@-redecl@*/
/*@exposed@*/ extern const char *const prDbiOpenFlags(int dbflags, /*@exposed@*/ extern const char *const prDbiOpenFlags(int dbflags,
int print_dbenv_flags); int print_dbenv_flags)
/*@*/;
/*@=redecl@*/
/** \ingroup dbi /** \ingroup dbi
* Return handle for an index database. * Return handle for an index database.
* @param rpmdb rpm database * @param db rpm database
* @param rpmtag rpm tag * @param rpmtag rpm tag
* @param flags (unused) * @param flags (unused)
* @return index database handle * @return index database handle
*/ */
/*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb rpmdb, int rpmtag, /*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, int rpmtag,
unsigned int flags); unsigned int flags)
/*@modifies db @*/;
/** \ingroup dbi /** \ingroup dbi
* @param dbi index database handle * @param dbi index database handle
* @param dbiflags DBI_WRITECURSOR or DBI_ITERATOR * @param dbiflags DBI_WRITECURSOR or DBI_ITERATOR
*/ */
int dbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int dbiflags); int dbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int dbiflags)
int XdbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int dbiflags, const char *f, unsigned int l); /*@modifies dbi, *dbcp @*/;
int XdbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int dbiflags,
const char *f, unsigned int l)
/*@modifies dbi, *dbcp @*/;
#define dbiCopen(_a,_b,_c) \ #define dbiCopen(_a,_b,_c) \
XdbiCopen(_a, _b, _c, __FILE__, __LINE__) XdbiCopen(_a, _b, _c, __FILE__, __LINE__)
@ -366,8 +398,11 @@ int XdbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int dbiflags, const
* @param dbi index database handle * @param dbi index database handle
* @param flags (unused) * @param flags (unused)
*/ */
int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags); int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags)
int XdbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags, const char *f, unsigned int l); /*@modifies dbi @*/;
int XdbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags,
const char *f, unsigned int l)
/*@modifies dbi, *dbcursor @*/;
#define dbiCclose(_a,_b,_c) \ #define dbiCclose(_a,_b,_c) \
XdbiCclose(_a, _b, _c, __FILE__, __LINE__) XdbiCclose(_a, _b, _c, __FILE__, __LINE__)
@ -380,7 +415,8 @@ int XdbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags, cons
* @return 0 on success * @return 0 on success
*/ */
int dbiDel(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen, int dbiDel(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen,
unsigned int flags); unsigned int flags)
/*@modifies *dbcursor, fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Retrieve (key,data) pair from index database. * Retrieve (key,data) pair from index database.
@ -393,10 +429,12 @@ int dbiDel(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen,
* @return 0 on success * @return 0 on success
*/ */
int dbiGet(dbiIndex dbi, DBC * dbcursor, void ** keypp, int dbiGet(dbiIndex dbi, DBC * dbcursor, void ** keypp,
/*@null@*/ size_t * keylenp, /*@null@*/ size_t * keylenp,
/*@null@*/ void ** datapp, /*@null@*/ void ** datapp,
/*@null@*/ size_t * datalenp, /*@null@*/ size_t * datalenp,
unsigned int flags); unsigned int flags)
/*@modifies *dbcursor, *keypp, *keylenp, *datapp, *datalenp,
fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Store (key,data) pair in index database. * Store (key,data) pair in index database.
@ -409,7 +447,8 @@ int dbiGet(dbiIndex dbi, DBC * dbcursor, void ** keypp,
* @return 0 on success * @return 0 on success
*/ */
int dbiPut(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen, int dbiPut(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen,
const void * datap, size_t datalen, unsigned int flags); const void * datap, size_t datalen, unsigned int flags)
/*@modifies *dbcursor, fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Retrieve count of (possible) duplicate items. * Retrieve count of (possible) duplicate items.
@ -419,8 +458,10 @@ int dbiPut(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen,
* @param flags (unused) * @param flags (unused)
* @return 0 on success * @return 0 on success
*/ */
/*@unused@*/
int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp, int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
unsigned int flags); unsigned int flags)
/*@modifies *dbcursor, fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Verify (and close) index database. * Verify (and close) index database.
@ -428,7 +469,8 @@ int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp,
* @param flags (unused) * @param flags (unused)
* @return 0 on success * @return 0 on success
*/ */
int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags); int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags)
/*@modifies dbi, fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Close index database. * Close index database.
@ -436,7 +478,8 @@ int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags);
* @param flags (unused) * @param flags (unused)
* @return 0 on success * @return 0 on success
*/ */
int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags); int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags)
/*@modifies dbi, fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Flush pending operations to disk. * Flush pending operations to disk.
@ -444,45 +487,53 @@ int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags);
* @param flags (unused) * @param flags (unused)
* @return 0 on success * @return 0 on success
*/ */
int dbiSync (dbiIndex dbi, unsigned int flags); int dbiSync (dbiIndex dbi, unsigned int flags)
/*@modifies fileSystem @*/;
/** \ingroup dbi /** \ingroup dbi
* Is database byte swapped? * Is database byte swapped?
* @param dbi index database handle * @param dbi index database handle
* @return 0 no * @return 0 no
*/ */
int dbiByteSwapped(dbiIndex dbi); int dbiByteSwapped(dbiIndex dbi)
/*@*/;
/** \ingroup db1 /** \ingroup db1
* Return base file name for db1 database (legacy). * Return base file name for db1 database (legacy).
* @param rpmtag rpm tag * @param rpmtag rpm tag
* @return base file name of db1 database * @return base file name of db1 database
*/ */
char * db1basename(int rpmtag); char * db1basename(int rpmtag)
/*@*/;
/*@=exportlocal@*/ /*@=exportlocal@*/
/** \ingroup rpmdb /** \ingroup rpmdb
*/ */
unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi); /*@unused@*/
unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi)
/*@*/;
/** \ingroup rpmdb /** \ingroup rpmdb
* @param rpmdb rpm database * @param db rpm database
*/ */
int rpmdbFindFpList(/*@null@*/ rpmdb rpmdb, fingerPrint * fpList, int rpmdbFindFpList(/*@null@*/ rpmdb db, fingerPrint * fpList,
/*@out@*/dbiIndexSet * matchList, int numItems); /*@out@*/dbiIndexSet * matchList, int numItems)
/*@modifies db, *matchList @*/;
/** \ingroup dbi /** \ingroup dbi
* Destroy set of index database items. * Destroy set of index database items.
* @param set set of index database items * @param set set of index database items
*/ */
void dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set); void dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set)
/*@modifies set @*/;
/** \ingroup dbi /** \ingroup dbi
* Count items in index database set. * Count items in index database set.
* @param set set of index database items * @param set set of index database items
* @return number of items * @return number of items
*/ */
unsigned int dbiIndexSetCount(dbiIndexSet set); unsigned int dbiIndexSetCount(dbiIndexSet set)
/*@*/;
/** \ingroup dbi /** \ingroup dbi
* Return record offset of header from element in index database set. * Return record offset of header from element in index database set.
@ -490,7 +541,8 @@ unsigned int dbiIndexSetCount(dbiIndexSet set);
* @param recno index of item in set * @param recno index of item in set
* @return record offset of header * @return record offset of header
*/ */
unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno); unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno)
/*@*/;
/** \ingroup dbi /** \ingroup dbi
* Return file index from element in index database set. * Return file index from element in index database set.
@ -498,7 +550,8 @@ unsigned int dbiIndexRecordOffset(dbiIndexSet set, int recno);
* @param recno index of item in set * @param recno index of item in set
* @return file index * @return file index
*/ */
unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno); unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno)
/*@*/;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -14,6 +14,7 @@ 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) /*@*/;
@ -59,7 +60,8 @@ void htFree( /*@only@*/ hashTable ht);
* @param data pointer to data value * @param data pointer to data value
*/ */
void htAddEntry(hashTable ht, /*@owned@*/ const void * key, void htAddEntry(hashTable ht, /*@owned@*/ const void * key,
/*@owned@*/ const void * data) /*@modifies ht */; /*@owned@*/ const void * data)
/*@modifies ht */;
/** /**
* Retrieve item from hash table. * Retrieve item from hash table.
@ -82,6 +84,7 @@ int htGetEntry(hashTable ht, const void * key,
* @param key pointer to key value * @param key pointer to key value
* @return 1 if the key is present, 0 otherwise * @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 #ifdef __cplusplus

View File

@ -16,6 +16,7 @@ extern "C" {
* @retval lenp address of no. bytes of binary data * @retval lenp address of no. bytes of binary data
* @return 0 on success * @return 0 on success
*/ */
/*@unused@*/
int B64decode (const char * s, /*@out@*/ void ** datap, /*@out@*/ size_t *lenp); int B64decode (const char * s, /*@out@*/ void ** datap, /*@out@*/ size_t *lenp);
/** /**
@ -24,6 +25,7 @@ int B64decode (const char * s, /*@out@*/ void ** datap, /*@out@*/ size_t *lenp);
* @param ns no. bytes of data (0 uses strlen(data)) * @param ns no. bytes of data (0 uses strlen(data))
* @return (malloc'd) base64 string * @return (malloc'd) base64 string
*/ */
/*@unused@*/
char * B64encode (const void * data, size_t ns); char * B64encode (const void * data, size_t ns);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -361,7 +361,10 @@ MD5Transform(DIGEST_CTX ctx)
static int _ie = 0x44332211; static int _ie = 0x44332211;
/*@-redef@*/ /*@-redef@*/
static union _mendian { int i; char b[4]; } *_endian = (union _mendian *)&_ie; static union _mendian {
/*@unused@*/ int i;
char b[4];
} *_endian = (union _mendian *)&_ie;
/*@=redef@*/ /*@=redef@*/
#define IS_BIG_ENDIAN() (_endian->b[0] == '\x44') #define IS_BIG_ENDIAN() (_endian->b[0] == '\x44')
#define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11') #define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11')

View File

@ -76,7 +76,7 @@ typedef struct MacroBuf {
static int expandMacro(MacroBuf *mb); static int expandMacro(MacroBuf *mb);
/*@-exportlocal@*/ /*@-exportlocal -exportheadervar@*/
#define MAX_MACRO_DEPTH 16 #define MAX_MACRO_DEPTH 16
int max_macro_depth = MAX_MACRO_DEPTH; int max_macro_depth = MAX_MACRO_DEPTH;
@ -87,17 +87,19 @@ int print_expand_trace = 0;
int print_macro_trace = 0; int print_macro_trace = 0;
int print_expand_trace = 0; int print_expand_trace = 0;
#endif #endif
/*@=exportlocal@*/ /*@=exportlocal =exportheadervar@*/
#define MACRO_CHUNK_SIZE 16 #define MACRO_CHUNK_SIZE 16
/** /**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param this memory to free * @param p memory to free
* @retval NULL always * @retval NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) { /*@unused@*/ static inline /*@null@*/ void *
if (this != NULL) free((void *)this); _free(/*@only@*/ /*@null@*/ const void * p) /*@modifies p@*/
{
if (p != NULL) free((void *)p);
return NULL; return NULL;
} }

View File

@ -22,6 +22,7 @@
/** /**
* Tokens used by rpmError(). * Tokens used by rpmError().
*/ */
/*@-enummemuse -typeuse @*/
typedef enum rpmerrCode_e { typedef enum rpmerrCode_e {
RPMERR_GDBMOPEN = _em(2), /*!< gdbm open failed */ RPMERR_GDBMOPEN = _em(2), /*!< gdbm open failed */
RPMERR_GDBMREAD = _em(3), /*!< gdbm read failed */ RPMERR_GDBMREAD = _em(3), /*!< gdbm read failed */
@ -106,6 +107,7 @@ typedef enum rpmerrCode_e {
RPMWARN_RMDIR = _wm(512u+17), /*!< rmdir(2) failed */ RPMWARN_RMDIR = _wm(512u+17), /*!< rmdir(2) failed */
RPMWARN_FLOCK = _wm(512u+27) /*!< locking the database failed */ RPMWARN_FLOCK = _wm(512u+27) /*!< locking the database failed */
} rpmerrCode; } rpmerrCode;
/*@=enummemuse =typeuse @*/
/** /**
* Retrofit rpmError() onto rpmlog sub-system. * Retrofit rpmError() onto rpmlog sub-system.
@ -114,7 +116,9 @@ typedef enum rpmerrCode_e {
#define rpmErrorCode() rpmlogCode() #define rpmErrorCode() rpmlogCode()
#define rpmErrorString() rpmlogMessage() #define rpmErrorString() rpmlogMessage()
#define rpmErrorSetCallback(_cb) rpmlogSetCallback(_cb) #define rpmErrorSetCallback(_cb) rpmlogSetCallback(_cb)
/*@-typeuse@*/
typedef rpmlogCallback rpmErrorCallBackType; typedef rpmlogCallback rpmErrorCallBackType;
/*@=typeuse@*/
#endif /* H_RPMERR */ #endif /* H_RPMERR */

View File

@ -95,11 +95,13 @@ int _rpmio_debug = 0;
/** /**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param this memory to free * @param p memory to free
* @retval NULL always * @retval NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) { /*@unused@*/ static inline /*@null@*/ void *
if (this != NULL) free((void *)this); _free(/*@only@*/ /*@null@*/ const void * p) /*@modifies p@*/
{
if (p != NULL) free((void *)p);
return NULL; return NULL;
} }

View File

@ -115,9 +115,11 @@ typedef int fdio_chdir_function_t (const char * path);
typedef int fdio_rmdir_function_t (const char * path); typedef int fdio_rmdir_function_t (const char * path);
typedef int fdio_rename_function_t (const char * oldpath, const char * newpath); typedef int fdio_rename_function_t (const char * oldpath, const char * newpath);
typedef int fdio_unlink_function_t (const char * path); typedef int fdio_unlink_function_t (const char * path);
/*@-typeuse@*/
typedef int fdio_stat_function_t (const char * path, struct stat * st); typedef int fdio_stat_function_t (const char * path, struct stat * st);
typedef int fdio_lstat_function_t (const char * path, struct stat * st); typedef int fdio_lstat_function_t (const char * path, struct stat * st);
typedef int fdio_access_function_t (const char * path, int amode); typedef int fdio_access_function_t (const char * path, int amode);
/*@=typeuse@*/
/*@}*/ /*@}*/
@ -155,69 +157,84 @@ struct FDIO_s {
/** \ingroup rpmio /** \ingroup rpmio
* strerror(3) clone. * strerror(3) clone.
*/ */
/*@observer@*/ const char * Fstrerror(/*@null@*/ FD_t fd); /*@-redecl@*/
/*@observer@*/ const char * Fstrerror(/*@null@*/ FD_t fd)
/*@*/;
/*@=redecl@*/
/** \ingroup rpmio /** \ingroup rpmio
* fread(3) clone. * fread(3) clone.
*/ */
size_t Fread (/*@out@*/ void * buf, size_t size, size_t nmemb, FD_t fd); size_t Fread(/*@out@*/ void * buf, size_t size, size_t nmemb, FD_t fd)
/*@modifies fd, *buf, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
* fwrite(3) clone. * fwrite(3) clone.
*/ */
size_t Fwrite (const void * buf, size_t size, size_t nmemb, FD_t fd); size_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd)
/*@modifies fd, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
* fseek(3) clone. * fseek(3) clone.
*/ */
int Fseek (FD_t fd, _libio_off_t offset, int whence); int Fseek(FD_t fd, _libio_off_t offset, int whence)
/*@modifies fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
* fclose(3) clone. * fclose(3) clone.
*/ */
int Fclose ( /*@killref@*/ FD_t fd); int Fclose( /*@killref@*/ FD_t fd)
/*@modifies fd, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@null@*/ FD_t Fdopen (FD_t fd, const char * fmode); /*@null@*/ FD_t Fdopen(FD_t fd, const char * fmode)
/*@modifies fd, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
* fopen(3) clone. * fopen(3) clone.
*/ */
/*@null@*/ FD_t Fopen (/*@null@*/ const char * path, /*@null@*/ const char * fmode); /*@null@*/ FD_t Fopen(/*@null@*/ const char * path,
/*@null@*/ const char * fmode)
/*@modifies fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
* fflush(3) clone. * fflush(3) clone.
*/ */
int Fflush (/*@null@*/ FD_t fd); int Fflush(/*@null@*/ FD_t fd)
/*@modifies fd, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
* ferror(3) clone. * ferror(3) clone.
*/ */
int Ferror (/*@null@*/ FD_t fd); int Ferror(/*@null@*/ FD_t fd)
/*@*/;
/** \ingroup rpmio /** \ingroup rpmio
* fileno(3) clone. * fileno(3) clone.
*/ */
int Fileno (FD_t fd); int Fileno(FD_t fd)
/*@*/;
/** \ingroup rpmio /** \ingroup rpmio
* fcntl(2) clone. * fcntl(2) clone.
*/ */
int Fcntl (FD_t fd, int op, void *lip); int Fcntl(FD_t fd, int op, void *lip)
/*@modifies fd, *lip, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
* pread(2) clone. * pread(2) clone.
*/ */
ssize_t Pread(FD_t fd, void * buf, size_t count, _libio_off_t offset); ssize_t Pread(FD_t fd, void * buf, size_t count, _libio_off_t offset)
/*@modifies fd, *buf, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
* pwrite(2) clone. * pwrite(2) clone.
*/ */
ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset); ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset)
/*@modifies fd, fileSystem @*/;
/*@}*/ /*@}*/
/** \ingroup rpmrpc /** \ingroup rpmrpc
@ -228,81 +245,97 @@ ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset);
/** \ingroup rpmrpc /** \ingroup rpmrpc
* mkdir(2) clone. * mkdir(2) clone.
*/ */
int Mkdir (const char * path, mode_t mode); int Mkdir(const char * path, mode_t mode)
/*@modifies fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* chdir(2) clone. * chdir(2) clone.
*/ */
int Chdir (const char * path); int Chdir(const char * path)
/*@modifies fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* rmdir(2) clone. * rmdir(2) clone.
*/ */
int Rmdir (const char * path); int Rmdir(const char * path)
/*@modifies fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* rename(2) clone. * rename(2) clone.
*/ */
int Rename (const char * oldpath, const char * newpath); int Rename(const char * oldpath, const char * newpath)
/*@modifies fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* link(2) clone. * link(2) clone.
*/ */
int Link (const char * oldpath, const char * newpath); int Link(const char * oldpath, const char * newpath)
/*@modifies fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* unlink(2) clone. * unlink(2) clone.
*/ */
int Unlink (const char * path); int Unlink(const char * path)
/*@modifies fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* readlink(2) clone. * readlink(2) clone.
*/ */
int Readlink(const char * path, char * buf, size_t bufsiz); int Readlink(const char * path, char * buf, size_t bufsiz)
/*@modifies *buf, fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* stat(2) clone. * stat(2) clone.
*/ */
int Stat (const char * path, /*@out@*/ struct stat * st); int Stat(const char * path, /*@out@*/ struct stat * st)
/*@modifies *st, fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* lstat(2) clone. * lstat(2) clone.
*/ */
int Lstat (const char * path, /*@out@*/ struct stat * st); int Lstat(const char * path, /*@out@*/ struct stat * st)
/*@modifies *st, fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* access(2) clone. * access(2) clone.
*/ */
int Access (const char * path, int amode); int Access(const char * path, int amode)
/*@modifies fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* glob(3) clone. * glob(3) clone.
*/ */
int Glob (const char * pattern, int flags, int Glob(const char * pattern, int flags,
int errfunc(const char * epath, int eerrno), /*@out@*/ glob_t * pglob); int errfunc(const char * epath, int eerrno),
/*@out@*/ glob_t * pglob)
/*@modifies *pglob @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* globfree(3) clone. * globfree(3) clone.
*/ */
void Globfree( /*@only@*/ glob_t * pglob); void Globfree( /*@only@*/ glob_t * pglob)
/*@modifies *pglob @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* opendir(3) clone. * opendir(3) clone.
*/ */
/*@null@*/ DIR * Opendir (const char * name); /*@null@*/ DIR * Opendir(const char * name)
/*@modifies fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* readdir(3) clone. * readdir(3) clone.
*/ */
/*@null@*/ struct dirent * Readdir (DIR * dir); /*@null@*/ struct dirent * Readdir(DIR * dir)
/*@modifies *dir, fileSystem @*/;
/** \ingroup rpmrpc /** \ingroup rpmrpc
* closedir(3) clone. * closedir(3) clone.
*/ */
int Closedir(/*@only@*/ DIR * dir); int Closedir(/*@only@*/ DIR * dir)
/*@modifies *dir, fileSystem @*/;
/*@}*/ /*@}*/
@ -313,11 +346,14 @@ int Closedir(/*@only@*/ DIR * dir);
/** \ingroup rpmio /** \ingroup rpmio
*/ */
off_t fdSize (FD_t fd); off_t fdSize(FD_t fd)
/*@modifies fd, fileSystem@*/;
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@null@*/ FD_t fdDup(int fdno); /*@null@*/ FD_t fdDup(int fdno)
/*@modifies fileSystem@*/;
#ifdef UNUSED #ifdef UNUSED
/*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode); /*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode);
#endif #endif
@ -326,27 +362,32 @@ off_t fdSize (FD_t fd);
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@-shadow@*/ /*@-shadow -declundef -fcnuse@*/
int fdFileno(void * cookie); int fdFileno(void * cookie)
/*@=shadow@*/ /*@*/;
/*@=shadow =declundef =fcnuse@*/
/*@-exportlocal@*/ /*@-exportlocal@*/
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@null@*/ FD_t fdOpen(const char *path, int flags, mode_t mode); /*@null@*/ FD_t fdOpen(const char *path, int flags, mode_t mode)
/*@modifies fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
*/ */
ssize_t fdRead(void * cookie, /*@out@*/ char * buf, size_t count); ssize_t fdRead(void * cookie, /*@out@*/ char * buf, size_t count)
/*@modifies *cookie, *buf, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
*/ */
ssize_t fdWrite(void * cookie, const char * buf, size_t count); ssize_t fdWrite(void * cookie, const char * buf, size_t count)
/*@modifies *cookie, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
*/ */
int fdClose( /*@only@*/ void * cookie); int fdClose( /*@only@*/ void * cookie)
/*@modifies *cookie, fileSystem @*/;
/* XXX FD_t reference count debugging wrappers */ /* XXX FD_t reference count debugging wrappers */
#define fdLink(_fd, _msg) fdio->_fdref(_fd, _msg, __FILE__, __LINE__) #define fdLink(_fd, _msg) fdio->_fdref(_fd, _msg, __FILE__, __LINE__)
@ -356,16 +397,19 @@ int fdClose( /*@only@*/ void * cookie);
/** \ingroup rpmio /** \ingroup rpmio
*/ */
int fdWritable(FD_t fd, int secs); int fdWritable(FD_t fd, int secs)
/*@modifies fd @*/;
/** \ingroup rpmio /** \ingroup rpmio
*/ */
int fdReadable(FD_t fd, int secs); int fdReadable(FD_t fd, int secs)
/*@modifies fd @*/;
/*@=exportlocal@*/ /*@=exportlocal@*/
/** \ingroup rpmio /** \ingroup rpmio
* FTP and HTTP error codes. * FTP and HTTP error codes.
*/ */
/*@-typeuse@*/
typedef enum ftperrCode_e { typedef enum ftperrCode_e {
FTPERR_BAD_SERVER_RESPONSE = -1, /*!< Bad server response */ FTPERR_BAD_SERVER_RESPONSE = -1, /*!< Bad server response */
FTPERR_SERVER_IO_ERROR = -2, /*!< Server I/O error */ FTPERR_SERVER_IO_ERROR = -2, /*!< Server I/O error */
@ -380,32 +424,42 @@ typedef enum ftperrCode_e {
FTPERR_NIC_ABORT_IN_PROGRESS= -11, /*!< Abort in progress */ FTPERR_NIC_ABORT_IN_PROGRESS= -11, /*!< Abort in progress */
FTPERR_UNKNOWN = -100 /*!< Unknown or unexpected error */ FTPERR_UNKNOWN = -100 /*!< Unknown or unexpected error */
} ftperrCode; } ftperrCode;
/*@=typeuse@*/
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@observer@*/ const char *const ftpStrerror(int errorNumber); /*@-redecl@*/
/*@observer@*/ const char *const ftpStrerror(int errorNumber) /*@*/;
/*@=redecl@*/
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@dependent@*/ /*@null@*/ void * ufdGetUrlinfo(FD_t fd); /*@unused@*/
/*@dependent@*/ /*@null@*/ void * ufdGetUrlinfo(FD_t fd) /*@*/;
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@observer@*/ const char * urlStrerror(const char * url); /*@-redecl@*/
/*@unused@*/
/*@observer@*/ const char * urlStrerror(const char * url) /*@*/;
/*@=redecl@*/
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@-exportlocal@*/ /*@-exportlocal@*/
int ufdCopy(FD_t sfd, FD_t tfd); int ufdCopy(FD_t sfd, FD_t tfd)
/*@modifies sfd, tfd, fileSystem @*/;
/*@=exportlocal@*/ /*@=exportlocal@*/
/** \ingroup rpmio /** \ingroup rpmio
*/ */
int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd); int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd)
/*@modifies sfd, tfd, fileSystem @*/;
/** \ingroup rpmio /** \ingroup rpmio
*/ */
int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length); int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length)
/*@modifies fd, *bufptr, fileSystem @*/;
#define timedRead ufdio->read #define timedRead ufdio->read
@ -436,31 +490,39 @@ int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length);
/*@=exportlocal@*/ /*@=exportlocal@*/
/*@}*/ /*@}*/
/*@unused@*/ static inline int xislower(int c) {return (c >= 'a' && c <= 'z');} /*@unused@*/ static inline int xislower(int c) /*@*/ {
/*@unused@*/ static inline int xisupper(int c) {return (c >= 'A' && c <= 'Z');} return (c >= 'a' && c <= 'z');
/*@unused@*/ static inline int xisalpha(int c) { }
/*@unused@*/ static inline int xisupper(int c) /*@*/ {
return (c >= 'A' && c <= 'Z');
}
/*@unused@*/ static inline int xisalpha(int c) /*@*/ {
return (xislower(c) || xisupper(c)); return (xislower(c) || xisupper(c));
} }
/*@unused@*/ static inline int xisdigit(int c) {return (c >= '0' && c <= '9');} /*@unused@*/ static inline int xisdigit(int c) /*@*/ {
/*@unused@*/ static inline int xisalnum(int c) { return (c >= '0' && c <= '9');
}
/*@unused@*/ static inline int xisalnum(int c) /*@*/ {
return (xisalpha(c) || xisdigit(c)); return (xisalpha(c) || xisdigit(c));
} }
/*@unused@*/ static inline int xisblank(int c) {return (c == ' ' || c == '\t');} /*@unused@*/ static inline int xisblank(int c) /*@*/ {
/*@unused@*/ static inline int xisspace(int c) { return (c == ' ' || c == '\t');
}
/*@unused@*/ static inline int xisspace(int c) /*@*/ {
return (xisblank(c) || c == '\n' || c == '\r' || c == '\f' || c == '\v'); return (xisblank(c) || c == '\n' || c == '\r' || c == '\f' || c == '\v');
} }
/*@unused@*/ static inline int xtolower(int c) { /*@unused@*/ static inline int xtolower(int c) /*@*/ {
return ((xisupper(c)) ? (c | ('a' - 'A')) : c); return ((xisupper(c)) ? (c | ('a' - 'A')) : c);
} }
/*@unused@*/ static inline int xtoupper(int c) { /*@unused@*/ static inline int xtoupper(int c) /*@*/ {
return ((xislower(c)) ? (c & ~('a' - 'A')) : c); return ((xislower(c)) ? (c & ~('a' - 'A')) : c);
} }
/** \ingroup rpmio /** \ingroup rpmio
* Locale insensitive strcasecmp(3). * Locale insensitive strcasecmp(3).
*/ */
int xstrcasecmp(const char *s1, const char * s2) /*@*/; int xstrcasecmp(const char * s1, const char * s2) /*@*/;
/** \ingroup rpmio /** \ingroup rpmio
* Locale insensitive strncasecmp(3). * Locale insensitive strncasecmp(3).

View File

@ -13,7 +13,7 @@
/*@access FD_t@*/ /*@access FD_t@*/
/*@-redef@*/ /*@-redef -redecl@*/
int fdFileno(void * cookie); /* Yet Another Prototype. */ int fdFileno(void * cookie); /* Yet Another Prototype. */
int fdFileno(void * cookie) { int fdFileno(void * cookie) {
FD_t fd; FD_t fd;
@ -21,4 +21,4 @@ int fdFileno(void * cookie) {
fd = c2f(cookie); fd = c2f(cookie);
return fd->fps[0].fdno; return fd->fps[0].fdno;
} }
/*@=redef@*/ /*@=redef =redecl@*/

View File

@ -15,37 +15,37 @@ static inline int fdFileno(/*@null@*/ void * cookie);
/** \ingroup rpmio /** \ingroup rpmio
*/ */
typedef struct _FDSTACK_s { typedef struct _FDSTACK_s {
FDIO_t io; FDIO_t io;
/*@dependent@*/ void * fp; /*@dependent@*/ void * fp;
int fdno; int fdno;
} FDSTACK_t; } FDSTACK_t;
/** \ingroup rpmio /** \ingroup rpmio
* Cumulative statistics for an I/O operation. * Cumulative statistics for an I/O operation.
*/ */
typedef struct { typedef struct {
int count; /*!< Number of operations. */ int count; /*!< Number of operations. */
off_t bytes; /*!< Number of bytes transferred. */ off_t bytes; /*!< Number of bytes transferred. */
time_t msecs; /*!< Number of milli-seconds. */ time_t msecs; /*!< Number of milli-seconds. */
} OPSTAT_t; } OPSTAT_t;
/** \ingroup rpmio /** \ingroup rpmio
* Identify per-desciptor I/O operation statistics. * Identify per-desciptor I/O operation statistics.
*/ */
enum FDSTAT_e { enum FDSTAT_e {
FDSTAT_READ = 0, /*!< Read statistics index. */ FDSTAT_READ = 0, /*!< Read statistics index. */
FDSTAT_WRITE = 1, /*!< Write statistics index. */ FDSTAT_WRITE = 1, /*!< Write statistics index. */
FDSTAT_SEEK = 2, /*!< Seek statistics index. */ FDSTAT_SEEK = 2, /*!< Seek statistics index. */
FDSTAT_CLOSE = 3 /*!< Close statistics. index */ FDSTAT_CLOSE = 3 /*!< Close statistics. index */
}; };
/** \ingroup rpmio /** \ingroup rpmio
* Cumulative statistics for a descriptor. * Cumulative statistics for a descriptor.
*/ */
typedef /*@abstract@*/ struct { typedef /*@abstract@*/ struct {
struct timeval create; /*!< Structure creation time. */ struct timeval create; /*!< Structure creation time. */
struct timeval begin; /*!< Operation start time. */ struct timeval begin; /*!< Operation start time. */
OPSTAT_t ops[4]; /*!< Cumulative statistics. */ OPSTAT_t ops[4]; /*!< Cumulative statistics. */
} * FDSTAT_t; } * FDSTAT_t;
/** \ingroup rpmio /** \ingroup rpmio
@ -65,7 +65,8 @@ typedef /*@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
* @param flags bit(s) to control digest operation * @param flags bit(s) to control digest operation
* @return digest private data * @return digest private data
*/ */
DIGEST_CTX rpmDigestInit(rpmDigestFlags flags); DIGEST_CTX rpmDigestInit(rpmDigestFlags flags)
/*@*/;
/** \ingroup rpmio /** \ingroup rpmio
* Update context to with next plain text buffer. * Update context to with next plain text buffer.
@ -73,7 +74,8 @@ DIGEST_CTX rpmDigestInit(rpmDigestFlags flags);
* @param data next data buffer * @param data next data buffer
* @param len no. bytes of data * @param len no. bytes of data
*/ */
void rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len); void rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len)
/*@modifies ctx @*/;
/** \ingroup rpmio /** \ingroup rpmio
* Return digest and destroy context. * Return digest and destroy context.
@ -87,45 +89,48 @@ void rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len);
*/ */
void rpmDigestFinal(/*@only@*/ DIGEST_CTX ctx, void rpmDigestFinal(/*@only@*/ DIGEST_CTX ctx,
/*@null@*/ /*@out@*/ void ** datap, /*@null@*/ /*@out@*/ void ** datap,
/*@null@*/ /*@out@*/ size_t *lenp, int asAscii); /*@null@*/ /*@out@*/ size_t * lenp, int asAscii)
/*@modifies *datap, *lenp @*/;
/** \ingroup rpmio /** \ingroup rpmio
* The FD_t File Handle data structure. * The FD_t File Handle data structure.
*/ */
struct _FD_s { struct _FD_s {
/*@refs@*/ int nrefs; /*@refs@*/ int nrefs;
int flags; int flags;
#define RPMIO_DEBUG_IO 0x40000000 #define RPMIO_DEBUG_IO 0x40000000
#define RPMIO_DEBUG_REFS 0x20000000 #define RPMIO_DEBUG_REFS 0x20000000
int magic; int magic;
#define FDMAGIC 0x04463138 #define FDMAGIC 0x04463138
int nfps; int nfps;
FDSTACK_t fps[8]; FDSTACK_t fps[8];
int urlType; /* ufdio: */ int urlType; /* ufdio: */
/*@dependent@*/ void * url; /* ufdio: URL info */ /*@dependent@*/ void * url; /* ufdio: URL info */
int rd_timeoutsecs; /* ufdRead: per FD_t timer */ int rd_timeoutsecs; /* ufdRead: per FD_t timer */
ssize_t bytesRemain; /* ufdio: */ ssize_t bytesRemain; /* ufdio: */
ssize_t contentLength; /* ufdio: */ ssize_t contentLength; /* ufdio: */
int persist; /* ufdio: */ int persist; /* ufdio: */
int wr_chunked; /* ufdio: */ int wr_chunked; /* ufdio: */
int syserrno; /* last system errno encountered */ int syserrno; /* last system errno encountered */
/*@observer@*/ const void *errcookie; /* gzdio/bzdio/ufdio: */ /*@observer@*/ const void *errcookie; /* gzdio/bzdio/ufdio: */
FDSTAT_t stats; /* I/O statistics */ FDSTAT_t stats; /* I/O statistics */
/*@owned@*/ DIGEST_CTX digest; /* Digest private data */ /*@owned@*/ /*@null@*/ DIGEST_CTX digest; /* Digest private data */
int ftpFileDoneNeeded; /* ufdio: (FTP) */ int ftpFileDoneNeeded; /* ufdio: (FTP) */
unsigned int firstFree; /* fadio: */ unsigned int firstFree; /* fadio: */
long int fileSize; /* fadio: */ long int fileSize; /* fadio: */
long int fd_cpioPos; /* cpio: */ long int fd_cpioPos; /* cpio: */
}; };
/*@access FD_t@*/ /*@access FD_t@*/
#define FDSANE(fd) assert(fd && fd->magic == FDMAGIC) #define FDSANE(fd) assert(fd && fd->magic == FDMAGIC)
/*@-redecl@*/
extern int _rpmio_debug; extern int _rpmio_debug;
/*@=redecl@*/
#define DBG(_f, _m, _x) \ #define DBG(_f, _m, _x) \
if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x
@ -149,7 +154,9 @@ int ufdClose( /*@only@*/ void * cookie);
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
/*@null@*/ const FDIO_t fdGetIo(FD_t fd) { /*@null@*/ const FDIO_t fdGetIo(FD_t fd)
/*@*/
{
FDSANE(fd); FDSANE(fd);
return fd->fps[fd->nfps].io; return fd->fps[fd->nfps].io;
} }
@ -157,7 +164,9 @@ int ufdClose( /*@only@*/ void * cookie);
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdSetIo(FD_t fd, /*@kept@*/ /*@null@*/ FDIO_t io) { void fdSetIo(FD_t fd, /*@kept@*/ /*@null@*/ FDIO_t io)
/*@modifies fd @*/
{
FDSANE(fd); FDSANE(fd);
fd->fps[fd->nfps].io = io; fd->fps[fd->nfps].io = io;
} }
@ -165,7 +174,9 @@ void fdSetIo(FD_t fd, /*@kept@*/ /*@null@*/ FDIO_t io) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
/*@dependent@*/ /*@null@*/ FILE * fdGetFILE(FD_t fd) { /*@dependent@*/ /*@null@*/ FILE * fdGetFILE(FD_t fd)
/*@*/
{
FDSANE(fd); FDSANE(fd);
/*@+voidabstract@*/ /*@+voidabstract@*/
return ((FILE *)fd->fps[fd->nfps].fp); return ((FILE *)fd->fps[fd->nfps].fp);
@ -175,7 +186,9 @@ void fdSetIo(FD_t fd, /*@kept@*/ /*@null@*/ FDIO_t io) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
/*@dependent@*/ /*@null@*/ void * fdGetFp(FD_t fd) { /*@dependent@*/ /*@null@*/ void * fdGetFp(FD_t fd)
/*@*/
{
FDSANE(fd); FDSANE(fd);
return fd->fps[fd->nfps].fp; return fd->fps[fd->nfps].fp;
} }
@ -183,7 +196,9 @@ void fdSetIo(FD_t fd, /*@kept@*/ /*@null@*/ FDIO_t io) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdSetFp(FD_t fd, /*@kept@*/ /*@null@*/ void * fp) { void fdSetFp(FD_t fd, /*@kept@*/ /*@null@*/ void * fp)
/*@modifies fd @*/
{
FDSANE(fd); FDSANE(fd);
fd->fps[fd->nfps].fp = fp; fd->fps[fd->nfps].fp = fp;
} }
@ -191,7 +206,9 @@ void fdSetFp(FD_t fd, /*@kept@*/ /*@null@*/ void * fp) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
int fdGetFdno(FD_t fd) { int fdGetFdno(FD_t fd)
/*@*/
{
FDSANE(fd); FDSANE(fd);
return fd->fps[fd->nfps].fdno; return fd->fps[fd->nfps].fdno;
} }
@ -199,7 +216,9 @@ int fdGetFdno(FD_t fd) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdSetFdno(FD_t fd, int fdno) { void fdSetFdno(FD_t fd, int fdno)
/*@modifies fd @*/
{
FDSANE(fd); FDSANE(fd);
fd->fps[fd->nfps].fdno = fdno; fd->fps[fd->nfps].fdno = fdno;
} }
@ -208,6 +227,7 @@ void fdSetFdno(FD_t fd, int fdno) {
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdSetContentLength(FD_t fd, ssize_t contentLength) void fdSetContentLength(FD_t fd, ssize_t contentLength)
/*@modifies fd @*/
{ {
FDSANE(fd); FDSANE(fd);
fd->contentLength = fd->bytesRemain = contentLength; fd->contentLength = fd->bytesRemain = contentLength;
@ -217,6 +237,7 @@ void fdSetContentLength(FD_t fd, ssize_t contentLength)
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno) void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno)
/*@modifies fd @*/
{ {
FDSANE(fd); FDSANE(fd);
if (fd->nfps >= (sizeof(fd->fps)/sizeof(fd->fps[0]) - 1)) if (fd->nfps >= (sizeof(fd->fps)/sizeof(fd->fps[0]) - 1))
@ -229,7 +250,9 @@ void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno)
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline void fdPop(FD_t fd) { /*@unused@*/ static inline void fdPop(FD_t fd)
/*@modifies fd @*/
{
FDSANE(fd); FDSANE(fd);
if (fd->nfps < 0) return; if (fd->nfps < 0) return;
fdSetIo(fd, NULL); fdSetIo(fd, NULL);
@ -241,6 +264,7 @@ void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno)
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline void fdstat_enter(/*@null@*/ FD_t fd, int opx) /*@unused@*/ static inline void fdstat_enter(/*@null@*/ FD_t fd, int opx)
/*@modifies fd @*/
{ {
if (fd == NULL || fd->stats == NULL) return; if (fd == NULL || fd->stats == NULL) return;
fd->stats->ops[opx].count++; fd->stats->ops[opx].count++;
@ -250,15 +274,15 @@ void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno)
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
time_t tvsub(struct timeval * etv, struct timeval * btv) { time_t tvsub(/*@null@*/ const struct timeval * etv,
/*@null@*/ const struct timeval * btv)
/*@*/
{
time_t secs, usecs; time_t secs, usecs;
if (!(etv && btv)) return 0; if (etv == NULL || btv == NULL) return 0;
secs = etv->tv_sec - btv->tv_sec; secs = etv->tv_sec - btv->tv_sec;
usecs = etv->tv_usec - btv->tv_usec; for (usecs = etv->tv_usec - btv->tv_usec; usecs < 0; usecs += 1000000)
while (usecs < 0) {
secs++; secs++;
usecs += 1000000;
}
return ((secs * 1000) + (usecs/1000)); return ((secs * 1000) + (usecs/1000));
} }
@ -266,6 +290,7 @@ time_t tvsub(struct timeval * etv, struct timeval * btv) {
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdstat_exit(/*@null@*/ FD_t fd, int opx, ssize_t rc) void fdstat_exit(/*@null@*/ FD_t fd, int opx, ssize_t rc)
/*@modifies fd @*/
{ {
struct timeval end; struct timeval end;
if (fd == NULL) return; if (fd == NULL) return;
@ -290,7 +315,9 @@ void fdstat_exit(/*@null@*/ FD_t fd, int opx, ssize_t rc)
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdstat_print(/*@null@*/ FD_t fd, const char * msg, FILE * fp) { void fdstat_print(/*@null@*/ FD_t fd, const char * msg, FILE * fp)
/*@modifies *fp @*/
{
int opx; int opx;
if (fd == NULL || fd->stats == NULL) return; if (fd == NULL || fd->stats == NULL) return;
for (opx = 0; opx < 4; opx++) { for (opx = 0; opx < 4; opx++) {
@ -320,7 +347,9 @@ void fdstat_print(/*@null@*/ FD_t fd, const char * msg, FILE * fp) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdSetSyserrno(FD_t fd, int syserrno, /*@kept@*/ const void * errcookie) { void fdSetSyserrno(FD_t fd, int syserrno, /*@kept@*/ const void * errcookie)
/*@modifies fd @*/
{
FDSANE(fd); FDSANE(fd);
fd->syserrno = syserrno; fd->syserrno = syserrno;
fd->errcookie = errcookie; fd->errcookie = errcookie;
@ -329,7 +358,9 @@ void fdSetSyserrno(FD_t fd, int syserrno, /*@kept@*/ const void * errcookie) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
int fdGetRdTimeoutSecs(FD_t fd) { int fdGetRdTimeoutSecs(FD_t fd)
/*@*/
{
FDSANE(fd); FDSANE(fd);
return fd->rd_timeoutsecs; return fd->rd_timeoutsecs;
} }
@ -337,7 +368,9 @@ int fdGetRdTimeoutSecs(FD_t fd) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
long int fdGetCpioPos(FD_t fd) { long int fdGetCpioPos(FD_t fd)
/*@*/
{
FDSANE(fd); FDSANE(fd);
return fd->fd_cpioPos; return fd->fd_cpioPos;
} }
@ -345,7 +378,9 @@ long int fdGetCpioPos(FD_t fd) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdSetCpioPos(FD_t fd, long int cpioPos) { void fdSetCpioPos(FD_t fd, long int cpioPos)
/*@modifies fd @*/
{
FDSANE(fd); FDSANE(fd);
fd->fd_cpioPos = cpioPos; fd->fd_cpioPos = cpioPos;
} }
@ -353,7 +388,9 @@ void fdSetCpioPos(FD_t fd, long int cpioPos) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@mayexit@*/ /*@unused@*/ static inline /*@mayexit@*/ /*@unused@*/ static inline
FD_t c2f(/*@null@*/ void * cookie) { FD_t c2f(/*@null@*/ void * cookie)
/*@*/
{
FD_t fd = (FD_t) cookie; FD_t fd = (FD_t) cookie;
FDSANE(fd); FDSANE(fd);
/*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/ /*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
@ -362,7 +399,9 @@ FD_t c2f(/*@null@*/ void * cookie) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdInitMD5(FD_t fd, int flags) { void fdInitMD5(FD_t fd, int flags)
/*@modifies fd @*/
{
if (flags) flags = RPMDIGEST_NATIVE; if (flags) flags = RPMDIGEST_NATIVE;
flags |= RPMDIGEST_MD5; flags |= RPMDIGEST_MD5;
fd->digest = rpmDigestInit(flags); fd->digest = rpmDigestInit(flags);
@ -371,14 +410,21 @@ void fdInitMD5(FD_t fd, int flags) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdInitSHA1(FD_t fd) { void fdInitSHA1(FD_t fd)
/*@modifies fd @*/
{
fd->digest = rpmDigestInit(RPMDIGEST_SHA1); fd->digest = rpmDigestInit(RPMDIGEST_SHA1);
} }
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdFiniMD5(FD_t fd, void **datap, size_t *lenp, int asAscii) { void fdFiniMD5(FD_t fd,
/*@null@*/ /*@out@*/ void ** datap,
/*@null@*/ /*@out@*/ size_t * lenp,
int asAscii)
/*@modifies fd, *datap, *lenp @*/
{
if (fd->digest == NULL) { if (fd->digest == NULL) {
if (datap) *datap = NULL; if (datap) *datap = NULL;
if (lenp) *lenp = 0; if (lenp) *lenp = 0;
@ -393,7 +439,12 @@ void fdFiniMD5(FD_t fd, void **datap, size_t *lenp, int asAscii) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
void fdFiniSHA1(FD_t fd, void **datap, size_t *lenp, int asAscii) { void fdFiniSHA1(FD_t fd,
/*@null@*/ /*@out@*/ void ** datap,
/*@null@*/ /*@out@*/ size_t * lenp,
int asAscii)
/*@modifies fd, *datap, *lenp @*/
{
if (fd->digest == NULL) { if (fd->digest == NULL) {
if (datap) *datap = NULL; if (datap) *datap = NULL;
if (lenp) *lenp = 0; if (lenp) *lenp = 0;
@ -409,7 +460,9 @@ void fdFiniSHA1(FD_t fd, void **datap, size_t *lenp, int asAscii) {
/** \ingroup rpmio /** \ingroup rpmio
*/ */
/*@unused@*/ static inline /*@unused@*/ static inline
int fdFileno(/*@null@*/ void * cookie) { int fdFileno(/*@null@*/ void * cookie)
/*@*/
{
FD_t fd; FD_t fd;
if (cookie == NULL) return -2; if (cookie == NULL) return -2;
fd = c2f(cookie); fd = c2f(cookie);

View File

@ -14,11 +14,13 @@ static /*@only@*/ /*@null@*/ rpmlogRec recs = NULL;
/** /**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param this memory to free * @param p memory to free
* @retval NULL always * @retval NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) { /*@unused@*/ static inline /*@null@*/ void *
if (this != NULL) free((void *)this); _free(/*@only@*/ /*@null@*/ const void * p) /*@modifies p@*/
{
if (p != NULL) free((void *)p);
return NULL; return NULL;
} }

View File

@ -19,6 +19,7 @@
* *
* priorities (these are ordered) * priorities (these are ordered)
*/ */
/*@-typeuse@*/
typedef enum rpmlogLvl_e { typedef enum rpmlogLvl_e {
RPMLOG_EMERG = 0, /*!< system is unusable */ RPMLOG_EMERG = 0, /*!< system is unusable */
RPMLOG_ALERT = 1, /*!< action must be taken immediately */ RPMLOG_ALERT = 1, /*!< action must be taken immediately */
@ -29,6 +30,7 @@ typedef enum rpmlogLvl_e {
RPMLOG_INFO = 6, /*!< informational */ RPMLOG_INFO = 6, /*!< informational */
RPMLOG_DEBUG = 7 /*!< debug-level messages */ RPMLOG_DEBUG = 7 /*!< debug-level messages */
} rpmlogLvl; } rpmlogLvl;
/*@=typeuse@*/
#define RPMLOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ #define RPMLOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
/* extract priority */ /* extract priority */
@ -65,6 +67,7 @@ RPMCODE rpmprioritynames[] =
/** /**
* facility codes * facility codes
*/ */
/*@-enummemuse -typeuse@*/
typedef enum rpmlogFac_e { typedef enum rpmlogFac_e {
RPMLOG_KERN = (0<<3), /*!< kernel messages */ RPMLOG_KERN = (0<<3), /*!< kernel messages */
RPMLOG_USER = (1<<3), /*!< random user-level messages */ RPMLOG_USER = (1<<3), /*!< random user-level messages */
@ -92,6 +95,7 @@ typedef enum rpmlogFac_e {
#define RPMLOG_NFACILITIES 24 /*!< current number of facilities */ #define RPMLOG_NFACILITIES 24 /*!< current number of facilities */
RPMLOG_ERRMSG = (((unsigned)(RPMLOG_NFACILITIES+0))<<3) RPMLOG_ERRMSG = (((unsigned)(RPMLOG_NFACILITIES+0))<<3)
} rpmlogFac; } rpmlogFac;
/*@=enummemuse =typeuse@*/
#define RPMLOG_FACMASK 0x03f8 /*!< mask to extract facility part */ #define RPMLOG_FACMASK 0x03f8 /*!< mask to extract facility part */
#define RPMLOG_FAC(p) (((p) & RPMLOG_FACMASK) >> 3) #define RPMLOG_FAC(p) (((p) & RPMLOG_FACMASK) >> 3)
@ -165,42 +169,51 @@ extern "C" {
* Return number of rpmError() ressages. * Return number of rpmError() ressages.
* @return number of messages * @return number of messages
*/ */
int rpmlogGetNrecs(void); int rpmlogGetNrecs(void) /*@*/;
/** /**
* Print all rpmError() messages. * Print all rpmError() messages.
* @param f file handle (NULL uses stderr) * @param f file handle (NULL uses stderr)
*/ */
void rpmlogPrint(FILE *f); void rpmlogPrint(FILE *f)
/*@modifies *f @*/;
/** /**
* Close desriptor used to write to system logger. * Close desriptor used to write to system logger.
* @todo Implement. * @todo Implement.
*/ */
void rpmlogClose (void); /*@unused@*/
void rpmlogClose (void)
/*@modifies internalState @*/;
/** /**
* Open connection to system logger. * Open connection to system logger.
* @todo Implement. * @todo Implement.
*/ */
void rpmlogOpen (const char *ident, int option, int facility); /*@unused@*/
void rpmlogOpen (const char * ident, int option, int facility)
/*@modifies internalState @*/;
/** /**
* Set the log mask level. * Set the log mask level.
*/ */
int rpmlogSetMask (int mask); int rpmlogSetMask (int mask)
/*@modifies internalState @*/;
/** /**
* Generate a log message using FMT string and option arguments. * Generate a log message using FMT string and option arguments.
*/ */
/*@mayexit@*/ /*@printflike@*/ void rpmlog (int pri, const char *fmt, ...); /*@mayexit@*/ /*@printflike@*/ void rpmlog (int pri, const char *fmt, ...)
/*@modifies internalState @*/;
/*@-exportlocal@*/ /*@-exportlocal@*/
/** /**
* Return text of last rpmError() message. * Return text of last rpmError() message.
* @return text of last message * @return text of last message
*/ */
/*@observer@*/ /*@null@*/ const char * rpmlogMessage(void); /*@-redecl@*/
/*@observer@*/ /*@null@*/ const char * rpmlogMessage(void) /*@*/;
/*@=redecl@*/
/** /**
* Return error code from last rpmError() message. * Return error code from last rpmError() message.
@ -209,33 +222,37 @@ int rpmlogSetMask (int mask);
* and parsed IMHO. * and parsed IMHO.
* @return code from last message * @return code from last message
*/ */
int rpmlogCode(void); int rpmlogCode(void) /*@*/;
/** /**
* Set rpmlog callback function. * Set rpmlog callback function.
*/ */
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb); rpmlogCallback rpmlogSetCallback(rpmlogCallback cb)
/*@modifies internalState @*/;
/*@=exportlocal@*/ /*@=exportlocal@*/
/** /**
* Set rpmlog callback function. * Set rpmlog callback function.
* @deprecated gnorpm needs, use rpmlogSetCallback() instead. * @deprecated gnorpm needs, use rpmlogSetCallback() instead.
*/ */
extern rpmlogCallback rpmErrorSetCallback(rpmlogCallback cb); extern rpmlogCallback rpmErrorSetCallback(rpmlogCallback cb)
/*@modifies internalState @*/;
/** /**
* Return error code from last rpmError() message. * Return error code from last rpmError() message.
* @deprecated Perl-RPM needs, use rpmlogCode() instead. * @deprecated Perl-RPM needs, use rpmlogCode() instead.
* @return code from last message * @return code from last message
*/ */
extern int rpmErrorCode(void); extern int rpmErrorCode(void) /*@*/;
/** /**
* Return text of last rpmError() message. * Return text of last rpmError() message.
* @deprecated gnorpm needs, use rpmlogMessage() instead. * @deprecated gnorpm needs, use rpmlogMessage() instead.
* @return text of last message * @return text of last message
*/ */
/*@observer@*/ /*@null@*/ extern const char * rpmErrorString(void); /*@-redecl@*/
/*@observer@*/ /*@null@*/ extern const char * rpmErrorString(void) /*@*/;
/*@=redecl@*/
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -157,8 +157,10 @@ char * rpmExpand (/*@null@*/ const char * arg, ...)
* @param path macro(s) to expand (NULL terminates list) * @param path macro(s) to expand (NULL terminates list)
* @return canonicalized path (malloc'ed) * @return canonicalized path (malloc'ed)
*/ */
/*@-redecl@*/
const char * rpmGetPath (/*@null@*/ const char * path, ...) const char * rpmGetPath (/*@null@*/ const char * path, ...)
/*@*/; /*@*/;
/*@=redecl@*/
/** /**
* Merge 3 args into path, any or all of which may be a url. * Merge 3 args into path, any or all of which may be a url.
@ -170,10 +172,12 @@ const char * rpmGetPath (/*@null@*/ const char * path, ...)
* @param file file URL (often a file, or NULL) * @param file file URL (often a file, or NULL)
* @return expanded, merged, canonicalized path (malloc'ed) * @return expanded, merged, canonicalized path (malloc'ed)
*/ */
/*@-redecl@*/
const char * rpmGenPath (/*@null@*/ const char * root, const char * rpmGenPath (/*@null@*/ const char * root,
/*@null@*/ const char * mdir, /*@null@*/ const char * mdir,
/*@null@*/ const char * file) /*@null@*/ const char * file)
/*@*/; /*@*/;
/*@=redecl@*/
/** /**
* Return macro expansion as a numeric value. * Return macro expansion as a numeric value.

View File

@ -67,6 +67,7 @@ typedef /*@only@*/ /*@null@*/
/** /**
*/ */
/*@unused@*/
void urlSetCallback(rpmCallbackFunction notify, rpmCallbackData notifyData, void urlSetCallback(rpmCallbackFunction notify, rpmCallbackData notifyData,
int notifyCount); int notifyCount);

View File

@ -11,7 +11,9 @@
/*@access FD_t@*/ /*@access FD_t@*/
/*@access urlinfo@*/ /*@access urlinfo@*/
/*@-redecl@*/
extern int _rpmio_debug; extern int _rpmio_debug;
/*@=redecl@*/
/* =============================================================== */ /* =============================================================== */
static int ftpMkdir(const char * path, /*@unused@*/ mode_t mode) { static int ftpMkdir(const char * path, /*@unused@*/ mode_t mode) {

View File

@ -16,6 +16,7 @@ int gnameToGid(const char * thisGname, /*@out@*/ gid_t * gid);
/* Call w/ -1 to flush the cache, returns NULL if the user can't be found */ /* Call w/ -1 to flush the cache, returns NULL if the user can't be found */
/*@observer@*/ /*@null@*/ char * uidToUname(uid_t uid); /*@observer@*/ /*@null@*/ char * uidToUname(uid_t uid);
/*@unused@*/
/*@observer@*/ /*@null@*/ char * gidToGname(gid_t gid); /*@observer@*/ /*@null@*/ char * gidToGname(gid_t gid);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -41,11 +41,13 @@ static int uCount = 0;
/** /**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param this memory to free * @param p memory to free
* @retval NULL always * @retval NULL always
*/ */
/*@unused@*/ static inline /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) { /*@unused@*/ static inline /*@null@*/ void *
if (this != NULL) free((void *)this); _free(/*@only@*/ /*@null@*/ const void * p) /*@modifies p@*/
{
if (p != NULL) free((void *)p);
return NULL; return NULL;
} }

View File

@ -88,17 +88,23 @@ enum modes {
#define MODES_FOR_TEST (MODES_BT | MODES_IE) #define MODES_FOR_TEST (MODES_BT | MODES_IE)
#define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB) #define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB)
/*@-exportheadervar@*/
extern int _ftp_debug; extern int _ftp_debug;
extern int noLibio; extern int noLibio;
extern int _rpmio_debug; extern int _rpmio_debug;
extern int _url_debug; extern int _url_debug;
extern int _noDirTokens; extern int _noDirTokens;
/*@-varuse@*/
extern const char * rpmNAME; extern const char * rpmNAME;
/*@=varuse@*/
extern const char * rpmEVR; extern const char * rpmEVR;
/*@-varuse@*/
extern int rpmFLAGS; extern int rpmFLAGS;
/*@=varuse@*/
extern struct MacroContext_s rpmCLIMacroContext; extern struct MacroContext_s rpmCLIMacroContext;
/*@=exportheadervar@*/
/* options for all executables */ /* options for all executables */

View File

@ -38,6 +38,12 @@
extern time_t timezone; extern time_t timezone;
#endif #endif
#ifdef __LCLINT__
typedef unsigned int u_int32_t;
typedef unsigned short u_int16_t;
typedef unsigned char u_int8_t;
typedef int int32_t;
#endif
/* Since major is a function on SVR4, we can't use `ifndef major'. */ /* Since major is a function on SVR4, we can't use `ifndef major'. */
#if MAJOR_IN_MKDEV #if MAJOR_IN_MKDEV
@ -77,16 +83,22 @@ char *memchr ();
#endif #endif
#if !defined(HAVE_STPCPY) || defined(__LCLINT__) #if !defined(HAVE_STPCPY) || defined(__LCLINT__)
char * stpcpy(char * dest, const char * src); /*@-declundef@*/
char * stpcpy(char * dest, const char * src) /*@modifies *dest @*/;
/*@=declundef@*/
#endif #endif
#if !defined(HAVE_STPNCPY) || defined(__LCLINT__) #if !defined(HAVE_STPNCPY) || defined(__LCLINT__)
char * stpncpy(char * dest, const char * src, size_t n); /*@-declundef@*/
char * stpncpy(char * dest, const char * src, size_t n) /*@modifies *dest @*/;
/*@=declundef@*/
#endif #endif
#include <errno.h> #include <errno.h>
#ifndef errno #ifndef errno
/*@-declundef @*/
extern int errno; extern int errno;
/*@=declundef @*/
#endif #endif
#ifdef STDC_HEADERS #ifdef STDC_HEADERS
@ -112,12 +124,12 @@ char *getenv (const char *name);
#include <sys/file.h> #include <sys/file.h>
#endif #endif
#ifndef SEEK_SET #if !defined(SEEK_SET) && !defined(__LCLINT__)
#define SEEK_SET 0 #define SEEK_SET 0
#define SEEK_CUR 1 #define SEEK_CUR 1
#define SEEK_END 2 #define SEEK_END 2
#endif #endif
#ifndef F_OK #if !defined(F_OK) && !defined(__LCLINT__)
#define F_OK 0 #define F_OK 0
#define X_OK 1 #define X_OK 1
#define W_OK 2 #define W_OK 2
@ -194,11 +206,14 @@ char *alloca ();
#include <malloc.h> #include <malloc.h>
#endif #endif
/*@only@*/ void * xmalloc (size_t size); /*@-declundef@*/
/*@only@*/ void * xcalloc (size_t nmemb, size_t size); /*@mayexit@*/ /*@only@*/ void * xmalloc (size_t size) /*@*/;
/*@only@*/ void * xrealloc (/*@only@*/ /*@null@*/ void * ptr, size_t size); /*@mayexit@*/ /*@only@*/ void * xcalloc (size_t nmemb, size_t size) /*@*/;
/*@only@*/ char * xstrdup (const char *str); /*@mayexit@*/ /*@only@*/ void * xrealloc (/*@only@*//*@null@*/ void * ptr,
/*@only@*/ void *vmefail(size_t size); size_t size) /*@*/;
/*@mayexit@*/ /*@only@*/ char * xstrdup (const char *str) /*@*/;
/*@=declundef@*/
/*@unused@*/ /*@exits@*/ /*@only@*/ void * vmefail(size_t size);
#if HAVE_MCHECK_H #if HAVE_MCHECK_H
#include <mcheck.h> #include <mcheck.h>