From f005d4c15c11eacc245d11e2f069881d2543e32c Mon Sep 17 00:00:00 2001 From: jbj Date: Sun, 12 Sep 1999 20:43:23 +0000 Subject: [PATCH] Fiddles to resurrect lclint. CVS patchset: 3281 CVS date: 1999/09/12 20:43:23 --- lib/dbindex.c | 2 +- lib/dbindex.h | 2 +- lib/depends.c | 2 +- lib/fprint.c | 2 +- lib/ftp.c | 21 +++++++----- lib/hash.h | 4 +-- lib/header.c | 7 ++++ lib/header.h | 2 +- lib/lookup.h | 2 +- lib/oldheader.c | 7 ++++ lib/package.c | 7 ++++ lib/rpmdb.h | 2 +- lib/rpmlead.c | 7 ++++ lib/rpmlib.h | 28 ++++++++-------- lib/transaction.c | 20 ++++++------ lib/url.c | 7 ++++ po/rpm.pot | 96 +++++++++++++++++++++++++++---------------------------- system.h | 4 +++ 18 files changed, 133 insertions(+), 89 deletions(-) diff --git a/lib/dbindex.c b/lib/dbindex.c index c7a8066..59cb43e 100644 --- a/lib/dbindex.c +++ b/lib/dbindex.c @@ -2,7 +2,7 @@ #include -int dbiIndexSetCount(dbiIndexSet set) { +unsigned int dbiIndexSetCount(dbiIndexSet set) { return set.count; } diff --git a/lib/dbindex.h b/lib/dbindex.h index b6b7581..ddb7223 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 8ab4534..835d6eb 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 b9d4c32..2780fee 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); } diff --git a/lib/ftp.c b/lib/ftp.c index baade99..48ba4d0 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -7,27 +7,32 @@ #define HAVE_SYS_SOCKET_H 1 #endif -#ifndef __LCLINT__ +#if ! HAVE_HERRNO +extern int h_errno; +#endif + +#include + +#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 #endif -#endif #if HAVE_NETINET_IN_SYSTM_H # include # include #endif -#if ! HAVE_HERRNO -extern int h_errno; -#endif - -#include - #include #include #include #include +#endif /* __LCLINT__ */ #include #include diff --git a/lib/hash.h b/lib/hash.h index 49e7aee..f7fee83 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 dee1e44..b9c2b50 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 +#endif /* __LCLINT__ */ #include #include diff --git a/lib/header.h b/lib/header.h index 5a9918e..1de6474 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 010ad61..7ba2a16 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 ec4a730..02b206e 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 +#endif /* __LCLINT__ */ #include diff --git a/lib/package.c b/lib/package.c index b89f58c..a9264d2 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 +#endif /* __LCLINT__ */ #include diff --git a/lib/rpmdb.h b/lib/rpmdb.h index e4fbf7d..e993f97 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 dd0587f..9eb8117 100644 --- a/lib/rpmlead.c +++ b/lib/rpmlead.c @@ -4,7 +4,14 @@ # include #endif +#ifdef __LCLINT__ +#define ntohl(_x) (_x) +#define ntohs(_x) (_x) +#define htonl(_x) (_x) +#define htons(_x) (_x) +#else #include +#endif /* __LCLINT__ */ #include diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 7698d1d..726b1a9 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 e6ab55c..beb5a0c 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++; } diff --git a/lib/url.c b/lib/url.c index ca9da70..9c51f4f 100644 --- a/lib/url.c +++ b/lib/url.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 +#endif /* __LCLINT__ */ #include "build/rpmbuild.h" diff --git a/po/rpm.pot b/po/rpm.pot index e183482..d83f794 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-09-11 19:59-0400\n" +"POT-Creation-Date: 1999-09-12 16:38-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2012,8 +2012,8 @@ msgid "" msgstr "" #: ../lib/formats.c:65 ../lib/formats.c:83 ../lib/formats.c:104 -#: ../lib/formats.c:137 ../lib/header.c:2078 ../lib/header.c:2095 -#: ../lib/header.c:2115 +#: ../lib/formats.c:137 ../lib/header.c:2085 ../lib/header.c:2102 +#: ../lib/header.c:2122 msgid "(not a number)" msgstr "" @@ -2041,136 +2041,136 @@ msgstr "" msgid "file %s is on an unknown device" msgstr "" -#: ../lib/ftp.c:650 +#: ../lib/ftp.c:655 msgid "Success" msgstr "" -#: ../lib/ftp.c:653 +#: ../lib/ftp.c:658 msgid "Bad server response" msgstr "" -#: ../lib/ftp.c:656 +#: ../lib/ftp.c:661 msgid "Server IO error" msgstr "" -#: ../lib/ftp.c:659 +#: ../lib/ftp.c:664 msgid "Server timeout" msgstr "" -#: ../lib/ftp.c:662 +#: ../lib/ftp.c:667 msgid "Unable to lookup server host address" msgstr "" -#: ../lib/ftp.c:665 +#: ../lib/ftp.c:670 msgid "Unable to lookup server host name" msgstr "" -#: ../lib/ftp.c:668 +#: ../lib/ftp.c:673 msgid "Failed to connect to server" msgstr "" -#: ../lib/ftp.c:671 +#: ../lib/ftp.c:676 msgid "Failed to establish data connection to server" msgstr "" -#: ../lib/ftp.c:674 +#: ../lib/ftp.c:679 msgid "IO error to local file" msgstr "" -#: ../lib/ftp.c:677 +#: ../lib/ftp.c:682 msgid "Error setting remote server to passive mode" msgstr "" -#: ../lib/ftp.c:680 +#: ../lib/ftp.c:685 msgid "File not found on server" msgstr "" -#: ../lib/ftp.c:683 +#: ../lib/ftp.c:688 msgid "Abort in progress" msgstr "" -#: ../lib/ftp.c:687 +#: ../lib/ftp.c:692 msgid "Unknown or unexpected error" msgstr "" #. This should not be allowed -#: ../lib/header.c:162 +#: ../lib/header.c:169 msgid "grabData() RPM_STRING_TYPE count must be 1.\n" msgstr "" -#: ../lib/header.c:192 +#: ../lib/header.c:199 #, c-format msgid "Data type %d not supported\n" msgstr "" -#: ../lib/header.c:734 +#: ../lib/header.c:741 #, c-format msgid "Data type %d not supprted\n" msgstr "" -#: ../lib/header.c:1078 +#: ../lib/header.c:1085 #, c-format msgid "Bad count for headerAddEntry(): %d\n" msgstr "" -#: ../lib/header.c:1478 +#: ../lib/header.c:1485 #, c-format msgid "missing { after %" msgstr "" -#: ../lib/header.c:1506 +#: ../lib/header.c:1513 msgid "missing } after %{" msgstr "" -#: ../lib/header.c:1518 +#: ../lib/header.c:1525 msgid "empty tag format" msgstr "" -#: ../lib/header.c:1528 +#: ../lib/header.c:1535 msgid "empty tag name" msgstr "" -#: ../lib/header.c:1543 +#: ../lib/header.c:1550 msgid "unknown tag" msgstr "" -#: ../lib/header.c:1569 +#: ../lib/header.c:1576 msgid "] expected at end of array" msgstr "" -#: ../lib/header.c:1585 +#: ../lib/header.c:1592 msgid "unexpected ]" msgstr "" -#: ../lib/header.c:1587 +#: ../lib/header.c:1594 msgid "unexpected }" msgstr "" -#: ../lib/header.c:1639 +#: ../lib/header.c:1646 msgid "? expected in expression" msgstr "" -#: ../lib/header.c:1646 +#: ../lib/header.c:1653 msgid "{ expected after ? in expression" msgstr "" -#: ../lib/header.c:1656 ../lib/header.c:1688 +#: ../lib/header.c:1663 ../lib/header.c:1695 msgid "} expected in expression" msgstr "" -#: ../lib/header.c:1663 +#: ../lib/header.c:1670 msgid ": expected following ? subexpression" msgstr "" -#: ../lib/header.c:1676 +#: ../lib/header.c:1683 msgid "{ expected after : in expression" msgstr "" -#: ../lib/header.c:1695 +#: ../lib/header.c:1702 msgid "| expected at end of expression" msgstr "" -#: ../lib/header.c:1862 +#: ../lib/header.c:1869 msgid "(unknown type)" msgstr "" @@ -2380,29 +2380,29 @@ msgstr "" msgid "error creating temporary file %s" msgstr "" -#: ../lib/oldheader.c:292 +#: ../lib/oldheader.c:299 #, c-format msgid "bad file state: %s" msgstr "" -#: ../lib/package.c:228 +#: ../lib/package.c:235 msgid "package is a version one package!\n" msgstr "" -#: ../lib/package.c:233 +#: ../lib/package.c:240 msgid "old style source package -- I'll do my best\n" msgstr "" -#: ../lib/package.c:236 +#: ../lib/package.c:243 #, c-format msgid "archive offset is %d\n" msgstr "" -#: ../lib/package.c:246 +#: ../lib/package.c:253 msgid "old style binary package\n" msgstr "" -#: ../lib/package.c:290 +#: ../lib/package.c:297 msgid "" "only packages with major numbers <= 3 are supported by this version of RPM" msgstr "" @@ -2807,7 +2807,7 @@ msgstr "" msgid "opening database mode 0x%x in %s\n" msgstr "" -#: ../lib/rpmdb.c:173 ../lib/url.c:421 +#: ../lib/rpmdb.c:173 ../lib/url.c:428 #, c-format msgid "failed to open %s\n" msgstr "" @@ -2999,7 +2999,7 @@ msgstr "" msgid "Installing %s\n" msgstr "" -#: ../lib/rpmlead.c:41 +#: ../lib/rpmlead.c:48 #, c-format msgid "read failed: %s (%d)" msgstr "" @@ -3273,27 +3273,27 @@ msgstr "" msgid "execution of script failed" msgstr "" -#: ../lib/url.c:135 +#: ../lib/url.c:142 #, c-format msgid "Password for %s@%s: " msgstr "" -#: ../lib/url.c:159 ../lib/url.c:185 +#: ../lib/url.c:166 ../lib/url.c:192 #, c-format msgid "error: %sport must be a number\n" msgstr "" -#: ../lib/url.c:270 +#: ../lib/url.c:277 msgid "url port must be a number\n" msgstr "" #. XXX PARANOIA -#: ../lib/url.c:307 +#: ../lib/url.c:314 #, c-format msgid "logging into %s as %s, pw %s\n" msgstr "" -#: ../lib/url.c:436 +#: ../lib/url.c:443 #, c-format msgid "failed to create %s\n" msgstr "" diff --git a/system.h b/system.h index cbb9ea1..bfb163d 100644 --- a/system.h +++ b/system.h @@ -195,7 +195,9 @@ char *alloca (); #endif #if HAVE_NETDB_H +#ifndef __LCLINT__ #include +#endif /* __LCLINT__ */ #endif #if HAVE_PWD_H @@ -265,7 +267,9 @@ extern void *myrealloc(void *, size_t); #if HAVE_SYS_SOCKET_H #include +#ifndef __LCLINT__ #include +#endif /* __LCLINT__ */ #endif #if HAVE_SYS_SELECT_H -- 2.7.4