diff options
author | jbj <devnull@localhost> | 1999-09-12 20:43:23 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-09-12 20:43:23 +0000 |
commit | f005d4c15c11eacc245d11e2f069881d2543e32c (patch) | |
tree | b001f1e5698de223c4a813e3b00dea011b8c5748 /lib | |
parent | fa165f14175844cbb582eea1617345da0bd779eb (diff) | |
download | rpm-f005d4c15c11eacc245d11e2f069881d2543e32c.tar.gz rpm-f005d4c15c11eacc245d11e2f069881d2543e32c.tar.bz2 rpm-f005d4c15c11eacc245d11e2f069881d2543e32c.zip |
Fiddles to resurrect lclint.
CVS patchset: 3281
CVS date: 1999/09/12 20:43:23
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dbindex.c | 2 | ||||
-rw-r--r-- | lib/dbindex.h | 2 | ||||
-rw-r--r-- | lib/depends.c | 2 | ||||
-rw-r--r-- | lib/fprint.c | 2 | ||||
-rw-r--r-- | lib/ftp.c | 21 | ||||
-rw-r--r-- | lib/hash.h | 4 | ||||
-rw-r--r-- | lib/header.c | 7 | ||||
-rw-r--r-- | lib/header.h | 2 | ||||
-rw-r--r-- | lib/lookup.h | 2 | ||||
-rw-r--r-- | lib/oldheader.c | 7 | ||||
-rw-r--r-- | lib/package.c | 7 | ||||
-rw-r--r-- | lib/rpmdb.h | 2 | ||||
-rw-r--r-- | lib/rpmlead.c | 7 | ||||
-rw-r--r-- | lib/rpmlib.h | 28 | ||||
-rw-r--r-- | lib/transaction.c | 20 | ||||
-rw-r--r-- | lib/url.c | 7 |
16 files changed, 81 insertions, 41 deletions
diff --git a/lib/dbindex.c b/lib/dbindex.c index c7a80667f..59cb43e4e 100644 --- a/lib/dbindex.c +++ b/lib/dbindex.c @@ -2,7 +2,7 @@ #include <rpmlib.h> -int dbiIndexSetCount(dbiIndexSet set) { +unsigned int dbiIndexSetCount(dbiIndexSet set) { return set.count; } diff --git a/lib/dbindex.h b/lib/dbindex.h index b6b758187..ddb7223df 100644 --- a/lib/dbindex.h +++ b/lib/dbindex.h @@ -47,7 +47,7 @@ dbiIndexSet dbiCreateIndexRecord(void); void dbiFreeIndexRecord(dbiIndexSet set); int dbiGetFirstKey(dbiIndex * dbi, const char ** key); -extern int dbiIndexSetCount(dbiIndexSet set); +extern unsigned int dbiIndexSetCount(dbiIndexSet set); /* structure return */ extern dbiIndexRecord dbiReturnIndexRecordInstance(unsigned int recOffset, unsigned int fileNumber); diff --git a/lib/depends.c b/lib/depends.c index 8ab4534de..835d6eb5f 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -355,7 +355,7 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req return result; } -int headerMatchesDepFlags(Header h, const char *reqName, const char * reqEVR, int reqFlags) +int headerMatchesDepFlags(Header h, /*@unused@*/const char *reqName, const char * reqEVR, int reqFlags) { const char * epoch, * version, * release; const char * reqEpoch = NULL; diff --git a/lib/fprint.c b/lib/fprint.c index b9d4c32ad..2780fee98 100644 --- a/lib/fprint.c +++ b/lib/fprint.c @@ -15,7 +15,7 @@ struct lookupCache { static int strCompare(const void * a, const void * b) { const char * const * one = a; - const char * const * two = a; + const char * const * two = b; return strcmp(*one, *two); } @@ -7,27 +7,32 @@ #define HAVE_SYS_SOCKET_H 1 #endif -#ifndef __LCLINT__ +#if ! HAVE_HERRNO +extern int h_errno; +#endif + +#include <stdarg.h> + +#ifdef __LCLINT__ +#define ntohl(_x) (_x) +#define ntohs(_x) (_x) +#define htonl(_x) (_x) +#define htons(_x) (_x) +#else #if HAVE_MACHINE_TYPES_H # include <machine/types.h> #endif -#endif #if HAVE_NETINET_IN_SYSTM_H # include <sys/types.h> # include <netinet/in_systm.h> #endif -#if ! HAVE_HERRNO -extern int h_errno; -#endif - -#include <stdarg.h> - #include <netinet/in.h> #include <netinet/ip.h> #include <arpa/inet.h> #include <arpa/telnet.h> +#endif /* __LCLINT__ */ #include <rpmlib.h> #include <rpmio.h> diff --git a/lib/hash.h b/lib/hash.h index 49e7aee06..f7fee836f 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -20,8 +20,8 @@ hashTable htCreate(int numBuckets, int keySize, hashFunctionType fn, void htAddEntry(hashTable ht, const void * key, const void * data); void htFree(hashTable ht); /* returns 0 on success, 1 if the item is not found. tableKey may be NULL */ -int htGetEntry(hashTable ht, const void * key, const void *** data, int * dataCount, - const void ** tableKey); +int htGetEntry(hashTable ht, const void * key, /*@out@*/const void *** data, /*@out@*/int * dataCount, + /*@out@*/const void ** tableKey); /* returns 1 if the item is present, 0 otherwise */ int htHasEntry(hashTable ht, const void * key); diff --git a/lib/header.c b/lib/header.c index dee1e441b..b9c2b5084 100644 --- a/lib/header.c +++ b/lib/header.c @@ -9,7 +9,14 @@ #include "system.h" +#ifdef __LCLINT__ +#define ntohl(_x) (_x) +#define ntohs(_x) (_x) +#define htonl(_x) (_x) +#define htons(_x) (_x) +#else #include <netinet/in.h> +#endif /* __LCLINT__ */ #include <rpmio.h> #include <header.h> diff --git a/lib/header.h b/lib/header.h index 5a9918e5b..1de6474c7 100644 --- a/lib/header.h +++ b/lib/header.h @@ -134,7 +134,7 @@ int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type, /* Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements w/ RPM_I18NSTRING_TYPE equivalent enreies are translated (if HEADER_I18NTABLE entry is present). */ -int headerGetEntry(Header h, int_32 tag, int_32 *type, /*@out@*/void **p, int_32 *c); +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); diff --git a/lib/lookup.h b/lib/lookup.h index 010ad61c2..7ba2a160d 100644 --- a/lib/lookup.h +++ b/lib/lookup.h @@ -8,7 +8,7 @@ extern "C" { #endif int findMatches(rpmdb db, const char * name, const char * version, - const char * release, dbiIndexSet * matches); + const char * release, /*@out@*/dbiIndexSet * matches); #ifdef __cplusplus } diff --git a/lib/oldheader.c b/lib/oldheader.c index ec4a730d8..02b206ea9 100644 --- a/lib/oldheader.c +++ b/lib/oldheader.c @@ -1,6 +1,13 @@ #include "system.h" +#ifdef __LCLINT__ +#define ntohl(_x) (_x) +#define ntohs(_x) (_x) +#define htonl(_x) (_x) +#define htons(_x) (_x) +#else #include <netinet/in.h> +#endif /* __LCLINT__ */ #include <rpmlib.h> diff --git a/lib/package.c b/lib/package.c index b89f58ccc..a9264d200 100644 --- a/lib/package.c +++ b/lib/package.c @@ -1,6 +1,13 @@ #include "system.h" +#ifdef __LCLINT__ +#define ntohl(_x) (_x) +#define ntohs(_x) (_x) +#define htonl(_x) (_x) +#define htons(_x) (_x) +#else #include <netinet/in.h> +#endif /* __LCLINT__ */ #include <rpmlib.h> diff --git a/lib/rpmdb.h b/lib/rpmdb.h index e4fbf7d76..e993f97d1 100644 --- a/lib/rpmdb.h +++ b/lib/rpmdb.h @@ -21,7 +21,7 @@ int rpmdbUpdateRecord(rpmdb db, int secOffset, Header secHeader); void rpmdbRemoveDatabase(const char * rootdir, const char * dbpath); int rpmdbMoveDatabase(const char * rootdir, const char * olddbpath, const char * newdbpath); /* matchList must be preallocated!!! */ -int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList, +int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, /*@out@*/dbiIndexSet * matchList, int numItems); #ifdef __cplusplus diff --git a/lib/rpmlead.c b/lib/rpmlead.c index dd0587f75..9eb81179b 100644 --- a/lib/rpmlead.c +++ b/lib/rpmlead.c @@ -4,7 +4,14 @@ # include <machine/types.h> #endif +#ifdef __LCLINT__ +#define ntohl(_x) (_x) +#define ntohs(_x) (_x) +#define htonl(_x) (_x) +#define htons(_x) (_x) +#else #include <netinet/in.h> +#endif /* __LCLINT__ */ #include <rpmlib.h> diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 7698d1d37..726b1a97b 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -14,11 +14,11 @@ extern "C" { #endif -int rpmReadPackageInfo(FD_t fd, Header * signatures, Header * hdr); -int rpmReadPackageHeader(FD_t fd, Header * hdr, int * isSource, int * major, - int * minor); +int rpmReadPackageInfo(FD_t fd, /*@out@*/Header * signatures, /*@out@*/Header * hdr); +int rpmReadPackageHeader(FD_t fd, /*@out@*/Header * hdr, /*@out@*/int * isSource, /*@out@*/int * major, + /*@out@*/int * minor); -int headerNVR(Header h, const char **np, const char **vp, const char **rp); +int headerNVR(Header h, /*@out@*/const char **np, /*@out@*/const char **vp, /*@out@*/const char **rp); /* 0 = success */ /* 1 = bad magic */ @@ -310,17 +310,17 @@ int rpmdbNextRecNum(rpmdb db, unsigned int lastOffset); /* 0 at end, -1 on error */ Header rpmdbGetRecord(rpmdb db, unsigned int offset); -int rpmdbFindByFile(rpmdb db, const char * filespec, dbiIndexSet * matches); -int rpmdbFindByGroup(rpmdb db, const char * group, dbiIndexSet * matches); -int rpmdbFindPackage(rpmdb db, const char * name, dbiIndexSet * matches); -int rpmdbFindByProvides(rpmdb db, const char * provides, dbiIndexSet * matches); -int rpmdbFindByRequiredBy(rpmdb db, const char * requires, dbiIndexSet * matches); -int rpmdbFindByConflicts(rpmdb db, const char * conflicts, dbiIndexSet * matches); -int rpmdbFindByTriggeredBy(rpmdb db, const char * package, dbiIndexSet * matches); +int rpmdbFindByFile(rpmdb db, const char * filespec, /*@out@*/dbiIndexSet * matches); +int rpmdbFindByGroup(rpmdb db, const char * group, /*@out@*/dbiIndexSet * matches); +int rpmdbFindPackage(rpmdb db, const char * name, /*@out@*/dbiIndexSet * matches); +int rpmdbFindByProvides(rpmdb db, const char * provides, /*@out@*/dbiIndexSet * matches); +int rpmdbFindByRequiredBy(rpmdb db, const char * requires, /*@out@*/dbiIndexSet * matches); +int rpmdbFindByConflicts(rpmdb db, const char * conflicts, /*@out@*/dbiIndexSet * matches); +int rpmdbFindByTriggeredBy(rpmdb db, const char * package, /*@out@*/dbiIndexSet * matches); /* these are just convenience functions */ -int rpmdbFindByLabel(rpmdb db, const char * label, dbiIndexSet * matches); -int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches); +int rpmdbFindByLabel(rpmdb db, const char * label, /*@out@*/dbiIndexSet * matches); +int rpmdbFindByHeader(rpmdb db, Header h, /*@out@*/dbiIndexSet * matches); /* we pass these around as an array with a sentinel */ typedef struct rpmRelocation_s { @@ -628,7 +628,7 @@ void rpmFreeSignature(Header h); int rpmVerifySignature(const char *file, int_32 sigTag, void *sig, int count, char *result); -int rpmGetFilesystemList(const char *** listptr, int * num); +int rpmGetFilesystemList(/*@out@*/const char *** listptr, /*@out@*/int * num); int rpmGetFilesystemUsage(const char ** filelist, int_32 * fssizes, int numFiles, uint_32 ** usagesPtr, int flags); diff --git a/lib/transaction.c b/lib/transaction.c index e6ab55c3a..beb5a0c29 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -579,7 +579,7 @@ static int handleInstInstalledFiles(struct fileInfo * fi, rpmdb db, uint_16 * otherModes; int numReplaced = 0; - if (!(h = rpmdbGetRecord(db, shared->otherPkg))) + if ((h = rpmdbGetRecord(db, shared->otherPkg)) == NULL) return 1; headerGetEntryMinMemory(h, RPMTAG_FILEMD5S, NULL, @@ -655,7 +655,7 @@ static int handleRmvdInstalledFiles(struct fileInfo * fi, rpmdb db, const char * otherStates; int i; - if (!(h = rpmdbGetRecord(db, shared->otherPkg))) + if ((h = rpmdbGetRecord(db, shared->otherPkg)) == NULL) return 1; headerGetEntryMinMemory(h, RPMTAG_FILESTATES, NULL, @@ -1083,8 +1083,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, if (rc == 2) { return -1; } else if (!rc) { - for (i = 0; i < dbi.count; i++) - ensureOlder(ts->db, alp->h, dbi.recs[i].recOffset, + for (i = 0; i < dbiIndexSetCount(dbi); i++) + ensureOlder(ts->db, alp->h, dbiIndexRecordOffset(dbi, i), probs, alp->key); dbiFreeIndexRecord(dbi); @@ -1155,7 +1155,7 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, case TR_REMOVED: fi->record = ts->order[oc].u.removed.dboffset; fi->h = rpmdbGetRecord(ts->db, fi->record); - if (!fi->h) { + if (fi->h == NULL) { /* ACK! */ continue; } @@ -1257,7 +1257,7 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, numShared = 0; for (i = 0; i < fi->fc; i++) - numShared += matches[i].count; + numShared += dbiIndexSetCount(matches[i]); /* Build sorted file info list for this package. */ shared = sharedList = malloc(sizeof(*sharedList) * (numShared + 1)); @@ -1266,9 +1266,9 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, * Take care not to mark files as replaced in packages that will * have been removed before we will get here. */ - for (j = 0; j < matches[i].count; j++) { + for (j = 0; j < dbiIndexSetCount(matches[i]); j++) { int k, ro; - ro = matches[i].recs[j].recOffset; + ro = dbiIndexRecordOffset(matches[i], j); knownBad = 0; for (k = 0; ro != knownBad && k < ts->orderCount; k++) { switch (ts->order[k].type) { @@ -1282,8 +1282,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify, } shared->pkgFileNum = i; - shared->otherPkg = matches[i].recs[j].recOffset; - shared->otherFileNum = matches[i].recs[j].fileNumber; + shared->otherPkg = dbiIndexRecordOffset(matches[i], j); + shared->otherFileNum = dbiIndexRecordFileNumber(matches[i], j); shared->isRemoved = (knownBad == ro); shared++; } @@ -1,6 +1,13 @@ #include "system.h" +#ifdef __LCLINT__ +#define ntohl(_x) (_x) +#define ntohs(_x) (_x) +#define htonl(_x) (_x) +#define htons(_x) (_x) +#else #include <netinet/in.h> +#endif /* __LCLINT__ */ #include "build/rpmbuild.h" |