diff options
author | jbj <devnull@localhost> | 1999-09-17 20:40:41 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-09-17 20:40:41 +0000 |
commit | b8d3c0d56a77ca1131a74560413a0e8a16704f4f (patch) | |
tree | 01eff96646b6c3c1d23f3e140f7a9df176230f31 | |
parent | b226bc53d0074ed9eadc979abcda1adb75fd7ff3 (diff) | |
download | rpm-b8d3c0d56a77ca1131a74560413a0e8a16704f4f.tar.gz rpm-b8d3c0d56a77ca1131a74560413a0e8a16704f4f.tar.bz2 rpm-b8d3c0d56a77ca1131a74560413a0e8a16704f4f.zip |
lclint annotations.
CVS patchset: 3288
CVS date: 1999/09/17 20:40:41
-rw-r--r-- | lib/cpio.h | 16 | ||||
-rw-r--r-- | lib/depends.h | 12 | ||||
-rw-r--r-- | lib/falloc.h | 6 | ||||
-rw-r--r-- | lib/header.h | 19 | ||||
-rw-r--r-- | lib/install.h | 16 | ||||
-rw-r--r-- | lib/query.c | 60 | ||||
-rw-r--r-- | lib/rpmbzio.c | 12 | ||||
-rw-r--r-- | lib/rpmio.h | 28 | ||||
-rw-r--r-- | lib/rpmlead.h | 2 | ||||
-rw-r--r-- | lib/rpmurl.h | 22 | ||||
-rw-r--r-- | lib/signature.h | 4 | ||||
-rw-r--r-- | lib/verify.c | 10 | ||||
-rw-r--r-- | rpmio/messages.c | 8 |
13 files changed, 112 insertions, 103 deletions
diff --git a/lib/cpio.h b/lib/cpio.h index 8099634e0..7ab64df6b 100644 --- a/lib/cpio.h +++ b/lib/cpio.h @@ -45,8 +45,8 @@ #define CPIO_FOLLOW_SYMLINKS (1 << 4) /* only for building */ struct cpioFileMapping { - char * archivePath; - char * fsPath; + /*@dependent@*/ const char * archivePath; + /*@dependent@*/ const char * fsPath; mode_t finalMode; uid_t finalUid; gid_t finalGid; @@ -55,7 +55,7 @@ struct cpioFileMapping { /* on cpio building, only "file" is filled in */ struct cpioCallbackInfo { - char * file; + /*@dependent@*/ const char * file; long fileSize; /* total file size */ long fileComplete; /* amount of file unpacked */ long bytesProcessed; /* bytes in archive read */ @@ -63,11 +63,11 @@ struct cpioCallbackInfo { typedef struct CFD { union { - FD_t _cfdu_fd; + /*@owned@*/FD_t _cfdu_fd; #define cpioFd _cfdu._cfdu_fd - FILE * _cfdu_fp; + /*@owned@*/FILE *_cfdu_fp; #define cpioFp _cfdu._cfdu_fp - FD_t _cfdu_gzfd; + /*@owned@*/FD_t _cfdu_gzfd; #define cpioGzFd _cfdu._cfdu_gzfd } _cfdu; int cpioPos; @@ -94,7 +94,7 @@ typedef void (*cpioCallback)(struct cpioCallbackInfo * filespec, void * data); user. If *failedFile is non-NULL on return, it should be free()d. */ int cpioInstallArchive(CFD_t *cfd, struct cpioFileMapping * mappings, int numMappings, cpioCallback cb, void * cbData, - char ** failedFile); + /*@out@*/const char ** failedFile); int cpioBuildArchive(CFD_t *cfd, struct cpioFileMapping * mappings, int numMappings, cpioCallback cb, void * cbData, unsigned int * archiveSize, /*@out@*/char ** failedFile); @@ -102,7 +102,7 @@ int cpioBuildArchive(CFD_t *cfd, struct cpioFileMapping * mappings, /* This is designed to be qsort/bsearch compatible */ int cpioFileMapCmp(const void * a, const void * b); -const char *cpioStrerror(int rc); +/*@observer@*/ const char *cpioStrerror(int rc); #ifdef __cplusplus } diff --git a/lib/depends.h b/lib/depends.h index dd2ddb20c..334a48183 100644 --- a/lib/depends.h +++ b/lib/depends.h @@ -12,9 +12,9 @@ struct availablePackage { const char * name, * version, * release; int_32 *epoch; int providesCount, filesCount; - const void * key; + /*@owned@*/ const void * key; rpmRelocation * relocs; - FD_t fd; + /*@owned@*/ FD_t fd; } ; enum indexEntryType { IET_NAME, IET_PROVIDES, IET_FILE }; @@ -48,13 +48,13 @@ struct transactionElement { }; struct rpmTransactionSet_s { - rpmdb db; /* may be NULL */ - int * removedPackages; + /*@owned@*/rpmdb db; /* may be NULL */ + /*@only@*/int * removedPackages; int numRemovedPackages, allocedRemovedPackages; struct availableList addedPackages, availablePackages; - struct transactionElement * order; + /*@only@*/struct transactionElement * order; int orderCount, orderAlloced; - char * root; + /*@only@*/const char * root; FD_t scriptFd; }; diff --git a/lib/falloc.h b/lib/falloc.h index 46155ca12..fc9aaad74 100644 --- a/lib/falloc.h +++ b/lib/falloc.h @@ -6,7 +6,7 @@ uses 32 bit offsets on all platforms and should be byte order independent */ typedef /*@abstract@*/ struct faFile_s { - FD_t fd; + /*@owned@*/FD_t fd; int readOnly; unsigned int firstFree; unsigned long fileSize; @@ -22,10 +22,10 @@ extern "C" { #endif /* flags here is the same as for open(2) - NULL returned on error */ -faFile faOpen(char * path, int flags, int perms); +/*@only@*/faFile faOpen(const char * path, int flags, int perms); unsigned int faAlloc(faFile fa, unsigned int size); /* returns 0 on failure */ void faFree(faFile fa, unsigned int offset); -void faClose(faFile fa); +void faClose(/*@only@*/faFile fa); FD_t faFileno(faFile fa); off_t faLseek(faFile fa, off_t off, int op); diff --git a/lib/header.h b/lib/header.h index 1de6474c7..4d9db0fe6 100644 --- a/lib/header.h +++ b/lib/header.h @@ -34,11 +34,11 @@ typedef unsigned int uint_32; typedef unsigned short uint_16; #endif -typedef /*@abstract@*/ struct headerToken *Header; +typedef /*@abstract@*/ /*@refcounted@*/ struct headerToken *Header; typedef /*@abstract@*/ struct headerIteratorS *HeaderIterator; struct headerTagTableEntry { - char * name; + const char * name; int val; }; @@ -73,7 +73,7 @@ extern const struct headerSprintfExtension headerDefaultFormats[]; Header headerRead(FD_t fd, int magicp); int headerWrite(FD_t fd, Header h, int magicp); Header headerGzRead(FD_t fd, int magicp); -void headerGzWrite(FD_t fd, Header h, int magicp); +int headerGzWrite(FD_t fd, Header h, int magicp); unsigned int headerSizeof(Header h, int magicp); #define HEADER_MAGIC_NO 0 @@ -84,7 +84,7 @@ Header headerLoad(void *p); void *headerUnload(Header h); Header headerNew(void); -void headerFree(/*@only@*/ Header h); +void headerFree(/*@killref@*/ Header h); /* dump a header to a file, in human readable format */ void headerDump(Header h, FILE *f, int flags, @@ -94,7 +94,7 @@ void headerDump(Header h, FILE *f, int flags, char * headerSprintf(Header h, const char * fmt, const struct headerTagTableEntry * tags, const struct headerSprintfExtension * extentions, - /*@out@*/char ** error); + /*@out@*/const char ** error); #define HEADER_DUMP_INLINE 1 @@ -102,7 +102,7 @@ char * headerSprintf(Header h, const char * fmt, exceptions noted below). While you are allowed to add i18n string arrays through this function, you probably don't mean to. See headerAddI18NString() instead */ -int headerAddEntry(Header h, int_32 tag, int_32 type, void *p, int_32 c); +int headerAddEntry(Header h, int_32 tag, int_32 type, /*@out@*/void *p, int_32 c); /* if there are multiple entries with this tag, the first one gets replaced */ int headerModifyEntry(Header h, int_32 tag, int_32 type, void *p, int_32 c); @@ -137,11 +137,11 @@ int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type, int headerGetEntry(Header h, int_32 tag, /*@out@*/int_32 *type, /*@out@*/void **p, /*@out@*/int_32 *c); /* This gets an entry, and uses as little extra RAM as possible to represent it (this is only an issue for RPM_STRING_ARRAY_TYPE. */ -int headerGetEntryMinMemory(Header h, int_32 tag, int_32 *type, /*@out@*/void **p, int_32 *c); +int headerGetEntryMinMemory(Header h, int_32 tag, int_32 *type, /*@out@*/void **p, /*@out@*/int_32 *c); /* If *type is RPM_NULL_TYPE any type will match, otherwise only *type will match. */ -int headerGetRawEntry(Header h, int_32 tag, int_32 *type, void **p, int_32 *c); +int headerGetRawEntry(Header h, int_32 tag, /*@out@*/int_32 *type, /*@out@*/void **p, /*@out@*/int_32 *c); int headerIsEntry(Header h, int_32 tag); /* removes all entries of type tag from the header, returns 1 if none were @@ -150,7 +150,8 @@ int headerRemoveEntry(Header h, int_32 tag); HeaderIterator headerInitIterator(Header h); int headerNextIterator(HeaderIterator iter, - int_32 *tag, int_32 *type, void **p, int_32 *c); + /*@out@*/int_32 *tag, /*@out@*/int_32 *type, /*@out@*/void **p, + /*@out@*/int_32 *c); void headerFreeIterator(/*@only@*/ HeaderIterator iter); Header headerCopy(Header h); diff --git a/lib/install.h b/lib/install.h index 183280542..ab95511d6 100644 --- a/lib/install.h +++ b/lib/install.h @@ -24,22 +24,22 @@ enum fileTypes { XDIR, BDEV, CDEV, SOCK, PIPE, REG, LINK } ; extern "C" { #endif -int removeBinaryPackage(char * root, rpmdb db, unsigned int offset, int flags, - enum fileActions * actions, FD_t scriptFd); +int removeBinaryPackage(const char * root, rpmdb db, unsigned int offset, + int flags, enum fileActions * actions, FD_t scriptFd); int runInstScript(const char * prefix, Header h, int scriptTag, int progTag, - int arg, int norunScripts, FD_t err); + int arg, int norunScripts, FD_t err); /* this looks for triggers in the database which h would set off */ int runTriggers(const char * root, rpmdb db, int sense, Header h, int countCorrection, FD_t scriptFd); /* while this looks for triggers in h which are set off by things in the db database to calculate arguments to the trigger */ int runImmedTriggers(const char * root, rpmdb db, int sense, Header h, - int countCorrection, FD_t scriptFd); + int countCorrection, FD_t scriptFd); int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h, - int flags, rpmCallbackFunction notify, - void * notifyData, const void * pkgKey, - enum fileActions * actions, - struct sharedFileInfo * sharedList, FD_t scriptFd); + int flags, rpmCallbackFunction notify, + void * notifyData, const void * pkgKey, + enum fileActions * actions, + struct sharedFileInfo * sharedList, FD_t scriptFd); const char * fileActionString(enum fileActions a); #ifdef __cplusplus diff --git a/lib/query.c b/lib/query.c index 7eae04256..4d61e2139 100644 --- a/lib/query.c +++ b/lib/query.c @@ -132,7 +132,7 @@ static void printFileInfo(FILE *fp, const char * name, static int queryHeader(FILE *fp, Header h, const char * chptr) { char * str; - char * error; + const char * error; str = headerSprintf(h, chptr, rpmTagTable, rpmHeaderFormats, &error); if (!str) { @@ -145,7 +145,7 @@ static int queryHeader(FILE *fp, Header h, const char * chptr) return 0; } -int showQueryPackage(QVA_t *qva, rpmdb db, Header h) +int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb db, Header h) { FILE *fp = stdout; /* XXX FIXME: pass as arg */ int queryFlags = qva->qva_flags; @@ -154,13 +154,15 @@ int showQueryPackage(QVA_t *qva, rpmdb db, Header h) const char * name, * version, * release; int_32 count, type; char * prefix = NULL; - char ** fileList, ** fileMD5List; - char * fileStatesList; - char ** fileOwnerList = NULL; - char ** fileGroupList = NULL; - char ** fileLinktoList; + const char ** fileList; + const char ** fileMD5List; + const char * fileStatesList; + const char ** fileOwnerList = NULL; + const char ** fileGroupList = NULL; + const char ** fileLinktoList; int_32 * fileFlagsList, * fileMTimeList, * fileSizeList; - int_32 * fileUIDList, * fileGIDList; + int_32 * fileUIDList = NULL; + int_32 * fileGIDList = NULL; uint_16 * fileModeList; uint_16 * fileRdevList; int i; @@ -201,17 +203,17 @@ int showQueryPackage(QVA_t *qva, rpmdb db, Header h) if (!headerGetEntry(h, RPMTAG_FILEUIDS, &type, (void **) &fileUIDList, &count)) { fileUIDList = NULL; - } else { - headerGetEntry(h, RPMTAG_FILEGIDS, &type, - (void **) &fileGIDList, &count); + } else if (!headerGetEntry(h, RPMTAG_FILEGIDS, &type, + (void **) &fileGIDList, &count)) { + fileGIDList = NULL; } if (!headerGetEntry(h, RPMTAG_FILEUSERNAME, &type, (void **) &fileOwnerList, &count)) { fileOwnerList = NULL; - } else { - headerGetEntry(h, RPMTAG_FILEGROUPNAME, &type, - (void **) &fileGroupList, &count); + } else if (!headerGetEntry(h, RPMTAG_FILEGROUPNAME, &type, + (void **) &fileGroupList, &count)) { + fileGroupList = NULL; } for (i = 0; i < count; i++) { @@ -238,7 +240,7 @@ int showQueryPackage(QVA_t *qva, rpmdb db, Header h) fputs(_("net shared "), fp); break; default: fprintf(fp, _("(unknown %3d) "), - fileStatesList[i]); + (int)fileStatesList[i]); } } else { fputs( _("(no state) "), fp); @@ -250,10 +252,10 @@ int showQueryPackage(QVA_t *qva, rpmdb db, Header h) fileSizeList[i], fileMTimeList[i], fileMD5List[i], fileModeList[i]); - if (fileOwnerList) + if (fileOwnerList && fileGroupList) fprintf(fp, "%s %s", fileOwnerList[i], fileGroupList[i]); - else if (fileUIDList) + else if (fileUIDList && fileGIDList) fprintf(fp, "%d %d", fileUIDList[i], fileGIDList[i]); else { @@ -274,13 +276,13 @@ int showQueryPackage(QVA_t *qva, rpmdb db, Header h) } else if (!rpmIsVerbose()) { fputs(fileList[i], fp); fputs("\n", fp); - } else if (fileOwnerList) + } else if (fileOwnerList && fileGroupList) printFileInfo(fp, fileList[i], fileSizeList[i], fileModeList[i], fileMTimeList[i], fileRdevList[i], fileOwnerList[i], fileGroupList[i], -1, -1, fileLinktoList[i]); - else if (fileUIDList) { + else if (fileUIDList && fileGIDList) { printFileInfo(fp, fileList[i], fileSizeList[i], fileModeList[i], fileMTimeList[i], fileRdevList[i], NULL, @@ -333,7 +335,8 @@ printNewSpecfile(Spec spec) switch(t->t_tag) { case RPMTAG_SUMMARY: case RPMTAG_GROUP: - FREE(sl->sl_lines[t->t_startx]); + free(sl->sl_lines[t->t_startx]); + sl->sl_lines[t->t_startx] = NULL; if (t->t_lang && strcmp(t->t_lang, RPMBUILD_DEFAULT_LANG)) continue; sprintf(buf, "%s: %s\n", @@ -342,10 +345,13 @@ printNewSpecfile(Spec spec) sl->sl_lines[t->t_startx] = strdup(buf); break; case RPMTAG_DESCRIPTION: - for (j = 1; j < t->t_nlines; j++) - FREE(sl->sl_lines[t->t_startx + j]); + for (j = 1; j < t->t_nlines; j++) { + free(sl->sl_lines[t->t_startx + j]); + sl->sl_lines[t->t_startx + j] = NULL; + } if (t->t_lang && strcmp(t->t_lang, RPMBUILD_DEFAULT_LANG)) { - FREE(sl->sl_lines[t->t_startx]); + free(sl->sl_lines[t->t_startx]); + sl->sl_lines[t->t_startx] = NULL; continue; } sl->sl_lines[t->t_startx + 1] = strdup(msgstr); @@ -457,7 +463,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg, break; case 1: fprintf(stderr, _("%s does not appear to be a RPM package\n"), arg); - /* fallthrough */ + /*@fallthrough@*/ case 2: fprintf(stderr, _("query of %s failed\n"), arg); retcode = 1; @@ -650,8 +656,8 @@ int rpmQuery(QVA_t *qva, enum rpmQVSources source, const char * arg) #define POPT_SPECFILE 1006 /* ========== Query/Verify source popt args */ -static void rpmQVSourceArgCallback(poptContext con, enum poptCallbackReason reason, - const struct poptOption * opt, const char * arg, +static void rpmQVSourceArgCallback(/*@unused@*/poptContext con, /*@unused@*/enum poptCallbackReason reason, + const struct poptOption * opt, /*@unused@*/const char * arg, QVA_t *qva) { @@ -703,7 +709,7 @@ struct poptOption rpmQVSourcePoptTable[] = { /* ========== Query specific popt args */ -static void queryArgCallback(poptContext con, enum poptCallbackReason reason, +static void queryArgCallback(/*@unused@*/poptContext con, /*@unused@*/enum poptCallbackReason reason, const struct poptOption * opt, const char * arg, QVA_t *qva) { diff --git a/lib/rpmbzio.c b/lib/rpmbzio.c index c66f38be9..bde4ccafe 100644 --- a/lib/rpmbzio.c +++ b/lib/rpmbzio.c @@ -3,6 +3,8 @@ #include <rpmlib.h> #include <rpmio.h> +/*@access FD_t@*/ + /* =============================================================== */ /* Support for BZIP2 library. */ @@ -14,7 +16,7 @@ BZFILE * bzdFileno(FD_t fd) { return (fd != NULL ? ((BZFILE *)fd->fd_bzd) : NULL); } -/*@null@*/ FD_t bzdOpen(const char *pathname, const char *mode) { +FD_t bzdOpen(const char *pathname, const char *mode) { FD_t fd; BZFILE *bzfile;; if ((bzfile = bzopen(pathname, mode)) == NULL) @@ -24,7 +26,7 @@ BZFILE * bzdFileno(FD_t fd) { return fd; } -/*@shared@*/ FD_t bzdFdopen(FD_t fd, const char *mode) { +FD_t bzdFdopen(FD_t fd, const char *mode) { BZFILE *bzfile = bzdopen(fdFileno(fd), mode); if (bzfile != NULL) { fd->fd_fd = -1; @@ -46,12 +48,12 @@ int bzdFlush(FD_t fd) { return bzflush(bzdFileno(fd)); } -char * bzdStrerror(FD_t fd) { +const char * bzdStrerror(FD_t fd) { int bzerr; - return (char *)bzerror(bzdFileno(fd), &bzerr); + return bzerror(bzdFileno(fd), &bzerr); } -int bzdClose(/*@only@*/ FD_t fd) { +int bzdClose(FD_t fd) { BZFILE *bzfile; if (fd != NULL && (bzfile = bzdFileno(fd)) != NULL) { diff --git a/lib/rpmio.h b/lib/rpmio.h index 1f8cf8fee..57c2b6acc 100644 --- a/lib/rpmio.h +++ b/lib/rpmio.h @@ -22,21 +22,21 @@ typedef /*@abstract@*/ struct _FD { extern "C" { #endif -int timedRead(FD_t fd, void * bufptr, int length); +int timedRead(FD_t fd, /*@out@*/void * bufptr, int length); -extern /*@null@*/ FD_t fdNew(void); +extern /*@only@*/ /*@null@*/ FD_t fdNew(void); extern int fdValid(FD_t fd); extern int fdFileno(FD_t fd); -extern /*@null@*/ FD_t fdOpen(const char *pathname, int flags, mode_t mode); -extern /*@null@*/ FD_t fdDup(int fdno); +extern /*@only@*/ /*@null@*/ FD_t fdOpen(const char *pathname, int flags, mode_t mode); +extern /*@only@*/ /*@null@*/ FD_t fdDup(int fdno); extern off_t fdLseek(FD_t fd, off_t offset, int whence); -extern ssize_t fdRead(FD_t fd, void * buf, size_t count); +extern ssize_t fdRead(FD_t fd, /*@out@*/void * buf, size_t count); extern ssize_t fdWrite(FD_t fd, const void * buf, size_t count); extern int fdClose(/*@only@*/ FD_t fd); -extern /*@shared@*/ FILE *fdFdopen(/*@owned@*/ FD_t fd, const char *mode); +extern /*@null@*/ FILE *fdFdopen(FD_t fd, const char *mode); /* * Support for GZIP library. @@ -47,11 +47,11 @@ extern /*@shared@*/ FILE *fdFdopen(/*@owned@*/ FD_t fd, const char *mode); extern gzFile * gzdFileno(FD_t fd); -extern /*@null@*/ FD_t gzdOpen(const char *pathname, const char *mode); +extern /*@only@*/ /*@null@*/ FD_t gzdOpen(const char *pathname, const char *mode); -extern /*@shared@*/ FD_t gzdFdopen(FD_t fd, const char *mode); +extern /*@only@*/ /*@null@*/ FD_t gzdFdopen(FD_t fd, const char *mode); -extern ssize_t gzdRead(FD_t fd, void * buf, size_t count); +extern ssize_t gzdRead(FD_t fd, /*@out@*/void * buf, size_t count); extern ssize_t gzdWrite(FD_t fd, const void * buf, size_t count); @@ -59,7 +59,7 @@ extern off_t gzdLseek(FD_t fd, off_t offset, int whence); extern int gzdFlush(FD_t fd); -extern char * gzdStrerror(FD_t fd); +extern /*@only@*/ /*@observer@*/ const char * gzdStrerror(FD_t fd); extern int gzdClose(/*@only@*/ FD_t fd); @@ -74,17 +74,17 @@ extern int gzdClose(/*@only@*/ FD_t fd); extern BZFILE * bzdFileno(FD_t fd); -extern /*@null@*/ FD_t bzdOpen(const char *pathname, const char *mode); +extern /*@only@*/ /*@null@*/ FD_t bzdOpen(const char *pathname, const char *mode); -extern /*@shared@*/ FD_t bzdFdopen(FD_t fd, const char *mode); +extern /*@only@*/ /*@null@*/ FD_t bzdFdopen(FD_t fd, const char *mode); -extern ssize_t bzdRead(FD_t fd, void * buf, size_t count); +extern ssize_t bzdRead(FD_t fd, /*@out@*/void * buf, size_t count); extern ssize_t bzdWrite(FD_t fd, const void * buf, size_t count); extern int bzdFlush(FD_t fd); -extern char * bzdStrerror(FD_t fd); +extern /*@only@*/ /*@observer@*/ const char * bzdStrerror(FD_t fd); extern int bzdClose(/*@only@*/ FD_t fd); diff --git a/lib/rpmlead.h b/lib/rpmlead.h index 2de5941d3..a87fefe38 100644 --- a/lib/rpmlead.h +++ b/lib/rpmlead.h @@ -10,7 +10,7 @@ extern "C" { #endif int writeLead(FD_t fd, struct rpmlead *lead); -int readLead(FD_t fd, struct rpmlead *lead); +int readLead(FD_t fd, /*@out@*/struct rpmlead *lead); #ifdef __cplusplus } diff --git a/lib/rpmurl.h b/lib/rpmurl.h index 879b59409..39b50dee8 100644 --- a/lib/rpmurl.h +++ b/lib/rpmurl.h @@ -50,26 +50,26 @@ typedef struct urlinfo { extern "C" { #endif -const char * ftpStrerror(int ftpErrno); +/*@only@*/ /*@observer@*/ const char * ftpStrerror(int ftpErrno); void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount); int httpOpen(urlinfo *u); int ftpOpen(urlinfo *u); -int httpGetFile(FD_t sfd, FD_t tfd); -int ftpGetFile(FD_t sfd, FD_t tfd); +int httpGetFile(/*@only@*/FD_t sfd, FD_t tfd); +int ftpGetFile(/*@only@*/FD_t sfd, FD_t tfd); int ftpGetFileDesc(FD_t); -int ftpAbort(FD_t fd); -int ftpClose(FD_t fd); +int ftpAbort(/*@only@*/FD_t fd); +int ftpClose(/*@only@*/FD_t fd); urltype urlIsURL(const char * url); -int urlSplit(const char *url, urlinfo **u); -urlinfo *newUrlinfo(void); -void freeUrlinfo(urlinfo *u); +int urlSplit(const char *url, /*@out@*/urlinfo **u); +/*@only@*/urlinfo *newUrlinfo(void); +void freeUrlinfo(/*@only@*/urlinfo *u); -FD_t ufdOpen(const char * pathname, int flags, mode_t mode); -int ufdClose(FD_t fd); -const char *urlStrerror(const char *url); +/*@only@*/ FD_t ufdOpen(const char * pathname, int flags, mode_t mode); +int ufdClose(/*@only@*/FD_t fd); +/*@observer@*/ const char *urlStrerror(const char *url); int urlGetFile(const char * url, const char * dest); void urlInvalidateCache(const char * url); diff --git a/lib/signature.h b/lib/signature.h index d4e2e64f2..099ffc0a9 100644 --- a/lib/signature.h +++ b/lib/signature.h @@ -38,7 +38,7 @@ extern "C" { Header rpmNewSignature(void); /* If an old-style signature is found, we emulate a new style one */ -int rpmReadSignature(FD_t fd, Header *header, short sig_type); +int rpmReadSignature(FD_t fd, /*@out@*/Header *header, short sig_type); int rpmWriteSignature(FD_t fd, Header header); /* Generate a signature of data in file, insert in header */ @@ -64,7 +64,7 @@ typedef enum pgpVersion_e { } pgpVersion; /* Return path to pgp executable of given type, or NULL when not found */ -const char *rpmDetectPGPVersion(pgpVersion *pgpVersion); +const char *rpmDetectPGPVersion(/*@out@*/pgpVersion *pgpVersion); #ifdef __cplusplus } diff --git a/lib/verify.c b/lib/verify.c index dc989287c..7008b6b47 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -19,9 +19,9 @@ static union _endian { int i; char b[4]; } *_endian = (union _endian *)&_ie; #define POPT_NOFILES 1000 /* ========== Verify specific popt args */ -static void verifyArgCallback(poptContext con, enum poptCallbackReason reason, - const struct poptOption * opt, const char * arg, - QVA_t *qva) +static void verifyArgCallback(/*@unused@*/poptContext con, + /*@unused@*/enum poptCallbackReason reason, + const struct poptOption * opt, /*@unused@*/const char * arg, QVA_t *qva) { switch (opt->val) { case POPT_NOFILES: qva->qva_flags |= VERIFY_FILES; break; @@ -301,7 +301,7 @@ static int verifyHeader(QVA_t *qva, Header h) return ec; } -static int verifyDependencies(rpmdb db, Header h) { +static int verifyDependencies(/*@only@*/rpmdb db, Header h) { rpmTransactionSet rpmdep; struct rpmDependencyConflict * conflicts; int numConflicts; @@ -361,7 +361,7 @@ int rpmVerify(QVA_t *qva, enum rpmQVSources source, const char *arg) case RPMQV_RPM: if (!(qva->qva_flags & VERIFY_DEPS)) break; - /* fall thru */ + /*@fallthrough@*/ default: if (rpmdbOpen(qva->qva_prefix, &db, O_RDONLY, 0644)) { fprintf(stderr, _("rpmVerify: rpmdbOpen() failed\n")); diff --git a/rpmio/messages.c b/rpmio/messages.c index 342ea2bce..ee6f7c1ef 100644 --- a/rpmio/messages.c +++ b/rpmio/messages.c @@ -63,15 +63,15 @@ void rpmMessage(int level, const char * format, ...) { fprintf(stderr, _("fatal error: ")); vfprintf(stderr, format, args); fflush(stderr); - exit(1); - break; + exit(EXIT_FAILURE); + /*@unreached@*/ break; default: fprintf(stderr, _("internal error (rpm bug?): ")); vfprintf(stderr, format, args); fflush(stderr); - exit(1); - break; + exit(EXIT_FAILURE); + /*@unreached@*/ break; } } |